Commit bd74882d authored by Bill Hoffman's avatar Bill Hoffman

ENH: use CMAKE_ROOT and not PROJECT_ for try compile stuff, this allows...

ENH: use CMAKE_ROOT and not PROJECT_ for try compile stuff, this allows projects within projects to have different languages
parent 5abc8c18
......@@ -56,5 +56,5 @@ ENDIF(NOT CMAKE_COMPILER_RETURN)
# configure variables set in this file for fast reload later on
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
${PROJECT_BINARY_DIR}/CMakeCCompiler.cmake IMMEDIATE)
${CMAKE_BINARY_DIR}/CMakeCCompiler.cmake IMMEDIATE)
MARK_AS_ADVANCED(CMAKE_AR CMAKE_C_COMPILER_FULLPATH)
......@@ -48,5 +48,5 @@ ENDIF(NOT CMAKE_COMPILER_RETURN)
# configure all variables set in this file
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
${PROJECT_BINARY_DIR}/CMakeCXXCompiler.cmake IMMEDIATE)
${CMAKE_BINARY_DIR}/CMakeCXXCompiler.cmake IMMEDIATE)
MARK_AS_ADVANCED(CMAKE_CXX_COMPILER_FULLPATH)
......@@ -71,5 +71,5 @@ MARK_AS_ADVANCED(CMAKE_JAVA_COMPILER)
# configure variables set in this file for fast reload later on
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeJavaCompiler.cmake.in
${PROJECT_BINARY_DIR}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY)
${CMAKE_BINARY_DIR}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY)
MARK_AS_ADVANCED(CMAKE_AR CMAKE_JAVA_COMPILER_FULLPATH)
......@@ -63,5 +63,5 @@ ENDIF(CMAKE_SYSTEM_VERSION)
# configure variables set in this file for fast reload
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
${PROJECT_BINARY_DIR}/CMakeSystem.cmake IMMEDIATE)
${CMAKE_BINARY_DIR}/CMakeSystem.cmake IMMEDIATE)
......@@ -45,12 +45,12 @@ ELSE(EXISTS ${CMAKE_SYSTEM_INFO_FILE})
MESSAGE("System is unknown to cmake, create:\n${CMAKE_SYSTEM_INFO_FILE}"
" to use this system, please send your config file to "
"cmake@www.cmake.org so it can be added to cmake"")
IF(EXISTS ${PROJECT_BINARY_DIR}/CMakeCache.txt)
CONFIGURE_FILE(${PROJECT_BINARY_DIR}/CMakeCache.txt
${PROJECT_BINARY_DIR}/CopyOfCMakeCache.txt COPYONLY)
IF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/CMakeCache.txt
${CMAKE_BINARY_DIR}/CopyOfCMakeCache.txt COPYONLY)
MESSAGE("You CMakeCache.txt file was copied to CopyOfCMakeCache.txt. "
"Please send that file to cmake@www.cmake.org.")
ENDIF(EXISTS ${PROJECT_BINARY_DIR}/CMakeCache.txt)
ENDIF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
ENDIF(EXISTS ${CMAKE_SYSTEM_INFO_FILE})
# 3. include optional systemname-compiler.cmake files
......
......@@ -11,7 +11,7 @@ MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
SET(MACRO_CHECK_FUNCTION_DEFINITIONS -DCHECK_FUNCTION_EXISTS=${FUNCTION})
MESSAGE(STATUS "Looking for ${FUNCTION}")
TRY_COMPILE(${VARIABLE}
${PROJECT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckFunctionExists.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
OUTPUT_VARIABLE OUTPUT)
......@@ -21,7 +21,7 @@ MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
ELSE(${VARIABLE})
MESSAGE(STATUS "Looking for ${FUNCTION} - not found")
SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}")
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining if the function ${FUNCTION} exists failed with the following output:\n"
"${OUTPUT}\n" APPEND)
ENDIF(${VARIABLE})
......
......@@ -10,11 +10,11 @@ MACRO(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in
${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.c IMMEDIATE)
${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFile.c IMMEDIATE)
MESSAGE(STATUS "Looking for ${INCLUDE}")
TRY_COMPILE(${VARIABLE}
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.c
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFile.c
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
MESSAGE(STATUS "Looking for ${INCLUDE} - found")
......@@ -22,7 +22,7 @@ MACRO(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
ELSE(${VARIABLE})
MESSAGE(STATUS "Looking for ${INCLUDE} - not found.")
SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining if the include file ${INCLUDE} "
"exists failed with the following output:\n"
"${OUTPUT}\n" APPEND)
......
......@@ -11,10 +11,10 @@ MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
MESSAGE(STATUS "Checking for CXX include file ${INCLUDE}")
SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
TRY_COMPILE(${VARIABLE}
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CMAKE_ANSI_CXXFLAGS}
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
......@@ -23,7 +23,7 @@ MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
ELSE(${VARIABLE})
MESSAGE(STATUS "Checking for CXX include file ${INCLUDE} -- not found")
SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining if the include file ${INCLUDE} "
"exists failed with the following output:\n"
"${OUTPUT}\n" APPEND)
......
......@@ -11,7 +11,7 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION -DCHECK_FUNCTION_EXISTS=${FUNCTION})
MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
TRY_COMPILE(${VARIABLE}
${PROJECT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckFunctionExists.c
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION}
......@@ -25,7 +25,7 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
ELSE(${VARIABLE})
MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
SET(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}")
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
"failed with the following output:\n"
"${OUTPUT}\n" APPEND)
......
......@@ -18,7 +18,7 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
ENDIF(HAVE_STDINT_H)
MESSAGE(STATUS "Check size of ${TYPE}")
TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
${PROJECT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckSizeOf.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
OUTPUT_VARIABLE OUTPUT)
......@@ -26,7 +26,7 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
MESSAGE(STATUS "Check size of ${TYPE} - done")
ELSE(HAVE_${VARIABLE})
MESSAGE(STATUS "Check size of ${TYPE} - failed")
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n"
APPEND)
ENDIF(HAVE_${VARIABLE})
......
......@@ -9,7 +9,7 @@ MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(MACRO_CHECK_VARIABLE_DEFINITIONS -DCHECK_VARIABLE_EXISTS=${VAR})
TRY_COMPILE(${VARIABLE}
${PROJECT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckVariableExists.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_VARIABLE_DEFINITIONS}
OUTPUT_VARIABLE OUTPUT)
......@@ -17,7 +17,7 @@ MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE)
SET(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}")
ELSE(${VARIABLE})
SET(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}")
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining if the variable ${VAR} exists failed with the following output:\n"
"${OUTPUT}\n" APPEND)
ENDIF(${VARIABLE})
......
......@@ -6,11 +6,11 @@
MACRO(TEST_BIG_ENDIAN VARIABLE)
TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
${PROJECT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestBigEndian.c
OUTPUT_VARIABLE OUTPUT)
IF(NOT HAVE_${VARIABLE})
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining the endianes of the system failed with the following output:\n${OUTPUT}\n"
APPEND)
ENDIF(NOT HAVE_${VARIABLE})
......
......@@ -9,14 +9,14 @@
MACRO(CHECK_CXX_ACCEPTS_FLAG FLAGS VARIABLE)
MESSAGE(STATUS "Checking to see if CXX compiler acepts flag ${FLAGS}")
TRY_COMPILE(${VARIABLE}
${PROJECT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/DummyCXXFile.cxx
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${FLAGS}
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
MESSAGE(STATUS "Checking to see if CXX compiler acepts flag ${FLAGS} - yes")
ELSE(${VARIABLE})
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining if the CXX compiler accepts the flag ${FLAGS} failed with the following output:\n" "${OUTPUT}\n" APPEND)
ENDIF(${VARIABLE})
ENDMACRO(CHECK_CXX_ACCEPTS_FLAG)
......@@ -6,7 +6,7 @@
IF(NOT CMAKE_ANSI_FOR_SCOPE)
MESSAGE(STATUS "Check for ANSI scope")
TRY_COMPILE(CMAKE_ANSI_FOR_SCOPE ${PROJECT_BINARY_DIR}
TRY_COMPILE(CMAKE_ANSI_FOR_SCOPE ${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CMAKE_ANSI_CXXFLAGS})
IF (CMAKE_ANSI_FOR_SCOPE)
......
......@@ -6,7 +6,7 @@
IF(NOT CMAKE_STD_NAMESPACE)
MESSAGE(STATUS "Check for STD namespace")
TRY_COMPILE(CMAKE_STD_NAMESPACE ${PROJECT_BINARY_DIR}
TRY_COMPILE(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CMAKE_ANSI_CXXFLAGS})
IF (CMAKE_STD_NAMESPACE)
......
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