#4020 System : Add ri_apply_cotire() and make available for targets

This commit is contained in:
Magne Sjaastad
2019-02-01 06:55:44 +01:00
parent ae98ba6c58
commit 8bb13f4e15
2 changed files with 18 additions and 1 deletions

View File

@@ -67,7 +67,14 @@ find_package(Octave)
option(RESINSIGHT_ENABLE_COTIRE "Experimental speedup of compilation using cotire" OFF)
mark_as_advanced(FORCE RESINSIGHT_ENABLE_COTIRE)
if(RESINSIGHT_ENABLE_COTIRE)
include(cotire)
if(NOT COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES)
message("cotire: Setting default number of includes to 5")
set(COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES 5)
endif()
include(cotire)
include(RiHelpers)
endif()
################################################################################

10
cmake/RiHelpers.cmake Normal file
View File

@@ -0,0 +1,10 @@
macro (ri_apply_cotire)
if (COMMAND cotire)
cotire(${PROJECT_NAME})
# make sure the unity target is included in the active builds to trigger rebuild before debug
get_target_property(_unityTargetName ${PROJECT_NAME} COTIRE_UNITY_TARGET_NAME)
set_target_properties(${_unityTargetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD FALSE)
set_target_properties(${PROJECT_NAME} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
endif()
endmacro (ri_apply_cotire)