mirror of
https://github.com/silverqx/TinyORM.git
synced 2025-12-30 07:19:34 -06:00
- added include_guard() everywhere where it's appropriate - get rid of many duplicate and unnecessary include()-s as they were already in the scope - moved some include()-s around
30 lines
1.3 KiB
CMake
30 lines
1.3 KiB
CMake
include_guard(GLOBAL)
|
|
|
|
# Allow per-translation-unit parallel builds when using MSVC
|
|
function(tiny_msvc_parallel description)
|
|
|
|
if(CMAKE_GENERATOR MATCHES "Visual Studio" AND
|
|
(CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel" OR
|
|
CMAKE_CXX_COMPILER_ID MATCHES "MSVC|Intel")
|
|
)
|
|
set(MSVC_PARALLEL ON CACHE STRING "${description}")
|
|
|
|
# This conditions are correct (revisited), the else() branch is invoked even if
|
|
# the MSVC_PARALLEL == ON, the if() branch is only invoked if MSVC_PARALLEL
|
|
# contains a number.
|
|
if(MSVC_PARALLEL)
|
|
if(MSVC_PARALLEL GREATER 0)
|
|
string(APPEND CMAKE_C_FLAGS " /MP${CMake_MSVC_PARALLEL}") # Cannot contain space between
|
|
string(APPEND CMAKE_CXX_FLAGS " /MP${CMake_MSVC_PARALLEL}")
|
|
else()
|
|
string(APPEND CMAKE_C_FLAGS " /MP")
|
|
string(APPEND CMAKE_CXX_FLAGS " /MP")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
# TODO so this doesn't work, anyway it has to be refactored, use target_compile_options() instead of string(APPEND CMAKE_C_FLAGS silverqx
|
|
# TODO make it dependent on cmake_disable_precompile_headers and MSVC; after long time - I don't understand why it needs to depend on the cmake_disable_precompile_headers but it has to have a reason if I wrote or noted it this way silverqx
|