@@ -33,27 +33,8 @@ endif()
33
33
# Top level project, doesn't really affect anything.
34
34
project (genzh LANGUAGES C CXX )
35
35
36
- # Print some information
37
- message (STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER} " )
38
- message (STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID} " )
39
- message (STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION} " )
40
- message (STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} " )
41
- if (DEFINED MSVC_VERSION )
42
- message (STATUS "MSVC_VERSION: ${MSVC_VERSION} " )
43
- endif ()
44
-
45
- # Set variable for VS6 to handle special cases.
46
- if (DEFINED MSVC_VERSION AND MSVC_VERSION LESS 1300 )
47
- set (IS_VS6_BUILD TRUE )
48
- else ()
49
- set (IS_VS6_BUILD FALSE )
50
- endif ()
51
-
52
- # Create PDB for Release as long as debug info was generated during compile.
53
- if (MSVC )
54
- string (APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE " /DEBUG /OPT:REF /OPT:ICF" )
55
- string (APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE " /DEBUG /OPT:REF /OPT:ICF" )
56
- endif ()
36
+ # This file handles extra settings wanted/needed for different compilers.
37
+ include (cmake/compilers.cmake )
57
38
58
39
include (FetchContent )
59
40
@@ -78,20 +59,6 @@ add_subdirectory(Dependencies/MaxSDK)
78
59
add_subdirectory (Dependencies/SafeDisc )
79
60
add_subdirectory (Dependencies/Utility )
80
61
81
- if (NOT IS_VS6_BUILD )
82
- # Set C++ standard
83
- set (CMAKE_CXX_STANDARD 20 )
84
- set (CMAKE_CXX_STANDARD_REQUIRED ON )
85
- set (CMAKE_CXX_EXTENSIONS OFF ) # Ensures only ISO features are used
86
-
87
- if (MSVC )
88
- # Multithreaded build.
89
- add_compile_options (/MP )
90
- # Enforce strict __cplusplus version
91
- add_compile_options (/Zc:__cplusplus )
92
- endif ()
93
- endif ()
94
-
95
62
# Do we want to build extra SDK stuff or just the game binary?
96
63
option (GENZH_BUILD_ZEROHOUR "Build Zero Hour code." ON )
97
64
option (GENZH_BUILD_GENERALS "Build Generals code." ON )
@@ -110,6 +77,11 @@ add_feature_info(ProfileBuild GENZH_BUILD_PROFILE "Building as a \"Profile\" bui
110
77
111
78
add_library (gz_config INTERFACE )
112
79
80
+ if (NOT IS_VS6_BUILD )
81
+ # Because we set CMAKE_CXX_STANDARD_REQUIRED and CMAKE_CXX_EXTENSIONS in the compilers.cmake this should be enforced.
82
+ target_compile_features (gz_config INTERFACE cxx_std_20 )
83
+ endif ()
84
+
113
85
target_compile_options (gz_config INTERFACE ${GENZH_FLAGS} )
114
86
115
87
target_compile_definitions (gz_config INTERFACE $< IF:$< CONFIG:Debug> ,_DEBUG WWDEBUG DEBUG,_RELEASE> )
0 commit comments