ENH: use CMAKE_ROOT and not PROJECT_ for try compile stuff, this allows projects within projects to have different languages

This commit is contained in:
Bill Hoffman 2002-12-17 14:54:25 -05:00
parent 5abc8c18c0
commit bd74882d3e
15 changed files with 30 additions and 30 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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})

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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})

View File

@ -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})

View File

@ -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})

View File

@ -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)

View File

@ -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)

View File

@ -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)