diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 1 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 1 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 35 | ||||
-rw-r--r-- | Modules/CPackWIX.cmake | 2 | ||||
-rw-r--r-- | Modules/FindPythonLibs.cmake | 7 | ||||
-rw-r--r-- | Modules/FindXMLRPC.cmake | 43 |
6 files changed, 55 insertions, 34 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index fcbda20..4e56ce1 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -110,6 +110,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c) + CMAKE_DIAGNOSE_UNSUPPORTED_CLANG(C CC) # Set old compiler and platform id variables. if(CMAKE_C_COMPILER_ID STREQUAL "GNU") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 8c33eb6..4541844 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -105,6 +105,7 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp) + CMAKE_DIAGNOSE_UNSUPPORTED_CLANG(CXX CXX) # Set old compiler and platform id variables. if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 7efe739..347106e 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -735,3 +735,38 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags) set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "" PARENT_SCOPE) endif() endfunction() + +function(CMAKE_DIAGNOSE_UNSUPPORTED_CLANG lang envvar) + if(NOT CMAKE_HOST_WIN32 OR CMAKE_GENERATOR MATCHES "Visual Studio" OR + NOT "${CMAKE_${lang}_COMPILER_ID};${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "Clang;MSVC") + return() + endif() + + # Test whether a GNU-like command-line option works. + execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" --version + RESULT_VARIABLE _clang_result + OUTPUT_VARIABLE _clang_stdout + ERROR_VARIABLE _clang_stderr) + if(NOT _clang_result EQUAL 0) + return() + endif() + + # Help the user configure the environment to use the MSVC-like Clang. + string(CONCAT _msg + "The Clang compiler tool\n" + " \"${CMAKE_${lang}_COMPILER}\"\n" + "targets the MSVC ABI but has a GNU-like command-line interface. " + "This is not supported. " + "Use 'clang-cl' instead, e.g. by setting '${envvar}=clang-cl' in the environment." + ) + execute_process(COMMAND rc -help + RESULT_VARIABLE _rc_result + OUTPUT_VARIABLE _rc_stdout + ERROR_VARIABLE _rc_stderr) + if(NOT _rc_result EQUAL 0) + string(APPEND _msg " " + "Furthermore, use the MSVC command-line environment." + ) + endif() + message(FATAL_ERROR "${_msg}") +endfunction() diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 1dc37d4..c723e72 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -289,7 +289,7 @@ # if(NOT CPACK_WIX_ROOT) - file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT) + string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}") endif() find_program(CPACK_WIX_CANDLE_EXECUTABLE candle diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 63ec9a8..341d5d9 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -122,6 +122,7 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) if(WIN32) find_library(PYTHON_DEBUG_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS}_d python + NAMES_PER_DIR HINTS ${_Python_LIBRARY_PATH_HINT} PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug @@ -145,20 +146,18 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) python${_CURRENT_VERSION}m python${_CURRENT_VERSION}u python${_CURRENT_VERSION} + NAMES_PER_DIR HINTS ${_Python_LIBRARY_PATH_HINT} PATHS ${PYTHON_FRAMEWORK_LIBRARIES} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs - # Avoid finding the .dll in the PATH. We want the .lib. - NO_SYSTEM_ENVIRONMENT_PATH ) # Look for the static library in the Python config directory find_library(PYTHON_LIBRARY NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION} - # Avoid finding the .dll in the PATH. We want the .lib. - NO_SYSTEM_ENVIRONMENT_PATH + NAMES_PER_DIR # This is where the static library is usually located PATH_SUFFIXES python${_CURRENT_VERSION}/config ) diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake index f0b2583..e7ae919 100644 --- a/Modules/FindXMLRPC.cmake +++ b/Modules/FindXMLRPC.cmake @@ -43,20 +43,12 @@ endif() # Lookup the include directories needed for the components requested. if(XMLRPC_C_FOUND) - # Use the newer EXECUTE_PROCESS command if it is available. - if(COMMAND EXECUTE_PROCESS) - execute_process( - COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --cflags - OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT - ) - else() - exec_program(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --cflags" - OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS - RETURN_VALUE XMLRPC_C_CONFIG_RESULT - ) - endif() + execute_process( + COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --cflags + OUTPUT_VARIABLE XMLRPC_C_CONFIG_CFLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT + ) # Parse the include flags. if("${XMLRPC_C_CONFIG_RESULT}" STREQUAL "0") @@ -65,6 +57,7 @@ if(XMLRPC_C_FOUND) XMLRPC_C_CONFIG_CFLAGS "${XMLRPC_C_CONFIG_CFLAGS}") # Look for -I options. + # FIXME: Use these as hints to a find_path call to find the headers. set(XMLRPC_INCLUDE_DIRS) foreach(flag ${XMLRPC_C_CONFIG_CFLAGS}) if("${flag}" MATCHES "^-I(.+)") @@ -80,20 +73,12 @@ endif() # Lookup the libraries needed for the components requested. if(XMLRPC_C_FOUND) - # Use the newer EXECUTE_PROCESS command if it is available. - if(COMMAND EXECUTE_PROCESS) - execute_process( - COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --libs - OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT - ) - else() - exec_program(${XMLRPC_C_CONFIG} ARGS "${XMLRPC_FIND_COMPONENTS} --libs" - OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS - RETURN_VALUE XMLRPC_C_CONFIG_RESULT - ) - endif() + execute_process( + COMMAND ${XMLRPC_C_CONFIG} ${XMLRPC_FIND_COMPONENTS} --libs + OUTPUT_VARIABLE XMLRPC_C_CONFIG_LIBS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE XMLRPC_C_CONFIG_RESULT + ) # Parse the library names and directories. if("${XMLRPC_C_CONFIG_RESULT}" STREQUAL "0") @@ -139,5 +124,5 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS( XMLRPC - REQUIRED_VARS XMLRPC_C_FOUND XMLRPC_LIBRARIES XMLRPC_INCLUDE_DIRS + REQUIRED_VARS XMLRPC_C_FOUND XMLRPC_LIBRARIES FAIL_MESSAGE "XMLRPC was not found. Make sure the entries XMLRPC_* are set.") |