From 6413da0a45b8ee66b9a9ac0adabcbf5139ea2fff Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 14 Oct 2020 02:43:31 +0300 Subject: common.cmake: allow nested inclusions --- common.cmake | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'common.cmake') diff --git a/common.cmake b/common.cmake index 0d813fe..f26c61a 100644 --- a/common.cmake +++ b/common.cmake @@ -77,13 +77,15 @@ endif() option(Boost_USE_STATIC_LIBS "Use the static Boost libraries" "${default_value}") option(Boost_USE_STATIC_RUNTIME "Use Boost libraries linked to the runtime statically" "${CC_STATIC_RUNTIME}") -message(STATUS "Toolset: ${toolset}") -message(STATUS "C++ standard: ${CC_CXX_STANDARD}") -message(STATUS "Set common compiler options: ${CC_BEST_PRACTICES}") -message(STATUS "Define useful Windows macros: ${CC_WINDOWS_DEF}") -message(STATUS "Use the static Boost libraries: ${Boost_USE_STATIC_LIBS}") -message(STATUS "Link the runtime statically: ${CC_STATIC_RUNTIME}") -message(STATUS "Strip symbols: ${CC_STRIP_SYMBOLS}") +if(NOT parent_dir) + message(STATUS "Toolset: ${toolset}") + message(STATUS "C++ standard: ${CC_CXX_STANDARD}") + message(STATUS "Set common compiler options: ${CC_BEST_PRACTICES}") + message(STATUS "Define useful Windows macros: ${CC_WINDOWS_DEF}") + message(STATUS "Use the static Boost libraries: ${Boost_USE_STATIC_LIBS}") + message(STATUS "Link the runtime statically: ${CC_STATIC_RUNTIME}") + message(STATUS "Strip symbols: ${CC_STRIP_SYMBOLS}") +endif() # C++ standard version: @@ -214,12 +216,14 @@ function(_cc_apply_settings target) endif() endfunction() -macro(add_executable target) - _add_executable(${ARGV}) - _cc_apply_settings("${target}") -endmacro() +if(NOT parent_dir) + macro(add_executable target) + _add_executable(${ARGV}) + _cc_apply_settings("${target}") + endmacro() -macro(add_library target) - _add_library(${ARGV}) - _cc_apply_settings("${target}") -endmacro() + macro(add_library target) + _add_library(${ARGV}) + _cc_apply_settings("${target}") + endmacro() +endif() -- cgit v1.2.3