summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jekoritz@microsoft.com>2019-06-05 14:48:55 -0700
committerGitHub <noreply@github.com>2019-06-05 14:48:55 -0700
commit90dd13ee1bd497d7724c2b1d0fd833d42f7001ad (patch)
treeae6167d368f59598c6dd6c71e3280d1af0485f02 /src/pal
parentd7e49efa6b41afb2b7a9ee3adc8f0850b968562a (diff)
downloadcoreclr-90dd13ee1bd497d7724c2b1d0fd833d42f7001ad.tar.gz
coreclr-90dd13ee1bd497d7724c2b1d0fd833d42f7001ad.tar.bz2
coreclr-90dd13ee1bd497d7724c2b1d0fd833d42f7001ad.zip
Use Modern CMake features instead of CMAKE_CXX_FLAGS (#24861)
* Convert C++ standard settings and warning options from CMAKE_<LANG>_FLAGS to Modern CMake isms. * More $<COMPILE_LANGUAGE> generator expressions instead of CMAKE_CXX_FLAGS. * Use $<COMPILE_LANGUAGE:CXX> for all -fpermissive usage * Fix generator expression that generates multiple flags * Fix invalid use of CMAKE_CXX_FLAGS instead of CMAKE_C_FLAGS. * Treat AppleClang as though it is Clang (match pre-3.0 behavior). * Update our build system to understand that AppleClang is distinct from Clang and remove CMP0025 policy setting. * PR Feedback.
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/src/libunwind/src/CMakeLists.txt6
-rw-r--r--src/pal/tests/CMakeLists.txt2
-rw-r--r--src/pal/tests/palsuite/CMakeLists.txt4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/pal/src/libunwind/src/CMakeLists.txt b/src/pal/src/libunwind/src/CMakeLists.txt
index b29e7ee9a2..93b4daf3a6 100644
--- a/src/pal/src/libunwind/src/CMakeLists.txt
+++ b/src/pal/src/libunwind/src/CMakeLists.txt
@@ -22,7 +22,7 @@ add_definitions("-Ddwarf_search_unwind_table_int=UNW_OBJ(dwarf_search_unwind_tab
# Disable warning due to incorrect format specifier in debugging printf via the Debug macro
add_compile_options(-Wno-format)
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-header-guard)
elseif()
add_compile_options(-Wno-unused-value)
@@ -33,7 +33,7 @@ if(CLR_CMAKE_PLATFORM_ARCH_ARM)
add_definitions("-Darm_search_unwind_table=UNW_OBJ(arm_search_unwind_table)")
# Disable warning in asm: use of SP or PC in the list is deprecated
add_compile_options(-Wno-inline-asm)
- if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Disable warning due to labs function called on unsigned argument
add_compile_options(-Wno-absolute-value)
endif()
@@ -48,7 +48,7 @@ if(CLR_CMAKE_PLATFORM_ARCH_ARM)
# the include/tdep-arm to include directories
include_directories(../include/tdep-arm)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
- if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Disable warning due to labs function called on unsigned argument
add_compile_options(-Wno-absolute-value)
endif()
diff --git a/src/pal/tests/CMakeLists.txt b/src/pal/tests/CMakeLists.txt
index 5597922f72..0ec630df8c 100644
--- a/src/pal/tests/CMakeLists.txt
+++ b/src/pal/tests/CMakeLists.txt
@@ -32,7 +32,7 @@ endif()
# C++ emits errors and warnings for c-string literal fed into char* parameter
# this is just to take care of the warnings
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-writable-strings)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-write-strings)
diff --git a/src/pal/tests/palsuite/CMakeLists.txt b/src/pal/tests/palsuite/CMakeLists.txt
index 6726165caf..00a4301784 100644
--- a/src/pal/tests/palsuite/CMakeLists.txt
+++ b/src/pal/tests/palsuite/CMakeLists.txt
@@ -14,13 +14,13 @@ endif()
list(APPEND COMMON_TEST_LIBRARIES coreclrpal)
-if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-incompatible-pointer-types-discards-qualifiers)
add_compile_options(-Wno-int-to-void-pointer-cast)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-sign-compare)
add_compile_options(-Wno-narrowing)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive" )
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
add_compile_options(-Wno-int-to-pointer-cast)
endif()