diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-10-14 02:43:31 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-10-14 02:43:31 +0300 |
commit | 6413da0a45b8ee66b9a9ac0adabcbf5139ea2fff (patch) | |
tree | c8f357f0d961e73a283eea933c9330a54f5d672d | |
parent | fix build dir path on Travis/AppVeyor (diff) | |
download | cmake-common-6413da0a45b8ee66b9a9ac0adabcbf5139ea2fff.tar.gz cmake-common-6413da0a45b8ee66b9a9ac0adabcbf5139ea2fff.zip |
common.cmake: allow nested inclusions
-rw-r--r-- | common.cmake | 34 |
1 files changed, 19 insertions, 15 deletions
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() |