summaryrefslogtreecommitdiffstats
path: root/Modules/Internal
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Internal')
-rw-r--r--Modules/Internal/CheckSourceCompiles.cmake5
-rw-r--r--Modules/Internal/CheckSourceRuns.cmake5
-rw-r--r--Modules/Internal/FeatureTesting.cmake9
3 files changed, 9 insertions, 10 deletions
diff --git a/Modules/Internal/CheckSourceCompiles.cmake b/Modules/Internal/CheckSourceCompiles.cmake
index a4415c4..eadf3da 100644
--- a/Modules/Internal/CheckSourceCompiles.cmake
+++ b/Modules/Internal/CheckSourceCompiles.cmake
@@ -86,14 +86,13 @@ function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var)
else()
set(CHECK_${LANG}_SOURCE_COMPILES_ADD_INCLUDES)
endif()
- file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}"
- "${_source}\n")
if(NOT CMAKE_REQUIRED_QUIET)
message(CHECK_START "Performing Test ${_var}")
endif()
+ string(APPEND _source "\n")
try_compile(${_var}
- SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
+ SOURCE_FROM_VAR "src.${_SRC_EXT}" _source
COMPILE_DEFINITIONS -D${_var} ${CMAKE_REQUIRED_DEFINITIONS}
${CHECK_${LANG}_SOURCE_COMPILES_ADD_LINK_OPTIONS}
${CHECK_${LANG}_SOURCE_COMPILES_ADD_LIBRARIES}
diff --git a/Modules/Internal/CheckSourceRuns.cmake b/Modules/Internal/CheckSourceRuns.cmake
index 4d58bb6..09c85c5 100644
--- a/Modules/Internal/CheckSourceRuns.cmake
+++ b/Modules/Internal/CheckSourceRuns.cmake
@@ -85,14 +85,13 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var)
else()
set(CHECK_${_lang}_SOURCE_COMPILES_ADD_INCLUDES)
endif()
- file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}"
- "${_source}\n")
if(NOT CMAKE_REQUIRED_QUIET)
message(CHECK_START "Performing Test ${_var}")
endif()
+ string(APPEND _source "\n")
try_run(${_var}_EXITCODE ${_var}_COMPILED
- SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
+ SOURCE_FROM_VAR "src.${_SRC_EXT}" _source
COMPILE_DEFINITIONS -D${_var} ${CMAKE_REQUIRED_DEFINITIONS}
${CHECK_${_lang}_SOURCE_COMPILES_ADD_LINK_OPTIONS}
${CHECK_${_lang}_SOURCE_COMPILES_ADD_LIBRARIES}
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index 0b10032..5c144ec 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -4,7 +4,7 @@ macro(_record_compiler_features lang compile_flags feature_list)
string(TOLOWER ${lang} lang_lc)
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin")
- file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "
+ set(_content "
const char features[] = {\"\\n\"\n")
get_property(known_features GLOBAL PROPERTY CMAKE_${lang}_KNOWN_FEATURES)
@@ -16,10 +16,11 @@ macro(_record_compiler_features lang compile_flags feature_list)
else()
set(_feature_condition "#if ${_cmake_feature_test_${feature}}\n\"1\"\n#else\n\"0\"\n#endif\n")
endif()
- file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "\"${lang}_FEATURE:\"\n${_feature_condition}\"${feature}\\n\"\n")
+ string(APPEND _content
+ "\"${lang}_FEATURE:\"\n${_feature_condition}\"${feature}\\n\"\n")
endif()
endforeach()
- file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
+ string(APPEND _content
"\n};\n\nint main(int argc, char** argv) { (void)argv; return features[argc]; }\n")
if(CMAKE_${lang}_LINK_WITH_STANDARD_COMPILE_OPTION)
@@ -31,7 +32,7 @@ macro(_record_compiler_features lang compile_flags feature_list)
endif()
try_compile(CMAKE_${lang}_FEATURE_TEST
- SOURCES "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
+ SOURCE_FROM_VAR "feature_tests.${lang_lc}" _content
COMPILE_DEFINITIONS "${compile_flags}"
LINK_LIBRARIES "${compile_flags_for_link}"
OUTPUT_VARIABLE _output