summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-12-02 15:32:14 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-12-02 15:32:14 +0100
commit0699ce86d640791ab67494cf6e56b6314da1170c (patch)
tree2301ae3a966a177a7435aa68944e748b5ac9212f
parent8e0a07366aa4d06cfd56223e71edcd4143f8fd16 (diff)
cmake: play nicer with multi-config generators
-rw-r--r--CMakeLists.txt14
1 files changed, 10 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a42855d4..c3681587 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,9 +36,11 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR CMAKE_INSTALL_PREFIX STREQUAL
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
endif()
+if(NOT GENERATOR_IS_MULTI_CONFIG)
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
endif()
+endif()
set(FLOORMAT_PRECOMPILED-HEADERS ON CACHE BOOL
"Use precompiled headers while building the floormat.")
@@ -59,8 +61,10 @@ function(sets type)
endwhile()
endfunction()
+if(NOT GENERATOR_IS_MULTI_CONFIG)
string(TOUPPER "${CMAKE_BUILD_TYPE}" __fm_uppercase_CMAKE_BUILD_TYPE)
sets(STRING CMAKE_BUILD_TYPE "${__fm_uppercase_CMAKE_BUILD_TYPE}")
+endif()
macro(fm_run_hook str)
if(COMMAND "${str}")
@@ -92,7 +96,9 @@ endif()
if(NOT "$ENV{FLOORMAT_NO_USERCONFIG}" AND NOT FLOORMAT_NO_USERCONFIG)
fm_load_userconfig()
- string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)
+ if(NOT GENERATOR_IS_MULTI_CONFIG)
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)
+ endif()
endif()
if(WIN32)
@@ -117,7 +123,7 @@ if(MSVC)
add_link_options(-HIGHENTROPYVA)
endif()
else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-cxa-atexit")
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fuse-cxa-atexit>)
if(WIN32)
add_link_options(-Wl,--nxcompat -Wl,--dynamicbase)
if(CMAKE_SIZEOF_VOID_P GREATER_EQUAL 8)
@@ -140,9 +146,9 @@ set_directory_properties(PROPERTIES INTERFACE_CORRADE_CXX_STANDARD ${CMAKE_CXX_S
add_subdirectory(external)
if(MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FIcompat/prelude.hpp")
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/FIcompat/prelude.hpp>)
else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include compat/prelude.hpp")
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-includecompat/prelude.hpp>)
endif()
add_definitions(