[test-suite] r268474 - cmake/caches: Use CMAKE_C_FLAGS_RELEASE to pass flags.
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue May 3 20:06:16 PDT 2016
Author: matze
Date: Tue May 3 22:06:16 2016
New Revision: 268474
URL: http://llvm.org/viewvc/llvm-project?rev=268474&view=rev
Log:
cmake/caches: Use CMAKE_C_FLAGS_RELEASE to pass flags.
Do not set CMAKE_C_FLAGS etc. in the cache files because these often get
overridden by the user. This means we have to use intended cmake
mechanisms to select the target architecture (CMAKE_OSX_ARCHITECTURES,
CMAKE_C_COMPILER_TARGET, ...) so the following try_compile() calls do not
fail.
Removed:
test-suite/trunk/cmake/caches/util/arch_flags.cmake
Modified:
test-suite/trunk/CMakeLists.txt
test-suite/trunk/cmake/caches/target-arm64-iphoneos.cmake
test-suite/trunk/cmake/caches/target-haswell.cmake
test-suite/trunk/cmake/caches/target-thumbv7s-iphoneos.cmake
test-suite/trunk/cmake/caches/util/xcode_sdk.cmake
Modified: test-suite/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/CMakeLists.txt?rev=268474&r1=268473&r2=268474&view=diff
==============================================================================
--- test-suite/trunk/CMakeLists.txt (original)
+++ test-suite/trunk/CMakeLists.txt Tue May 3 22:06:16 2016
@@ -9,16 +9,19 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
endif()
# Selecting installation directories or build types is untypical.
-mark_as_advanced(CMAKE_INSTALL_PREFIX)
+mark_as_advanced(CMAKE_INSTALL_PREFIX CMAKE_BUILD_TYPE)
# On the other hand we often want to switch compiler or cflags
mark_as_advanced(CLEAR CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_LINKER
- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL
- CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL
- CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
- CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS_DEBUG
- CMAKE_EXE_LINKER_FLAGS_MINSIZEREL CMAKE_EXE_LINKER_FLAGS_RELEASE
- CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO)
+ CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS)
+
+# The files in cmake/caches often want to pass along additional flags to select
+# the target architecture. Note that you should still use
+# CMAKE_OSX_ARCHITECTURES and CMAKE_C_COMPILER_TARGET where possible.
+set(TEST_SUITE_ARCH_FLAGS CACHE STRING
+ "Extra flags to select target architecture.")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TEST_SUITE_ARCH_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TEST_SUITE_ARCH_FLAGS}")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TEST_SUITE_ARCH_FLAGS}")
project(test-suite C CXX)
Modified: test-suite/trunk/cmake/caches/target-arm64-iphoneos.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/caches/target-arm64-iphoneos.cmake?rev=268474&r1=268473&r2=268474&view=diff
==============================================================================
--- test-suite/trunk/cmake/caches/target-arm64-iphoneos.cmake (original)
+++ test-suite/trunk/cmake/caches/target-arm64-iphoneos.cmake Tue May 3 22:06:16 2016
@@ -1,3 +1,3 @@
set(XCRUN_FLAGS --toolchain iOS --sdk iphoneos)
-set(ARCH_FLAGS "${ARCH_FLAGS} -arch arm64")
+set(CMAKE_OSX_ARCHITECTURES arm64 CACHE STRING "")
include(${CMAKE_CURRENT_LIST_DIR}/util/xcode_sdk.cmake)
Modified: test-suite/trunk/cmake/caches/target-haswell.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/caches/target-haswell.cmake?rev=268474&r1=268473&r2=268474&view=diff
==============================================================================
--- test-suite/trunk/cmake/caches/target-haswell.cmake (original)
+++ test-suite/trunk/cmake/caches/target-haswell.cmake Tue May 3 22:06:16 2016
@@ -1,2 +1 @@
-set(ARCH_FLAGS "-march=haswell")
-include(${CMAKE_CURRENT_LIST_DIR}/util/arch_flags.cmake)
+set(TEST_SUITE_ARCH_FLAGS "-march=haswell" CACHE STRING "")
Modified: test-suite/trunk/cmake/caches/target-thumbv7s-iphoneos.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/caches/target-thumbv7s-iphoneos.cmake?rev=268474&r1=268473&r2=268474&view=diff
==============================================================================
--- test-suite/trunk/cmake/caches/target-thumbv7s-iphoneos.cmake (original)
+++ test-suite/trunk/cmake/caches/target-thumbv7s-iphoneos.cmake Tue May 3 22:06:16 2016
@@ -1,3 +1,3 @@
set(XCRUN_FLAGS --toolchain iOS --sdk iphoneos)
-set(ARCH_FLAGS "${ARCH_FLAGS} -arch thumbv7s")
+set(CMAKE_OSX_ARCHITECTURES thumbv7s CACHE STRING "")
include(${CMAKE_CURRENT_LIST_DIR}/util/xcode_sdk.cmake)
Removed: test-suite/trunk/cmake/caches/util/arch_flags.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/caches/util/arch_flags.cmake?rev=268473&view=auto
==============================================================================
--- test-suite/trunk/cmake/caches/util/arch_flags.cmake (original)
+++ test-suite/trunk/cmake/caches/util/arch_flags.cmake (removed)
@@ -1,4 +0,0 @@
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_FLAGS}" CACHE STRING "")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAGS}" CACHE STRING "")
-set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${ARCH_FLAGS}" CACHE STRING "")
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ARCH_FLAGS}" CACHE STRING "")
Modified: test-suite/trunk/cmake/caches/util/xcode_sdk.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/caches/util/xcode_sdk.cmake?rev=268474&r1=268473&r2=268474&view=diff
==============================================================================
--- test-suite/trunk/cmake/caches/util/xcode_sdk.cmake (original)
+++ test-suite/trunk/cmake/caches/util/xcode_sdk.cmake Tue May 3 22:06:16 2016
@@ -21,10 +21,8 @@ xcrun_find_update_cache(CMAKE_AR ar)
xcrun_find_update_cache(CMAKE_STRIP strip)
xcrun_find_update_cache(CMAKE_NM nm)
-# I couldn't find a way to stop cmake from adding a -isysroot, at least make it
-# add the correct path
set(CMAKE_OSX_SYSROOT "${SDK_PATH}" CACHE STRING "")
-set(ARCH_FLAGS "${ARCH_FLAGS} --sysroot ${SDK_PATH}")
-set(ARCH_FLAGS "${ARCH_FLAGS} -B ${LINKER_DIR}")
-include(${CMAKE_CURRENT_LIST_DIR}/arch_flags.cmake)
+# Append -B so clang picks up the linker coming with the SDK instead of the
+# one in $PATH.
+set(TEST_SUITE_ARCH_FLAGS "-B ${LINKER_DIR}" CACHE STRING "")
More information about the llvm-commits
mailing list