Skip to content

Commit 884f974

Browse files
giladreichSiegeLord
authored andcommitted
Move cmake_minimum_required to top level.
Setting policies and version requirement for cmake should really be happening before the script is executing. Also note that 3.0 is very old version and most toolchains not using it anymore, including Android Studio and some other legacy tools and Linux distros. As CMake evolved a lot ever since and many bug-fixes, ideally should be set to 3.18 unless it really breaks compatibility for some projects and it's reasonable to reason about.
1 parent c2bf1e1 commit 884f974

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

CMakeLists.txt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,6 @@
55
# - some documentation targets still missing
66
# - installing documentation
77
#
8-
9-
#-----------------------------------------------------------------------------#
10-
#
11-
# Build system setup
12-
#
13-
#-----------------------------------------------------------------------------#
14-
15-
# Set the project name.
16-
# We use C++ in a few cases.
17-
set(ALLEGRO_PROJECT_SUFFIX "" CACHE STRING "Project suffix")
18-
set(ALLEGRO_PROJECT_NAME "ALLEGRO" CACHE STRING "Project default name")
19-
20-
project(${ALLEGRO_PROJECT_NAME}${ALLEGRO_PROJECT_SUFFIX} C CXX)
21-
228
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
239
if(COMMAND cmake_policy)
2410
cmake_policy(SET CMP0003 NEW)
@@ -36,6 +22,19 @@ if(COMMAND cmake_policy)
3622
endif()
3723
endif(COMMAND cmake_policy)
3824

25+
#-----------------------------------------------------------------------------#
26+
#
27+
# Build system setup
28+
#
29+
#-----------------------------------------------------------------------------#
30+
31+
# Set the project name.
32+
# We use C++ in a few cases.
33+
set(ALLEGRO_PROJECT_SUFFIX "" CACHE STRING "Project suffix")
34+
set(ALLEGRO_PROJECT_NAME "ALLEGRO" CACHE STRING "Project default name")
35+
36+
project(${ALLEGRO_PROJECT_NAME}${ALLEGRO_PROJECT_SUFFIX} C CXX)
37+
3938
if(NOT CMAKE_BUILD_TYPE)
4039
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
4140
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Profile."

0 commit comments

Comments
 (0)