diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeAddFortranSubdirectory.cmake | 12 | ||||
-rw-r--r-- | Modules/FindBLAS.cmake | 204 | ||||
-rw-r--r-- | Modules/FindGLUT.cmake | 34 | ||||
-rw-r--r-- | Modules/FindGettext.cmake | 48 | ||||
-rw-r--r-- | Modules/FindLAPACK.cmake | 91 | ||||
-rw-r--r-- | Modules/FindLibXslt.cmake | 18 | ||||
-rw-r--r-- | Modules/FindPerlLibs.cmake | 54 | ||||
-rw-r--r-- | Modules/FindRuby.cmake | 57 | ||||
-rw-r--r-- | Modules/FindX11.cmake | 8 |
9 files changed, 288 insertions, 238 deletions
diff --git a/Modules/CMakeAddFortranSubdirectory.cmake b/Modules/CMakeAddFortranSubdirectory.cmake index ddb79fb..abd9100 100644 --- a/Modules/CMakeAddFortranSubdirectory.cmake +++ b/Modules/CMakeAddFortranSubdirectory.cmake @@ -50,7 +50,7 @@ include(CheckLanguage) include(ExternalProject) include(CMakeParseArguments) -function(_setup_mingw_config_and_build source_dir) +function(_setup_mingw_config_and_build source_dir build_dir) # Look for a MinGW gfortran. find_program(MINGW_GFORTRAN NAMES gfortran @@ -91,11 +91,11 @@ function(_setup_mingw_config_and_build source_dir) string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}") configure_file( ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake + ${build_dir}/config_mingw.cmake @ONLY) configure_file( ${_MS_MINGW_SOURCE_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake + ${build_dir}/build_mingw.cmake @ONLY) endfunction() @@ -144,15 +144,15 @@ function(cmake_add_fortran_subdirectory subdir) endif() endforeach() # create build and configure wrapper scripts - _setup_mingw_config_and_build(${source_dir}) + _setup_mingw_config_and_build("${source_dir}" "${build_dir}") # create the external project externalproject_add(${project_name}_build SOURCE_DIR ${source_dir} BINARY_DIR ${build_dir} CONFIGURE_COMMAND ${CMAKE_COMMAND} - -P ${CMAKE_CURRENT_BINARY_DIR}/config_mingw.cmake + -P ${build_dir}/config_mingw.cmake BUILD_COMMAND ${CMAKE_COMMAND} - -P ${CMAKE_CURRENT_BINARY_DIR}/build_mingw.cmake + -P ${build_dir}/build_mingw.cmake INSTALL_COMMAND "" ) # make the external project always run make with each build diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 9b76d90..9eadfd1 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -23,6 +23,7 @@ ########## ### List of vendors (BLA_VENDOR) valid in this module ## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model), +## Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model), ## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic # C/CXX should be enabled to use Intel mkl @@ -85,6 +86,7 @@ if (NOT _libdir) set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH) endif () endif () + foreach(_library ${_list}) set(_combined_name ${_combined_name}_${_library}) @@ -115,7 +117,7 @@ foreach(_library ${_list}) endforeach(_library ${_list}) if(_libraries_work) # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") if (_CHECK_FORTRAN) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) @@ -460,117 +462,99 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads REQUIRED) endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) - if (WIN32) + + set(BLAS_SEARCH_LIBS "") + if(BLA_F95) - if(NOT BLAS95_LIBRARIES) - check_fortran_libraries( - BLAS95_LIBRARIES - BLAS - sgemm - "" - "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40" - "" - ) - endif(NOT BLAS95_LIBRARIES) - else(BLA_F95) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - SGEMM - "" - "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40" - "" - ) - endif(NOT BLAS_LIBRARIES) - endif(BLA_F95) - else(WIN32) - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - if(BLA_F95) - if(NOT BLAS95_LIBRARIES) - check_fortran_libraries( - BLAS95_LIBRARIES - BLAS - sgemm - "" - "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS95_LIBRARIES) - else(BLA_F95) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" - "${LM}" - ) - endif(NOT BLAS_LIBRARIES) - endif(BLA_F95) - endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - if(BLA_F95) - if(NOT BLAS95_LIBRARIES) - check_fortran_libraries( - BLAS95_LIBRARIES - BLAS - sgemm - "" - "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS95_LIBRARIES) - else(BLA_F95) - if(NOT BLAS_LIBRARIES) + set(BLAS_mkl_SEARCH_SYMBOL SGEMM) + set(_LIBRARIES BLAS95_LIBRARIES) + if (WIN32) + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel_c mkl_intel_thread mkl_core libguide40") + else (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + # old version + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") + + # mkl >= 10.3 + if (CMAKE_C_COMPILER MATCHES ".+gcc.*") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core") + set(LM "${LM};-lgomp") + else () + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + endif () + endif () + endif (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_blas95_lp64 mkl_intel_lp64 mkl_sequential mkl_core") + endif () + else (BLA_F95) + set(BLAS_mkl_SEARCH_SYMBOL sgemm) + set(_LIBRARIES BLAS_LIBRARIES) + if (WIN32) + list(APPEND BLAS_SEARCH_LIBS + "mkl_c_dll mkl_intel_thread_dll mkl_core_dll libguide40") + else (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel mkl_intel_thread mkl_core guide") + endif () + if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") + + # old version + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_intel_thread mkl_core guide") + + # mkl >= 10.3 + if (CMAKE_C_COMPILER MATCHES ".+gcc.*") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_gnu_thread mkl_core") + set(LM "${LM};-lgomp") + else () + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") + endif () + endif () + + #older vesions of intel mkl libs + if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl") + list(APPEND BLAS_SEARCH_LIBS + "mkl_ia32") + list(APPEND BLAS_SEARCH_LIBS + "mkl_em64t") + endif () + endif (WIN32) + if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") + list(APPEND BLAS_SEARCH_LIBS + "mkl_intel_lp64 mkl_sequential mkl_core") + endif () + endif (BLA_F95) + + foreach (IT ${BLAS_SEARCH_LIBS}) + string(REPLACE " " ";" SEARCH_LIBS ${IT}) + if (${_LIBRARIES}) + else () check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) - endif(BLA_F95) - endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - endif (WIN32) - #older vesions of intel mkl libs - # BLAS in intel mkl library? (shared) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) - #BLAS in intel mkl library? (static, 32bit) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_ia32;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) - #BLAS in intel mkl library? (static, em64t 64bit) - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "mkl_em64t;guide" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif(NOT BLAS_LIBRARIES) + ${_LIBRARIES} + BLAS + ${BLAS_mkl_SEARCH_SYMBOL} + "" + "${SEARCH_LIBS}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif () + endforeach () + endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index af88997..8205779 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -64,25 +64,23 @@ ELSE (WIN32) ENDIF (WIN32) -SET( GLUT_FOUND "NO" ) -IF(GLUT_INCLUDE_DIR) - IF(GLUT_glut_LIBRARY) - # Is -lXi and -lXmu required on all platforms that have it? - # If not, we need some way to figure out what platform we are on. - SET( GLUT_LIBRARIES - ${GLUT_glut_LIBRARY} - ${GLUT_Xmu_LIBRARY} - ${GLUT_Xi_LIBRARY} - ${GLUT_cocoa_LIBRARY} - ) - SET( GLUT_FOUND "YES" ) - - #The following deprecated settings are for backwards compatibility with CMake1.4 - SET (GLUT_LIBRARY ${GLUT_LIBRARIES}) - SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR) + +IF (GLUT_FOUND) + # Is -lXi and -lXmu required on all platforms that have it? + # If not, we need some way to figure out what platform we are on. + SET( GLUT_LIBRARIES + ${GLUT_glut_LIBRARY} + ${GLUT_Xmu_LIBRARY} + ${GLUT_Xi_LIBRARY} + ${GLUT_cocoa_LIBRARY} + ) - ENDIF(GLUT_glut_LIBRARY) -ENDIF(GLUT_INCLUDE_DIR) + #The following deprecated settings are for backwards compatibility with CMake1.4 + SET (GLUT_LIBRARY ${GLUT_LIBRARIES}) + SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) +ENDIF(GLUT_FOUND) MARK_AS_ADVANCED( GLUT_INCLUDE_DIR diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 635090b..6dbc026 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -61,6 +61,17 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext INCLUDE(CMakeParseArguments) +FUNCTION(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) + SET(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") + GET_PROPERTY(currentCounter GLOBAL PROPERTY "${propertyName}") + IF(NOT currentCounter) + SET(currentCounter 1) + ENDIF() + SET(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) + MATH(EXPR currentCounter "${currentCounter} + 1") + SET_PROPERTY(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) +ENDFUNCTION() + MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) # make it a real variable, so we can modify it here SET(_firstPoFile "${_firstPoFileArg}") @@ -94,7 +105,15 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) ENDFOREACH (_currentPoFile ) - ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles}) + IF(NOT TARGET translations) + ADD_CUSTOM_TARGET(translations) + ENDIF() + + _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName) + + ADD_CUSTOM_TARGET(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) + + ADD_DEPENDENCIES(translations ${uniqueTargetName}) ENDMACRO(GETTEXT_CREATE_TRANSLATIONS ) @@ -133,11 +152,20 @@ FUNCTION(GETTEXT_PROCESS_POT_FILE _potFile) LIST(APPEND _gmoFiles ${_gmoFile}) ENDFOREACH (_lang ) + IF(NOT TARGET potfiles) + ADD_CUSTOM_TARGET(potfiles) + ENDIF() + + _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName) + IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(potfiles ALL DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(potfiles DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) ENDIF(_parsedArguments_ALL) + + ADD_DEPENDENCIES(potfiles ${uniqueTargetName}) + ENDFUNCTION(GETTEXT_PROCESS_POT_FILE) @@ -165,11 +193,21 @@ FUNCTION(GETTEXT_PROCESS_PO_FILES _lang) LIST(APPEND _gmoFiles ${_gmoFile}) ENDFOREACH(_current_PO_FILE) + + IF(NOT TARGET pofiles) + ADD_CUSTOM_TARGET(pofiles) + ENDIF() + + _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName) + IF(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(pofiles ALL DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) ELSE(_parsedArguments_ALL) - ADD_CUSTOM_TARGET(pofiles DEPENDS ${_gmoFiles}) + ADD_CUSTOM_TARGET(${uniqueTargetName} DEPENDS ${_gmoFiles}) ENDIF(_parsedArguments_ALL) + + ADD_DEPENDENCIES(pofiles ${uniqueTargetName}) + ENDFUNCTION(GETTEXT_PROCESS_PO_FILES) IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 884266f..0ae98df 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -219,40 +219,69 @@ if (BLA_VENDOR STREQUAL "Generic" OR endif ( NOT LAPACK_LIBRARIES ) endif () #intel lapack - if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") +if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + if (NOT WIN32) + set(LM "-lm") + endif () if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_PACKAGE(Threads) - else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_package(Threads REQUIRED) - endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - if (BLA_F95) - if(NOT LAPACK95_LIBRARIES) - check_lapack_libraries( - LAPACK95_LIBRARIES - LAPACK - cheev - "" - "mkl_lapack95" - "${BLAS95_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT}" - ) - endif(NOT LAPACK95_LIBRARIES) - else(BLA_F95) - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "mkl_lapack" - "${BLAS_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT}" - ) - endif(NOT LAPACK_LIBRARIES) - endif(BLA_F95) + else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + find_package(Threads REQUIRED) + endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) + if (BLA_F95) + if(NOT LAPACK95_LIBRARIES) + # old + check_lapack_libraries( + LAPACK95_LIBRARIES + LAPACK + cheev + "" + "mkl_lapack95" + "${BLAS95_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK95_LIBRARIES) + if(NOT LAPACK95_LIBRARIES) + # new >= 10.3 + check_lapack_libraries( + LAPACK95_LIBRARIES + LAPACK + CHEEV + "" + "mkl_intel_lp64" + "${BLAS95_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK95_LIBRARIES) + else(BLA_F95) + if(NOT LAPACK_LIBRARIES) + # old + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "mkl_lapack" + "${BLAS_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK_LIBRARIES) + if(NOT LAPACK_LIBRARIES) + # new >= 10.3 + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "mkl_gf_lp64" + "${BLAS_LIBRARIES}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" + ) + endif(NOT LAPACK_LIBRARIES) + endif(BLA_F95) endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") +endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") else(BLAS_FOUND) message(STATUS "LAPACK requires BLAS") endif(BLAS_FOUND) diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index 1e42f42..dd5aac4 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -5,6 +5,7 @@ # LIBXSLT_INCLUDE_DIR - the LibXslt include directory # LIBXSLT_LIBRARIES - Link these to LibXslt # LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt +# LIBXSLT_VERSION_STRING - version of LibXslt found (since CMake 2.8.8) # Additionally, the following two variables are set (but not required for using xslt): # LIBXSLT_EXSLT_LIBRARIES - Link to these if you need to link against the exslt library # LIBXSLT_XSLTPROC_EXECUTABLE - Contains the full path to the xsltproc executable if found @@ -51,10 +52,21 @@ SET(LIBXSLT_EXSLT_LIBRARIES ${LIBXSLT_EXSLT_LIBRARY} ) FIND_PROGRAM(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc) -# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if -# all listed variables are TRUE +IF(PC_LIBXSLT_VERSION) + SET(LIBXSLT_VERSION_STRING ${PC_LIBXSLT_VERSION}) +ELSEIF(LIBXSLT_INCLUDE_DIR AND EXISTS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h") + FILE(STRINGS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h" libxslt_version_str + REGEX "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\".*\"") + + STRING(REGEX REPLACE "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1" + LIBXSLT_VERSION_STRING "${libxslt_version_str}") + UNSET(libxslt_version_str) +ENDIF() + INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt DEFAULT_MSG LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt + REQUIRED_VARS LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR + VERSION_VAR LIBXSLT_VERSION_STRING) MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake index 0ac8060..b2ffd3c 100644 --- a/Modules/FindPerlLibs.cmake +++ b/Modules/FindPerlLibs.cmake @@ -94,6 +94,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_SITESEARCH_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITESEARCH ${PERL_SITESEARCH_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_SITESEARCH}" PERL_SITESEARCH) endif (NOT PERL_SITESEARCH_RESULT_VARIABLE) ### PERL_SITELIB @@ -107,6 +108,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_SITELIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITELIB ${PERL_SITELIB_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_SITELIB}" PERL_SITELIB) endif (NOT PERL_SITELIB_RESULT_VARIABLE) ### PERL_VENDORARCH @@ -120,6 +122,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_VENDORARCH_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORARCH ${PERL_VENDORARCH_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_VENDORARCH}" PERL_VENDORARCH) endif (NOT PERL_VENDORARCH_RESULT_VARIABLE) ### PERL_VENDORLIB @@ -133,6 +136,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_VENDORLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE}) + file(TO_CMAKE_PATH "${PERL_VENDORLIB}" PERL_VENDORLIB) endif (NOT PERL_VENDORLIB_RESULT_VARIABLE) macro(perl_adjust_darwin_lib_variable varname) @@ -173,6 +177,7 @@ if (PERL_EXECUTABLE) if (NOT PERL_ARCHLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_ARCHLIB ${PERL_ARCHLIB_OUTPUT_VARIABLE}) perl_adjust_darwin_lib_variable( ARCHLIB ) + file(TO_CMAKE_PATH "${PERL_ARCHLIB}" PERL_ARCHLIB) endif (NOT PERL_ARCHLIB_RESULT_VARIABLE) ### PERL_PRIVLIB @@ -187,28 +192,10 @@ if (PERL_EXECUTABLE) if (NOT PERL_PRIVLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_PRIVLIB ${PERL_PRIVLIB_OUTPUT_VARIABLE}) perl_adjust_darwin_lib_variable( PRIVLIB ) + file(TO_CMAKE_PATH "${PERL_PRIVLIB}" PERL_PRIVLIB) endif (NOT PERL_PRIVLIB_RESULT_VARIABLE) - - ### PERL_POSSIBLE_INCLUDE_PATHS - set(PERL_POSSIBLE_INCLUDE_PATHS - ${PERL_ARCHLIB}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/CORE - ) - - ### PERL_POSSIBLE_LIB_PATHS - set(PERL_POSSIBLE_LIB_PATHS - ${PERL_ARCHLIB}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE - /usr/lib/perl5/${PERL_VERSION_STRING}/CORE - /usr/lib/perl/${PERL_VERSION_STRING}/CORE - ) - - ### PERL_POSSIBLE_LIBRARY_NAME + ### PERL_POSSIBLE_LIBRARY_NAMES execute_process( COMMAND ${PERL_EXECUTABLE} -V:libperl @@ -218,10 +205,9 @@ if (PERL_EXECUTABLE) PERL_LIBRARY_RESULT_VARIABLE ) if (NOT PERL_LIBRARY_RESULT_VARIABLE) - foreach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS}) - string(REGEX REPLACE "libperl='([^']+)'" "\\1" PERL_LIBRARY_OUTPUT_VARIABLE ${PERL_LIBRARY_OUTPUT_VARIABLE}) - set(PERL_POSSIBLE_LIBRARY_NAME ${PERL_POSSIBLE_LIBRARY_NAME} "${_perl_lib_path}/${PERL_LIBRARY_OUTPUT_VARIABLE}") - endforeach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS}) + string(REGEX REPLACE "libperl='([^']+)'.*" "\\1" PERL_POSSIBLE_LIBRARY_NAMES ${PERL_LIBRARY_OUTPUT_VARIABLE}) + else (NOT PERL_LIBRARY_RESULT_VARIABLE) + set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl) endif (NOT PERL_LIBRARY_RESULT_VARIABLE) ### PERL_INCLUDE_PATH @@ -229,17 +215,23 @@ if (PERL_EXECUTABLE) NAMES perl.h PATHS - ${PERL_POSSIBLE_INCLUDE_PATHS} + ${PERL_ARCHLIB}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/CORE ) - + ### PERL_LIBRARY find_library(PERL_LIBRARY NAMES - ${PERL_POSSIBLE_LIBRARY_NAME} - perl${PERL_VERSION_STRING} - perl + ${PERL_POSSIBLE_LIBRARY_NAMES} PATHS - ${PERL_POSSIBLE_LIB_PATHS} + ${PERL_ARCHLIB}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE + /usr/lib/perl5/${PERL_VERSION_STRING}/CORE + /usr/lib/perl/${PERL_VERSION_STRING}/CORE ) endif (PERL_EXECUTABLE) @@ -254,7 +246,7 @@ find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLU set(PERL_INCLUDE_DIR ${PERL_INCLUDE_PATH}) set(PERL_INCLUDE_DIRS ${PERL_INCLUDE_PATH}) set(PERL_LIBRARIES ${PERL_LIBRARY}) -# For backward compatibility with CMake before 2.8.7 +# For backward compatibility with CMake before 2.8.8 set(PERL_VERSION ${PERL_VERSION_STRING}) mark_as_advanced( diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index c4adfd1..5e973e4 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -61,49 +61,44 @@ FIND_PROGRAM(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}) IF(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR) - # query the ruby version - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['MAJOR']" - OUTPUT_VARIABLE RUBY_VERSION_MAJOR) + FUNCTION(_RUBY_CONFIG_VAR RBVAR OUTVAR) + EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']" + RESULT_VARIABLE _RUBY_SUCCESS + OUTPUT_VARIABLE _RUBY_OUTPUT + ERROR_QUIET) + IF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT) + EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']" + RESULT_VARIABLE _RUBY_SUCCESS + OUTPUT_VARIABLE _RUBY_OUTPUT + ERROR_QUIET) + ENDIF(_RUBY_SUCCESS OR NOT _RUBY_OUTPUT) + SET(${OUTVAR} "${_RUBY_OUTPUT}" PARENT_SCOPE) + ENDFUNCTION(_RUBY_CONFIG_VAR) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['MINOR']" - OUTPUT_VARIABLE RUBY_VERSION_MINOR) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['TEENY']" - OUTPUT_VARIABLE RUBY_VERSION_PATCH) + # query the ruby version + _RUBY_CONFIG_VAR("MAJOR" RUBY_VERSION_MAJOR) + _RUBY_CONFIG_VAR("MINOR" RUBY_VERSION_MINOR) + _RUBY_CONFIG_VAR("TEENY" RUBY_VERSION_PATCH) # query the different directories - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['archdir']" - OUTPUT_VARIABLE RUBY_ARCH_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['arch']" - OUTPUT_VARIABLE RUBY_ARCH) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['rubyhdrdir']" - OUTPUT_VARIABLE RUBY_HDR_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['libdir']" - OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['rubylibdir']" - OUTPUT_VARIABLE RUBY_RUBY_LIB_DIR) + _RUBY_CONFIG_VAR("archdir" RUBY_ARCH_DIR) + _RUBY_CONFIG_VAR("arch" RUBY_ARCH) + _RUBY_CONFIG_VAR("rubyhdrdir" RUBY_HDR_DIR) + _RUBY_CONFIG_VAR("libdir" RUBY_POSSIBLE_LIB_DIR) + _RUBY_CONFIG_VAR("rubylibdir" RUBY_RUBY_LIB_DIR) # site_ruby - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitearchdir']" - OUTPUT_VARIABLE RUBY_SITEARCH_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitelibdir']" - OUTPUT_VARIABLE RUBY_SITELIB_DIR) + _RUBY_CONFIG_VAR("sitearchdir" RUBY_SITEARCH_DIR) + _RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR) # vendor_ruby available ? EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'" OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET) IF(RUBY_HAS_VENDOR_RUBY) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorlibdir']" - OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorarchdir']" - OUTPUT_VARIABLE RUBY_VENDORARCH_DIR) + _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR) + _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR) ENDIF(RUBY_HAS_VENDOR_RUBY) # save the results in the cache so we don't have to run ruby the next time again diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 1735bd4..76fb3c9 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -20,7 +20,7 @@ # X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND # X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND # X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND -# X11_xf86vmode_INCLUDE_PATH, X11_xf86vmode_FOUND +# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND # X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND # X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND # X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND @@ -146,6 +146,7 @@ IF (UNIX) FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH}) + FIND_LIBRARY(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH}) SET(X11_LIBRARY_DIR "") IF(X11_X11_LIB) @@ -270,10 +271,10 @@ IF (UNIX) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH}) ENDIF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) - IF (X11_xf86vmode_INCLUDE_PATH) + IF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) SET(X11_xf86vmode_FOUND TRUE) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) - ENDIF (X11_xf86vmode_INCLUDE_PATH) + ENDIF (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) IF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) SET(X11_Xcursor_FOUND TRUE) @@ -443,6 +444,7 @@ IF (UNIX) X11_XRes_INCLUDE_PATH X11_Xxf86misc_LIB X11_xf86misc_INCLUDE_PATH + X11_Xxf86vm_LIB X11_xf86vmode_INCLUDE_PATH X11_Xi_LIB X11_Xi_INCLUDE_PATH |