diff options
Diffstat (limited to 'core/CMakeLists.txt')
-rw-r--r-- | core/CMakeLists.txt | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index d8e9db1..f71cdd4 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -17,7 +17,7 @@ endif() function(add_source_group GROUP_NAME) set(${GROUP_NAME} ${ARGN} PARENT_SCOPE) set_source_files_properties(${ARGN} - PROPERTIES + PROPERTIES UNITY_GROUP "${GROUP_NAME}" ) endfunction() @@ -35,6 +35,7 @@ set(ENTRYPOINT_MODULE_SOURCES add_source_group(MODEL_MODULE_SOURCES src/Model/GlobalStates.cpp + src/Model/Items.cpp src/Model/Project.cpp src/Model/Stock.cpp ) @@ -136,15 +137,32 @@ function(add_executable_variant TARGET_NAME) endif() if(WIN32) - # No console window when targetting windows - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + # No console window when targeting windows + function(handle_gnu_style_compiler) # Supposedly the flag -mwindows would automatically make the executable use GUI subsystem # But, when subsystem is set to GUI, linker will only search WinMain and wWinMain but not the standard main (it seems like) # so creating GUI executable fails and the linker silently reverts to the default, CUI subsystem target_link_options(${TARGET_NAME} PRIVATE -Wl,-subsystem:windows) target_link_options(${TARGET_NAME} PRIVATE -Wl,-entry:mainCRTStartup) - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + endfunction() + + function(handle_msvc_style_compiler) target_link_options(${TARGET_NAME} PRIVATE /SUBSYSTEM:windows /ENTRY:mainCRTStartup) + endfunction() + + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # GCC (MinGW) + handle_gnu_style_compiler() + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + # MSVC-style argument clang (clang-cl.exe) + handle_msvc_style_compiler() + else() + # GNU-style argument clang (clang.exe and clang++.exe) + handle_gnu_style_compiler() + endif() + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + handle_msvc_style_compiler() endif() endif() |