aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/common.cmake
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-11-30 01:26:41 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-11-30 01:26:41 +0300
commitddcc56201160e74563f96ae0c2804f058c152b71 (patch)
treefab09576ffe1181463446658761d64700faff1df /common.cmake
parentupdate repo URL (diff)
downloadcmake-common-ddcc56201160e74563f96ae0c2804f058c152b71.tar.gz
cmake-common-ddcc56201160e74563f96ae0c2804f058c152b71.zip
better toolset identification
Diffstat (limited to 'common.cmake')
-rw-r--r--common.cmake14
1 files changed, 12 insertions, 2 deletions
diff --git a/common.cmake b/common.cmake
index f64519b..57451ab 100644
--- a/common.cmake
+++ b/common.cmake
@@ -11,6 +11,14 @@
get_directory_property(parent_directory PARENT_DIRECTORY)
set(is_root_project $<NOT:parent_directory>)
+if(CMAKE_C_COMPILER)
+ set(toolset "${CMAKE_C_COMPILER_ID}")
+elseif(CMAKE_CXX_COMPILER)
+ set(toolset "${CMAKE_CXX_COMPILER_ID}")
+else()
+ set(toolset "unknown")
+endif()
+
set(USE_STATIC_RUNTIME "${is_root_project}" CACHE BOOL "Link the runtime statically")
set(STRIP_SYMBOL_TABLE "${is_root_project}" CACHE BOOL "Strip symbol tables")
@@ -19,6 +27,8 @@ if(is_root_project)
add_compile_options(/MP /W4)
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(-Wall -Wextra)
+ else()
+ message(WARNING "Unrecognized toolset: ${toolset}")
endif()
endif()
@@ -49,7 +59,7 @@ function(use_static_runtime target)
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
use_static_runtime_gcc("${target}")
else()
- message(WARNING "Unrecognized toolset")
+ message(WARNING "Unrecognized toolset: ${toolset}")
endif()
endfunction()
@@ -67,7 +77,7 @@ function(strip_symbol_table target)
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
strip_symbol_table_gcc("${target}")
else()
- message(WARNING "Unrecognized toolset")
+ message(WARNING "Unrecognized toolset: ${toolset}")
endif()
endfunction()