diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 9 | ||||
-rw-r--r-- | Modules/CMakeGraphVizOptions.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakePackageConfigHelpers.cmake | 39 | ||||
-rw-r--r-- | Modules/FindHDF5.cmake | 38 | ||||
-rw-r--r-- | Modules/FindLua.cmake | 153 | ||||
-rw-r--r-- | Modules/FindOpenSSL.cmake | 2 | ||||
-rw-r--r-- | Modules/FindPythonInterp.cmake | 18 | ||||
-rw-r--r-- | Modules/FindPythonLibs.cmake | 10 | ||||
-rw-r--r-- | Modules/FindwxWidgets.cmake | 2 | ||||
-rw-r--r-- | Modules/FortranCInterface/Detect.cmake | 2 | ||||
-rw-r--r-- | Modules/GenerateExportHeader.cmake | 47 | ||||
-rw-r--r-- | Modules/Platform/Darwin.cmake | 9 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 17 |
13 files changed, 274 insertions, 74 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index ebd9ce0..da955cb 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -133,7 +133,11 @@ Id flags: ${testflags} endif() if(CMAKE_VS_WINCE_VERSION) set(id_entrypoint "mainACRTStartup") - set(id_subsystem 9) + if("${vs_version}" VERSION_LESS 9) + set(id_subsystem 9) + else() + set(id_subsystem 8) + endif() else() set(id_subsystem 1) endif() @@ -157,7 +161,8 @@ Id flags: ${testflags} ) # Match the compiler location line printed out. if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]") - set(_comp "${CMAKE_MATCH_1}") + # Strip VS diagnostic output from the end of the line. + string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _comp "${CMAKE_MATCH_1}") if(EXISTS "${_comp}") file(TO_CMAKE_PATH "${_comp}" _comp) set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake index e4af54c..2f04abb 100644 --- a/Modules/CMakeGraphVizOptions.cmake +++ b/Modules/CMakeGraphVizOptions.cmake @@ -53,7 +53,7 @@ # Default : TRUE ##end ##variable -# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude static libraries from the generated graphs. +# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude module libraries from the generated graphs. # Mandatory : NO # Default : TRUE ##end diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index d042d5e..3c56b7f 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -3,7 +3,8 @@ # CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path> # [PATH_VARS <var1> <var2> ... <varN>] # [NO_SET_AND_CHECK_MACRO] -# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]) +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] +# [NO_FIND_DEPENDENCY_MACRO]) # # CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain # configure_file() command when creating the <Name>Config.cmake or <Name>-config.cmake @@ -154,7 +155,7 @@ endmacro() function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) - set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO) set(oneValueArgs INSTALL_DESTINATION ) set(multiValueArgs PATH_VARS ) @@ -240,6 +241,40 @@ endmacro() ") endif() + if(NOT CCF_NO_FIND_DEPENDENCY_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(find_dependency dep) + if (NOT \${dep}_FOUND) + if (\${ARGV1}) + set(version \${ARGV1}) + endif() + set(exact_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT) + set(exact_arg EXACT) + endif() + set(quiet_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(quiet_arg QUIET) + endif() + set(required_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(required_arg REQUIRED) + endif() + + find_package(\${dep} \${version} \${exact_arg} \${quiet_arg} \${required_arg}) + if (NOT \${dep}_FOUND) + set(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE \"\${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \${dep} could not be found.\") + set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND False) + return() + endif() + set(required_arg) + set(quiet_arg) + set(exact_arg) + endif() +endmacro() +") + endif() + set(PACKAGE_INIT "${PACKAGE_INIT} ####################################################################################") diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 8514164..0c246a1 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -289,27 +289,13 @@ if( NOT HDF5_FOUND ) ENV HDF5_ROOT PATH_SUFFIXES lib Lib ) select_library_configurations( HDF5_${LIB} ) - # even though we adjusted the individual library names in - # select_library_configurations, we still need to distinguish - # between debug and release variants because HDF5_LIBRARIES will - # need to specify different lists for debug and optimized builds. - # We can't just use the HDF5_${LIB}_LIBRARY variable (which was set - # up by the selection macro above) because it may specify debug and - # optimized variants for a particular library, but a list of - # libraries is allowed to specify debug and optimized only once. - list( APPEND HDF5_${LANGUAGE}_LIBRARIES_DEBUG - ${HDF5_${LIB}_LIBRARY_DEBUG} ) - list( APPEND HDF5_${LANGUAGE}_LIBRARIES_RELEASE - ${HDF5_${LIB}_LIBRARY_RELEASE} ) + list(APPEND HDF5_${LANGUAGE}_LIBRARIES ${HDF5_${LIB}_LIBRARY}) endforeach() list( APPEND HDF5_LIBRARY_DIRS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} ) # Append the libraries for this language binding to the list of all # required libraries. - list( APPEND HDF5_LIBRARIES_DEBUG - ${HDF5_${LANGUAGE}_LIBRARIES_DEBUG} ) - list( APPEND HDF5_LIBRARIES_RELEASE - ${HDF5_${LANGUAGE}_LIBRARIES_RELEASE} ) + list(APPEND HDF5_LIBRARIES ${HDF5_${LANGUAGE}_LIBRARIES}) endforeach() # We may have picked up some duplicates in various lists during the above @@ -329,30 +315,10 @@ if( NOT HDF5_FOUND ) if( HDF5_INCLUDE_DIRS ) _remove_duplicates_from_beginning( HDF5_INCLUDE_DIRS ) endif() - if( HDF5_LIBRARIES_DEBUG ) - _remove_duplicates_from_beginning( HDF5_LIBRARIES_DEBUG ) - endif() - if( HDF5_LIBRARIES_RELEASE ) - _remove_duplicates_from_beginning( HDF5_LIBRARIES_RELEASE ) - endif() if( HDF5_LIBRARY_DIRS ) _remove_duplicates_from_beginning( HDF5_LIBRARY_DIRS ) endif() - # Construct the complete list of HDF5 libraries with debug and optimized - # variants when the generator supports them. - if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) - set( HDF5_LIBRARIES ) - foreach( _lib ${HDF5_LIBRARIES_DEBUG} ) - list( APPEND HDF5_LIBRARIES debug ${_lib} ) - endforeach() - foreach( _lib ${HDF5_LIBRARIES_RELEASE} ) - list( APPEND HDF5_LIBRARIES optimized ${_lib} ) - endforeach() - else() - set( HDF5_LIBRARIES ${HDF5_LIBRARIES_RELEASE} ) - endif() - # If the HDF5 include directory was found, open H5pubconf.h to determine if # HDF5 was compiled with parallel IO support set( HDF5_IS_PARALLEL FALSE ) diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake new file mode 100644 index 0000000..31fe54c --- /dev/null +++ b/Modules/FindLua.cmake @@ -0,0 +1,153 @@ +# Locate Lua library +# This module defines +# LUA_FOUND - if false, do not try to link to Lua +# LUA_LIBRARIES - both lua and lualib +# LUA_INCLUDE_DIR - where to find lua.h +# LUA_VERSION_STRING - the version of Lua found +# LUA_VERSION_MAJOR - the major version of Lua +# LUA_VERSION_MINOR - the minor version of Lua +# LUA_VERSION_PATCH - the patch version of Lua +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include <lua/lua.h> +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +unset(_lua_include_subdirs) +unset(_lua_library_names) + +# this is a function only to have all the variables inside go away automatically +function(set_lua_version_vars) + set(LUA_VERSIONS5 5.3 5.2 5.1 5.0) + + if (Lua_FIND_VERSION_EXACT) + if (Lua_FIND_VERSION_COUNT GREATER 1) + set(lua_append_versions ${Lua_FIND_VERSION_MAJOR} ${Lua_FIND_VERSION_MINOR}) + endif () + elseif (Lua_FIND_VERSION) + # once there is a different major version supported this should become a loop + if (NOT Lua_FIND_VERSION_MAJOR GREATER 5) + if (Lua_FIND_VERSION_COUNT EQUAL 1) + set(lua_append_versions ${LUA_VERSIONS5}) + else () + foreach (subver IN LISTS LUA_VERSIONS5) + if (NOT subver VERSION_LESS ${Lua_FIND_VERSION}) + list(APPEND lua_append_versions ${subver}) + endif () + endforeach () + endif () + endif () + else () + # once there is a different major version supported this should become a loop + set(lua_append_versions ${LUA_VERSIONS5}) + endif () + + foreach (ver IN LISTS lua_append_versions) + string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") + list(APPEND _lua_include_subdirs + include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + list(APPEND _lua_library_names + lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + endforeach () + + set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) + set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) +endfunction(set_lua_version_vars) + +set_lua_version_vars() + +find_path(LUA_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES ${_lua_include_subdirs} include/lua include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) +unset(_lua_include_subdirs) + +find_library(LUA_LIBRARY + NAMES ${_lua_library_names} lua + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) +unset(_lua_library_names) + +if (LUA_LIBRARY) + # include the math library for Unix + if (UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") + # For Windows and Mac, don't need to explicitly include the math library + else () + set(LUA_LIBRARIES "${LUA_LIBRARY}") + endif () +endif () + +if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + # At least 5.[012] have different ways to express the version + # so all of them need to be tested. Lua 5.2 defines LUA_VERSION + # and LUA_RELEASE as joined by the C preprocessor, so avoid those. + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings + REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") + + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") + if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") + set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") + else () + string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + endif () + string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") + endif () + + unset(lua_version_strings) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUA_VERSION_STRING) + +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 9851f67..b610438 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -138,6 +138,8 @@ if(WIN32 AND NOT CYGWIN) select_library_configurations(LIB_EAY) select_library_configurations(SSL_EAY) + mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE + SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE) set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) elseif(MINGW) # same player, for MinGW diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 7fb65b8..b6b7897 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -36,28 +36,30 @@ set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) if(PythonInterp_FIND_VERSION) - if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") - string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}") - string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") - list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ}) + if(PythonInterp_FIND_VERSION_COUNT GREATER 1) + set(_PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION_MAJOR}.${PythonInterp_FIND_VERSION_MINOR}") + list(APPEND _Python_NAMES + python${_PYTHON_FIND_MAJ_MIN} + python${PythonInterp_FIND_VERSION_MAJOR}) unset(_PYTHON_FIND_OTHER_VERSIONS) if(NOT PythonInterp_FIND_VERSION_EXACT) - foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + foreach(_PYTHON_V ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS}) if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) endif() endforeach() endif() unset(_PYTHON_FIND_MAJ_MIN) - unset(_PYTHON_FIND_MAJ) else() - list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION}) - set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS}) + list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION_MAJOR}) + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS}) endif() else() set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) endif() +message(STATUS "names ${_Python_NAMES}") +message(STATUS "other versions ${_PYTHON_FIND_OTHER_VERSIONS}") list(APPEND _Python_NAMES python) # Search for the current active python version first diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index bffa9fb..8356ed9 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -41,9 +41,8 @@ set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) if(PythonLibs_FIND_VERSION) - if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") - string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}") - string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") + if(PythonLibs_FIND_VERSION_COUNT GREATER 1) + set(_PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION_MAJOR}.${PythonLibs_FIND_VERSION_MINOR}") unset(_PYTHON_FIND_OTHER_VERSIONS) if(PythonLibs_FIND_VERSION_EXACT) if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) @@ -52,16 +51,15 @@ if(PythonLibs_FIND_VERSION) set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}") endif() else() - foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + foreach(_PYTHON_V ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS}) if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) endif() endforeach() endif() unset(_PYTHON_FIND_MAJ_MIN) - unset(_PYTHON_FIND_MAJ) else() - set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS}) + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS}) endif() else() set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 37a894c..28c1b64 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -475,6 +475,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # settings. if(MINGW) set(WX_LIB_DIR_PREFIX gcc) + elseif(CMAKE_CL_64) + set(WX_LIB_DIR_PREFIX vc_x64) else() set(WX_LIB_DIR_PREFIX vc) endif() diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 798c44c..afeb9c5 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -49,7 +49,7 @@ unset(FortranCInterface_COMPILED CACHE) # Locate the sample project executable. if(FortranCInterface_COMPILED) find_program(FortranCInterface_EXE - NAMES FortranCInterface + NAMES FortranCInterface${CMAKE_EXECUTABLE_SUFFIX} PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Debug NO_DEFAULT_PATH ) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 4ef14ac..b2fda09 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -1,6 +1,5 @@ # - Function for generation of export macros for libraries -# This module provides the function GENERATE_EXPORT_HEADER() and the -# accompanying ADD_COMPILER_EXPORT_FLAGS() function. +# This module provides the function GENERATE_EXPORT_HEADER(). # # The GENERATE_EXPORT_HEADER function can be used to generate a file suitable # for preprocessor inclusion which contains EXPORT macros to be used in @@ -18,20 +17,17 @@ # [PREFIX_NAME <prefix_name>] # ) # -# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +# The target properties CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN +# can be used to add the appropriate compile flags for targets. See the +# documentation of those target properties, and the convenience variables +# CMAKE_CXX_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN. # # By default GENERATE_EXPORT_HEADER() generates macro names in a file name -# determined by the name of the library. The ADD_COMPILER_EXPORT_FLAGS function -# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on -# Windows which does not need extra compiler flags for exporting support. You -# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will -# be populated with the required CXX_FLAGS required to enable visibility support -# for the compiler/architecture in use. +# determined by the name of the library. This means that in the simplest case, +# users of generate_export_header will be equivalent to: # -# This means that in the simplest case, users of these functions will be -# equivalent to: -# -# add_compiler_export_flags() +# set(CMAKE_CXX_VISIBILITY_PRESET hidden) +# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) # add_library(somelib someclass.cpp) # generate_export_header(somelib) # install(TARGETS somelib DESTINATION ${LIBRARY_INSTALL_DIR}) @@ -128,6 +124,20 @@ # generate_export_header(somelib PREFIX_NAME VTK_) # # Generates the macros VTK_SOMELIB_EXPORT etc. +# +# +# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +# +# The ADD_COMPILER_EXPORT_FLAGS function +# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on +# Windows which does not need extra compiler flags for exporting support. You +# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will +# be populated with the required CXX_FLAGS required to enable visibility support +# for the compiler/architecture in use. +# +# This function is deprecated. Set the target properties CXX_VISIBILITY_PRESET +# and VISIBILITY_INLINES_HIDDEN instead. +# #============================================================================= # Copyright 2011 Stephen Kelly <steveire@gmail.com> @@ -326,6 +336,17 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) endfunction() function(add_compiler_export_flags) + if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) + if(CMAKE_WARN_DEPRECATED) + set(messageType WARNING) + endif() + if(CMAKE_ERROR_DEPRECATED) + set(messageType FATAL_ERROR) + endif() + if(messageType) + message(${messageType} "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.") + endif() + endif() _test_compiler_hidden_visibility() _test_compiler_has_deprecated() diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 0930880..72844b5 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -294,6 +294,15 @@ endif() # set up the default search directories for frameworks set(CMAKE_SYSTEM_FRAMEWORK_PATH ~/Library/Frameworks + ) +if(_CMAKE_OSX_SYSROOT_PATH) + list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH + ${_CMAKE_OSX_SYSROOT_PATH}/Library/Frameworks + ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks + ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks + ) +endif() +list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 8cb7fd5..7036ba0 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -124,8 +124,15 @@ endif() set(CMAKE_BUILD_TYPE_INIT Debug) if(WINCE) - string(TOUPPER "${MSVC_C_ARCHITECTURE_ID}" _MSVC_C_ARCHITECTURE_ID_UPPER) - string(TOUPPER "${MSVC_CXX_ARCHITECTURE_ID}" _MSVC_CXX_ARCHITECTURE_ID_UPPER) + foreach(lang C CXX) + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}") + if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "THUMB") + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM") + elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^SH") + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "SHx") + endif() + string(TOUPPER "${_MSVC_${lang}_ARCHITECTURE_FAMILY}" _MSVC_${lang}_ARCHITECTURE_FAMILY_UPPER) + endforeach() if("${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)") math(EXPR _CE_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") @@ -136,15 +143,15 @@ if(WINCE) endif() set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE") - set(_PLATFORM_DEFINES_C " /D${MSVC_C_ARCHITECTURE_ID} /D_${_MSVC_C_ARCHITECTURE_ID_UPPER}_") - set(_PLATFORM_DEFINES_CXX " /D${MSVC_CXX_ARCHITECTURE_ID} /D_${_MSVC_CXX_ARCHITECTURE_ID_UPPER}_") + set(_PLATFORM_DEFINES_C " /D${_MSVC_C_ARCHITECTURE_FAMILY} /D_${_MSVC_C_ARCHITECTURE_FAMILY_UPPER}_") + set(_PLATFORM_DEFINES_CXX " /D${_MSVC_CXX_ARCHITECTURE_FAMILY} /D_${_MSVC_CXX_ARCHITECTURE_FAMILY_UPPER}_") set(_RTC1 "") set(_FLAGS_CXX " /GR /EHsc") set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib") set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib") - if (MSVC_VERSION LESS 1500) + if (MSVC_VERSION LESS 1600) set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib") endif () else() |