summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Dickens <michael.dickens@ettus.com>2018-11-16 08:51:28 -0800
committerMarcus Müller <marcus@hostalia.de>2018-11-17 20:10:41 +0100
commit9a13da0fc9a6118a8e4c904ec5b0f7a26e876685 (patch)
tree7195c91fd3a6a52b2af5260d1696153b0d532f8c
parenta976029ea9c3e69dde3ee3d900d60a85ecda646d (diff)
cmake: replace 'CMAKE_COMPILER_IS_GNUCXX' with CMAKE_CXX_COMPILER_ID
... and expand from just GNU to both GNU and Clang, since they work comparably for the flags being tested.
-rw-r--r--CMakeLists.txt15
-rw-r--r--gr-utils/python/modtool/gr-newmod/CMakeLists.txt4
2 files changed, 11 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee36845a98..8b422fa31f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -193,16 +193,17 @@ include(CMakeOverloads)
########################################################################
include(GrMiscUtils) #compiler flag check
-if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
- #http://gcc.gnu.org/wiki/Visibility
- GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
-endif()
-
-if(CMAKE_COMPILER_IS_GNUCXX)
+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ if(NOT WIN32)
+ #http://gcc.gnu.org/wiki/Visibility
+ GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
+ endif(NOT WIN32)
GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-Wsign-compare HAVE_WARN_SIGN_COMPARE)
GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-Wall HAVE_WARN_ALL)
GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-Wno-uninitialized HAVE_WARN_NO_UNINITIALIZED)
-endif(CMAKE_COMPILER_IS_GNUCXX)
+endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(MSVC)
include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc) #missing headers
diff --git a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
index c079c3db13..0496ceeaa4 100644
--- a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
@@ -67,7 +67,9 @@ endif()
########################################################################
# Compiler specific setup
########################################################################
-if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
+if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ AND NOT WIN32)
#http://gcc.gnu.org/wiki/Visibility
add_definitions(-fvisibility=hidden)
endif()