ENH: Patch from Mathieu Malaterre to allow users to tell CMakeImportBuildSettings to not force compiler settings.

This commit is contained in:
Brad King 2008-03-28 13:26:31 -04:00
parent b8169eb4e3
commit d71c6ba49a
1 changed files with 20 additions and 20 deletions

View File

@ -119,7 +119,7 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
ENDIF(WIN32)
# Enforce the C++ compiler setting.
IF(CMAKE_CXX_COMPILER_MISMATCH)
IF(CMAKE_CXX_COMPILER_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_CXX_COMPILER to "
"\"${CMAKE_BUILD_SETTING_CXX_COMPILER}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. This is required "
@ -129,10 +129,10 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects. Was set to ${CMAKE_CXX_COMPILER}")
SET(CMAKE_CXX_COMPILER ${CMAKE_BUILD_SETTING_CXX_COMPILER}
CACHE STRING "C++ compiler imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_CXX_COMPILER_MISMATCH)
ENDIF(CMAKE_CXX_COMPILER_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
# Enforce the build type.
IF(CMAKE_BUILD_TYPE_MISMATCH)
IF(CMAKE_BUILD_TYPE_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_BUILD_TYPE to "
"\"${CMAKE_BUILD_SETTING_BUILD_TYPE}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. This is required "
@ -142,11 +142,11 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects.")
SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_SETTING_BUILD_TYPE}
CACHE STRING "Build type imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_BUILD_TYPE_MISMATCH)
ENDIF(CMAKE_BUILD_TYPE_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
# Enforce the C build variation flags.
IF(CMAKE_C_FLAGS_DEBUG_MISMATCH)
IF(CMAKE_C_FLAGS_DEBUG_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_C_FLAGS_DEBUG to "
"\"${CMAKE_BUILD_SETTING_C_FLAGS_DEBUG}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. "
@ -155,9 +155,9 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects.")
SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_BUILD_SETTING_C_FLAGS_DEBUG}
CACHE STRING "C DEBUG flags imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_C_FLAGS_DEBUG_MISMATCH)
ENDIF(CMAKE_C_FLAGS_DEBUG_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
IF(CMAKE_C_FLAGS_RELEASE_MISMATCH)
IF(CMAKE_C_FLAGS_RELEASE_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_C_FLAGS_RELEASE to "
"\"${CMAKE_BUILD_SETTING_C_FLAGS_RELEASE}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. "
@ -166,9 +166,9 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects.")
SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_BUILD_SETTING_C_FLAGS_RELEASE}
CACHE STRING "C RELEASE flags imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_C_FLAGS_RELEASE_MISMATCH)
ENDIF(CMAKE_C_FLAGS_RELEASE_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
IF(CMAKE_C_FLAGS_MINSIZEREL_MISMATCH)
IF(CMAKE_C_FLAGS_MINSIZEREL_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_C_FLAGS_MINSIZEREL to "
"\"${CMAKE_BUILD_SETTING_C_FLAGS_MINSIZEREL}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. "
@ -177,9 +177,9 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects.")
SET(CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_BUILD_SETTING_C_FLAGS_MINSIZEREL}
CACHE STRING "C MINSIZEREL flags imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_C_FLAGS_MINSIZEREL_MISMATCH)
ENDIF(CMAKE_C_FLAGS_MINSIZEREL_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
IF(CMAKE_C_FLAGS_RELWITHDEBINFO_MISMATCH)
IF(CMAKE_C_FLAGS_RELWITHDEBINFO_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_C_FLAGS_RELWITHDEBINFO to "
"\"${CMAKE_BUILD_SETTING_C_FLAGS_RELWITHDEBINFO}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. "
@ -188,11 +188,11 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects.")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_BUILD_SETTING_C_FLAGS_RELWITHDEBINFO}
CACHE STRING "C RELWITHDEBINFO flags imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_C_FLAGS_RELWITHDEBINFO_MISMATCH)
ENDIF(CMAKE_C_FLAGS_RELWITHDEBINFO_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
# Enforce the C++ build variation flags.
IF(CMAKE_CXX_FLAGS_DEBUG_MISMATCH)
IF(CMAKE_CXX_FLAGS_DEBUG_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_CXX_FLAGS_DEBUG to "
"\"${CMAKE_BUILD_SETTING_CXX_FLAGS_DEBUG}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. "
@ -201,9 +201,9 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects.")
SET(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_BUILD_SETTING_CXX_FLAGS_DEBUG}
CACHE STRING "C++ DEBUG flags imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_CXX_FLAGS_DEBUG_MISMATCH)
ENDIF(CMAKE_CXX_FLAGS_DEBUG_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
IF(CMAKE_CXX_FLAGS_RELEASE_MISMATCH)
IF(CMAKE_CXX_FLAGS_RELEASE_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_CXX_FLAGS_RELEASE to "
"\"${CMAKE_BUILD_SETTING_CXX_FLAGS_RELEASE}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. "
@ -212,9 +212,9 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects.")
SET(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_BUILD_SETTING_CXX_FLAGS_RELEASE}
CACHE STRING "C++ RELEASE flags imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_CXX_FLAGS_RELEASE_MISMATCH)
ENDIF(CMAKE_CXX_FLAGS_RELEASE_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
IF(CMAKE_CXX_FLAGS_MINSIZEREL_MISMATCH)
IF(CMAKE_CXX_FLAGS_MINSIZEREL_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_CXX_FLAGS_MINSIZEREL to "
"\"${CMAKE_BUILD_SETTING_CXX_FLAGS_MINSIZEREL}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. "
@ -223,9 +223,9 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects.")
SET(CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_BUILD_SETTING_CXX_FLAGS_MINSIZEREL}
CACHE STRING "C++ MINSIZEREL flags imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_CXX_FLAGS_MINSIZEREL_MISMATCH)
ENDIF(CMAKE_CXX_FLAGS_MINSIZEREL_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
IF(CMAKE_CXX_FLAGS_RELWITHDEBINFO_MISMATCH)
IF(CMAKE_CXX_FLAGS_RELWITHDEBINFO_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
MESSAGE("Warning: CMake is forcing CMAKE_CXX_FLAGS_RELWITHDEBINFO to "
"\"${CMAKE_BUILD_SETTING_CXX_FLAGS_RELWITHDEBINFO}\" to match that imported "
"from ${CMAKE_BUILD_SETTING_PROJECT_NAME}. "
@ -234,7 +234,7 @@ MACRO(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
"re-build one of those projects.")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_BUILD_SETTING_CXX_FLAGS_RELWITHDEBINFO}
CACHE STRING "C++ RELWITHDEBINFO flags imported from ${CMAKE_BUILD_SETTING_PROJECT_NAME}." FORCE)
ENDIF(CMAKE_CXX_FLAGS_RELWITHDEBINFO_MISMATCH)
ENDIF(CMAKE_CXX_FLAGS_RELWITHDEBINFO_MISMATCH AND NOT CMAKE_OVERRIDE_COMPILER_MISMATCH)
ELSE(${SETTINGS_FILE} MATCHES ".+")
MESSAGE(SEND_ERROR "CMAKE_IMPORT_BUILD_SETTINGS called with no argument.")