summaryrefslogtreecommitdiffstats
path: root/Modules/CheckIncludeFiles.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/CheckIncludeFiles.cmake')
-rw-r--r--Modules/CheckIncludeFiles.cmake16
1 files changed, 7 insertions, 9 deletions
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 22af4f2..8e82859 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -52,7 +52,7 @@ include_guard(GLOBAL)
macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
if(NOT DEFINED "${VARIABLE}")
- set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
+ set(_src_content "/* */\n")
if("x${ARGN}" STREQUAL "x")
if(CMAKE_C_COMPILER_LOADED)
@@ -71,9 +71,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
endif()
if(_lang STREQUAL "C")
- set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckIncludeFiles/${VARIABLE}.c)
+ set(src ${VARIABLE}.c)
elseif(_lang STREQUAL "CXX")
- set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckIncludeFiles/${VARIABLE}.cpp)
+ set(src ${VARIABLE}.cpp)
else()
message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n")
endif()
@@ -86,13 +86,11 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
set(CHECK_INCLUDE_FILES_CONTENT "/* */\n")
set(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS})
foreach(FILE ${INCLUDE})
- string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT
+ string(APPEND _src_content
"#include <${FILE}>\n")
endforeach()
- string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT
+ string(APPEND _src_content
"\n\nint main(void){return 0;}\n")
- configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
- "${src}" @ONLY)
set(_INCLUDE ${INCLUDE}) # remove empty elements
if("${_INCLUDE}" MATCHES "^([^;]+);.+;([^;]+)$")
@@ -136,7 +134,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
message(CHECK_START "Looking for ${_description}")
endif()
try_compile(${VARIABLE}
- SOURCES ${src}
+ SOURCE_FROM_VAR "${src}" _src_content
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
${_CIF_LINK_OPTIONS}
${_CIF_LINK_LIBRARIES}
@@ -163,7 +161,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if files ${INCLUDE} "
"exist failed with the following output:\n"
- "${OUTPUT}\nSource:\n${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
+ "${OUTPUT}\nSource:\n${_src_content}\n")
endif()
endif()
endmacro()