diff options
47 files changed, 757 insertions, 818 deletions
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 91bf2f2..de1df3d 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -610,12 +610,7 @@ function(cpack_deb_prepare_package_vars) if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OR CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS) # Generating binary list - Get type of all install files - cmake_policy(PUSH) - # Tell file(GLOB_RECURSE) not to follow directory symlinks - # even if the project does not set this policy to NEW. - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*") - cmake_policy(POP) + file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*") find_program(FILE_EXECUTABLE file) if(NOT FILE_EXECUTABLE) @@ -931,13 +926,10 @@ function(cpack_deb_prepare_package_vars) if(CPACK_DEBIAN_ARCHIVE_TYPE) set(archive_types_ "paxr;gnutar") - cmake_policy(PUSH) - cmake_policy(SET CMP0057 NEW) - if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_) - message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported" - "type ${CPACK_DEBIAN_ARCHIVE_TYPE}") - endif() - cmake_policy(POP) + if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_) + message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported" + "type ${CPACK_DEBIAN_ARCHIVE_TYPE}") + endif() else() set(CPACK_DEBIAN_ARCHIVE_TYPE "paxr") endif() @@ -1039,13 +1031,9 @@ function(cpack_deb_prepare_package_vars) set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") else() - cmake_policy(PUSH) - cmake_policy(SET CMP0010 NEW) - if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)") - cmake_policy(POP) - message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!") - endif() - cmake_policy(POP) + if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)") + message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!") + endif() set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}") endif() diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index faa2df8..bb5181f 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -962,7 +962,6 @@ function(get_file_permissions FILE RETURN_VAR) ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - cmake_policy(SET CMP0007 NEW) string(REPLACE " " ";" permissions_ "${permissions_}") list(GET permissions_ 0 permissions_) @@ -1066,12 +1065,7 @@ function(cpack_rpm_prepare_relocation_paths) endforeach() # warn about all the paths that are not relocatable - cmake_policy(PUSH) - # Tell file(GLOB_RECURSE) not to follow directory symlinks - # even if the project does not set this policy to NEW. - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*") - cmake_policy(POP) + file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*") foreach(TMP_PATH ${FILE_PATHS_}) string(LENGTH "${WDIR}" WDIR_LEN) string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH) @@ -1098,10 +1092,7 @@ endfunction() function(cpack_rpm_prepare_content_list) # get files list - cmake_policy(PUSH) - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*") - cmake_policy(POP) + file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*") set(CPACK_RPM_INSTALL_FILES "/${CPACK_RPM_INSTALL_FILES}") string(REPLACE ";" ";/" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}") @@ -1120,10 +1111,7 @@ function(cpack_rpm_prepare_content_list) set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS " ${_RPM_RELOCATION_PREFIX}") - cmake_policy(PUSH) - cmake_policy(SET CMP0007 NEW) - list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) - cmake_policy(POP) + list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) unset(_TMP_LIST) # Now generate all of the parent dirs of the relocation path foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) @@ -1608,7 +1596,6 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR) endif() get_file_permissions("${WORKING_DIR}/${F}" permissions_) - cmake_policy(SET CMP0057 NEW) if(NOT "USER_EXECUTE" IN_LIST permissions_ AND NOT "GROUP_EXECUTE" IN_LIST permissions_ AND NOT "WORLD_EXECUTE" IN_LIST permissions_) @@ -1997,19 +1984,15 @@ function(cpack_rpm_generate_package) endif() if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) - cmake_policy(PUSH) - cmake_policy(SET CMP0057 NEW) - # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now - # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun) - # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag - set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV) - if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_) - cmake_policy(POP) - message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not " - "supported in provided rpmbuild. Tag will not be used.") - continue() - endif() - cmake_policy(POP) + # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now + # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun) + # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag + set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV) + if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_) + message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not " + "supported in provided rpmbuild. Tag will not be used.") + continue() + endif() if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") @@ -2301,12 +2284,9 @@ function(cpack_rpm_generate_package) continue() endif() - cmake_policy(PUSH) - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE - "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}" - "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*") - cmake_policy(POP) + file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE + "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}" + "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*") foreach(f_ IN LISTS files_for_move_) get_filename_component(dir_path_ "${f_}" DIRECTORY) @@ -2438,13 +2418,9 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES} "CPACK_RPM_FILE_NAME") if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT") if(CPACK_RPM_FILE_NAME) - cmake_policy(PUSH) - cmake_policy(SET CMP0010 NEW) - if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm") - cmake_policy(POP) - message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!") - endif() - cmake_policy(POP) + if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm") + message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!") + endif() else() # old file name format for back compatibility string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}" @@ -2762,13 +2738,8 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT endif() # find generated rpm files and take their names - cmake_policy(PUSH) - # Tell file(GLOB_RECURSE) not to follow directory symlinks - # even if the project does not set this policy to NEW. - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm" - "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm") - cmake_policy(POP) + file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm" + "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm") if(NOT GENERATED_FILES) message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}") diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake index b29ee81..5fecb26 100644 --- a/Modules/Compiler/IAR-FindBinUtils.cmake +++ b/Modules/Compiler/IAR-FindBinUtils.cmake @@ -10,7 +10,7 @@ get_filename_component(__iar_hint_2 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPI set(__iar_hints "${__iar_hint_1}" "${__iar_hint_2}") -if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") +if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") # could allow using normal binutils ar, since objects are normal ELF files? find_program(CMAKE_IAR_LINKARM ilinkarm.exe HINTS ${__iar_hints} DOC "The IAR ARM linker") @@ -38,7 +38,7 @@ set(CMAKE_IAR_LINKARM \"${CMAKE_IAR_LINKARM}\") ") -elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") +elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") # For AVR and AVR32, IAR uses the "xlink" linker and the "xar" archiver: find_program(CMAKE_IAR_LINKER xlink.exe HINTS ${__iar_hints} diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 4d9444a..db14a89 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -602,9 +602,6 @@ function (_MPI_interrogate_compiler lang) if(MPI_DIRECT_LIB_NAMES_WORK) set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}") endif() - if(MPI_${LANG}_EXTRA_LIB_NAMES) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") - endif() # MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to # link it in that case. -lpthread is covered by the normal library treatment on the other hand. @@ -617,6 +614,16 @@ function (_MPI_interrogate_compiler lang) endif() endif() + if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}") + endif() + if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}") + endif() + if(MPI_${LANG}_EXTRA_LIB_NAMES) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") + endif() + # If we found MPI, set up all of the appropriate cache entries if(NOT MPI_${LANG}_COMPILE_OPTIONS) set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) @@ -825,33 +832,43 @@ endfunction() macro(_MPI_assemble_libraries LANG) set(MPI_${LANG}_LIBRARIES "") - foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) - endforeach() + # Only for libraries do we need to check whether the compiler's linking stage is separate. + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT) + foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) + endforeach() + endif() endmacro() macro(_MPI_assemble_include_dirs LANG) - set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") - if("${LANG}" MATCHES "(C|CXX)") - if(MPI_${LANG}_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - else() # Fortran - if(MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_${LANG}_INCLUDE_DIRS "") + else() + set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") + if("${LANG}" MATCHES "(C|CXX)") + if(MPI_${LANG}_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + else() # Fortran + if(MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + endif() + if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + endif() endif() - if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}") + endforeach() endif() endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(mpiadditionalinclude IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${mpiadditionalinclude}_INCLUDE_DIR}") - endforeach() - endif() endmacro() function(_MPI_split_include_dirs LANG) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + return() + endif() # Backwards compatibility: Search INCLUDE_PATH if given. if(MPI_${LANG}_INCLUDE_PATH) list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") @@ -887,6 +904,13 @@ function(_MPI_split_include_dirs LANG) endif() mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) endif() + # Remove duplicates and default system directories from the list. + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR}) + endforeach() + endif() set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) endfunction() @@ -1016,7 +1040,7 @@ elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") # FreeBSD ships mpich under the normal system paths - but available openmpi implementations # will be found in /usr/local/mpi/<name> - MPI_search_mpi_prefix_folder("/usr/local/mpi/") + MPI_search_mpi_prefix_folder("/usr/local/mpi") endif() # Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. @@ -1052,51 +1076,54 @@ mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXE # # Once we find the new variables, we translate them back into their old # equivalents below. -foreach (LANG IN ITEMS C CXX) - # Old input variables. - set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) - - # Set new vars based on their old equivalents, if the new versions are not already set. - foreach (var ${_MPI_OLD_INPUT_VARS}) - if (NOT MPI_${LANG}_${var} AND MPI_${var}) - set(MPI_${LANG}_${var} "${MPI_${var}}") - endif() - endforeach() - - # Chop the old compile flags into options and definitions - if(MPI_${LANG}_COMPILE_FLAGS) - unset(MPI_${LANG}_COMPILE_OPTIONS) - unset(MPI_${LANG}_COMPILE_DEFINITIONS) - separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") - foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) - if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") - list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") - else() - list(APPEND MPI_${LANG}_COMPILE_FLAGS "${_MPI_FLAG}") +if(NOT MPI_IGNORE_LEGACY_VARIABLES) + foreach (LANG IN ITEMS C CXX) + # Old input variables. + set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) + + # Set new vars based on their old equivalents, if the new versions are not already set. + foreach (var ${_MPI_OLD_INPUT_VARS}) + if (NOT MPI_${LANG}_${var} AND MPI_${var}) + set(MPI_${LANG}_${var} "${MPI_${var}}") endif() endforeach() - unset(MPI_SEPARATE_FLAGS) - endif() - # If a list of libraries was given, we'll split it into new-style cache variables - unset(MPI_${LANG}_EXTRA_LIB_NAMES) - if(NOT MPI_${LANG}_LIB_NAMES) - foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) - if(_MPI_LIB) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) - get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) - list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endif() - endforeach() - endif() -endforeach() + # Chop the old compile flags into options and definitions + + unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + if(MPI_${LANG}_COMPILE_FLAGS) + separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") + foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) + if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") + list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") + else() + list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}") + endif() + endforeach() + unset(MPI_SEPARATE_FLAGS) + endif() + + # If a list of libraries was given, we'll split it into new-style cache variables + unset(MPI_${LANG}_EXTRA_LIB_NAMES) + if(NOT MPI_${LANG}_LIB_NAMES) + foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) + if(_MPI_LIB) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) + get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) + list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endif() + endforeach() + endif() + endforeach() +endif() #============================================================================= unset(MPI_VERSION) @@ -1105,6 +1132,11 @@ unset(MPI_VERSION_MINOR) unset(_MPI_MIN_VERSION) +# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. +if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) + set(MPI_SKIP_COMPILER_WRAPPER TRUE) +endif() + # This loop finds the compilers and sends them off for interrogation. foreach(LANG IN ITEMS C CXX Fortran) if(CMAKE_${LANG}_COMPILER_LOADED) @@ -1126,6 +1158,8 @@ foreach(LANG IN ITEMS C CXX Fortran) mark_as_advanced(MPI_CXX_SKIP_MPICXX) endif() if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) + set(MPI_${LANG}_TRIED_IMPLICIT FALSE) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) # Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g. # Cray PrgEnv. @@ -1135,80 +1169,90 @@ foreach(LANG IN ITEMS C CXX Fortran) # If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it. if(MPI_${LANG}_WORKS) set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) endif() + set(MPI_${LANG}_TRIED_IMPLICIT TRUE) endif() - # If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. - if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) - set(MPI_SKIP_COMPILER_WRAPPER TRUE) - endif() - if(NOT MPI_SKIP_COMPILER_WRAPPER) - if(MPI_${LANG}_COMPILER) - # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. - if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") - # Get rid of our default list of names and just search for the name the user wants. - set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") - unset(MPI_${LANG}_COMPILER CACHE) + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WRAPPER_FOUND FALSE) + set(MPI_PINNED_COMPILER FALSE) + + if(NOT MPI_SKIP_COMPILER_WRAPPER) + if(MPI_${LANG}_COMPILER) + # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. + if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") + # Get rid of our default list of names and just search for the name the user wants. + set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") + unset(MPI_${LANG}_COMPILER CACHE) + endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(MPI_PINNED_COMPILER TRUE) + endif() + + # If we have an MPI base directory, we'll try all compiler names in that one first. + # This should prevent mixing different MPI environments + if(_MPI_BASE_DIR) + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${_MPI_BASE_DIR} + NO_DEFAULT_PATH + DOC "MPI compiler for ${LANG}" + ) endif() - # If the user specifies a compiler, we don't want to try to search libraries either. - set(MPI_PINNED_COMPILER TRUE) - else() - set(MPI_PINNED_COMPILER FALSE) - endif() - # If we have an MPI base directory, we'll try all compiler names in that one first. - # This should prevent mixing different MPI environments - if(_MPI_BASE_DIR) + # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), + # we shall try searching in the default paths. find_program(MPI_${LANG}_COMPILER NAMES ${_MPI_${LANG}_COMPILER_NAMES} PATH_SUFFIXES bin sbin - HINTS ${_MPI_BASE_DIR} - NO_DEFAULT_PATH DOC "MPI compiler for ${LANG}" ) - endif() - # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), - # we shall try searching in the default paths. - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - DOC "MPI compiler for ${LANG}" - ) - - if(MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - set(MPI_SKIP_GUESSING TRUE) - elseif(MPI_${LANG}_COMPILER) - _MPI_interrogate_compiler(${LANG}) - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_PINNED_COMPILER TRUE) + + # If we haven't made the implicit compiler test yet, perform it now. + if(NOT MPI_${LANG}_TRIED_IMPLICIT) + _MPI_create_imported_target(${LANG}) + _MPI_check_lang_works(${LANG}) + endif() + + # Should the MPI compiler not work implicitly for MPI, still interrogate it. + # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used + # directly during linkage instead of CMAKE_<LANG>_COMPILER will not work. + if(NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) + _MPI_interrogate_compiler(${LANG}) + else() + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) + endif() + elseif(MPI_${LANG}_COMPILER) + _MPI_interrogate_compiler(${LANG}) + endif() endif() - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) - set(MPI_PINNED_COMPILER FALSE) - endif() - if(NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) - # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the - # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. - if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) - set(MPI_${LANG}_WRAPPER_FOUND TRUE) - elseif(NOT MPI_SKIP_GUESSING) - _MPI_guess_settings(${LANG}) + if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) + # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the + # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. + if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) + set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) + else() + _MPI_guess_settings(${LANG}) + endif() endif() endif() endif() _MPI_split_include_dirs(${LANG}) - if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - _MPI_assemble_include_dirs(${LANG}) - _MPI_assemble_libraries(${LANG}) - endif() + _MPI_assemble_include_dirs(${LANG}) + _MPI_assemble_libraries(${LANG}) + _MPI_adjust_compile_definitions(${LANG}) # We always create imported targets even if they're empty _MPI_create_imported_target(${LANG}) @@ -1222,7 +1266,9 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + endif() mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) @@ -1453,6 +1499,7 @@ if (MPI_NUMLIBS GREATER 1) else() set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") endif() +set(MPI_IGNORE_LEGACY_VARIABLES TRUE) #============================================================================= # unset these vars to cleanup namespace diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake index e01e75e..0b902e7 100644 --- a/Modules/FindPerlLibs.cmake +++ b/Modules/FindPerlLibs.cmake @@ -32,193 +32,94 @@ # # :: # -# PERL_SITESEARCH = path to the sitesearch install dir -# PERL_SITELIB = path to the sitelib install directory -# PERL_VENDORARCH = path to the vendor arch install directory -# PERL_VENDORLIB = path to the vendor lib install directory -# PERL_ARCHLIB = path to the arch lib install directory -# PERL_PRIVLIB = path to the priv lib install directory +# PERL_SITESEARCH = path to the sitesearch install dir (-V:installsitesearch) +# PERL_SITEARCH = path to the sitelib install directory (-V:installsitearch) +# PERL_SITELIB = path to the sitelib install directory (-V:installsitelib) +# PERL_VENDORARCH = path to the vendor arch install directory (-V:installvendorarch) +# PERL_VENDORLIB = path to the vendor lib install directory (-V:installvendorlib) +# PERL_ARCHLIB = path to the core arch lib install directory (-V:archlib) +# PERL_PRIVLIB = path to the core priv lib install directory (-V:privlib) +# PERL_UPDATE_ARCHLIB = path to the update arch lib install directory (-V:installarchlib) +# PERL_UPDATE_PRIVLIB = path to the update priv lib install directory (-V:installprivlib) # PERL_EXTRA_C_FLAGS = Compilation flags used to build perl # find the perl executable include(${CMAKE_CURRENT_LIST_DIR}/FindPerl.cmake) if (PERL_EXECUTABLE) - ### PERL_PREFIX - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:prefix - OUTPUT_VARIABLE - PERL_PREFIX_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_PREFIX_RESULT_VARIABLE - ) - if (NOT PERL_PREFIX_RESULT_VARIABLE) - string(REGEX REPLACE "prefix='([^']+)'.*" "\\1" PERL_PREFIX ${PERL_PREFIX_OUTPUT_VARIABLE}) - endif () + function (perl_get_info _pgi_info tag) + cmake_parse_arguments(_PGI "IS_PATH" "" "" ${ARGN}) - ### PERL_ARCHNAME - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:archname - OUTPUT_VARIABLE - PERL_ARCHNAME_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_ARCHNAME_RESULT_VARIABLE - ) - if (NOT PERL_ARCHNAME_RESULT_VARIABLE) - string(REGEX REPLACE "archname='([^']+)'.*" "\\1" PERL_ARCHNAME ${PERL_ARCHNAME_OUTPUT_VARIABLE}) - endif () + set (${_pgi_info} NOTFOUND PARENT_SCOPE) + + execute_process(COMMAND "${PERL_EXECUTABLE}" -V:${tag} + OUTPUT_VARIABLE result + RESULT_VARIABLE status) + + if (NOT status) + string(REGEX REPLACE "${tag}='([^']*)'.*" "\\1" result "${result}") + if (_PGI_IS_PATH) + file(TO_CMAKE_PATH "${result}" result) + endif() + set (${_pgi_info} "${result}" PARENT_SCOPE) + endif () + endfunction() + ### PERL_PREFIX + perl_get_info(PERL_PREFIX prefix IS_PATH) + ### PERL_ARCHNAME + perl_get_info(PERL_ARCHNAME archname) ### PERL_EXTRA_C_FLAGS - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:cppflags - OUTPUT_VARIABLE - PERL_CPPFLAGS_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_CPPFLAGS_RESULT_VARIABLE - ) - if (NOT PERL_CPPFLAGS_RESULT_VARIABLE) - string(REGEX REPLACE "cppflags='([^']+)'.*" "\\1" PERL_EXTRA_C_FLAGS ${PERL_CPPFLAGS_OUTPUT_VARIABLE}) - endif () + perl_get_info(PERL_EXTRA_C_FLAGS cppflags) ### PERL_SITESEARCH - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:installsitesearch - OUTPUT_VARIABLE - PERL_SITESEARCH_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_SITESEARCH_RESULT_VARIABLE - ) - 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 () + perl_get_info(PERL_SITESEARCH installsitesearch IS_PATH) + + ### PERL_SITEARCH + perl_get_info(PERL_SITEARCH installsitearch IS_PATH) ### PERL_SITELIB - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:installsitelib - OUTPUT_VARIABLE - PERL_SITELIB_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_SITELIB_RESULT_VARIABLE - ) - 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 () + perl_get_info(PERL_SITELIB installsitelib IS_PATH) ### PERL_VENDORARCH - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:installvendorarch - OUTPUT_VARIABLE - PERL_VENDORARCH_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_VENDORARCH_RESULT_VARIABLE - ) - 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 () + perl_get_info(PERL_VENDORARCH installvendorarch IS_PATH) ### PERL_VENDORLIB - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:installvendorlib - OUTPUT_VARIABLE - PERL_VENDORLIB_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_VENDORLIB_RESULT_VARIABLE - ) - 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 () - - macro(perl_adjust_darwin_lib_variable varname) - string( TOUPPER PERL_${varname} FINDPERL_VARNAME ) - string( TOLOWER install${varname} PERL_VARNAME ) - - if (NOT PERL_MINUSV_OUTPUT_VARIABLE) - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V - OUTPUT_VARIABLE - PERL_MINUSV_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_MINUSV_RESULT_VARIABLE - ) - endif() - - if (NOT PERL_MINUSV_RESULT_VARIABLE) - string(REGEX MATCH "(${PERL_VARNAME}.*points? to the Updates directory)" - PERL_NEEDS_ADJUSTMENT ${PERL_MINUSV_OUTPUT_VARIABLE}) - - if (PERL_NEEDS_ADJUSTMENT) - string(REGEX REPLACE "(.*)/Updates/" "/System/\\1/" ${FINDPERL_VARNAME} ${${FINDPERL_VARNAME}}) - endif () - - endif () - endmacro() + perl_get_info(PERL_VENDORLIB installvendorlib IS_PATH) ### PERL_ARCHLIB - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:installarchlib - OUTPUT_VARIABLE - PERL_ARCHLIB_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_ARCHLIB_RESULT_VARIABLE - ) - 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 () + perl_get_info(PERL_ARCHLIB archlib IS_PATH) ### PERL_PRIVLIB - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:installprivlib - OUTPUT_VARIABLE - PERL_PRIVLIB_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_PRIVLIB_RESULT_VARIABLE - ) - 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 () + perl_get_info(PERL_PRIVLIB privlib IS_PATH) + + ### PERL_UPDATE_ARCHLIB + perl_get_info(PERL_UPDATE_ARCHLIB installarchlib IS_PATH) + + ### PERL_UPDATE_PRIVLIB + perl_get_info(PERL_UPDATE_PRIVLIB installprivlib IS_PATH) ### PERL_POSSIBLE_LIBRARY_NAMES - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:libperl - OUTPUT_VARIABLE - PERL_LIBRARY_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_LIBRARY_RESULT_VARIABLE - ) - if (NOT PERL_LIBRARY_RESULT_VARIABLE) - string(REGEX REPLACE "libperl='([^']+)'.*" "\\1" PERL_POSSIBLE_LIBRARY_NAMES ${PERL_LIBRARY_OUTPUT_VARIABLE}) - else () + perl_get_info(PERL_POSSIBLE_LIBRARY_NAMES libperl) + if (NOT PERL_POSSIBLE_LIBRARY_NAMES) set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl) - endif () + endif() + if (CMAKE_SYSTEM_NAME MATCHES "MSYS|CYGWIN") + # on MSYS and CYGWIN environments, current perl -V:libperl gives shared library name + # rather than the import library. So, extends possible library names + list (APPEND PERL_POSSIBLE_LIBRARY_NAMES perl) + endif() ### PERL_INCLUDE_PATH find_path(PERL_INCLUDE_PATH NAMES perl.h PATHS - ${PERL_ARCHLIB}/CORE + "${PERL_UPDATE_ARCHLIB}/CORE" + "${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 @@ -230,7 +131,8 @@ if (PERL_EXECUTABLE) NAMES ${PERL_POSSIBLE_LIBRARY_NAMES} PATHS - ${PERL_ARCHLIB}/CORE + "${PERL_UPDATE_ARCHLIB}/CORE" + "${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 diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 76afa8a..aad3b74 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -1,19 +1,22 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#.rst: -# FindPkgConfig -# ------------- -# -# A `pkg-config` module for CMake. -# -# Finds the ``pkg-config`` executable and add the -# :command:`pkg_check_modules` and :command:`pkg_search_module` -# commands. -# -# In order to find the ``pkg-config`` executable, it uses the -# :variable:`PKG_CONFIG_EXECUTABLE` variable or the ``PKG_CONFIG`` -# environment variable first. +#[========================================[.rst: +FindPkgConfig +------------- + +A ``pkg-config`` module for CMake. + +Finds the ``pkg-config`` executable and adds the :command:`pkg_get_variable`, +:command:`pkg_check_modules` and :command:`pkg_search_module` commands. The +following variables will also be set:: + + PKG_CONFIG_FOUND ... if pkg-config executable was found + PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program + PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found + (since CMake 2.8.8) + +#]========================================] ### Common stuff #### set(PKG_CONFIG_VERSION 1) @@ -82,12 +85,13 @@ endmacro() #[========================================[.rst: .. command:: pkg_get_variable - Retrieves the value of a variable from a package:: + Retrieves the value of a pkg-config variable ``varName`` and stores it in the + result variable ``resultVar`` in the calling scope. :: - pkg_get_variable(<RESULT> <MODULE> <VARIABLE>) + pkg_get_variable(<resultVar> <moduleName> <varName>) - If multiple values are returned variable will contain a - :ref:`;-list <CMake Language Lists>`. + If ``pkg-config`` returns multiple values for the specified variable, + ``resultVar`` will contain a :ref:`;-list <CMake Language Lists>`. For example: @@ -472,117 +476,106 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma endif() endmacro() -### -### User visible macros start here -### #[========================================[.rst: .. command:: pkg_check_modules - Checks for all the given modules. :: + Checks for all the given modules, setting a variety of result variables in + the calling scope. :: - pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] - [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] + pkg_check_modules(<prefix> + [REQUIRED] [QUIET] + [NO_CMAKE_PATH] + [NO_CMAKE_ENVIRONMENT_PATH] [IMPORTED_TARGET] - <MODULE> [<MODULE>]*) - - - When the ``REQUIRED`` argument was set, macros will fail with an error - when module(s) could not be found. - - When the ``QUIET`` argument is set, no status messages will be printed. - - By default, if :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or - later, or if :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` is set, the - :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH`, and - :variable:`CMAKE_APPBUNDLE_PATH` cache and environment variables will - be added to ``pkg-config`` search path. - The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments - disable this behavior for the cache variables and the environment - variables, respectively. - The ``IMPORTED_TARGET`` argument will create an imported target named - PkgConfig::<PREFIX>> that can be passed directly as an argument to - :command:`target_link_libraries`. - - It sets the following variables: :: - - PKG_CONFIG_FOUND ... if pkg-config executable was found - PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program - PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found - (since CMake 2.8.8) - - For the following variables two sets of values exist; first one is the - common one and has the given PREFIX. The second set contains flags - which are given out when ``pkg-config`` was called with the ``--static`` - option. :: - - <XPREFIX>_FOUND ... set to 1 if module(s) exist - <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l') - <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L') - <XPREFIX>_LDFLAGS ... all required linker flags - <XPREFIX>_LDFLAGS_OTHER ... all other linker flags - <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I') - <XPREFIX>_CFLAGS ... all required cflags - <XPREFIX>_CFLAGS_OTHER ... the other compiler flags + <moduleSpec> [<moduleSpec>...]) + + When the ``REQUIRED`` argument is given, the command will fail with an error + if module(s) could not be found. + + When the ``QUIET`` argument is given, no status messages will be printed. + + By default, if :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or + later, or if :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` is set to a + boolean ``True`` value, then the :variable:`CMAKE_PREFIX_PATH`, + :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH` cache + and environment variables will be added to the ``pkg-config`` search path. + The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments + disable this behavior for the cache variables and environment variables + respectively. + + The ``IMPORTED_TARGET`` argument will create an imported target named + ``PkgConfig::<prefix>`` that can be passed directly as an argument to + :command:`target_link_libraries`. + + Each ``<moduleSpec>`` must be in one of the following formats:: + + {moduleName} ... matches any version + {moduleName}>={version} ... at least version <version> is required + {moduleName}={version} ... exactly version <version> is required + {moduleName}<={version} ... modules must not be newer than <version> + + The following variables may be set upon return. Two sets of values exist, + one for the common case (``<XXX> = <prefix>``) and another for the + information ``pkg-config`` provides when it is called with the ``--static`` + option (``<XXX> = <prefix>_STATIC``):: + + <XXX>_FOUND ... set to 1 if module(s) exist + <XXX>_LIBRARIES ... only the libraries (without the '-l') + <XXX>_LIBRARY_DIRS ... the paths of the libraries (without the '-L') + <XXX>_LDFLAGS ... all required linker flags + <XXX>_LDFLAGS_OTHER ... all other linker flags + <XXX>_INCLUDE_DIRS ... the '-I' preprocessor flags (without the '-I') + <XXX>_CFLAGS ... all required cflags + <XXX>_CFLAGS_OTHER ... the other compiler flags + + All but ``<XXX>_FOUND`` may be a :ref:`;-list <CMake Language Lists>` if the + associated variable returned from ``pkg-config`` has multiple values. + + There are some special variables whose prefix depends on the number of + ``<moduleSpec>`` given. When there is only one ``<moduleSpec>``, + ``<YYY>`` will simply be ``<prefix>``, but if two or more ``<moduleSpec>`` + items are given, ``<YYY>`` will be ``<prefix>_<moduleName>``:: + + <YYY>_VERSION ... version of the module + <YYY>_PREFIX ... prefix directory of the module + <YYY>_INCLUDEDIR ... include directory of the module + <YYY>_LIBDIR ... lib directory of the module + + Examples - :: - - <XPREFIX> = <PREFIX> for common case - <XPREFIX> = <PREFIX>_STATIC for static linking - - Every variable containing multiple values will be a - :ref:`;-list <CMake Language Lists>`. - - There are some special variables whose prefix depends on the count of - given modules. When there is only one module, <PREFIX> stays - unchanged. When there are multiple modules, the prefix will be - changed to <PREFIX>_<MODNAME>: :: - - <XPREFIX>_VERSION ... version of the module - <XPREFIX>_PREFIX ... prefix-directory of the module - <XPREFIX>_INCLUDEDIR ... include-dir of the module - <XPREFIX>_LIBDIR ... lib-dir of the module - - :: - - <XPREFIX> = <PREFIX> when |MODULES| == 1, else - <XPREFIX> = <PREFIX>_<MODNAME> - - A <MODULE> parameter can have the following formats: :: - - {MODNAME} ... matches any version - {MODNAME}>={VERSION} ... at least version <VERSION> is required - {MODNAME}={VERSION} ... exactly version <VERSION> is required - {MODNAME}<={VERSION} ... modules must not be newer than <VERSION> - - Examples + .. code-block:: cmake - .. code-block:: cmake + pkg_check_modules (GLIB2 glib-2.0) - pkg_check_modules (GLIB2 glib-2.0) + Looks for any version of glib2. If found, the output variable + ``GLIB2_VERSION`` will hold the actual version found. - .. code-block:: cmake + .. code-block:: cmake - pkg_check_modules (GLIB2 glib-2.0>=2.10) + pkg_check_modules (GLIB2 glib-2.0>=2.10) - Requires at least version 2.10 of glib2 and defines e.g. - ``GLIB2_VERSION=2.10.3`` + Looks for at least version 2.10 of glib2. If found, the output variable + ``GLIB2_VERSION`` will hold the actual version found. - .. code-block:: cmake + .. code-block:: cmake - pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0) + pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0) - Requires both glib2 and gtk2, and defines e.g. - ``FOO_glib-2.0_VERSION=2.10.3`` and ``FOO_gtk+-2.0_VERSION=2.8.20`` + Looks for both glib2-2.0 (at least version 2.10) and any version of + gtk2+-2.0. Only if both are found will ``FOO`` be considered found. + The ``FOO_glib-2.0_VERSION`` and ``FOO_gtk+-2.0_VERSION`` variables will be + set to their respective found module versions. - .. code-block:: cmake + .. code-block:: cmake pkg_check_modules (XRENDER REQUIRED xrender) - Defines for example:: + Requires any version of ``xrender``. Example output variables set by a + successful call:: - XRENDER_LIBRARIES=Xrender;X11`` - XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp + XRENDER_LIBRARIES=Xrender;X11 + XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp #]========================================] macro(pkg_check_modules _prefix _module0) _pkgconfig_parse_options(_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN}) @@ -605,19 +598,22 @@ endmacro() #[========================================[.rst: .. command:: pkg_search_module - Same as :command:`pkg_check_modules`, but instead it checks for given - modules and uses the first working one. :: + The behavior of this command is the same as :command:`pkg_check_modules`, + except that rather than checking for all the specified modules, it searches + for just the first successful match. :: - pkg_search_module(<PREFIX> [REQUIRED] [QUIET] - [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] + pkg_search_module(<prefix> + [REQUIRED] [QUIET] + [NO_CMAKE_PATH] + [NO_CMAKE_ENVIRONMENT_PATH] [IMPORTED_TARGET] - <MODULE> [<MODULE>]*) + <moduleSpec> [<moduleSpec>...]) - Examples + Examples - .. code-block:: cmake + .. code-block:: cmake - pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) + pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) #]========================================] macro(pkg_search_module _prefix _module0) _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN}) @@ -654,21 +650,26 @@ endmacro() #[========================================[.rst: -.. variable:: PKG_CONFIG_EXECUTABLE +Variables Affecting Behavior +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Path to the pkg-config executable. +.. variable:: PKG_CONFIG_EXECUTABLE + This can be set to the path of the pkg-config executable. If not provided, + it will be set by the module as a result of calling :command:`find_program` + internally. The ``PKG_CONFIG`` environment variable can be used as a hint. .. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH - Whether :command:`pkg_check_modules` and :command:`pkg_search_module` - should add the paths in :variable:`CMAKE_PREFIX_PATH`, - :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH` - cache and environment variables to ``pkg-config`` search path. + Specifies whether :command:`pkg_check_modules` and + :command:`pkg_search_module` should add the paths in the + :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH` and + :variable:`CMAKE_APPBUNDLE_PATH` cache and environment variables to the + ``pkg-config`` search path. - If this variable is not set, this behavior is enabled by default if - :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or later, disabled - otherwise. + If this variable is not set, this behavior is enabled by default if + :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or later, disabled + otherwise. #]========================================] diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index c886aef..797f9e4 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -56,10 +56,13 @@ # Specify the :command:`install(PROGRAMS)` command ``COMPONENT`` # option. If not specified, no such option will be used. +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced + set(_IRSL_HAVE_Intel FALSE) set(_IRSL_HAVE_MSVC FALSE) foreach(LANG IN ITEMS C CXX Fortran) - if(CMAKE_${LANG}_COMPILER_ID STREQUAL Intel) + if("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Intel") if(NOT _IRSL_HAVE_Intel) get_filename_component(_Intel_basedir "${CMAKE_${LANG}_COMPILER}" PATH) if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -81,7 +84,7 @@ foreach(LANG IN ITEMS C CXX Fortran) endif() set(_IRSL_HAVE_Intel TRUE) endif() - elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL MSVC) + elseif("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "MSVC") set(_IRSL_HAVE_MSVC TRUE) endif() endforeach() @@ -746,3 +749,5 @@ if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) ) endif() endif() + +cmake_policy(POP) diff --git a/Modules/Platform/Darwin-NVIDIA-CUDA.cmake b/Modules/Platform/Darwin-NVIDIA-CUDA.cmake new file mode 100644 index 0000000..bec3948 --- /dev/null +++ b/Modules/Platform/Darwin-NVIDIA-CUDA.cmake @@ -0,0 +1,19 @@ +include(Platform/Darwin) + +set(__IMPLICT_LINKS ) +foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) + string(APPEND __IMPLICT_LINKS " -L\"${dir}\"") +endforeach() +foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}) + if(${lib} MATCHES "/") + string(APPEND __IMPLICT_LINKS " \"${lib}\"") + else() + string(APPEND __IMPLICT_LINKS " -l${lib}") + endif() +endforeach() + +set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names") + +set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}") +set(CMAKE_CUDA_CREATE_SHARED_MODULE "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 5611e55..7031d5a 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -802,7 +802,6 @@ include_directories( # set(CTEST_SRCS cmCTest.cxx CTest/cmProcess.cxx - CTest/cmCTestBatchTestHandler.cxx CTest/cmCTestBuildAndTestHandler.cxx CTest/cmCTestBuildCommand.cxx CTest/cmCTestBuildHandler.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ae3bb06..3556f94 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 10) -set(CMake_VERSION_PATCH 20171207) +set(CMake_VERSION_PATCH 20171214) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index be75a9f..ea0e899 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -17,6 +17,7 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmStateSnapshot.h" +#include "cmVersion.h" #include "cmWorkingDirectory.h" #include "cmXMLSafe.h" #include "cmake.h" @@ -988,10 +989,16 @@ int cmCPackGenerator::DoPackage() */ packageFileNames.push_back(tempPackageFileName ? tempPackageFileName : ""); toplevel = tempDirectory; - if (!this->PackageFiles() || cmSystemTools::GetErrorOccuredFlag()) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem compressing the directory" - << std::endl); - return 0; + { // scope that enables package generators to run internal scripts with + // latest CMake policies enabled + cmMakefile::ScopePushPop pp{ this->MakefileMap }; + this->MakefileMap->SetPolicyVersion(cmVersion::GetCMakeVersion()); + + if (!this->PackageFiles() || cmSystemTools::GetErrorOccuredFlag()) { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem compressing the directory" + << std::endl); + return 0; + } } /* Prepare checksum algorithm*/ diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx deleted file mode 100644 index 2eed8be..0000000 --- a/Source/CTest/cmCTestBatchTestHandler.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmCTestBatchTestHandler.h" - -#include "cmCTest.h" -#include "cmCTestMultiProcessHandler.h" -#include "cmCTestTestHandler.h" -#include "cmProcess.h" -#include "cmSystemTools.h" - -#include <map> -#include <utility> -#include <vector> - -cmCTestBatchTestHandler::~cmCTestBatchTestHandler() -{ -} - -void cmCTestBatchTestHandler::RunTests() -{ - this->WriteBatchScript(); - this->SubmitBatchScript(); -} - -void cmCTestBatchTestHandler::WriteBatchScript() -{ - this->Script = this->CTest->GetBinaryDir() + "/Testing/CTestBatch.txt"; - cmsys::ofstream fout; - fout.open(this->Script.c_str()); - fout << "#!/bin/sh\n"; - - for (auto const& t : this->Tests) { - this->WriteSrunArgs(t.first, fout); - this->WriteTestCommand(t.first, fout); - fout << "\n"; - } - fout.flush(); - fout.close(); -} - -void cmCTestBatchTestHandler::WriteSrunArgs(int test, std::ostream& fout) -{ - cmCTestTestHandler::cmCTestTestProperties* properties = - this->Properties[test]; - - fout << "srun "; - // fout << "--jobid=" << test << " "; - fout << "-J=" << properties->Name << " "; - - // Write dependency information - /*if(!this->Tests[test].empty()) - { - fout << "-P=afterany"; - for(TestSet::iterator i = this->Tests[test].begin(); - i != this->Tests[test].end(); ++i) - { - fout << ":" << *i; - } - fout << " "; - }*/ - if (properties->RunSerial) { - fout << "--exclusive "; - } - if (properties->Processors > 1) { - fout << "-n" << properties->Processors << " "; - } -} - -void cmCTestBatchTestHandler::WriteTestCommand(int test, std::ostream& fout) -{ - std::vector<std::string> args = this->Properties[test]->Args; - std::vector<std::string> processArgs; - std::string command; - - command = this->TestHandler->FindTheExecutable(args[1].c_str()); - command = cmSystemTools::ConvertToOutputPath(command.c_str()); - - // Prepends memcheck args to our command string if this is a memcheck - this->TestHandler->GenerateTestCommand(processArgs, test); - processArgs.push_back(command); - - for (std::string const& arg : processArgs) { - fout << arg << " "; - } - - std::vector<std::string>::iterator i = args.begin(); - ++i; // the test name - ++i; // the executable (command) - if (args.size() > 2) { - fout << "'"; - } - while (i != args.end()) { - fout << "\"" << *i << "\""; // args to the test executable - ++i; - - if (i == args.end() && args.size() > 2) { - fout << "'"; - } - fout << " "; - } - // TODO ZACH build TestResult.FullCommandLine - // this->TestResult.FullCommandLine = this->TestCommand; -} - -void cmCTestBatchTestHandler::SubmitBatchScript() -{ - cmProcess sbatch; - std::vector<std::string> args; - args.push_back(this->Script); - args.push_back("-o"); - args.push_back(this->CTest->GetBinaryDir() + "/Testing/CTestBatch.txt"); - - sbatch.SetCommand("sbatch"); - sbatch.SetCommandArguments(args); - /*if(sbatch.StartProcess()) - { - //success condition - } - else - { - //fail condition - }*/ -} diff --git a/Source/CTest/cmCTestBatchTestHandler.h b/Source/CTest/cmCTestBatchTestHandler.h deleted file mode 100644 index 42f87bd..0000000 --- a/Source/CTest/cmCTestBatchTestHandler.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmCTestBatchTestHandler_h -#define cmCTestBatchTestHandler_h - -#include "cmConfigure.h" // IWYU pragma: keep - -#include "cmCTestMultiProcessHandler.h" -#include "cmsys/FStream.hxx" -#include <string> - -/** \class cmCTestBatchTestHandler - * \brief run parallel ctest - * - * cmCTestBatchTestHandler - */ -class cmCTestBatchTestHandler : public cmCTestMultiProcessHandler -{ -public: - ~cmCTestBatchTestHandler() override; - void RunTests() override; - -protected: - void WriteBatchScript(); - void WriteSrunArgs(int test, std::ostream& fout); - void WriteTestCommand(int test, std::ostream& fout); - - void SubmitBatchScript(); - - std::string Script; -}; - -#endif diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 672087d..85d98d0 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -11,6 +11,7 @@ #include "cmsys/Process.h" #include <chrono> +#include <ratio> #include <stdlib.h> cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() @@ -18,7 +19,7 @@ cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() this->BuildTwoConfig = false; this->BuildNoClean = false; this->BuildNoCMake = false; - this->Timeout = 0; + this->Timeout = std::chrono::duration<double>::zero(); } void cmCTestBuildAndTestHandler::Initialize() @@ -224,10 +225,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } for (std::string const& tar : this->BuildTargets) { std::chrono::duration<double> remainingTime = std::chrono::seconds(0); - if (this->Timeout > 0) { - remainingTime = std::chrono::duration<double>(this->Timeout) - - std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::steady_clock::now() - clock_start); + if (this->Timeout > std::chrono::duration<double>::zero()) { + remainingTime = + this->Timeout - (std::chrono::steady_clock::now() - clock_start); if (remainingTime <= std::chrono::seconds(0)) { if (outstring) { *outstring = "--build-and-test timeout exceeded. "; @@ -324,10 +324,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) // how much time is remaining std::chrono::duration<double> remainingTime = std::chrono::seconds(0); - if (this->Timeout > 0) { - remainingTime = std::chrono::duration<double>(this->Timeout) - - std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::steady_clock::now() - clock_start); + if (this->Timeout > std::chrono::duration<double>::zero()) { + remainingTime = + this->Timeout - (std::chrono::steady_clock::now() - clock_start); if (remainingTime <= std::chrono::seconds(0)) { if (outstring) { *outstring = "--build-and-test timeout exceeded. "; @@ -396,7 +395,7 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( } if (currentArg.find("--test-timeout", 0) == 0 && idx < allArgs.size() - 1) { idx++; - this->Timeout = atof(allArgs[idx].c_str()); + this->Timeout = std::chrono::duration<double>(atof(allArgs[idx].c_str())); } if (currentArg == "--build-generator" && idx < allArgs.size() - 1) { idx++; diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index f19cb67..f8a9ed7 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -7,6 +7,7 @@ #include "cmCTestGenericHandler.h" +#include <chrono> #include <sstream> #include <stddef.h> #include <string> @@ -67,7 +68,7 @@ protected: std::vector<std::string> TestCommandArgs; std::vector<std::string> BuildTargets; bool BuildNoCMake; - double Timeout; + std::chrono::duration<double> Timeout; }; #endif diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 39b90d8..2a9fd72 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -11,7 +11,6 @@ #include "cmParseGTMCoverage.h" #include "cmParseJacocoCoverage.h" #include "cmParsePHPCoverage.h" -#include "cmProcess.h" #include "cmSystemTools.h" #include "cmWorkingDirectory.h" #include "cmXMLWriter.h" @@ -81,7 +80,7 @@ public: cmsysProcess_SetOption(this->Process, cmsysProcess_Option_HideWindow, 1); if (this->TimeOut >= std::chrono::duration<double>::zero()) { - cmsysProcess_SetTimeout(this->Process, this->TimeOut); + cmsysProcess_SetTimeout(this->Process, this->TimeOut.count()); } cmsysProcess_Execute(this->Process); this->PipeState = cmsysProcess_GetState(this->Process); diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index a056f4b..dbdefae 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -1,9 +1,5 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifdef _WIN32 -/* windows.h defines min() and max() macros that interfere. */ -#define NOMINMAX -#endif #include "cmCTestRunTest.h" #include "cmCTest.h" @@ -18,7 +14,6 @@ #include "cmsys/Base64.h" #include "cmsys/Process.h" #include "cmsys/RegularExpression.hxx" -#include <algorithm> #include <chrono> #include <iomanip> #include <sstream> @@ -266,11 +261,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED; char buf[1024]; - sprintf(buf, "%6.2f sec", - double(std::chrono::duration_cast<std::chrono::milliseconds>( - this->TestProcess->GetTotalTime()) - .count()) / - 1000.0); + sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime().count()); cmCTestLog(this->CTest, HANDLER_OUTPUT, buf << "\n"); if (outputTestErrorsToConsole) { @@ -395,11 +386,7 @@ void cmCTestRunTest::ComputeWeightedCost() { double prev = static_cast<double>(this->TestProperties->PreviousRuns); double avgcost = static_cast<double>(this->TestProperties->Cost); - double current = - double(std::chrono::duration_cast<std::chrono::milliseconds>( - this->TestResult.ExecutionTime) - .count()) / - 1000.0; + double current = this->TestResult.ExecutionTime.count(); if (this->TestResult.Status == cmCTestTestHandler::COMPLETED) { this->TestProperties->Cost = @@ -690,8 +677,10 @@ bool cmCTestRunTest::ForkProcess(std::chrono::duration<double> testTimeOut, // determine how much time we have std::chrono::duration<double> timeout = - std::min<std::chrono::duration<double>>( - this->CTest->GetRemainingTimeAllowed(), std::chrono::minutes(2)); + this->CTest->GetRemainingTimeAllowed(); + if (timeout != cmCTest::MaxDuration()) { + timeout -= std::chrono::minutes(2); + } if (this->CTest->GetTimeOut() > std::chrono::duration<double>::zero() && this->CTest->GetTimeOut() < timeout) { timeout = this->CTest->GetTimeOut(); @@ -713,7 +702,7 @@ bool cmCTestRunTest::ForkProcess(std::chrono::duration<double> testTimeOut, this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << "Test timeout computed to be: " - << (timeout == std::chrono::duration<double>::max() + << (timeout == cmCTest::MaxDuration() ? std::string("infinite") : std::to_string( std::chrono::duration_cast<std::chrono::seconds>(timeout) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 922f5c7..716ea10 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -1,12 +1,5 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ - -#ifdef _WIN32 -/* windows.h defines min() and max() macros, unless told to otherwise. This - * interferes with std::min() and std::max() at the very least. */ -#define NOMINMAX -#endif - #include "cmCTestScriptHandler.h" #include "cmsys/Directory.hxx" @@ -970,13 +963,13 @@ bool cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce( std::chrono::duration<double> cmCTestScriptHandler::GetRemainingTimeAllowed() { if (!this->Makefile) { - return std::chrono::duration<double>::max(); + return cmCTest::MaxDuration(); } const char* timelimitS = this->Makefile->GetDefinition("CTEST_TIME_LIMIT"); if (!timelimitS) { - return std::chrono::duration<double>::max(); + return cmCTest::MaxDuration(); } auto timelimit = std::chrono::duration<double>(atof(timelimitS)); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 1e15cc5..4c7cefb 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -19,7 +19,6 @@ #include "cmAlgorithms.h" #include "cmCTest.h" -#include "cmCTestBatchTestHandler.h" #include "cmCTestMultiProcessHandler.h" #include "cmCommand.h" #include "cmGeneratedFileStream.h" @@ -540,10 +539,8 @@ int cmCTestTestHandler::ProcessHandler() this->PrintLabelOrSubprojectSummary(false); } char realBuf[1024]; - auto durationInMs = std::chrono::duration_cast<std::chrono::milliseconds>( - clock_finish - clock_start) - .count(); - sprintf(realBuf, "%6.2f sec", static_cast<double>(durationInMs) / 1000.0); + std::chrono::duration<double> durationInSecs = clock_finish - clock_start; + sprintf(realBuf, "%6.2f sec", durationInSecs.count()); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " << realBuf << "\n", this->Quiet); @@ -654,10 +651,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) // only use labels found in labels if (labels.find(l) != labels.end()) { labelTimes[l] += - double(std::chrono::duration_cast<std::chrono::milliseconds>( - result.ExecutionTime) - .count()) / - 1000.0 * result.Properties->Processors; + result.ExecutionTime.count() * result.Properties->Processors; ++labelCounts[l]; } } @@ -1210,9 +1204,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed, this->StartTestTime = std::chrono::system_clock::now(); auto elapsed_time_start = std::chrono::steady_clock::now(); - cmCTestMultiProcessHandler* parallel = this->CTest->GetBatchJobs() - ? new cmCTestBatchTestHandler - : new cmCTestMultiProcessHandler; + cmCTestMultiProcessHandler* parallel = new cmCTestMultiProcessHandler; parallel->SetCTest(this->CTest); parallel->SetParallelLevel(this->CTest->GetParallelLevel()); parallel->SetTestHandler(this); @@ -1327,11 +1319,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.StartElement("NamedMeasurement"); xml.Attribute("type", "numeric/double"); xml.Attribute("name", "Execution Time"); - xml.Element("Value", - double(std::chrono::duration_cast<std::chrono::milliseconds>( - result.ExecutionTime) - .count()) / - 1000.0); + xml.Element("Value", result.ExecutionTime.count()); xml.EndElement(); // NamedMeasurement if (!result.Reason.empty()) { const char* reasonType = "Pass Reason"; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 19b345e..4fb067a 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -29,7 +29,6 @@ class cmCTestTestHandler : public cmCTestGenericHandler { friend class cmCTestRunTest; friend class cmCTestMultiProcessHandler; - friend class cmCTestBatchTestHandler; public: typedef cmCTestGenericHandler Superclass; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 69ffb33..0db66c3 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -5,16 +5,6 @@ #include "cmProcessOutput.h" #include <iostream> -void cmsysProcess_SetTimeout(cmsysProcess* process, - std::chrono::duration<double> timeout) -{ - cmsysProcess_SetTimeout( - process, - double( - std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count()) / - 1000.0); -}; - cmProcess::cmProcess() { this->Process = nullptr; @@ -59,7 +49,7 @@ bool cmProcess::StartProcess() cmsysProcess_SetWorkingDirectory(this->Process, this->WorkingDirectory.c_str()); } - cmsysProcess_SetTimeout(this->Process, this->Timeout); + cmsysProcess_SetTimeout(this->Process, this->Timeout.count()); cmsysProcess_SetOption(this->Process, cmsysProcess_Option_MergeOutput, 1); cmsysProcess_Execute(this->Process); return (cmsysProcess_GetState(this->Process) == @@ -115,10 +105,7 @@ int cmProcess::GetNextOutputLine(std::string& line, { cmProcessOutput processOutput(cmProcessOutput::UTF8); std::string strdata; - double waitTimeout = - double( - std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count()) / - 1000.0; + double waitTimeout = timeout.count(); for (;;) { // Look for lines already buffered. if (this->Output.GetLine(line)) { @@ -240,7 +227,7 @@ int cmProcess::ReportStatus() void cmProcess::ChangeTimeout(std::chrono::duration<double> t) { this->Timeout = t; - cmsysProcess_SetTimeout(this->Process, this->Timeout); + cmsysProcess_SetTimeout(this->Process, this->Timeout.count()); } void cmProcess::ResetStartTime() diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index cbb611d..f3b0bd7 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -10,13 +10,6 @@ #include <string> #include <vector> -/* - * A wrapper function for cmsysProcess_SetTimeout that takes an - * std::chrono::duration. For convenience only. - */ -void cmsysProcess_SetTimeout(cmsysProcess* process, - std::chrono::duration<double> timeout); - /** \class cmProcess * \brief run a process with c++ * diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index a4ca301..26e1dcb 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1,11 +1,5 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifdef _WIN32 -/* windows.h defines min() and max() macros by default. This interferes with - * C++ functions names. - */ -#define NOMINMAX -#endif #include "cmCTest.h" #include "cm_curl.h" @@ -50,7 +44,6 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmProcess.h" #include "cmProcessOutput.h" #include "cmState.h" #include "cmStateSnapshot.h" @@ -267,7 +260,6 @@ cmCTest::cmCTest() this->TestLoad = 0; this->SubmitIndex = 0; this->Failover = false; - this->BatchJobs = false; this->ForceNewCTestProcess = false; this->TomorrowTag = false; this->Verbose = false; @@ -998,7 +990,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, cmsysProcess_SetCommand(cp, &*argv.begin()); cmsysProcess_SetWorkingDirectory(cp, dir); cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); - cmsysProcess_SetTimeout(cp, timeout); + cmsysProcess_SetTimeout(cp, timeout.count()); cmsysProcess_Execute(cp); // Initialize tick's @@ -1089,9 +1081,10 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, bool modifyEnv = (environment && !environment->empty()); // determine how much time we have - std::chrono::duration<double> timeout = - std::min<std::chrono::duration<double>>(this->GetRemainingTimeAllowed(), - std::chrono::minutes(2)); + std::chrono::duration<double> timeout = this->GetRemainingTimeAllowed(); + if (timeout != cmCTest::MaxDuration()) { + timeout -= std::chrono::minutes(2); + } if (this->TimeOut > std::chrono::duration<double>::zero() && this->TimeOut < timeout) { timeout = this->TimeOut; @@ -1107,7 +1100,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, } cmCTestLog( this, HANDLER_VERBOSE_OUTPUT, "Test timeout computed to be: " - << (timeout == std::chrono::duration<double>::max() + << (timeout == cmCTest::MaxDuration() ? std::string("infinite") : std::to_string( std::chrono::duration_cast<std::chrono::seconds>(timeout) @@ -1130,6 +1123,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, // invocations. Since --build-generator is required this is a // good place to check for it, and to add the arguments in if (strcmp(i, "--build-generator") == 0 && + timeout != cmCTest::MaxDuration() && timeout > std::chrono::duration<double>::zero()) { args.push_back("--test-timeout"); std::ostringstream msg; @@ -1184,7 +1178,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); } - cmsysProcess_SetTimeout(cp, timeout); + cmsysProcess_SetTimeout(cp, timeout.count()); cmsysProcess_Execute(cp); char* data; @@ -1819,9 +1813,6 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, if (this->CheckArgument(arg, "-V", "--verbose")) { this->Verbose = true; } - if (this->CheckArgument(arg, "-B")) { - this->BatchJobs = true; - } if (this->CheckArgument(arg, "-VV", "--extra-verbose")) { this->ExtraVerbose = true; this->Verbose = true; @@ -2608,7 +2599,7 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args, if (cmSystemTools::GetRunCommandHideConsole()) { cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); } - cmsysProcess_SetTimeout(cp, timeout); + cmsysProcess_SetTimeout(cp, timeout.count()); cmsysProcess_Execute(cp); std::vector<char> tempOutput; @@ -2804,7 +2795,7 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg, std::chrono::duration<double> cmCTest::GetRemainingTimeAllowed() { if (!this->GetHandler("script")) { - return std::chrono::duration<double>::max(); + return cmCTest::MaxDuration(); } cmCTestScriptHandler* ch = @@ -2813,6 +2804,11 @@ std::chrono::duration<double> cmCTest::GetRemainingTimeAllowed() return ch->GetRemainingTimeAllowed(); } +std::chrono::duration<double> cmCTest::MaxDuration() +{ + return std::chrono::duration<double>(1.0e7); +} + void cmCTest::OutputTestErrors(std::vector<char> const& process_output) { std::string test_outputs("\n*** Test Failed:\n"); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index ba94866..23d71cb 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -208,6 +208,8 @@ public: */ std::chrono::duration<double> GetRemainingTimeAllowed(); + static std::chrono::duration<double> MaxDuration(); + /** * Open file in the output directory and set the stream */ @@ -427,9 +429,6 @@ public: void SetFailover(bool failover) { this->Failover = failover; } bool GetFailover() { return this->Failover; } - void SetBatchJobs(bool batch = true) { this->BatchJobs = batch; } - bool GetBatchJobs() { return this->BatchJobs; } - bool GetVerbose() { return this->Verbose; } bool GetExtraVerbose() { return this->ExtraVerbose; } @@ -475,7 +474,6 @@ private: bool UseHTTP10; bool PrintLabels; bool Failover; - bool BatchJobs; bool ForceNewCTestProcess; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index dd2993d..e684f5e 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -29,6 +29,22 @@ enum LinkLibraryScopeType const char* const GRAPHVIZ_PRIVATE_EDEGE_STYLE = "dashed"; const char* const GRAPHVIZ_INTERFACE_EDEGE_STYLE = "dotted"; +std::string getLinkLibraryStyle(const LinkLibraryScopeType& type) +{ + std::string style; + switch (type) { + case LLT_SCOPE_PRIVATE: + style = "[style = " + std::string(GRAPHVIZ_PRIVATE_EDEGE_STYLE) + "]"; + break; + case LLT_SCOPE_INTERFACE: + style = "[style = " + std::string(GRAPHVIZ_INTERFACE_EDEGE_STYLE) + "]"; + break; + default: + break; + } + return style; +} + const char* getShapeForTarget(const cmGeneratorTarget* target) { if (!target) { @@ -132,6 +148,7 @@ cmGraphVizWriter::cmGraphVizWriter( , GenerateForStaticLibs(true) , GenerateForSharedLibs(true) , GenerateForModuleLibs(true) + , GenerateForInterface(true) , GenerateForExternals(true) , GeneratePerTarget(true) , GenerateDependers(true) @@ -192,6 +209,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, __set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS"); __set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS"); __set_bool_if_set(this->GenerateForModuleLibs, "GRAPHVIZ_MODULE_LIBS"); + __set_bool_if_set(this->GenerateForInterface, "GRAPHVIZ_INTERFACE"); __set_bool_if_set(this->GenerateForExternals, "GRAPHVIZ_EXTERNAL_LIBS"); __set_bool_if_set(this->GeneratePerTarget, "GRAPHVIZ_GENERATE_PER_TARGET"); __set_bool_if_set(this->GenerateDependers, "GRAPHVIZ_GENERATE_DEPENDERS"); @@ -379,16 +397,7 @@ void cmGraphVizWriter::WriteConnections( str << " \"" << myNodeName << "\" -> \"" << libNameIt->second << "\""; - switch (llit.second) { - case LLT_SCOPE_PRIVATE: - str << "[style = " << GRAPHVIZ_PRIVATE_EDEGE_STYLE << "]"; - break; - case LLT_SCOPE_INTERFACE: - str << "[style = " << GRAPHVIZ_INTERFACE_EDEGE_STYLE << "]"; - break; - default: - break; - } + str << getLinkLibraryStyle(llit.second); str << " // " << targetName << " -> " << libName << std::endl; this->WriteConnections(libName, insertedNodes, insertedConnections, str); @@ -429,12 +438,11 @@ void cmGraphVizWriter::WriteDependerConnections( // Now we have a target, check whether it links against targetName. // If so, draw a connection, and then continue with dependers on that one. - const cmTarget::LinkLibraryVectorType* ll = - &(tptr.second->Target->GetOriginalLinkLibraries()); + std::map<std::string, LinkLibraryScopeType> ll = + getScopedLinkLibrariesFromTarget(tptr.second->Target); - for (auto const& llit : *ll) { - std::string libName = llit.first; - if (libName == targetName) { + for (auto const& llit : ll) { + if (llit.first == targetName) { // So this target links against targetName. std::map<std::string, std::string>::const_iterator dependerNodeNameIt = this->TargetNamesNodes.find(tptr.first); @@ -452,6 +460,7 @@ void cmGraphVizWriter::WriteDependerConnections( str << " \"" << dependerNodeNameIt->second << "\" -> \"" << myNodeName << "\""; str << " // " << targetName << " -> " << tptr.first << std::endl; + str << getLinkLibraryStyle(llit.second); this->WriteDependerConnections(tptr.first, insertedNodes, insertedConnections, str); } @@ -572,6 +581,8 @@ bool cmGraphVizWriter::GenerateForTargetType( return this->GenerateForSharedLibs; case cmStateEnums::MODULE_LIBRARY: return this->GenerateForModuleLibs; + case cmStateEnums::INTERFACE_LIBRARY: + return this->GenerateForInterface; default: break; } diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 824999b..ac20da9 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -79,6 +79,7 @@ protected: bool GenerateForStaticLibs; bool GenerateForSharedLibs; bool GenerateForModuleLibs; + bool GenerateForInterface; bool GenerateForExternals; bool GeneratePerTarget; bool GenerateDependers; diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 5e872d2..4b59f44 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -155,12 +155,12 @@ std::vector<std::string> const& cmIDEOptions::GetDefines() const return this->Defines; } -void cmIDEOptions::AddFlag(const char* flag, const char* value) +void cmIDEOptions::AddFlag(std::string const& flag, std::string const& value) { this->FlagMap[flag] = value; } -void cmIDEOptions::AddFlag(const char* flag, +void cmIDEOptions::AddFlag(std::string const& flag, std::vector<std::string> const& value) { this->FlagMap[flag] = value; @@ -185,7 +185,7 @@ void cmIDEOptions::AppendFlagString(std::string const& flag, this->FlagMap[flag].append_with_space(value); } -void cmIDEOptions::RemoveFlag(const char* flag) +void cmIDEOptions::RemoveFlag(std::string const& flag) { this->FlagMap.erase(flag); } @@ -195,12 +195,13 @@ bool cmIDEOptions::HasFlag(std::string const& flag) const return this->FlagMap.find(flag) != this->FlagMap.end(); } -const char* cmIDEOptions::GetFlag(const char* flag) +const char* cmIDEOptions::GetFlag(std::string const& flag) const { // This method works only for single-valued flags! - std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(flag); - if (i != this->FlagMap.end() && i->second.size() == 1) { + std::map<std::string, FlagValue>::const_iterator i = + this->FlagMap.find(flag); + if (i != this->FlagMap.cend() && i->second.size() == 1) { return i->second[0].c_str(); } - return 0; + return nullptr; } diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index af03128..ded92ca 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -26,15 +26,15 @@ public: void AddDefines(const std::vector<std::string>& defines); std::vector<std::string> const& GetDefines() const; - void AddFlag(const char* flag, const char* value); - void AddFlag(const char* flag, std::vector<std::string> const& value); + void AddFlag(std::string const& flag, std::string const& value); + void AddFlag(std::string const& flag, std::vector<std::string> const& value); void AppendFlag(std::string const& flag, std::string const& value); void AppendFlag(std::string const& flag, std::vector<std::string> const& value); void AppendFlagString(std::string const& flag, std::string const& value); - void RemoveFlag(const char* flag); + void RemoveFlag(std::string const& flag); bool HasFlag(std::string const& flag) const; - const char* GetFlag(const char* flag); + const char* GetFlag(std::string const& flag) const; protected: // create a map of xml tags to the values they should have in the output diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 53966cd..47e6d7d 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -701,7 +701,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( Options targetOptions(this, t, table, gg->ExtraFlagTable); targetOptions.FixExceptionHandlingDefault(); std::string asmLocation = configName + "/"; - targetOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str()); + targetOptions.AddFlag("AssemblerListingLocation", asmLocation); targetOptions.Parse(flags.c_str()); targetOptions.Parse(defineFlags.c_str()); targetOptions.ParseFinish(); @@ -1007,7 +1007,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( if (mdi && !mdi->DefFile.empty()) { std::string defFile = this->ConvertToOutputFormat(mdi->DefFile, cmOutputConverter::SHELL); - linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); + linkOptions.AddFlag("ModuleDefinitionFile", defFile); } switch (target->GetType()) { diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index bd692a2..14743de 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -821,40 +821,39 @@ void cmQtAutoGeneratorInitializer::InitCustomTargets() this->Target->Target->AddPreBuildCommand(cc); } else { - // Convert file dependencies std::set to std::vector - std::vector<std::string> autogenDepends(autogenDependFiles.begin(), - autogenDependFiles.end()); - // Add link library target dependencies to the autogen target // dependencies - for (std::string const& config : this->ConfigsList) { - cmLinkImplementationLibraries const* libs = - this->Target->GetLinkImplementationLibraries(config); - if (libs != nullptr) { - for (cmLinkItem const& item : libs->Libraries) { - cmGeneratorTarget const* libTarget = item.Target; - if ((libTarget != nullptr) && - !StaticLibraryCycle(this->Target, libTarget, config)) { - std::string util; - if (this->ConfigsList.size() > 1) { - util += "$<$<CONFIG:"; - util += config; - util += ">:"; - } - util += libTarget->GetName(); - if (this->ConfigsList.size() > 1) { - util += ">"; + { + // add_dependencies/addUtility do not support generator expressions. + // We depend only on the libraries found in all configs therefore. + std::map<cmGeneratorTarget const*, std::size_t> commonTargets; + for (std::string const& config : this->ConfigsList) { + cmLinkImplementationLibraries const* libs = + this->Target->GetLinkImplementationLibraries(config); + if (libs != nullptr) { + for (cmLinkItem const& item : libs->Libraries) { + cmGeneratorTarget const* libTarget = item.Target; + if ((libTarget != nullptr) && + !StaticLibraryCycle(this->Target, libTarget, config)) { + // Increment target config count + commonTargets[libTarget]++; } - autogenDepends.push_back(util); } } } + for (auto const& item : commonTargets) { + if (item.second == this->ConfigsList.size()) { + autogenDependTargets.insert(item.first->Target); + } + } } // Create autogen target cmTarget* autogenTarget = makefile->AddUtilityCommand( this->AutogenTargetName, cmMakefile::TargetOrigin::Generator, true, - this->DirWork.c_str(), /*byproducts=*/autogenProvides, autogenDepends, + this->DirWork.c_str(), /*byproducts=*/autogenProvides, + std::vector<std::string>(autogenDependFiles.begin(), + autogenDependFiles.end()), commandLines, false, autogenComment.c_str()); // Create autogen generator target localGen->AddGeneratorTarget( diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8589a96..fd2f899 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2448,7 +2448,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.FixExceptionHandlingDefault(); clOptions.AddFlag("PrecompiledHeader", "NotUsing"); std::string asmLocation = configName + "/"; - clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str()); + clOptions.AddFlag("AssemblerListingLocation", asmLocation); } } clOptions.Parse(flags.c_str()); @@ -3315,8 +3315,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( imLib += "/"; imLib += targetNameImport; - linkOptions.AddFlag("ImportLibrary", imLib.c_str()); - linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str()); + linkOptions.AddFlag("ImportLibrary", imLib); + linkOptions.AddFlag("ProgramDataBaseFile", pdb); // A Windows Runtime component uses internal .NET metadata, // so does not have an import library. @@ -3337,7 +3337,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries", "ole32.lib"); } } else if (this->NsightTegra) { - linkOptions.AddFlag("SoName", targetNameSO.c_str()); + linkOptions.AddFlag("SoName", targetNameSO); } linkOptions.Parse(flags.c_str()); diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index b1686be..4f3d737 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -258,7 +258,7 @@ void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration() void cmVisualStudioGeneratorOptions::FixManifestUACFlags() { - static const char* ENABLE_UAC = "EnableUAC"; + static std::string const ENABLE_UAC = "EnableUAC"; if (!HasFlag(ENABLE_UAC)) { return; } @@ -304,8 +304,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() continue; } - AddFlag(uacMap[keyValue[0]].c_str(), - uacExecuteLevelMap[keyValue[1]].c_str()); + AddFlag(uacMap[keyValue[0]], uacExecuteLevelMap[keyValue[1]]); continue; } @@ -314,7 +313,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() // unknown uiAccess value continue; } - AddFlag(uacMap[keyValue[0]].c_str(), keyValue[1].c_str()); + AddFlag(uacMap[keyValue[0]], keyValue[1]); continue; } diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 64b6484..351e38d 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -705,9 +705,13 @@ ENDIF() # selected components. Initialize with required components. SET(KWSYS_CLASSES) SET(KWSYS_H_FILES Configure SharedForward) -SET(KWSYS_HXX_FILES Configure String - hashtable hash_fun hash_map hash_set - ) +SET(KWSYS_HXX_FILES Configure String) + +IF(NOT CMake_SOURCE_DIR) + SET(KWSYS_HXX_FILES ${KWSYS_HXX_FILES} + hashtable hash_fun hash_map hash_set + ) +ENDIF() # Add selected C++ classes. SET(cppclasses @@ -1027,7 +1031,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ENDFOREACH() # C++ tests - IF(NOT WATCOM) + IF(NOT WATCOM AND NOT CMake_SOURCE_DIR) SET(KWSYS_CXX_TESTS testHashSTL ) diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 50aa857..649f30b 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -4234,11 +4234,16 @@ bool SystemTools::IsSubDirectory(const std::string& cSubdir, std::string dir = cDir; SystemTools::ConvertToUnixSlashes(subdir); SystemTools::ConvertToUnixSlashes(dir); - if (subdir.size() > dir.size() && subdir[dir.size()] == '/') { - std::string s = subdir.substr(0, dir.size()); - return SystemTools::ComparePath(s, dir); + if (subdir.size() <= dir.size() || dir.empty()) { + return false; } - return false; + bool isRootPath = *dir.rbegin() == '/'; // like "/" or "C:/" + size_t expectedSlashPosition = isRootPath ? dir.size() - 1u : dir.size(); + if (subdir[expectedSlashPosition] != '/') { + return false; + } + std::string s = subdir.substr(0, dir.size()); + return SystemTools::ComparePath(s, dir); } void SystemTools::Delay(unsigned int msec) diff --git a/Source/kwsys/hash_map.hxx.in b/Source/kwsys/hash_map.hxx.in index 3f9174f..8c9b81e 100644 --- a/Source/kwsys/hash_map.hxx.in +++ b/Source/kwsys/hash_map.hxx.in @@ -49,7 +49,7 @@ namespace @KWSYS_NAMESPACE@ { // select1st is an extension: it is not part of the standard. template <class T1, class T2> -struct hash_select1st : public std::unary_function<std::pair<T1, T2>, T1> +struct hash_select1st { const T1& operator()(const std::pair<T1, T2>& __x) const { diff --git a/Source/kwsys/hash_set.hxx.in b/Source/kwsys/hash_set.hxx.in index e3a0c6c..5edd367 100644 --- a/Source/kwsys/hash_set.hxx.in +++ b/Source/kwsys/hash_set.hxx.in @@ -49,7 +49,7 @@ namespace @KWSYS_NAMESPACE@ { // identity is an extension: it is not part of the standard. template <class _Tp> -struct _Identity : public std::unary_function<_Tp, _Tp> +struct _Identity { const _Tp& operator()(const _Tp& __x) const { return __x; } }; diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in index dd92cb9..e962f17 100644 --- a/Source/kwsys/hashtable.hxx.in +++ b/Source/kwsys/hashtable.hxx.in @@ -35,13 +35,12 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> -#include <algorithm> // lower_bound -#include <functional> // unary_function -#include <iterator> // iterator_traits -#include <memory> // allocator -#include <stddef.h> // size_t -#include <utility> // pair -#include <vector> // vector +#include <algorithm> // lower_bound +#include <iterator> // iterator_traits +#include <memory> // allocator +#include <stddef.h> // size_t +#include <utility> // pair +#include <vector> // vector #if defined(_MSC_VER) #pragma warning(push) diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 3b694c9..a6af9cc 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -813,6 +813,39 @@ static bool CheckFind() return res; } +static bool CheckIsSubDirectory() +{ + bool res = true; + + if (kwsys::SystemTools::IsSubDirectory("/foo", "/") == false) { + std::cerr << "Problem with IsSubDirectory (root - unix): " << std::endl; + res = false; + } + if (kwsys::SystemTools::IsSubDirectory("c:/foo", "c:/") == false) { + std::cerr << "Problem with IsSubDirectory (root - dos): " << std::endl; + res = false; + } + if (kwsys::SystemTools::IsSubDirectory("/foo/bar", "/foo") == false) { + std::cerr << "Problem with IsSubDirectory (deep): " << std::endl; + res = false; + } + if (kwsys::SystemTools::IsSubDirectory("/foo", "/foo") == true) { + std::cerr << "Problem with IsSubDirectory (identity): " << std::endl; + res = false; + } + if (kwsys::SystemTools::IsSubDirectory("/fooo", "/foo") == true) { + std::cerr << "Problem with IsSubDirectory (substring): " << std::endl; + res = false; + } + if (kwsys::SystemTools::IsSubDirectory("/foo/", "/foo") == true) { + std::cerr << "Problem with IsSubDirectory (prepended slash): " + << std::endl; + res = false; + } + + return res; +} + static bool CheckGetLineFromStream() { const std::string fileWithFiveCharsOnFirstLine(TEST_SYSTEMTOOLS_SOURCE_DIR @@ -897,6 +930,8 @@ int testSystemTools(int, char* []) res &= CheckFind(); + res &= CheckIsSubDirectory(); + res &= CheckGetLineFromStream(); res &= CheckGetFilenameName(); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9507880..1d13f1c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3069,8 +3069,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_test(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N) - add_test(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B) - configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestFdSetSize/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake" diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 32c2950..dff9d0c 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -215,6 +215,12 @@ add_subdirectory(uicInclude) add_subdirectory(objectLibrary) # -- Test +# MacOS Framework +if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) + add_subdirectory(macosFW) +endif() + +# -- Test # Source files with the same basename in different subdirectories add_subdirectory(sameName) diff --git a/Tests/QtAutogen/macosFW/CMakeLists.txt b/Tests/QtAutogen/macosFW/CMakeLists.txt new file mode 100644 index 0000000..114d9ba --- /dev/null +++ b/Tests/QtAutogen/macosFW/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.8) +project(macos-fw-test) + +find_package(Qt5Test REQUIRED) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/lib) +set(CMAKE_INSTALL_NAME_DIR ${CMAKE_BINARY_DIR}/output/lib) + +if(POLICY CMP0042) # in CMake 3.0.0+ + set (CMAKE_MACOSX_RPATH OFF) # otherwise ON by default +endif(POLICY CMP0042) + +if(POLICY CMP0068) # in CMake 3.9+ + cmake_policy(SET CMP0068 NEW) +endif(POLICY CMP0068) + +add_subdirectory(src) +add_subdirectory(test) diff --git a/Tests/QtAutogen/macosFW/src/CMakeLists.txt b/Tests/QtAutogen/macosFW/src/CMakeLists.txt new file mode 100644 index 0000000..a02be00 --- /dev/null +++ b/Tests/QtAutogen/macosFW/src/CMakeLists.txt @@ -0,0 +1,33 @@ +set(MACOS_FW_LIB_VERSION "0.1") +set(MACOS_FW_LIB_SRCS + macos_fw_lib.cpp +) +set(MACOS_FW_LIB_HDRS + macos_fw_lib.h +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${Qt5Core_INCLUDE_DIRS} +) + +add_library(macos_fw_lib SHARED + ${MACOS_FW_LIB_SRCS} + ${MACOS_FW_LIB_HDRS} +) +set_target_properties(macos_fw_lib PROPERTIES AUTOMOC TRUE) +set_target_properties(macos_fw_lib PROPERTIES + CLEAN_DIRECT_OUTPUT 1 + FRAMEWORK 1 + FRAMEWORK_VERSION ${MACOS_FW_LIB_VERSION} + VERSION ${MACOS_FW_LIB_VERSION} + SOVERSION ${MACOS_FW_LIB_VERSION} + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MACOS_FW_LIB_VERSION} + MACOSX_FRAMEWORK_IDENTIFIER org.macos.fw_lib + POSITION_INDEPENDENT_CODE ON + PUBLIC_HEADER "${MACOS_FW_LIB_HDRS}" +) +target_link_libraries(macos_fw_lib + Qt5::Core +) diff --git a/Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp b/Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp new file mode 100644 index 0000000..881a8c9 --- /dev/null +++ b/Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp @@ -0,0 +1,17 @@ +#include "macos_fw_lib.h" + +#include <QString> +#include <QtGlobal> + +MacosFWLib::MacosFWLib() +{ +} + +MacosFWLib::~MacosFWLib() +{ +} + +QString MacosFWLib::qtVersionString() const +{ + return QString(qVersion()); +} diff --git a/Tests/QtAutogen/macosFW/src/macos_fw_lib.h b/Tests/QtAutogen/macosFW/src/macos_fw_lib.h new file mode 100644 index 0000000..e66e0ea --- /dev/null +++ b/Tests/QtAutogen/macosFW/src/macos_fw_lib.h @@ -0,0 +1,18 @@ +#ifndef MACOSFWLIB_H +#define MACOSFWLIB_H + +#include <QObject> +#include <QString> + +class __attribute__((visibility("default"))) MacosFWLib : public QObject +{ + Q_OBJECT + +public: + explicit MacosFWLib(); + ~MacosFWLib(); + + QString qtVersionString() const; +}; + +#endif // MACOSFWLIB_H diff --git a/Tests/QtAutogen/macosFW/test/CMakeLists.txt b/Tests/QtAutogen/macosFW/test/CMakeLists.txt new file mode 100644 index 0000000..521c184 --- /dev/null +++ b/Tests/QtAutogen/macosFW/test/CMakeLists.txt @@ -0,0 +1,19 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src +) +include_directories(SYSTEM + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} +) + +set(testname AutomocMacosFWLib) +add_executable(${testname} testMacosFWLib.cpp) +set_target_properties(${testname} PROPERTIES AUTOMOC TRUE) +target_link_libraries(${testname} + Qt5::Core + Qt5::Widgets + Qt5::Test + macos_fw_lib +) diff --git a/Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp b/Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp new file mode 100644 index 0000000..3476d61 --- /dev/null +++ b/Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp @@ -0,0 +1,42 @@ +#include <QObject> +#include <QString> + +#include "macos_fw_lib.h" +#include "testMacosFWLib.h" + +class TestMacosFWLib : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void cleanupTestCase(); + void init() {} + void cleanup() {} + + void testQtVersion(); +}; + +void TestMacosFWLib::initTestCase() +{ +} + +void TestMacosFWLib::cleanupTestCase() +{ +} + +void TestMacosFWLib::testQtVersion() +{ + MacosFWLib* testLib = new MacosFWLib(); + QVERIFY(testLib->qtVersionString().contains("5.")); + testLib->deleteLater(); +} + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv, false); + MacosFWLib testObject; + return QTest::qExec(&testObject, argc, argv); +} + +#include "testMacosFWLib.moc" diff --git a/Tests/QtAutogen/macosFW/test/testMacosFWLib.h b/Tests/QtAutogen/macosFW/test/testMacosFWLib.h new file mode 100644 index 0000000..1fe8dae --- /dev/null +++ b/Tests/QtAutogen/macosFW/test/testMacosFWLib.h @@ -0,0 +1,7 @@ +#ifndef TESTMACOSFWLIB_H +#define TESTMACOSFWLIB_H + +#include "qapplication.h" +#include <QtTest/QtTest> + +#endif // TESTMACOSFWLIB_H |