summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2019-11-27 23:44:58 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2019-12-05 19:25:36 (GMT)
commit6f48c59257e7baec2acd89015dde136931a72c7c (patch)
tree6e22fecb074b29d2d643ed1a349d0d217f667a63 /Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
parent7046a5219893436cbe19b6973ac13fb489199601 (diff)
downloadCMake-6f48c59257e7baec2acd89015dde136931a72c7c.zip
CMake-6f48c59257e7baec2acd89015dde136931a72c7c.tar.gz
CMake-6f48c59257e7baec2acd89015dde136931a72c7c.tar.bz2
launcher: support setting a compiler launcher through the environment
This makes it much easier to use a launcher for all CMake projects in an environment rather than having to remember to pass the setting to every CMake build.
Diffstat (limited to 'Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake')
-rw-r--r--Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
index bb8da03..f86e8ea 100644
--- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
@@ -15,6 +15,13 @@ function(run_compiler_launcher lang)
run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args})
endfunction()
+function(run_compiler_launcher_env lang)
+ string(REGEX REPLACE "-.*" "" core_lang "${lang}")
+ set(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER} "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
+ run_compiler_launcher(${lang})
+ unset(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER})
+endfunction()
+
set(langs C CXX)
if(CMake_TEST_CUDA)
list(APPEND langs CUDA)
@@ -25,7 +32,9 @@ endif()
foreach(lang ${langs})
run_compiler_launcher(${lang})
+ run_compiler_launcher_env(${lang}-env)
if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
run_compiler_launcher(${lang}-launch)
+ run_compiler_launcher_env(${lang}-launch-env)
endif()
endforeach()