Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Meel <ankitjmeel@gmail.com>2020-11-04 18:30:29 +0300
committerAnkit Meel <ankitjmeel@gmail.com>2020-11-04 18:30:29 +0300
commit0802e9cf54f6858c8ad3ea91910eab6a51486b0a (patch)
treeda173f72f0347fda978ec43718aa05bdfc5db2e0 /CMakeLists.txt
parentabc5e7d59600249b4ac97b159ffe715fe463cb7f (diff)
Use compiler check for -fmacro-prefix-map
Use a more reliable method to check the availability of the flag than compiler versions. Some compilers have different behaviors for C and C++. Reviewed By: campbellbarton, ChrisLend Differential Revision: https://developer.blender.org/D9446
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt17
1 files changed, 8 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce5feb1b385..aba2fa806b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1662,15 +1662,14 @@ endif()
if(WITH_COMPILER_SHORT_FILE_MACRO)
# Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this).
- if((CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.4) OR
- (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0) OR
- (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)
- )
-
+ ADD_CHECK_C_COMPILER_FLAG(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
+ ADD_CHECK_CXX_COMPILER_FLAG(CXX_PREFIX_MAP_FLAGS CXX_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
+ if(C_MACRO_PREFIX_MAP AND CXX_MACRO_PREFIX_MAP)
if(APPLE)
if(XCODE AND ${XCODE_VERSION} VERSION_LESS 12.0)
- # Developers may have say LLVM Clang-10.0.1 toolchain with Xcode-11.
- message_first_run(WARNING
+ # Developers may have say LLVM Clang-10.0.1 toolchain (which supports the flag)
+ # with Xcode-11 (the Clang of which doesn't support the flag).
+ message(WARNING
"-fmacro-prefix-map flag is NOT supported by Clang shipped with Xcode-${XCODE_VERSION}."
" Some Xcode functionality in Product menu may not work. Disabling WITH_COMPILER_SHORT_FILE_MACRO."
)
@@ -1688,8 +1687,8 @@ if(WITH_COMPILER_SHORT_FILE_MACRO)
unset(_bin_dir)
endif()
else()
- message_first_run(WARNING
- "-fmacro-prefix-map flag is NOT supported by ${CMAKE_C_COMPILER_ID} version-${CMAKE_C_COMPILER_VERSION}."
+ message(WARNING
+ "-fmacro-prefix-map flag is NOT supported by C/C++ compiler."
" Disabling WITH_COMPILER_SHORT_FILE_MACRO."
)
set(WITH_COMPILER_SHORT_FILE_MACRO OFF)