Commit 01a55559 authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

ENH: Make modules use configure instead of file write

parent 1d96f839
@CMAKE_CONFIGURABLE_FILE_CONTENT@
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE) MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$") IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
IF(CMAKE_REQUIRED_INCLUDES) IF(CMAKE_REQUIRED_INCLUDES)
SET(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") SET(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
ELSE(CMAKE_REQUIRED_INCLUDES) ELSE(CMAKE_REQUIRED_INCLUDES)
...@@ -22,13 +23,13 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE) ...@@ -22,13 +23,13 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
SET(CHECK_INCLUDE_FILES_CONTENT "/* */\n") SET(CHECK_INCLUDE_FILES_CONTENT "/* */\n")
SET(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS}) SET(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS})
FOREACH(FILE ${INCLUDE}) FOREACH(FILE ${INCLUDE})
SET(CHECK_INCLUDE_FILES_CONTENT SET(CMAKE_CONFIGURABLE_FILE_CONTENT
"${CHECK_INCLUDE_FILES_CONTENT}#include <${FILE}>\n") "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
ENDFOREACH(FILE) ENDFOREACH(FILE)
SET(CHECK_INCLUDE_FILES_CONTENT SET(CMAKE_CONFIGURABLE_FILE_CONTENT
"${CHECK_INCLUDE_FILES_CONTENT}\n\nint main(){return 0;}\n") "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n")
FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFiles.c CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${CHECK_INCLUDE_FILES_CONTENT}") "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFiles.c" @ONLY)
MESSAGE(STATUS "Looking for include files ${VARIABLE}") MESSAGE(STATUS "Looking for include files ${VARIABLE}")
TRY_COMPILE(${VARIABLE} TRY_COMPILE(${VARIABLE}
...@@ -52,7 +53,7 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE) ...@@ -52,7 +53,7 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
"Determining if files ${INCLUDE} " "Determining if files ${INCLUDE} "
"exist failed with the following output:\n" "exist failed with the following output:\n"
"${OUTPUT}\nSource:\n${CHECK_INCLUDE_FILES_CONTENT}\n") "${OUTPUT}\nSource:\n${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
ENDIF(${VARIABLE}) ENDIF(${VARIABLE})
ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
ENDMACRO(CHECK_INCLUDE_FILES) ENDMACRO(CHECK_INCLUDE_FILES)
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$") IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(CHECK_SYMBOL_EXISTS_CONTENT "/* */\n") SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
IF(CMAKE_REQUIRED_LIBRARIES) IF(CMAKE_REQUIRED_LIBRARIES)
SET(CHECK_SYMBOL_EXISTS_LIBS SET(CHECK_SYMBOL_EXISTS_LIBS
...@@ -30,14 +30,14 @@ MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) ...@@ -30,14 +30,14 @@ MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
SET(CMAKE_SYMBOL_EXISTS_INCLUDES) SET(CMAKE_SYMBOL_EXISTS_INCLUDES)
ENDIF(CMAKE_REQUIRED_INCLUDES) ENDIF(CMAKE_REQUIRED_INCLUDES)
FOREACH(FILE ${FILES}) FOREACH(FILE ${FILES})
SET(CHECK_SYMBOL_EXISTS_CONTENT SET(CMAKE_CONFIGURABLE_FILE_CONTENT
"${CHECK_SYMBOL_EXISTS_CONTENT}#include <${FILE}>\n") "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
ENDFOREACH(FILE) ENDFOREACH(FILE)
SET(CHECK_SYMBOL_EXISTS_CONTENT SET(CMAKE_CONFIGURABLE_FILE_CONTENT
"${CHECK_SYMBOL_EXISTS_CONTENT}\nvoid cmakeRequireSymbol(int dummy,...){(void)dummy;}\nint main()\n{\n#ifndef ${SYMBOL}\n cmakeRequireSymbol(0,&${SYMBOL});\n#endif\n return 0;\n}\n") "${CMAKE_CONFIGURABLE_FILE_CONTENT}\nvoid cmakeRequireSymbol(int dummy,...){(void)dummy;}\nint main()\n{\n#ifndef ${SYMBOL}\n cmakeRequireSymbol(0,&${SYMBOL});\n#endif\n return 0;\n}\n")
FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckSymbolExists.c CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${CHECK_SYMBOL_EXISTS_CONTENT}") "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckSymbolExists.c" @ONLY)
MESSAGE(STATUS "Looking for ${SYMBOL}") MESSAGE(STATUS "Looking for ${SYMBOL}")
TRY_COMPILE(${VARIABLE} TRY_COMPILE(${VARIABLE}
...@@ -56,7 +56,7 @@ MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) ...@@ -56,7 +56,7 @@ MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
"Determining if the ${SYMBOL} " "Determining if the ${SYMBOL} "
"exist passed with the following output:\n" "exist passed with the following output:\n"
"${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckSymbolExists.c:\n" "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckSymbolExists.c:\n"
"${CHECK_SYMBOL_EXISTS_CONTENT}\n") "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
ELSE(${VARIABLE}) ELSE(${VARIABLE})
MESSAGE(STATUS "Looking for ${SYMBOL} - not found.") MESSAGE(STATUS "Looking for ${SYMBOL} - not found.")
SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}")
...@@ -64,7 +64,7 @@ MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) ...@@ -64,7 +64,7 @@ MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
"Determining if the ${SYMBOL} " "Determining if the ${SYMBOL} "
"exist failed with the following output:\n" "exist failed with the following output:\n"
"${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckSymbolExists.c:\n" "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckSymbolExists.c:\n"
"${CHECK_SYMBOL_EXISTS_CONTENT}\n") "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
ENDIF(${VARIABLE}) ENDIF(${VARIABLE})
ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
ENDMACRO(CHECK_SYMBOL_EXISTS) ENDMACRO(CHECK_SYMBOL_EXISTS)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment