Skip to content
Browse files

ENH: Make modules use configure instead of file write

  • Loading branch information...
1 parent 1d96f83 commit 01a55559dd8ed40ea88582b49b9e94136fd7613a Andy Cedilnik committed Feb 23, 2006
Showing with 19 additions and 16 deletions.
  1. +2 −0 Modules/CMakeConfigurableFile.in
  2. +8 −7 Modules/CheckIncludeFiles.cmake
  3. +9 −9 Modules/CheckSymbolExists.cmake
View
2 Modules/CMakeConfigurableFile.in
@@ -0,0 +1,2 @@
+@CMAKE_CONFIGURABLE_FILE_CONTENT@
+
View
15 Modules/CheckIncludeFiles.cmake
@@ -14,6 +14,7 @@
MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
IF(CMAKE_REQUIRED_INCLUDES)
SET(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
ELSE(CMAKE_REQUIRED_INCLUDES)
@@ -22,13 +23,13 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
SET(CHECK_INCLUDE_FILES_CONTENT "/* */\n")
SET(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS})
FOREACH(FILE ${INCLUDE})
- SET(CHECK_INCLUDE_FILES_CONTENT
- "${CHECK_INCLUDE_FILES_CONTENT}#include <${FILE}>\n")
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
ENDFOREACH(FILE)
- SET(CHECK_INCLUDE_FILES_CONTENT
- "${CHECK_INCLUDE_FILES_CONTENT}\n\nint main(){return 0;}\n")
- FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
- "${CHECK_INCLUDE_FILES_CONTENT}")
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n")
+ CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
+ "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFiles.c" @ONLY)
MESSAGE(STATUS "Looking for include files ${VARIABLE}")
TRY_COMPILE(${VARIABLE}
@@ -52,7 +53,7 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
"Determining if files ${INCLUDE} "
"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}" MATCHES "^${VARIABLE}$")
ENDMACRO(CHECK_INCLUDE_FILES)
View
18 Modules/CheckSymbolExists.cmake
@@ -15,7 +15,7 @@
MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES 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})
IF(CMAKE_REQUIRED_LIBRARIES)
SET(CHECK_SYMBOL_EXISTS_LIBS
@@ -30,14 +30,14 @@ MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
SET(CMAKE_SYMBOL_EXISTS_INCLUDES)
ENDIF(CMAKE_REQUIRED_INCLUDES)
FOREACH(FILE ${FILES})
- SET(CHECK_SYMBOL_EXISTS_CONTENT
- "${CHECK_SYMBOL_EXISTS_CONTENT}#include <${FILE}>\n")
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
ENDFOREACH(FILE)
- SET(CHECK_SYMBOL_EXISTS_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")
+ SET(CMAKE_CONFIGURABLE_FILE_CONTENT
+ "${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
- "${CHECK_SYMBOL_EXISTS_CONTENT}")
+ CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
+ "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckSymbolExists.c" @ONLY)
MESSAGE(STATUS "Looking for ${SYMBOL}")
TRY_COMPILE(${VARIABLE}
@@ -56,15 +56,15 @@ MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
"Determining if the ${SYMBOL} "
"exist passed with the following output:\n"
"${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckSymbolExists.c:\n"
- "${CHECK_SYMBOL_EXISTS_CONTENT}\n")
+ "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
ELSE(${VARIABLE})
MESSAGE(STATUS "Looking for ${SYMBOL} - not found.")
SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}")
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
"Determining if the ${SYMBOL} "
"exist failed with the following output:\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}" MATCHES "^${VARIABLE}$")
ENDMACRO(CHECK_SYMBOL_EXISTS)

0 comments on commit 01a5555

Please sign in to comment.
Something went wrong with that request. Please try again.