diff options
209 files changed, 2962 insertions, 689 deletions
diff --git a/.hooks-config.bash b/.hooks-config index ea9342a..064371c 100644 --- a/.hooks-config.bash +++ b/.hooks-config @@ -4,6 +4,7 @@ # Loaded by .git/hooks/(pre-commit|commit-msg|prepare-commit-msg) # during git commit after local hooks have been installed. -hooks_chain_pre_commit="Utilities/Git/pre-commit" -hooks_chain_commit_msg="Utilities/Git/commit-msg" -hooks_chain_prepare_commit_msg="Utilities/Git/prepare-commit-msg" +[hooks "chain"] + pre-commit = Utilities/Git/pre-commit + commit-msg = Utilities/Git/commit-msg + prepare-commit-msg = Utilities/Git/prepare-commit-msg diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index fabf9c1..1f19cb7 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -32,11 +32,11 @@ syn region cmakeArguments start=/(/ end=/)/ syn case match syn keyword cmakeProperty - \ ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ADVANCED ALIASED_TARGET ALLOW_DUPLICATE_CUSTOM_TARGETS ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_API ANDROID_API_MIN ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES ANDROID_GUI ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_DEBUG ARCHIVE_OUTPUT_DIRECTORY_RELEASE ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_DEBUG ARCHIVE_OUTPUT_NAME_RELEASE ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_MOC_OPTIONS AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTOUIC AUTOUIC_OPTIONS BINARY_DIR BUILD_WITH_INSTALL_RPATH BUNDLE BUNDLE_EXTENSION CACHE_VARIABLES CLEAN_NO_CUSTOM CMAKE_CONFIGURE_DEPENDS CMAKE_CXX_KNOWN_FEATURES CMAKE_C_KNOWN_FEATURES COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING COMPILE_DEFINITIONS COMPILE_DEFINITIONS_DEBUG COMPILE_DEFINITIONS_RELEASE COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_NAME_DEBUG COMPILE_PDB_NAME_RELEASE COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG COMPILE_PDB_OUTPUT_DIRECTORY_RELEASE COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXCLUDE_FROM_DEFAULT_BUILD_DEBUG EXCLUDE_FROM_DEFAULT_BUILD_RELEASE EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME GLOBAL_DEPENDS_DEBUG_MODE GLOBAL_DEPENDS_NO_CYCLES GNUtoMS HAS_CXX HEADER_FILE_ONLY HELPSTRING IMPLICIT_DEPENDS_INCLUDE_TRANSFORM IMPORTED IMPORTED_CONFIGURATIONS IMPORTED_IMPLIB IMPORTED_IMPLIB_DEBUG IMPORTED_IMPLIB_RELEASE IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_DEPENDENT_LIBRARIES_DEBUG IMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LINK_INTERFACE_MULTIPLICITY_DEBUG IMPORTED_LINK_INTERFACE_MULTIPLICITY_RELEASE IMPORTED_LOCATION IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_RELEASE IMPORTED_NO_SONAME IMPORTED_NO_SONAME_DEBUG IMPORTED_NO_SONAME_RELEASE IMPORTED_SONAME IMPORTED_SONAME_DEBUG IMPORTED_SONAME_RELEASE IMPORT_PREFIX IMPORT_SUFFIX INCLUDE_DIRECTORIES INCLUDE_REGULAR_EXPRESSION INSTALL_NAME_DIR INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH INTERFACE_AUTOUIC_OPTIONS INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SOURCES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION INTERPROCEDURAL_OPTIMIZATION_DEBUG INTERPROCEDURAL_OPTIMIZATION_RELEASE IN_TRY_COMPILE JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY_DEBUG LIBRARY_OUTPUT_DIRECTORY_RELEASE LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_DEBUG LIBRARY_OUTPUT_NAME_RELEASE LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_FLAGS_DEBUG LINK_FLAGS_RELEASE LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_DEBUG LINK_INTERFACE_LIBRARIES_RELEASE LINK_INTERFACE_MULTIPLICITY LINK_INTERFACE_MULTIPLICITY_DEBUG LINK_INTERFACE_MULTIPLICITY_RELEASE LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LISTFILE_STACK LOCATION LOCATION_DEBUG LOCATION_RELEASE MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MAP_IMPORTED_CONFIG_DEBUG MAP_IMPORTED_CONFIG_RELEASE MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OSX_ARCHITECTURES_DEBUG OSX_ARCHITECTURES_RELEASE OUTPUT_NAME OUTPUT_NAME_DEBUG OUTPUT_NAME_RELEASE PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_NAME_DEBUG PDB_NAME_RELEASE PDB_OUTPUT_DIRECTORY PDB_OUTPUT_DIRECTORY_DEBUG PDB_OUTPUT_DIRECTORY_RELEASE POSITION_INDEPENDENT_CODE POST_INSTALL_SCRIPT PREDEFINED_TARGETS_FOLDER PREFIX PRE_INSTALL_SCRIPT PRIVATE_HEADER PROCESSORS PROJECT_LABEL PUBLIC_HEADER REPORT_UNDEFINED_PROPERTIES REQUIRED_FILES RESOURCE RESOURCE_LOCK RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK RULE_MESSAGES RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_DIRECTORY_DEBUG RUNTIME_OUTPUT_DIRECTORY_RELEASE RUNTIME_OUTPUT_NAME RUNTIME_OUTPUT_NAME_DEBUG RUNTIME_OUTPUT_NAME_RELEASE RUN_SERIAL SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_DEBUG STATIC_LIBRARY_FLAGS_RELEASE STRINGS SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TIMEOUT TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES VS_XAML_TYPE WILL_FAIL WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS WORKING_DIRECTORY WRAP_EXCLUDE XCODE_EXPLICIT_FILE_TYPE XCODE_LAST_KNOWN_FILE_TYPE XCTEST + \ ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ADVANCED ALIASED_TARGET ALLOW_DUPLICATE_CUSTOM_TARGETS ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_API ANDROID_API_MIN ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES ANDROID_GUI ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_DEBUG ARCHIVE_OUTPUT_DIRECTORY_RELEASE ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_DEBUG ARCHIVE_OUTPUT_NAME_RELEASE ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_MOC_OPTIONS AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTOUIC AUTOUIC_OPTIONS BINARY_DIR BUILD_WITH_INSTALL_RPATH BUNDLE BUNDLE_EXTENSION CACHE_VARIABLES CLEAN_NO_CUSTOM CMAKE_CONFIGURE_DEPENDS CMAKE_CXX_KNOWN_FEATURES CMAKE_C_KNOWN_FEATURES COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING COMPILE_DEFINITIONS COMPILE_DEFINITIONS_DEBUG COMPILE_DEFINITIONS_RELEASE COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_NAME_DEBUG COMPILE_PDB_NAME_RELEASE COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG COMPILE_PDB_OUTPUT_DIRECTORY_RELEASE COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CXX_EXTENSIONS CXX_CPPLINT CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_CPPLINT C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXCLUDE_FROM_DEFAULT_BUILD_DEBUG EXCLUDE_FROM_DEFAULT_BUILD_RELEASE EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME GLOBAL_DEPENDS_DEBUG_MODE GLOBAL_DEPENDS_NO_CYCLES GNUtoMS HAS_CXX HEADER_FILE_ONLY HELPSTRING IMPLICIT_DEPENDS_INCLUDE_TRANSFORM IMPORTED IMPORTED_CONFIGURATIONS IMPORTED_IMPLIB IMPORTED_IMPLIB_DEBUG IMPORTED_IMPLIB_RELEASE IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_DEPENDENT_LIBRARIES_DEBUG IMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LINK_INTERFACE_MULTIPLICITY_DEBUG IMPORTED_LINK_INTERFACE_MULTIPLICITY_RELEASE IMPORTED_LOCATION IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_RELEASE IMPORTED_NO_SONAME IMPORTED_NO_SONAME_DEBUG IMPORTED_NO_SONAME_RELEASE IMPORTED_SONAME IMPORTED_SONAME_DEBUG IMPORTED_SONAME_RELEASE IMPORT_PREFIX IMPORT_SUFFIX INCLUDE_DIRECTORIES INCLUDE_REGULAR_EXPRESSION INSTALL_NAME_DIR INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH INTERFACE_AUTOUIC_OPTIONS INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SOURCES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION INTERPROCEDURAL_OPTIMIZATION_DEBUG INTERPROCEDURAL_OPTIMIZATION_RELEASE IN_TRY_COMPILE JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY_DEBUG LIBRARY_OUTPUT_DIRECTORY_RELEASE LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_DEBUG LIBRARY_OUTPUT_NAME_RELEASE LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_FLAGS_DEBUG LINK_FLAGS_RELEASE LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_DEBUG LINK_INTERFACE_LIBRARIES_RELEASE LINK_INTERFACE_MULTIPLICITY LINK_INTERFACE_MULTIPLICITY_DEBUG LINK_INTERFACE_MULTIPLICITY_RELEASE LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LISTFILE_STACK LOCATION LOCATION_DEBUG LOCATION_RELEASE MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MAP_IMPORTED_CONFIG_DEBUG MAP_IMPORTED_CONFIG_RELEASE MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OSX_ARCHITECTURES_DEBUG OSX_ARCHITECTURES_RELEASE OUTPUT_NAME OUTPUT_NAME_DEBUG OUTPUT_NAME_RELEASE PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_NAME_DEBUG PDB_NAME_RELEASE PDB_OUTPUT_DIRECTORY PDB_OUTPUT_DIRECTORY_DEBUG PDB_OUTPUT_DIRECTORY_RELEASE POSITION_INDEPENDENT_CODE POST_INSTALL_SCRIPT PREDEFINED_TARGETS_FOLDER PREFIX PRE_INSTALL_SCRIPT PRIVATE_HEADER PROCESSORS PROJECT_LABEL PUBLIC_HEADER REPORT_UNDEFINED_PROPERTIES REQUIRED_FILES RESOURCE RESOURCE_LOCK RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK RULE_MESSAGES RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_DIRECTORY_DEBUG RUNTIME_OUTPUT_DIRECTORY_RELEASE RUNTIME_OUTPUT_NAME RUNTIME_OUTPUT_NAME_DEBUG RUNTIME_OUTPUT_NAME_RELEASE RUN_SERIAL SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_DEBUG STATIC_LIBRARY_FLAGS_RELEASE STRINGS SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TIMEOUT TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES VS_XAML_TYPE WILL_FAIL WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS WORKING_DIRECTORY WRAP_EXCLUDE XCODE_EXPLICIT_FILE_TYPE XCODE_LAST_KNOWN_FILE_TYPE XCTEST \ contained syn keyword cmakeVariable - \ <PROJECT-NAME>_BINARY_DIR <PROJECT-NAME>_SOURCE_DIR <PROJECT-NAME>_VERSION <PROJECT-NAME>_VERSION_MAJOR <PROJECT-NAME>_VERSION_MINOR <PROJECT-NAME>_VERSION_PATCH <PROJECT-NAME>_VERSION_TWEAK APPLE BORLAND BUILD_SHARED_LIBS CMAKE_<CONFIG>_POSTFIX CMAKE_<LANG>_ARCHIVE_APPEND CMAKE_<LANG>_ARCHIVE_CREATE CMAKE_<LANG>_ARCHIVE_FINISH CMAKE_<LANG>_COMPILER CMAKE_<LANG>_COMPILER_ABI CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN CMAKE_<LANG>_COMPILER_ID CMAKE_<LANG>_COMPILER_LAUNCHER CMAKE_<LANG>_COMPILER_LOADED CMAKE_<LANG>_COMPILER_TARGET CMAKE_<LANG>_COMPILER_VERSION CMAKE_<LANG>_COMPILE_OBJECT CMAKE_<LANG>_CREATE_SHARED_LIBRARY CMAKE_<LANG>_CREATE_SHARED_MODULE CMAKE_<LANG>_CREATE_STATIC_LIBRARY CMAKE_<LANG>_FLAGS CMAKE_<LANG>_FLAGS_DEBUG CMAKE_<LANG>_FLAGS_MINSIZEREL CMAKE_<LANG>_FLAGS_RELEASE CMAKE_<LANG>_FLAGS_RELWITHDEBINFO CMAKE_<LANG>_GHS_KERNEL_FLAGS_DEBUG CMAKE_<LANG>_GHS_KERNEL_FLAGS_MINSIZEREL CMAKE_<LANG>_GHS_KERNEL_FLAGS_RELEASE CMAKE_<LANG>_GHS_KERNEL_FLAGS_RELWITHDEBINFO CMAKE_<LANG>_IGNORE_EXTENSIONS CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES CMAKE_<LANG>_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE CMAKE_<LANG>_LIBRARY_ARCHITECTURE CMAKE_<LANG>_LINKER_PREFERENCE CMAKE_<LANG>_LINKER_PREFERENCE_PROPAGATES CMAKE_<LANG>_LINK_EXECUTABLE CMAKE_<LANG>_OUTPUT_EXTENSION CMAKE_<LANG>_PLATFORM_ID CMAKE_<LANG>_SIMULATE_ID CMAKE_<LANG>_SIMULATE_VERSION CMAKE_<LANG>_SIZEOF_DATA_PTR CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS CMAKE_<LANG>_VISIBILITY_PRESET CMAKE_ABSOLUTE_DESTINATION_FILES CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS CMAKE_ANDROID_API CMAKE_ANDROID_API_MIN CMAKE_ANDROID_ARCH CMAKE_ANDROID_ASSETS_DIRECTORIES CMAKE_ANDROID_GUI CMAKE_ANDROID_JAR_DEPENDENCIES CMAKE_ANDROID_JAR_DIRECTORIES CMAKE_ANDROID_JAVA_SOURCE_DIR CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES CMAKE_ANDROID_PROCESS_MAX CMAKE_ANDROID_PROGUARD CMAKE_ANDROID_PROGUARD_CONFIG_PATH CMAKE_ANDROID_SECURE_PROPS_PATH CMAKE_ANDROID_SKIP_ANT_STEP CMAKE_ANDROID_STL_TYPE CMAKE_APPBUNDLE_PATH CMAKE_AR CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> CMAKE_ARGC CMAKE_ARGV0 CMAKE_AUTOMOC CMAKE_AUTOMOC_MOC_OPTIONS CMAKE_AUTOMOC_RELAXED_MODE CMAKE_AUTORCC CMAKE_AUTORCC_OPTIONS CMAKE_AUTOUIC CMAKE_AUTOUIC_OPTIONS CMAKE_BACKWARDS_COMPATIBILITY CMAKE_BINARY_DIR CMAKE_BUILD_TOOL CMAKE_BUILD_TYPE CMAKE_BUILD_WITH_INSTALL_RPATH CMAKE_CACHEFILE_DIR CMAKE_CACHE_MAJOR_VERSION CMAKE_CACHE_MINOR_VERSION CMAKE_CACHE_PATCH_VERSION CMAKE_CFG_INTDIR CMAKE_CL_64 CMAKE_COLOR_MAKEFILE CMAKE_COMMAND CMAKE_COMPILER_2005 CMAKE_COMPILER_IS_GNU<LANG> CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG> CMAKE_CONFIGURATION_TYPES CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR CMAKE_CTEST_COMMAND CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_LIST_DIR CMAKE_CURRENT_LIST_FILE CMAKE_CURRENT_LIST_LINE CMAKE_CURRENT_SOURCE_DIR CMAKE_CXX_COMPILE_FEATURES CMAKE_CXX_EXTENSIONS CMAKE_CXX_STANDARD CMAKE_CXX_STANDARD_REQUIRED CMAKE_C_COMPILE_FEATURES CMAKE_C_EXTENSIONS CMAKE_C_STANDARD CMAKE_C_STANDARD_REQUIRED CMAKE_DEBUG_POSTFIX CMAKE_DEBUG_TARGET_PROPERTIES CMAKE_DISABLE_FIND_PACKAGE_<PackageName> CMAKE_DL_LIBS CMAKE_EDIT_COMMAND CMAKE_ENABLE_EXPORTS CMAKE_ERROR_DEPRECATED CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_EXECUTABLE_SUFFIX CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS_<CONFIG> CMAKE_EXPORT_COMPILE_COMMANDS CMAKE_EXPORT_NO_PACKAGE_REGISTRY CMAKE_EXTRA_GENERATOR CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES CMAKE_FIND_APPBUNDLE CMAKE_FIND_FRAMEWORK CMAKE_FIND_LIBRARY_PREFIXES CMAKE_FIND_LIBRARY_SUFFIXES CMAKE_FIND_NO_INSTALL_PREFIX CMAKE_FIND_PACKAGE_NAME CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_WARN_NO_MODULE CMAKE_FIND_ROOT_PATH CMAKE_FIND_ROOT_PATH_MODE_INCLUDE CMAKE_FIND_ROOT_PATH_MODE_LIBRARY CMAKE_FIND_ROOT_PATH_MODE_PACKAGE CMAKE_FIND_ROOT_PATH_MODE_PROGRAM CMAKE_FRAMEWORK_PATH CMAKE_Fortran_FORMAT CMAKE_Fortran_MODDIR_DEFAULT CMAKE_Fortran_MODDIR_FLAG CMAKE_Fortran_MODOUT_FLAG CMAKE_Fortran_MODULE_DIRECTORY CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM CMAKE_GENERATOR_TOOLSET CMAKE_GNUtoMS CMAKE_HOME_DIRECTORY CMAKE_HOST_APPLE CMAKE_HOST_SYSTEM CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_UNIX CMAKE_HOST_WIN32 CMAKE_IGNORE_PATH CMAKE_IMPORT_LIBRARY_PREFIX CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_INCLUDE_CURRENT_DIR CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE CMAKE_INCLUDE_DIRECTORIES_BEFORE CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE CMAKE_INCLUDE_PATH CMAKE_INSTALL_DEFAULT_COMPONENT_NAME CMAKE_INSTALL_MESSAGE CMAKE_INSTALL_NAME_DIR CMAKE_INSTALL_PREFIX CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INTERNAL_PLATFORM_ABI CMAKE_IOS_INSTALL_COMBINED CMAKE_JOB_POOL_COMPILE CMAKE_JOB_POOL_LINK CMAKE_LIBRARY_ARCHITECTURE CMAKE_LIBRARY_ARCHITECTURE_REGEX CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG> CMAKE_LIBRARY_PATH CMAKE_LIBRARY_PATH_FLAG CMAKE_LINK_DEF_FILE_FLAG CMAKE_LINK_DEPENDS_NO_SHARED CMAKE_LINK_INTERFACE_LIBRARIES CMAKE_LINK_LIBRARY_FILE_FLAG CMAKE_LINK_LIBRARY_FLAG CMAKE_LINK_LIBRARY_SUFFIX CMAKE_LINK_SEARCH_END_STATIC CMAKE_LINK_SEARCH_START_STATIC CMAKE_MACOSX_BUNDLE CMAKE_MACOSX_RPATH CMAKE_MAJOR_VERSION CMAKE_MAKE_PROGRAM CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> CMAKE_MATCH_COUNT CMAKE_MFC_FLAG CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_MINOR_VERSION CMAKE_MODULE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS_<CONFIG> CMAKE_MODULE_PATH CMAKE_NOT_USING_CONFIG_FLAGS CMAKE_NO_BUILTIN_CHRPATH CMAKE_NO_SYSTEM_FROM_IMPORTED CMAKE_OBJECT_PATH_MAX CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT CMAKE_PARENT_LIST_FILE CMAKE_PATCH_VERSION CMAKE_PDB_OUTPUT_DIRECTORY CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG> CMAKE_POLICY_DEFAULT_CMP<NNNN> CMAKE_POLICY_WARNING_CMP<NNNN> CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH CMAKE_PROGRAM_PATH CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE CMAKE_PROJECT_NAME CMAKE_RANLIB CMAKE_ROOT CMAKE_RUNTIME_OUTPUT_DIRECTORY CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG> CMAKE_SCRIPT_MODE_FILE CMAKE_SHARED_LIBRARY_PREFIX CMAKE_SHARED_LIBRARY_SUFFIX CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_<CONFIG> CMAKE_SHARED_MODULE_PREFIX CMAKE_SHARED_MODULE_SUFFIX CMAKE_SIZEOF_VOID_P CMAKE_SKIP_BUILD_RPATH CMAKE_SKIP_INSTALL_ALL_DEPENDENCY CMAKE_SKIP_INSTALL_RPATH CMAKE_SKIP_INSTALL_RULES CMAKE_SKIP_RPATH CMAKE_SOURCE_DIR CMAKE_STAGING_PREFIX CMAKE_STANDARD_LIBRARIES CMAKE_STATIC_LIBRARY_PREFIX CMAKE_STATIC_LIBRARY_SUFFIX CMAKE_STATIC_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS_<CONFIG> CMAKE_SYSROOT CMAKE_SYSTEM CMAKE_SYSTEM_APPBUNDLE_PATH CMAKE_SYSTEM_FRAMEWORK_PATH CMAKE_SYSTEM_IGNORE_PATH CMAKE_SYSTEM_INCLUDE_PATH CMAKE_SYSTEM_LIBRARY_PATH CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PREFIX_PATH CMAKE_SYSTEM_PROCESSOR CMAKE_SYSTEM_PROGRAM_PATH CMAKE_SYSTEM_VERSION CMAKE_TOOLCHAIN_FILE CMAKE_TRY_COMPILE_CONFIGURATION CMAKE_TWEAK_VERSION CMAKE_USER_MAKE_RULES_OVERRIDE CMAKE_USER_MAKE_RULES_OVERRIDE_<LANG> CMAKE_USE_RELATIVE_PATHS CMAKE_VERBOSE_MAKEFILE CMAKE_VERSION CMAKE_VISIBILITY_INLINES_HIDDEN CMAKE_VS_DEVENV_COMMAND CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD CMAKE_VS_INTEL_Fortran_PROJECT_VERSION CMAKE_VS_MSBUILD_COMMAND CMAKE_VS_MSDEV_COMMAND CMAKE_VS_NsightTegra_VERSION CMAKE_VS_PLATFORM_NAME CMAKE_VS_PLATFORM_TOOLSET CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION CMAKE_WARN_DEPRECATED CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_WIN32_EXECUTABLE CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS CMAKE_XCODE_ATTRIBUTE_<an-attribute> CMAKE_XCODE_PLATFORM_TOOLSET CPACK_ABSOLUTE_DESTINATION_FILES CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CPACK_INCLUDE_TOPLEVEL_DIRECTORY CPACK_INSTALL_SCRIPT CPACK_PACKAGING_INSTALL_PREFIX CPACK_SET_DESTDIR CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CTEST_BINARY_DIRECTORY CTEST_BUILD_COMMAND CTEST_BUILD_NAME CTEST_BZR_COMMAND CTEST_BZR_UPDATE_OPTIONS CTEST_CHANGE_ID CTEST_CHECKOUT_COMMAND CTEST_CONFIGURATION_TYPE CTEST_CONFIGURE_COMMAND CTEST_COVERAGE_COMMAND CTEST_COVERAGE_EXTRA_FLAGS CTEST_CURL_OPTIONS CTEST_CUSTOM_COVERAGE_EXCLUDE CTEST_CUSTOM_ERROR_EXCEPTION CTEST_CUSTOM_ERROR_MATCH CTEST_CUSTOM_ERROR_POST_CONTEXT CTEST_CUSTOM_ERROR_PRE_CONTEXT CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MEMCHECK_IGNORE CTEST_CUSTOM_POST_MEMCHECK CTEST_CUSTOM_POST_TEST CTEST_CUSTOM_PRE_MEMCHECK CTEST_CUSTOM_PRE_TEST CTEST_CUSTOM_TEST_IGNORE CTEST_CUSTOM_WARNING_EXCEPTION CTEST_CUSTOM_WARNING_MATCH CTEST_CVS_CHECKOUT CTEST_CVS_COMMAND CTEST_CVS_UPDATE_OPTIONS CTEST_DROP_LOCATION CTEST_DROP_METHOD CTEST_DROP_SITE CTEST_DROP_SITE_CDASH CTEST_DROP_SITE_PASSWORD CTEST_DROP_SITE_USER CTEST_EXTRA_COVERAGE_GLOB CTEST_GIT_COMMAND CTEST_GIT_UPDATE_CUSTOM CTEST_GIT_UPDATE_OPTIONS CTEST_HG_COMMAND CTEST_HG_UPDATE_OPTIONS CTEST_MEMORYCHECK_COMMAND CTEST_MEMORYCHECK_COMMAND_OPTIONS CTEST_MEMORYCHECK_SANITIZER_OPTIONS CTEST_MEMORYCHECK_SUPPRESSIONS_FILE CTEST_MEMORYCHECK_TYPE CTEST_NIGHTLY_START_TIME CTEST_P4_CLIENT CTEST_P4_COMMAND CTEST_P4_OPTIONS CTEST_P4_UPDATE_OPTIONS CTEST_SCP_COMMAND CTEST_SITE CTEST_SOURCE_DIRECTORY CTEST_SVN_COMMAND CTEST_SVN_OPTIONS CTEST_SVN_UPDATE_OPTIONS CTEST_TEST_LOAD CTEST_TEST_TIMEOUT CTEST_TRIGGER_SITE CTEST_UPDATE_COMMAND CTEST_UPDATE_OPTIONS CTEST_UPDATE_VERSION_ONLY CTEST_USE_LAUNCHERS CYGWIN ENV EXECUTABLE_OUTPUT_PATH GHS-MULTI LIBRARY_OUTPUT_PATH MINGW MSVC MSVC10 MSVC11 MSVC12 MSVC14 MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 MSVC_IDE MSVC_VERSION PROJECT_BINARY_DIR PROJECT_NAME PROJECT_SOURCE_DIR PROJECT_VERSION PROJECT_VERSION_MAJOR PROJECT_VERSION_MINOR PROJECT_VERSION_PATCH PROJECT_VERSION_TWEAK UNIX WIN32 WINCE WINDOWS_PHONE WINDOWS_STORE XCODE_VERSION + \ <PROJECT-NAME>_BINARY_DIR <PROJECT-NAME>_SOURCE_DIR <PROJECT-NAME>_VERSION <PROJECT-NAME>_VERSION_MAJOR <PROJECT-NAME>_VERSION_MINOR <PROJECT-NAME>_VERSION_PATCH <PROJECT-NAME>_VERSION_TWEAK APPLE BORLAND BUILD_SHARED_LIBS CMAKE_<CONFIG>_POSTFIX CMAKE_<LANG>_ARCHIVE_APPEND CMAKE_<LANG>_ARCHIVE_CREATE CMAKE_<LANG>_ARCHIVE_FINISH CMAKE_<LANG>_COMPILER CMAKE_<LANG>_COMPILER_ABI CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN CMAKE_<LANG>_COMPILER_ID CMAKE_<LANG>_COMPILER_LAUNCHER CMAKE_<LANG>_COMPILER_LOADED CMAKE_<LANG>_COMPILER_TARGET CMAKE_<LANG>_COMPILER_VERSION CMAKE_<LANG>_COMPILE_OBJECT CMAKE_<LANG>_CREATE_SHARED_LIBRARY CMAKE_<LANG>_CREATE_SHARED_MODULE CMAKE_<LANG>_CREATE_STATIC_LIBRARY CMAKE_<LANG>_FLAGS CMAKE_<LANG>_FLAGS_DEBUG CMAKE_<LANG>_FLAGS_MINSIZEREL CMAKE_<LANG>_FLAGS_RELEASE CMAKE_<LANG>_FLAGS_RELWITHDEBINFO CMAKE_<LANG>_GHS_KERNEL_FLAGS_DEBUG CMAKE_<LANG>_GHS_KERNEL_FLAGS_MINSIZEREL CMAKE_<LANG>_GHS_KERNEL_FLAGS_RELEASE CMAKE_<LANG>_GHS_KERNEL_FLAGS_RELWITHDEBINFO CMAKE_<LANG>_IGNORE_EXTENSIONS CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES CMAKE_<LANG>_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE CMAKE_<LANG>_CPPLINT CMAKE_<LANG>_LIBRARY_ARCHITECTURE CMAKE_<LANG>_LINKER_PREFERENCE CMAKE_<LANG>_LINKER_PREFERENCE_PROPAGATES CMAKE_<LANG>_LINK_EXECUTABLE CMAKE_<LANG>_OUTPUT_EXTENSION CMAKE_<LANG>_PLATFORM_ID CMAKE_<LANG>_SIMULATE_ID CMAKE_<LANG>_SIMULATE_VERSION CMAKE_<LANG>_SIZEOF_DATA_PTR CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS CMAKE_<LANG>_VISIBILITY_PRESET CMAKE_ABSOLUTE_DESTINATION_FILES CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS CMAKE_ANDROID_API CMAKE_ANDROID_API_MIN CMAKE_ANDROID_ARCH CMAKE_ANDROID_ASSETS_DIRECTORIES CMAKE_ANDROID_GUI CMAKE_ANDROID_JAR_DEPENDENCIES CMAKE_ANDROID_JAR_DIRECTORIES CMAKE_ANDROID_JAVA_SOURCE_DIR CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES CMAKE_ANDROID_PROCESS_MAX CMAKE_ANDROID_PROGUARD CMAKE_ANDROID_PROGUARD_CONFIG_PATH CMAKE_ANDROID_SECURE_PROPS_PATH CMAKE_ANDROID_SKIP_ANT_STEP CMAKE_ANDROID_STL_TYPE CMAKE_APPBUNDLE_PATH CMAKE_AR CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> CMAKE_ARGC CMAKE_ARGV0 CMAKE_AUTOMOC CMAKE_AUTOMOC_MOC_OPTIONS CMAKE_AUTOMOC_RELAXED_MODE CMAKE_AUTORCC CMAKE_AUTORCC_OPTIONS CMAKE_AUTOUIC CMAKE_AUTOUIC_OPTIONS CMAKE_BACKWARDS_COMPATIBILITY CMAKE_BINARY_DIR CMAKE_BUILD_TOOL CMAKE_BUILD_TYPE CMAKE_BUILD_WITH_INSTALL_RPATH CMAKE_CACHEFILE_DIR CMAKE_CACHE_MAJOR_VERSION CMAKE_CACHE_MINOR_VERSION CMAKE_CACHE_PATCH_VERSION CMAKE_CFG_INTDIR CMAKE_CL_64 CMAKE_COLOR_MAKEFILE CMAKE_COMMAND CMAKE_COMPILER_2005 CMAKE_COMPILER_IS_GNU<LANG> CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG> CMAKE_CONFIGURATION_TYPES CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR CMAKE_CTEST_COMMAND CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_LIST_DIR CMAKE_CURRENT_LIST_FILE CMAKE_CURRENT_LIST_LINE CMAKE_CURRENT_SOURCE_DIR CMAKE_CXX_COMPILE_FEATURES CMAKE_CXX_EXTENSIONS CMAKE_CXX_STANDARD CMAKE_CXX_STANDARD_REQUIRED CMAKE_C_COMPILE_FEATURES CMAKE_C_EXTENSIONS CMAKE_C_STANDARD CMAKE_C_STANDARD_REQUIRED CMAKE_DEBUG_POSTFIX CMAKE_DEBUG_TARGET_PROPERTIES CMAKE_DISABLE_FIND_PACKAGE_<PackageName> CMAKE_DL_LIBS CMAKE_EDIT_COMMAND CMAKE_ENABLE_EXPORTS CMAKE_ERROR_DEPRECATED CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_EXECUTABLE_SUFFIX CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS_<CONFIG> CMAKE_EXPORT_COMPILE_COMMANDS CMAKE_EXPORT_NO_PACKAGE_REGISTRY CMAKE_EXTRA_GENERATOR CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES CMAKE_FIND_APPBUNDLE CMAKE_FIND_FRAMEWORK CMAKE_FIND_LIBRARY_PREFIXES CMAKE_FIND_LIBRARY_SUFFIXES CMAKE_FIND_NO_INSTALL_PREFIX CMAKE_FIND_PACKAGE_NAME CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_WARN_NO_MODULE CMAKE_FIND_ROOT_PATH CMAKE_FIND_ROOT_PATH_MODE_INCLUDE CMAKE_FIND_ROOT_PATH_MODE_LIBRARY CMAKE_FIND_ROOT_PATH_MODE_PACKAGE CMAKE_FIND_ROOT_PATH_MODE_PROGRAM CMAKE_FRAMEWORK_PATH CMAKE_Fortran_FORMAT CMAKE_Fortran_MODDIR_DEFAULT CMAKE_Fortran_MODDIR_FLAG CMAKE_Fortran_MODOUT_FLAG CMAKE_Fortran_MODULE_DIRECTORY CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM CMAKE_GENERATOR_TOOLSET CMAKE_GNUtoMS CMAKE_HOME_DIRECTORY CMAKE_HOST_APPLE CMAKE_HOST_SYSTEM CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_UNIX CMAKE_HOST_WIN32 CMAKE_IGNORE_PATH CMAKE_IMPORT_LIBRARY_PREFIX CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_INCLUDE_CURRENT_DIR CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE CMAKE_INCLUDE_DIRECTORIES_BEFORE CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE CMAKE_INCLUDE_PATH CMAKE_INSTALL_DEFAULT_COMPONENT_NAME CMAKE_INSTALL_MESSAGE CMAKE_INSTALL_NAME_DIR CMAKE_INSTALL_PREFIX CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INTERNAL_PLATFORM_ABI CMAKE_IOS_INSTALL_COMBINED CMAKE_JOB_POOL_COMPILE CMAKE_JOB_POOL_LINK CMAKE_LIBRARY_ARCHITECTURE CMAKE_LIBRARY_ARCHITECTURE_REGEX CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG> CMAKE_LIBRARY_PATH CMAKE_LIBRARY_PATH_FLAG CMAKE_LINK_DEF_FILE_FLAG CMAKE_LINK_DEPENDS_NO_SHARED CMAKE_LINK_INTERFACE_LIBRARIES CMAKE_LINK_LIBRARY_FILE_FLAG CMAKE_LINK_LIBRARY_FLAG CMAKE_LINK_LIBRARY_SUFFIX CMAKE_LINK_SEARCH_END_STATIC CMAKE_LINK_SEARCH_START_STATIC CMAKE_MACOSX_BUNDLE CMAKE_MACOSX_RPATH CMAKE_MAJOR_VERSION CMAKE_MAKE_PROGRAM CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> CMAKE_MATCH_COUNT CMAKE_MFC_FLAG CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_MINOR_VERSION CMAKE_MODULE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS_<CONFIG> CMAKE_MODULE_PATH CMAKE_NOT_USING_CONFIG_FLAGS CMAKE_NO_BUILTIN_CHRPATH CMAKE_NO_SYSTEM_FROM_IMPORTED CMAKE_OBJECT_PATH_MAX CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT CMAKE_PARENT_LIST_FILE CMAKE_PATCH_VERSION CMAKE_PDB_OUTPUT_DIRECTORY CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG> CMAKE_POLICY_DEFAULT_CMP<NNNN> CMAKE_POLICY_WARNING_CMP<NNNN> CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH CMAKE_PROGRAM_PATH CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE CMAKE_PROJECT_NAME CMAKE_RANLIB CMAKE_ROOT CMAKE_RUNTIME_OUTPUT_DIRECTORY CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG> CMAKE_SCRIPT_MODE_FILE CMAKE_SHARED_LIBRARY_PREFIX CMAKE_SHARED_LIBRARY_SUFFIX CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_<CONFIG> CMAKE_SHARED_MODULE_PREFIX CMAKE_SHARED_MODULE_SUFFIX CMAKE_SIZEOF_VOID_P CMAKE_SKIP_BUILD_RPATH CMAKE_SKIP_INSTALL_ALL_DEPENDENCY CMAKE_SKIP_INSTALL_RPATH CMAKE_SKIP_INSTALL_RULES CMAKE_SKIP_RPATH CMAKE_SOURCE_DIR CMAKE_STAGING_PREFIX CMAKE_STANDARD_LIBRARIES CMAKE_STATIC_LIBRARY_PREFIX CMAKE_STATIC_LIBRARY_SUFFIX CMAKE_STATIC_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS_<CONFIG> CMAKE_SYSROOT CMAKE_SYSTEM CMAKE_SYSTEM_APPBUNDLE_PATH CMAKE_SYSTEM_FRAMEWORK_PATH CMAKE_SYSTEM_IGNORE_PATH CMAKE_SYSTEM_INCLUDE_PATH CMAKE_SYSTEM_LIBRARY_PATH CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PREFIX_PATH CMAKE_SYSTEM_PROCESSOR CMAKE_SYSTEM_PROGRAM_PATH CMAKE_SYSTEM_VERSION CMAKE_TOOLCHAIN_FILE CMAKE_TRY_COMPILE_CONFIGURATION CMAKE_TWEAK_VERSION CMAKE_USER_MAKE_RULES_OVERRIDE CMAKE_USER_MAKE_RULES_OVERRIDE_<LANG> CMAKE_USE_RELATIVE_PATHS CMAKE_VERBOSE_MAKEFILE CMAKE_VERSION CMAKE_VISIBILITY_INLINES_HIDDEN CMAKE_VS_DEVENV_COMMAND CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD CMAKE_VS_INTEL_Fortran_PROJECT_VERSION CMAKE_VS_MSBUILD_COMMAND CMAKE_VS_MSDEV_COMMAND CMAKE_VS_NsightTegra_VERSION CMAKE_VS_PLATFORM_NAME CMAKE_VS_PLATFORM_TOOLSET CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION CMAKE_WARN_DEPRECATED CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_WIN32_EXECUTABLE CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS CMAKE_XCODE_ATTRIBUTE_<an-attribute> CMAKE_XCODE_PLATFORM_TOOLSET CPACK_ABSOLUTE_DESTINATION_FILES CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CPACK_INCLUDE_TOPLEVEL_DIRECTORY CPACK_INSTALL_SCRIPT CPACK_PACKAGING_INSTALL_PREFIX CPACK_SET_DESTDIR CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CTEST_BINARY_DIRECTORY CTEST_BUILD_COMMAND CTEST_BUILD_NAME CTEST_BZR_COMMAND CTEST_BZR_UPDATE_OPTIONS CTEST_CHANGE_ID CTEST_CHECKOUT_COMMAND CTEST_CONFIGURATION_TYPE CTEST_CONFIGURE_COMMAND CTEST_COVERAGE_COMMAND CTEST_COVERAGE_EXTRA_FLAGS CTEST_CURL_OPTIONS CTEST_CUSTOM_COVERAGE_EXCLUDE CTEST_CUSTOM_ERROR_EXCEPTION CTEST_CUSTOM_ERROR_MATCH CTEST_CUSTOM_ERROR_POST_CONTEXT CTEST_CUSTOM_ERROR_PRE_CONTEXT CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MEMCHECK_IGNORE CTEST_CUSTOM_POST_MEMCHECK CTEST_CUSTOM_POST_TEST CTEST_CUSTOM_PRE_MEMCHECK CTEST_CUSTOM_PRE_TEST CTEST_CUSTOM_TEST_IGNORE CTEST_CUSTOM_WARNING_EXCEPTION CTEST_CUSTOM_WARNING_MATCH CTEST_CVS_CHECKOUT CTEST_CVS_COMMAND CTEST_CVS_UPDATE_OPTIONS CTEST_DROP_LOCATION CTEST_DROP_METHOD CTEST_DROP_SITE CTEST_DROP_SITE_CDASH CTEST_DROP_SITE_PASSWORD CTEST_DROP_SITE_USER CTEST_EXTRA_COVERAGE_GLOB CTEST_GIT_COMMAND CTEST_GIT_UPDATE_CUSTOM CTEST_GIT_UPDATE_OPTIONS CTEST_HG_COMMAND CTEST_HG_UPDATE_OPTIONS CTEST_MEMORYCHECK_COMMAND CTEST_MEMORYCHECK_COMMAND_OPTIONS CTEST_MEMORYCHECK_SANITIZER_OPTIONS CTEST_MEMORYCHECK_SUPPRESSIONS_FILE CTEST_MEMORYCHECK_TYPE CTEST_NIGHTLY_START_TIME CTEST_P4_CLIENT CTEST_P4_COMMAND CTEST_P4_OPTIONS CTEST_P4_UPDATE_OPTIONS CTEST_SCP_COMMAND CTEST_SITE CTEST_SOURCE_DIRECTORY CTEST_SVN_COMMAND CTEST_SVN_OPTIONS CTEST_SVN_UPDATE_OPTIONS CTEST_TEST_LOAD CTEST_TEST_TIMEOUT CTEST_TRIGGER_SITE CTEST_UPDATE_COMMAND CTEST_UPDATE_OPTIONS CTEST_UPDATE_VERSION_ONLY CTEST_USE_LAUNCHERS CYGWIN ENV EXECUTABLE_OUTPUT_PATH GHS-MULTI LIBRARY_OUTPUT_PATH MINGW MSVC MSVC10 MSVC11 MSVC12 MSVC14 MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 MSVC_IDE MSVC_VERSION PROJECT_BINARY_DIR PROJECT_NAME PROJECT_SOURCE_DIR PROJECT_VERSION PROJECT_VERSION_MAJOR PROJECT_VERSION_MINOR PROJECT_VERSION_PATCH PROJECT_VERSION_TWEAK UNIX WIN32 WINCE WINDOWS_PHONE WINDOWS_STORE XCODE_VERSION \ contained syn keyword cmakeModule diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index 36adcbe..af75a39 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -33,7 +33,7 @@ type is ``STATIC`` or ``SHARED`` based on whether the current value of the variable :variable:`BUILD_SHARED_LIBS` is ``ON``. For ``SHARED`` and ``MODULE`` libraries the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property is set to ``ON`` automatically. -A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK` +A ``SHARED`` or ``STATIC`` library may be marked with the :prop_tgt:`FRAMEWORK` target property to create an OS X Framework. If a library does not export any symbols, it must not be declared as a diff --git a/Help/command/install.rst b/Help/command/install.rst index d57dd75..70087a4 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -90,8 +90,10 @@ project. There are five kinds of target files that may be installed: ``ARCHIVE``, ``LIBRARY``, ``RUNTIME``, ``FRAMEWORK``, and ``BUNDLE``. Executables are treated as ``RUNTIME`` targets, except that those marked with the ``MACOSX_BUNDLE`` property are treated as ``BUNDLE`` -targets on OS X. Static libraries are always treated as ``ARCHIVE`` -targets. Module libraries are always treated as ``LIBRARY`` targets. +targets on OS X. Static libraries are treated as ``ARCHIVE`` targets, +except that those marked with the ``FRAMEWORK`` property are treated +as ``FRAMEWORK`` targets on OS X. +Module libraries are always treated as ``LIBRARY`` targets. For non-DLL platforms shared libraries are treated as ``LIBRARY`` targets, except that those marked with the ``FRAMEWORK`` property are treated as ``FRAMEWORK`` targets on OS X. For DLL platforms the DLL diff --git a/Help/command/string.rst b/Help/command/string.rst index 77538f6..698a91d 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -296,6 +296,7 @@ specifiers: :: + %% A literal percent sign (%). %d The day of the current month (01-31). %H The hour on a 24-hour clock (00-23). %I The hour on a 12-hour clock (01-12). @@ -329,6 +330,12 @@ If no explicit ``<format string>`` is given it will default to: Write a string which can be used as an identifier in C. +.. note:: + + If the ``SOURCE_DATE_EPOCH`` environment variable is set, + its value will be used instead of the current time. + See https://reproducible-builds.org/specs/source-date-epoch/ for details. + UUID """" diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst index d641856..448fe9a 100644 --- a/Help/manual/cmake-compile-features.7.rst +++ b/Help/manual/cmake-compile-features.7.rst @@ -326,7 +326,7 @@ the feature-appropriate include directory Supported Compilers =================== -CMake is currently aware of the :prop_tgt:`language standards <CXX_STANDARD>` +CMake is currently aware of the :prop_tgt:`C++ standards <CXX_STANDARD>` and :prop_gbl:`compile features <CMAKE_CXX_KNOWN_FEATURES>` available from the following :variable:`compiler ids <CMAKE_<LANG>_COMPILER_ID>` as of the versions specified for each: @@ -338,7 +338,15 @@ versions specified for each: * ``SunPro``: Oracle SolarisStudio version 12.4. * ``Intel``: Intel compiler versions 12.1 through 17.0. -CMake is currently aware of the :prop_tgt:`language standards <CUDA_STANDARD>` +CMake is currently aware of the :prop_tgt:`C standards <C_STANDARD>` +and :prop_gbl:`compile features <CMAKE_C_KNOWN_FEATURES>` available from +the following :variable:`compiler ids <CMAKE_<LANG>_COMPILER_ID>` as of the +versions specified for each: + +* all compilers and versions listed above for C++ +* ``GNU``: GNU compiler versions 3.4 through 5.0. + +CMake is currently aware of the :prop_tgt:`CUDA standards <CUDA_STANDARD>` from the following :variable:`compiler ids <CMAKE_<LANG>_COMPILER_ID>` as of the versions specified for each: diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 6557686..46b922b 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -11,7 +11,7 @@ Introduction ============ This manual is intended for reference by developers modifying the CMake -source tree itself. +source tree itself, and by those authoring externally-maintained modules. Permitted C++ Subset diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 64d15a9..3a225ad 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -51,6 +51,8 @@ Available logical expressions are: ``0`` if all ``?`` are ``0``, else ``1`` ``$<NOT:?>`` ``0`` if ``?`` is ``1``, else ``1`` +``$<IF:?,true-value...,false-value...>``` + ``true-value...`` if ``?`` is ``1``, ``false-value...`` if ``?`` is ``0`` ``$<STREQUAL:a,b>`` ``1`` if ``a`` is STREQUAL ``b``, else ``0`` ``$<EQUAL:a,b>`` diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index c27c612..c9442bc 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -449,12 +449,12 @@ be true. This can be tested with logic in the package configuration file: foreach(_comp ${ClimbingStats_FIND_COMPONENTS}) if (NOT ";${_supported_components};" MATCHES _comp) set(ClimbingStats_FOUND False) - set(ClimbingStats_NOTFOUND_MESSAGE "Unsupported component: ${_comp}") + set(ClimbingStats_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") endif() include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStats${_comp}Targets.cmake") endforeach() -Here, the ``ClimbingStats_NOTFOUND_MESSAGE`` is set to a diagnosis that the package +Here, the ``ClimbingStats_NOT_FOUND_MESSAGE`` is set to a diagnosis that the package could not be found because an invalid component was specified. This message variable can be set for any case where the ``_FOUND`` variable is set to ``False``, and will be displayed to the user. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 5b39bed..38aba81 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -44,6 +44,7 @@ Properties of Global Scope /prop_gbl/TARGET_MESSAGES /prop_gbl/TARGET_SUPPORTS_SHARED_LIBS /prop_gbl/USE_FOLDERS + /prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME .. _`Directory Properties`: @@ -211,6 +212,7 @@ Properties on Targets /prop_tgt/LABELS /prop_tgt/LANG_CLANG_TIDY /prop_tgt/LANG_COMPILER_LAUNCHER + /prop_tgt/LANG_CPPLINT /prop_tgt/LANG_INCLUDE_WHAT_YOU_USE /prop_tgt/LANG_VISIBILITY_PRESET /prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG @@ -363,8 +365,11 @@ Properties on Source Files /prop_sf/SKIP_AUTORCC /prop_sf/SKIP_AUTOUIC /prop_sf/SYMBOLIC + /prop_sf/VS_COPY_TO_OUT_DIR /prop_sf/VS_DEPLOYMENT_CONTENT /prop_sf/VS_DEPLOYMENT_LOCATION + /prop_sf/VS_INCLUDE_IN_VSIX + /prop_sf/VS_RESOURCE_GENERATOR /prop_sf/VS_SHADER_ENTRYPOINT /prop_sf/VS_SHADER_FLAGS /prop_sf/VS_SHADER_MODEL diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 99b5eae..95f780a 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -284,6 +284,7 @@ Variables that Control the Build /variable/CMAKE_IOS_INSTALL_COMBINED /variable/CMAKE_LANG_CLANG_TIDY /variable/CMAKE_LANG_COMPILER_LAUNCHER + /variable/CMAKE_LANG_CPPLINT /variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE /variable/CMAKE_LANG_VISIBILITY_PRESET /variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY diff --git a/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst b/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst new file mode 100644 index 0000000..9a6086e --- /dev/null +++ b/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst @@ -0,0 +1,24 @@ +XCODE_EMIT_EFFECTIVE_PLATFORM_NAME +---------------------------------- + +Control emission of ``EFFECTIVE_PLATFORM_NAME`` by the Xcode generator. + +It is required for building the same target with multiple SDKs. A +common use case is the parallel use of ``iphoneos`` and +``iphonesimulator`` SDKs. + +Three different states possible that control when the Xcode generator +emits the ``EFFECTIVE_PLATFORM_NAME`` variable: + +- If set to ``ON`` it will always be emitted +- If set to ``OFF`` it will never be emitted +- If unset (the default) it will only be emitted when the project was + configured for an embedded Xcode SDK like iOS, tvOS, watchOS or any + of the simulators. + +.. note:: + + When this behavior is enable for generated Xcode projects, the + ``EFFECTIVE_PLATFORM_NAME`` variable will leak into + :manual:`Generator expressions <cmake-generator-expressions(7)>` + like ``TARGET_FILE`` and will render those mostly unusable. diff --git a/Help/prop_sf/VS_COPY_TO_OUT_DIR.rst b/Help/prop_sf/VS_COPY_TO_OUT_DIR.rst new file mode 100644 index 0000000..16c8d83 --- /dev/null +++ b/Help/prop_sf/VS_COPY_TO_OUT_DIR.rst @@ -0,0 +1,6 @@ +VS_COPY_TO_OUT_DIR +------------------ + +Sets the ``<CopyToOutputDirectory>`` tag for a source file in a +Visual Studio project file. Valid values are ``Never``, ``Always`` +and ``PreserveNewest``. diff --git a/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst b/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst new file mode 100644 index 0000000..30f471d --- /dev/null +++ b/Help/prop_sf/VS_INCLUDE_IN_VSIX.rst @@ -0,0 +1,6 @@ +VS_INCLUDE_IN_VSIX +------------------ + +Boolean property to specify if the file should be included within a VSIX +extension package. This is needed for development of Visual Studio +extensions. diff --git a/Help/prop_sf/VS_RESOURCE_GENERATOR.rst b/Help/prop_sf/VS_RESOURCE_GENERATOR.rst new file mode 100644 index 0000000..97e5aac --- /dev/null +++ b/Help/prop_sf/VS_RESOURCE_GENERATOR.rst @@ -0,0 +1,8 @@ +VS_RESOURCE_GENERATOR +--------------------- + +This property allows to specify the resource generator to be used +on this file. It defaults to ``PublicResXFileCodeGenerator`` if +not set. + +This property only applies to C# projects. diff --git a/Help/prop_tgt/FRAMEWORK.rst b/Help/prop_tgt/FRAMEWORK.rst index 8120c36..495d30e 100644 --- a/Help/prop_tgt/FRAMEWORK.rst +++ b/Help/prop_tgt/FRAMEWORK.rst @@ -1,9 +1,9 @@ FRAMEWORK --------- -Build ``SHARED`` library as Framework Bundle on the OS X and iOS. +Build ``SHARED`` or ``STATIC`` library as Framework Bundle on the OS X and iOS. -If a ``SHARED`` library target has this property set to ``TRUE`` it will be +If such a library target has this property set to ``TRUE`` it will be built as a framework when built on the OS X and iOS. It will have the directory structure required for a framework and will be suitable to be used with the ``-framework`` option diff --git a/Help/prop_tgt/LANG_CPPLINT.rst b/Help/prop_tgt/LANG_CPPLINT.rst new file mode 100644 index 0000000..14f47d4 --- /dev/null +++ b/Help/prop_tgt/LANG_CPPLINT.rst @@ -0,0 +1,13 @@ +<LANG>_CPPLINT +-------------- + +This property is supported only when ``<LANG>`` is ``C`` or ``CXX``. + +Specify a :ref:`;-list <CMake Language Lists>` containing a command line +for the ``cpplint`` style checker. The :ref:`Makefile Generators` and the +:generator:`Ninja` generator will run ``cpplint`` along with the compiler +and report any problems. + +This property is initialized by the value of the +:variable:`CMAKE_<LANG>_CPPLINT` variable if it is set when a target is +created. diff --git a/Help/release/dev/FeatureSummary_enhancement.rst b/Help/release/dev/FeatureSummary_enhancement.rst new file mode 100644 index 0000000..3a5d85f --- /dev/null +++ b/Help/release/dev/FeatureSummary_enhancement.rst @@ -0,0 +1,22 @@ +FeatureSummary_enhancement +-------------------------- + +* The :command:`set_package_info`, :command:`set_feature_info`, + :command:`print_enabled_features` and :command:`print_disabled_features` + commands from the the :module:`FeatureSummary` module are now deprecated. + +* The :command:`set_package_properties` command no longer forces the package + type to ``OPTIONAL`` when the type is not explicitly set. + +* The :command:`feature_summary` command in the :module:`FeatureSummary` module + accepts the new ``QUIET_ON_EMPTY`` option that will suppresses the output when + the list of packages that belong to the selected category is empty. + +* The :command:`add_feature_info` in the :module:`FeatureSummary` module learned + to accept lists of dependencies for deciding whether a feature is enabled or + not. + +* The package types accepted by the the :module:`FeatureSummary` module can now + be tweaked by changing the :variable:`FeatureSummary_PKG_TYPES`, + :variable:`FeatureSummary_REQUIRED_PKG_TYPES` and + :variable:`FeatureSummary_DEFAULT_PKG_TYPE` global properties. diff --git a/Help/release/dev/SOURCE_DATE_EPOCH.rst b/Help/release/dev/SOURCE_DATE_EPOCH.rst new file mode 100644 index 0000000..576e1da --- /dev/null +++ b/Help/release/dev/SOURCE_DATE_EPOCH.rst @@ -0,0 +1,5 @@ +SOURCE_DATE_EPOCH +----------------- + +* The :command:`string(TIMESTAMP)` will now honor the ``SOURCE_DATE_EPOCH`` + environment variable and use its value instead of the current time. diff --git a/Help/release/dev/WCDH_allow_unsupported.rst b/Help/release/dev/WCDH_allow_unsupported.rst new file mode 100644 index 0000000..c0b7377 --- /dev/null +++ b/Help/release/dev/WCDH_allow_unsupported.rst @@ -0,0 +1,8 @@ +WCDH_allow_unsupported +---------------------- + +* The :module:`WriteCompilerDetectionHeader` module gained the + ``ALLOW_UNKNOWN_COMPILERS`` and ``ALLOW_UNKNOWN_COMPILER_VERSIONS`` options + that allow creation of headers that will work also with unknown or old + compilers by simply assuming they do not support any of the requested + features. diff --git a/Help/release/dev/add-LANG_CPPLINT.rst b/Help/release/dev/add-LANG_CPPLINT.rst new file mode 100644 index 0000000..a0539cf --- /dev/null +++ b/Help/release/dev/add-LANG_CPPLINT.rst @@ -0,0 +1,8 @@ +add-LANG_CPPLINT +---------------- + +* A :prop_tgt:`<LANG>_CPPLINT` target property and supporting + :variable:`CMAKE_<LANG>_CPPLINT` variable were introduced to tell + the :ref:`Makefile Generators` and the :generator:`Ninja` generator to + run the ``cpplint`` style checker along with the compiler for ``C`` and + ``CXX`` languages. diff --git a/Help/release/dev/cpack-ifw-options.rst b/Help/release/dev/cpack-ifw-options.rst index cbe0f63..9838fd4 100644 --- a/Help/release/dev/cpack-ifw-options.rst +++ b/Help/release/dev/cpack-ifw-options.rst @@ -3,5 +3,19 @@ cpack-ifw-options * The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and :command:`cpack_ifw_configure_component_group` commands gained a new - ``DEFAULT``, ``VIRTUAL``, ``FORCED_INSTALLATION``, ``DISPLAY_NAME``, - ``DESCRIPTION`` and ``RELEASE_DATE`` options to more specific configuration. + ``DEFAULT``, ``VIRTUAL``, ``FORCED_INSTALLATION``, ``REQUIRES_ADMIN_RIGHTS``, + ``DISPLAY_NAME``, ``UPDATE_TEXT``, ``DESCRIPTION``, ``RELEASE_DATE``, + ``AUTO_DEPEND_ON`` and ``TRANSLATIONS`` options to more specific + configuration. + +* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` + command gained a new ``DEPENDENCIES`` alias for ``DEPENDS`` option. + +* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component_group` + command gained a new ``DEPENDS`` option. The ``DEPENDENCIES`` alias also + added. + +* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and + :command:`cpack_ifw_configure_component_group` commands ``PRIORITY`` + option now is deprecated and will be removed in a future version of CMake. + Please use new ``SORTING_PRIORITY`` option instead. diff --git a/Help/release/dev/gcc-features.rst b/Help/release/dev/gcc-features.rst new file mode 100644 index 0000000..c6959ab --- /dev/null +++ b/Help/release/dev/gcc-features.rst @@ -0,0 +1,5 @@ +gcc-features +------------ + +* The :manual:`Compile Features <cmake-compile-features(7)>` functionality + is now aware of the availability of C99 in gcc since version 3.4. diff --git a/Help/release/dev/if-genex.rst b/Help/release/dev/if-genex.rst new file mode 100644 index 0000000..62be3a7 --- /dev/null +++ b/Help/release/dev/if-genex.rst @@ -0,0 +1,7 @@ +genex-if +-------- + +* A new logical generator expression for immediate-if was added: + ``$<IF:cond,true-value,false-value>``. It takes three arguments: One + condition, a true-value, and a false-value. Resolves to the true-value if the + condition is ``1``, and resolves to the false-value if the condition is ``0``. diff --git a/Help/release/dev/pkg-config-recheck.rst b/Help/release/dev/pkg-config-recheck.rst new file mode 100644 index 0000000..950c3c8 --- /dev/null +++ b/Help/release/dev/pkg-config-recheck.rst @@ -0,0 +1,7 @@ +pkg-config-recheck +------------------ + +* Calls to the :module:`FindPkgConfig` module :command:`pkg_check_modules` + command following a successful call learned to re-evaluate the cached values + for a given prefix after changes to the parameters to the command for that + prefix. diff --git a/Help/release/dev/static-frameworks.rst b/Help/release/dev/static-frameworks.rst new file mode 100644 index 0000000..eae80bd --- /dev/null +++ b/Help/release/dev/static-frameworks.rst @@ -0,0 +1,6 @@ +static-frameworks +----------------- + +* The :prop_tgt:`FRAMEWORK` property could now also be applied to + static libraries on Apple targets. It will result in a proper + Framework but with a static library inside. diff --git a/Help/release/dev/timestamp-percent.rst b/Help/release/dev/timestamp-percent.rst new file mode 100644 index 0000000..046d6c5 --- /dev/null +++ b/Help/release/dev/timestamp-percent.rst @@ -0,0 +1,5 @@ +timestamp-percent +----------------- + +* The :command:`string(TIMESTAMP)` command learned to treat ``%%`` + as a way to encode plain ``%``. diff --git a/Help/release/dev/vs-advanced-source-properties.rst b/Help/release/dev/vs-advanced-source-properties.rst new file mode 100644 index 0000000..dd391e0 --- /dev/null +++ b/Help/release/dev/vs-advanced-source-properties.rst @@ -0,0 +1,12 @@ +vs-advanced-source-properties +----------------------------- + +* The :ref:`Visual Studio Generators` for VS 2010 and above + learned some more source file properties: + + - :prop_sf:`VS_RESOURCE_GENERATOR` (C# only): allows setting the resource + generator + - :prop_sf:`VS_COPY_TO_OUT_DIR`: parameter to set if file should be copied + to output directory (values: ``Never``, ``Always``, ``PreserveNewest``) + - :prop_sf:`VS_INCLUDE_IN_VSIX`: boolean property to include file include + Visual Studio extension package diff --git a/Help/release/dev/vs-csharp-support.rst b/Help/release/dev/vs-csharp-support.rst index 26d8574..46b235a 100644 --- a/Help/release/dev/vs-csharp-support.rst +++ b/Help/release/dev/vs-csharp-support.rst @@ -19,7 +19,16 @@ vs-native-csharp-support that specifically targets C# contains ``CSharp`` as a part of their names. -* More finetuning of C# targets can be done using target - properties. Specifically the Visual Studio related target +* More finetuning of C# targets can be done using target and source + file properties. Specifically the Visual Studio related target properties (``VS_*``) are worth a look (for setting toolset versions, root namespaces, assembly icons, ...). + +* **Auto-"linking"** in .csproj files: In C#/.NET development with + Visual Studio there is a number of visual editors used which + generate code. Both the generated files and the ones edited + with the UI are connected in the ``.csproj`` file using + ``<DependentUpon>`` tags. If CMake finds within a C# project + any source file with extension ``.Designer.cs`` or ``.xaml.cs``, + it checks sibling files with extension ``.xaml``, ``.settings``, + ``.resx`` or ``.cs`` and establishes the dependency connection. diff --git a/Help/release/dev/xcode-effective-platform-name.rst b/Help/release/dev/xcode-effective-platform-name.rst new file mode 100644 index 0000000..e337ca0 --- /dev/null +++ b/Help/release/dev/xcode-effective-platform-name.rst @@ -0,0 +1,8 @@ +xcode-effective-platform-name +----------------------------- + +* The Xcode generator can now control emission of the + ``EFFECTIVE_PLATFORM_NAME`` variable through the + :prop_gbl:`XCODE_EMIT_EFFECTIVE_PLATFORM_NAME` global property. + This is useful when building with multiple SDKs like macosx and + iphoneos in parallel. diff --git a/Help/variable/CMAKE_DL_LIBS.rst b/Help/variable/CMAKE_DL_LIBS.rst index 1fe7641..50d313d 100644 --- a/Help/variable/CMAKE_DL_LIBS.rst +++ b/Help/variable/CMAKE_DL_LIBS.rst @@ -1,7 +1,7 @@ CMAKE_DL_LIBS ------------- -Name of library containing ``dlopen`` and ``dlcose``. +Name of library containing ``dlopen`` and ``dlclose``. The name of the library that has ``dlopen`` and ``dlclose`` in it, usually ``-ldl`` on most UNIX machines. diff --git a/Help/variable/CMAKE_LANG_CPPLINT.rst b/Help/variable/CMAKE_LANG_CPPLINT.rst new file mode 100644 index 0000000..3b6f452 --- /dev/null +++ b/Help/variable/CMAKE_LANG_CPPLINT.rst @@ -0,0 +1,6 @@ +CMAKE_<LANG>_CPPLINT +-------------------- + +Default value for :prop_tgt:`<LANG>_CPPLINT` target property. This variable +is used to initialize the property on each target as it is created. This +is done only when ``<LANG>`` is ``C`` or ``CXX``. diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in index 7e8efa7..158d12b 100644 --- a/Modules/CMakeCUDACompiler.cmake.in +++ b/Modules/CMakeCUDACompiler.cmake.in @@ -13,7 +13,7 @@ set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX") set(CMAKE_CUDA_COMPILER_ID_RUN 1) set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu) -set(CMAKE_CUDA_LINKER_PREFERENCE 10) +set(CMAKE_CUDA_LINKER_PREFERENCE 15) set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1) set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES@") diff --git a/Modules/CPack.STGZ_Header.sh.in b/Modules/CPack.STGZ_Header.sh.in index dee576f..c615851 100755 --- a/Modules/CPack.STGZ_Header.sh.in +++ b/Modules/CPack.STGZ_Header.sh.in @@ -130,7 +130,10 @@ echo "" use_new_tail_syntax="-n" tail $use_new_tail_syntax +1 "$0" > /dev/null 2> /dev/null || use_new_tail_syntax="" -tail $use_new_tail_syntax +###CPACK_HEADER_LENGTH### "$0" | gunzip | (cd "${toplevel}" && tar xf -) || cpack_echo_exit "Problem unpacking the @CPACK_PACKAGE_FILE_NAME@" +extractor="pax -r" +command -v pax > /dev/null 2> /dev/null || extractor="tar xf -" + +tail $use_new_tail_syntax +###CPACK_HEADER_LENGTH### "$0" | gunzip | (cd "${toplevel}" && ${extractor}) || cpack_echo_exit "Problem unpacking the @CPACK_PACKAGE_FILE_NAME@" echo "Unpacking finished successfully" diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index ae595fb..deb724c 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -227,18 +227,21 @@ # :: # # cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL] -# [FORCED_INSTALLATION] +# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS] # [NAME <name>] # [DISPLAY_NAME <display_name>] # [DESCRIPTION <description>] +# [UPDATE_TEXT <update_text>] # [VERSION <version>] # [RELEASE_DATE <release_date>] # [SCRIPT <script>] -# [PRIORITY <priority>] -# [DEPENDS <com_id> ...] +# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated +# [DEPENDS|DEPENDENCIES <com_id> ...] +# [AUTO_DEPEND_ON <comp_id> ...] # [LICENSES <display_name> <file_path> ...] # [DEFAULT <value>] -# [USER_INTERFACES <file_path> <file_path> ...]) +# [USER_INTERFACES <file_path> <file_path> ...] +# [TRANSLATIONS <file_path> <file_path> ...]) # # This command should be called after :command:`cpack_add_component` command. # @@ -260,6 +263,9 @@ # It is a equivalent of the ``REQUARED`` option from the # :command:`cpack_add_component` command. # +# ``REQUIRES_ADMIN_RIGHTS`` +# set it if the component needs to be installed with elevated permissions. +# # ``NAME`` # is used to create domain-like identification for this component. # By default used origin component name. @@ -272,6 +278,10 @@ # set to rewrite original description configured by # :command:`cpack_add_component` command. # +# ``UPDATE_TEXT`` +# will be added to the component description if this is an update to +# the component. +# # ``VERSION`` # is version of component. # By default used :variable:`CPACK_PACKAGE_VERSION`. @@ -283,11 +293,18 @@ # is a relative or absolute path to operations script # for this component. # -# ``PRIORITY`` +# ``PRIORITY`` | ``SORTING_PRIORITY`` # is priority of the component in the tree. +# The ``PRIORITY`` option is deprecated and will be removed in a future +# version of CMake. Please use ``SORTING_PRIORITY`` option instead. +# +# ``DEPENDS`` | ``DEPENDENCIES`` +# list of dependency component or component group identifiers in +# QtIFW_ style. # -# ``DEPENDS`` -# list of dependency component identifiers in QtIFW_ style. +# ``AUTO_DEPEND_ON`` +# list of identifiers of component or component group in QtIFW_ style +# that this component has an automatic dependency on. # # ``LICENSES`` # pair of <display_name> and <file_path> of license text for this @@ -300,7 +317,10 @@ # as a value of the ``SCRIPT`` option). # # ``USER_INTERFACES`` -# a list of <file_path> representing pages to load +# is a list of <file_path> ('.ui' files) representing pages to load. +# +# ``TRANSLATIONS`` +# is a list of <file_path> ('.qm' files) representing translations to load. # # # .. command:: cpack_ifw_configure_component_group @@ -310,17 +330,21 @@ # :: # # cpack_ifw_configure_component_group(<groupname> [VIRTUAL] -# [FORCED_INSTALLATION] +# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS] # [NAME <name>] # [DISPLAY_NAME <display_name>] # [DESCRIPTION <description>] +# [UPDATE_TEXT <update_text>] # [VERSION <version>] # [RELEASE_DATE <release_date>] # [SCRIPT <script>] -# [PRIORITY <priority>] +# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated +# [DEPENDS|DEPENDENCIES <com_id> ...] +# [AUTO_DEPEND_ON <comp_id> ...] # [LICENSES <display_name> <file_path> ...] # [DEFAULT <value>] -# [USER_INTERFACES <file_path> <file_path> ...]) +# [USER_INTERFACES <file_path> <file_path> ...] +# [TRANSLATIONS <file_path> <file_path> ...]) # # This command should be called after :command:`cpack_add_component_group` # command. @@ -332,6 +356,10 @@ # ``FORCED_INSTALLATION`` # if set, then the group must always be installed. # +# ``REQUIRES_ADMIN_RIGHTS`` +# set it if the component group needs to be installed with elevated +# permissions. +# # ``NAME`` # is used to create domain-like identification for this component group. # By default used origin component group name. @@ -344,6 +372,10 @@ # set to rewrite original description configured by # :command:`cpack_add_component_group` command. # +# ``UPDATE_TEXT`` +# will be added to the component group description if this is an update to +# the component group. +# # ``VERSION`` # is version of component group. # By default used :variable:`CPACK_PACKAGE_VERSION`. @@ -355,8 +387,18 @@ # is a relative or absolute path to operations script # for this component group. # -# ``PRIORITY`` +# ``PRIORITY`` | ``SORTING_PRIORITY`` # is priority of the component group in the tree. +# The ``PRIORITY`` option is deprecated and will be removed in a future +# version of CMake. Please use ``SORTING_PRIORITY`` option instead. +# +# ``DEPENDS`` | ``DEPENDENCIES`` +# list of dependency component or component group identifiers in +# QtIFW_ style. +# +# ``AUTO_DEPEND_ON`` +# list of identifiers of component or component group in QtIFW_ style +# that this component group has an automatic dependency on. # # ``LICENSES`` # pair of <display_name> and <file_path> of license text for this @@ -370,7 +412,10 @@ # the script as a value of the ``SCRIPT`` option). # # ``USER_INTERFACES`` -# a list of <file_path> representing pages to load +# is a list of <file_path> ('.ui' files) representing pages to load. +# +# ``TRANSLATIONS`` +# is a list of <file_path> ('.qm' files) representing translations to load. # # # .. command:: cpack_ifw_add_repository @@ -711,14 +756,15 @@ macro(cpack_ifw_configure_component compname) string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME) - set(_IFW_OPT COMMON ESSENTIAL VIRTUAL FORCED_INSTALLATION) - set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY DEFAULT) - set(_IFW_MULTI_ARGS DEPENDS LICENSES USER_INTERFACES) + set(_IFW_OPT COMMON ESSENTIAL VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS) + set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT) + set(_IFW_MULTI_ARGS DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS) cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT) _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES) _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_USER_INTERFACES) + _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_TRANSLATIONS) set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n") @@ -751,14 +797,15 @@ macro(cpack_ifw_configure_component_group grpname) string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME) - set(_IFW_OPT VIRTUAL FORCED_INSTALLATION) - set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY DEFAULT) - set(_IFW_MULTI_ARGS LICENSES USER_INTERFACES) + set(_IFW_OPT VIRTUAL FORCED_INSTALLATION REQUIRES_ADMIN_RIGHTS) + set(_IFW_ARGS NAME DISPLAY_NAME DESCRIPTION VERSION RELEASE_DATE SCRIPT PRIORITY SORTING_PRIORITY UPDATE_TEXT DEFAULT) + set(_IFW_MULTI_ARGS DEPENDS DEPENDENCIES AUTO_DEPEND_ON LICENSES USER_INTERFACES TRANSLATIONS) cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT) _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES) _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_USER_INTERFACES) + _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_TRANSLATIONS) set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n") diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-C-DetermineCompiler.cmake index 6ddc566..6ddc566 100644 --- a/Modules/Compiler/GNU-DetermineCompiler.cmake +++ b/Modules/Compiler/GNU-C-DetermineCompiler.cmake diff --git a/Modules/Compiler/GNU-C-FeatureTests.cmake b/Modules/Compiler/GNU-C-FeatureTests.cmake index b3fe33f..0ab5265 100644 --- a/Modules/Compiler/GNU-C-FeatureTests.cmake +++ b/Modules/Compiler/GNU-C-FeatureTests.cmake @@ -1,5 +1,5 @@ -set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404") +set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304") # GNU 4.7 correctly sets __STDC_VERSION__ to 201112L, but GNU 4.6 sets it # to 201000L. As the former is strictly greater than the latter, test only @@ -8,10 +8,10 @@ set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404") # to the distinction between __cplusplus and __GXX_EXPERIMENTAL_CXX0X__ tests. set(GNU46_C11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L") set(_cmake_feature_test_c_static_assert "${GNU46_C11}") -# Since 4.4 at least: -set(GNU44_C99 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L") -set(_cmake_feature_test_c_restrict "${GNU44_C99}") -set(_cmake_feature_test_c_variadic_macros "${GNU44_C99}") +# Since 3.4 at least: +set(GNU34_C99 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L") +set(_cmake_feature_test_c_restrict "${GNU34_C99}") +set(_cmake_feature_test_c_variadic_macros "${GNU34_C99}") set(GNU_C90 "${_cmake_oldestSupported}") set(_cmake_feature_test_c_function_prototypes "${GNU_C90}") diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index 05c3bb2..3f02618 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -4,12 +4,12 @@ __compiler_gnu(C) if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") -elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) +elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") endif() -if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) +if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") endif() @@ -22,7 +22,7 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x") endif() -if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) if (NOT CMAKE_C_COMPILER_FORCED) if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT) message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") @@ -38,10 +38,9 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) endif() endif() - macro(cmake_record_c_compile_features) set(_result 0) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION) _record_compiler_features_c(11) endif() diff --git a/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake b/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..c25b147 --- /dev/null +++ b/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake @@ -0,0 +1,15 @@ + +set(_compiler_id_pp_test "defined(__GNUC__) || defined(__GNUG__)") + +set(_compiler_id_version_compute " +# if defined(__GNUC__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUC__) +# else +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__) +# endif") diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index b04ea11..c007c98 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -6,7 +6,7 @@ if (WIN32) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fno-keep-inline-dllexport") endif() else() - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.2) + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() endif() diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 6408392..9c67fbd 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -10,14 +10,17 @@ set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <OBJECT> -MF <DEPFILE>") if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(_std -Qstd) set(_ext c) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Qstd=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-Qstd=c11") + endif() else() set(_std -std) set(_ext gnu) -endif() - -if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) - set(CMAKE_C11_STANDARD_COMPILE_OPTION "${_std}=c11") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=${_ext}11") + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + endif() endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) diff --git a/Modules/CompilerId/VS-10.csproj.in b/Modules/CompilerId/VS-10.csproj.in index 833dca7..ed5e847 100644 --- a/Modules/CompilerId/VS-10.csproj.in +++ b/Modules/CompilerId/VS-10.csproj.in @@ -47,9 +47,9 @@ </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <PropertyGroup> - <PostBuildEvent>cd /D "$(MSBuildToolsPath)" -if not %errorlevel%==0 exit -1 -if not exist @id_cl@ exit -2 -%40echo CMAKE_@id_lang@_COMPILER=$(MSBuildToolsPath)\@id_cl@</PostBuildEvent> + <PostBuildEvent>if not "$(RoslynTargetsPath)"=="" if exist "$(RoslynTargetsPath)\@id_cl@" set _CSC=$(RoslynTargetsPath) +if exist "$(MSBuildToolsPath)\@id_cl@" set _CSC=$(MSBuildToolsPath) +if "%_CSC%"=="" exit -1 +%40echo CMAKE_@id_lang@_COMPILER=%_CSC%\@id_cl@</PostBuildEvent> </PropertyGroup> </Project> diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 78d9df3..8910be7 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -14,30 +14,93 @@ packages and/or feature for a build tree such as:: LibXml2 (required version >= 2.4), XML processing lib, <http://xmlsoft.org> * Enables HTML-import in MyWordProcessor * Enables odt-export in MyWordProcessor - PNG , A PNG image library. , <http://www.libpng.org/pub/png/> + PNG, A PNG image library., <http://www.libpng.org/pub/png/> * Enables saving screenshots -- The following OPTIONAL packages have not been found: - Lua51 , The Lua scripting language. , <http://www.lua.org> + Lua51, The Lua scripting language., <http://www.lua.org> * Enables macros in MyWordProcessor - Foo , Foo provides cool stuff. + Foo, Foo provides cool stuff. + +Global Properties +^^^^^^^^^^^^^^^^^ + +.. variable:: FeatureSummary_PKG_TYPES + +The global property :variable:`FeatureSummary_PKG_TYPES` defines the type of +packages used by `FeatureSummary`. + +The order in this list is important, the first package type in the list is the +least important, the last is the most important. the of a package can only be +changed to higher types. + +The default package types are , ``RUNTIME``, ``OPTIONAL``, ``RECOMMENDED`` and +``REQUIRED``, and their importance is +``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``. + + +.. variable:: FeatureSummary_REQUIRED_PKG_TYPES + +The global property :variable:`FeatureSummary_REQUIRED_PKG_TYPES` defines which +package types are required. + +If one or more package in this categories has not been found, CMake will abort +when calling :cmd;`feature_summary` with the +'FATAL_ON_MISSING_REQUIRED_PACKAGES' option enabled. + +The default value for this global property is ``REQUIRED``. + + +.. variable:: FeatureSummary_DEFAULT_PKG_TYPE + +The global property :variable:`FeatureSummary_DEFAULT_PKG_TYPE` defines which +package type is the default one. +When calling :cmd;`feature_summary`, if the user did not set the package type +explicitly, the package will be assigned to this category. + +This value must be one of the types defined in the +:variable:`FeatureSummary_PKG_TYPES` global property unless the package type +is set for all the packages. + +The default value for this global property is ``OPTIONAL``. + +#]=======================================================================] + +get_property(_fsPkgTypeIsSet GLOBAL PROPERTY FeatureSummary_PKG_TYPES SET) +if(NOT _fsPkgTypeIsSet) + set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES RUNTIME OPTIONAL RECOMMENDED REQUIRED) +endif() + +get_property(_fsReqPkgTypesIsSet GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES SET) +if(NOT _fsReqPkgTypesIsSet) + set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES REQUIRED) +endif() + +get_property(_fsDefaultPkgTypeIsSet GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE SET) +if(NOT _fsDefaultPkgTypeIsSet) + set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE OPTIONAL) +endif() + +#[=======================================================================[.rst: Functions ^^^^^^^^^ #]=======================================================================] +include(CMakeParseArguments) + function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet) + get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES) + get_property(_fsDefaultPkgType GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE) + set(_type "ANY") - if("${_property}" MATCHES "REQUIRED_") - set(_type "REQUIRED") - elseif("${_property}" MATCHES "RECOMMENDED_") - set(_type "RECOMMENDED") - elseif("${_property}" MATCHES "RUNTIME_") - set(_type "RUNTIME") - elseif("${_property}" MATCHES "OPTIONAL_") - set(_type "OPTIONAL") - endif() + foreach(_fsPkgType ${_fsPkgTypes}) + if("${_property}" MATCHES "${_fsPkgType}_PACKAGES_(NOT_)?FOUND") + set(_type "${_fsPkgType}") + break() + endif() + endforeach() if("${_property}" MATCHES "PACKAGES_FOUND") set(_property "PACKAGES_FOUND") @@ -57,15 +120,30 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet) # does this package belong to the type we currently want to list ? get_property(_currentType GLOBAL PROPERTY _CMAKE_${_currentFeature}_TYPE) if(NOT _currentType) - set(_currentType OPTIONAL) + list(FIND _fsPkgTypes "${_fsDefaultPkgType}" _defaultInPkgTypes) + if("${_defaultInPkgTypes}" STREQUAL "-1") + string(REGEX REPLACE ";([^;]+)$" " and \\1" _fsPkgTypes_msg "${_fsPkgTypes}") + string(REPLACE ";" ", " _fsPkgTypes_msg "${_fsPkgTypes_msg}") + message(FATAL_ERROR "Bad package property type ${_fsDefaultPkgType} used in global property FeatureSummary_DEFAULT_PKG_TYPE. " + "Valid types are ${_fsPkgTypes_msg}. " + "Either update FeatureSummary_DEFAULT_PKG_TYPE or add ${_fsDefaultPkgType} to the FeatureSummary_PKG_TYPES global property.") + endif() + set(_currentType ${_fsDefaultPkgType}) endif() if("${_type}" STREQUAL ANY OR "${_type}" STREQUAL "${_currentType}") - # check whether the current feature/package should be in the output depending on whether it was QUIET or not set(includeThisOne TRUE) + set(_required FALSE) # skip QUIET packages, except if they are REQUIRED or INCLUDE_QUIET_PACKAGES has been set - if((NOT "${_currentType}" STREQUAL "REQUIRED") AND NOT _includeQuiet) + get_property(_fsReqPkgTypes GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES) + foreach(_fsReqPkgType ${_fsReqPkgTypes}) + if("${_currentType}" STREQUAL "${_fsReqPkgType}") + set(_required TRUE) + break() + endif() + endforeach() + if(NOT _required AND NOT _includeQuiet) get_property(_isQuiet GLOBAL PROPERTY _CMAKE_${_currentFeature}_QUIET) if(_isQuiet) set(includeThisOne FALSE) @@ -87,11 +165,11 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet) endif() get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION) if(_info) - string(APPEND _currentFeatureText " , ${_info}") + string(APPEND _currentFeatureText ", ${_info}") endif() get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL) if(_info) - string(APPEND _currentFeatureText " , <${_info}>") + string(APPEND _currentFeatureText ", <${_info}>") endif() get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE) @@ -119,6 +197,7 @@ endfunction() [INCLUDE_QUIET_PACKAGES] [FATAL_ON_MISSING_REQUIRED_PACKAGES] [DESCRIPTION "Found packages:"] + [QUIET_ON_EMPTY] WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND | ENABLED_FEATURES | DISABLED_FEATURES) ) @@ -143,22 +222,15 @@ endfunction() the list of all packages which have been found ``PACKAGES_NOT_FOUND`` the list of all packages which have not been found - ``OPTIONAL_PACKAGES_FOUND`` - only those packages which have been found which have the type OPTIONAL - ``OPTIONAL_PACKAGES_NOT_FOUND`` - only those packages which have not been found which have the type OPTIONAL - ``RECOMMENDED_PACKAGES_FOUND`` - only those packages which have been found which have the type RECOMMENDED - ``RECOMMENDED_PACKAGES_NOT_FOUND`` - only those packages which have not been found which have the type RECOMMENDED - ``REQUIRED_PACKAGES_FOUND`` - only those packages which have been found which have the type REQUIRED - ``REQUIRED_PACKAGES_NOT_FOUND`` - only those packages which have not been found which have the type REQUIRED - ``RUNTIME_PACKAGES_FOUND`` - only those packages which have been found which have the type RUNTIME - ``RUNTIME_PACKAGES_NOT_FOUND`` - only those packages which have not been found which have the type RUNTIME + + For each package type ``<TYPE>`` defined by the + :variable:`FeatureSummary_PKG_TYPES` global property, the following + information can also be used: + + ``<TYPE>_PACKAGES_FOUND`` + only those packages which have been found which have the type <TYPE> + ``<TYPE>_PACKAGES_NOT_FOUND`` + only those packages which have not been found which have the type <TYPE> With the exception of the ``ALL`` value, these values can be combined in order to customize the output. For example: @@ -177,7 +249,20 @@ endfunction() packages which have been searched with ``find_package(... QUIET)`` will also be listed. By default they are skipped. If ``FATAL_ON_MISSING_REQUIRED_PACKAGES`` is given, CMake will abort if a - package which is marked as ``REQUIRED`` has not been found. + package which is marked as one of the package types listed in the + :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global property has not been + found. + The default value for the :variable:`FeatureSummary_REQUIRED_PKG_TYPES` global + property is ``REQUIRED``. + + The :variable:`FeatureSummary_DEFAULT_PKG_TYPE` global property can be + modified to change the default package type assigned when not explicitly + assigned by the user. + + If the ``QUIET_ON_EMPTY`` option is used, if only one type of package was + requested, and no packages belonging to that category were found, then no + output (including the ``DESCRIPTION``) is printed or added to the ``VAR`` + variable. Example 1, append everything to a file: @@ -198,11 +283,28 @@ endfunction() DESCRIPTION "Enabled Features:" VAR enabledFeaturesText) message(STATUS "${enabledFeaturesText}") + + Example 3, change default package types and print only the categories that + are not empty: + + .. code-block:: cmake + + include(FeatureSummary) + set_property(GLOBAL APPEND PROPERTY FeatureSummary_PKG_TYPES BUILD) + find_package(FOO) + set_package_properties(FOO PROPERTIES TYPE BUILD) + feature_summary(WHAT BUILD_PACKAGES_FOUND + Description "Build tools found:" + QUIET_ON_EMPTY) + feature_summary(WHAT BUILD_PACKAGES_NOT_FOUND + Description "Build tools not found:" + QUIET_ON_EMPTY) + #]=======================================================================] function(FEATURE_SUMMARY) # CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) - set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) + set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES QUIET_ON_EMPTY) set(oneValueArgs FILENAME VAR DESCRIPTION) set(multiValueArgs WHAT) @@ -219,40 +321,42 @@ function(FEATURE_SUMMARY) set(validWhatParts "ENABLED_FEATURES" "DISABLED_FEATURES" "PACKAGES_FOUND" - "PACKAGES_NOT_FOUND" - "OPTIONAL_PACKAGES_FOUND" - "OPTIONAL_PACKAGES_NOT_FOUND" - "RECOMMENDED_PACKAGES_FOUND" - "RECOMMENDED_PACKAGES_NOT_FOUND" - "REQUIRED_PACKAGES_FOUND" - "REQUIRED_PACKAGES_NOT_FOUND" - "RUNTIME_PACKAGES_FOUND" - "RUNTIME_PACKAGES_NOT_FOUND") + "PACKAGES_NOT_FOUND") + + get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES) + get_property(_fsReqPkgTypes GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES) + foreach(_fsPkgType ${_fsPkgTypes}) + list(APPEND validWhatParts "${_fsPkgType}_PACKAGES_FOUND" + "${_fsPkgType}_PACKAGES_NOT_FOUND") + endforeach() list(FIND validWhatParts "${_FS_WHAT}" indexInList) if(NOT "${indexInList}" STREQUAL "-1") _FS_GET_FEATURE_SUMMARY( ${_FS_WHAT} _featureSummary ${_FS_INCLUDE_QUIET_PACKAGES} ) - set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n") - if (("${_FS_WHAT}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") AND _featureSummary) - set(requiredPackagesNotFound TRUE) + if(_featureSummary OR NOT _FS_QUIET_ON_EMPTY) + set(_fullText "${_FS_DESCRIPTION}${_featureSummary}\n") + endif() + + if(_featureSummary) + foreach(_fsReqPkgType ${_fsReqPkgTypes}) + if("${_FS_WHAT}" STREQUAL "${_fsReqPkgType}_PACKAGES_NOT_FOUND") + set(requiredPackagesNotFound TRUE) + break() + endif() + endforeach() endif() else() if("${_FS_WHAT}" STREQUAL "ALL") - set(allWhatParts "ENABLED_FEATURES" - "RUNTIME_PACKAGES_FOUND" - "OPTIONAL_PACKAGES_FOUND" - "RECOMMENDED_PACKAGES_FOUND" - "REQUIRED_PACKAGES_FOUND" - - "DISABLED_FEATURES" - "RUNTIME_PACKAGES_NOT_FOUND" - "OPTIONAL_PACKAGES_NOT_FOUND" - "RECOMMENDED_PACKAGES_NOT_FOUND" - "REQUIRED_PACKAGES_NOT_FOUND" - ) - + set(allWhatParts "ENABLED_FEATURES") + foreach(_fsPkgType ${_fsPkgTypes}) + list(APPEND allWhatParts "${_fsPkgType}_PACKAGES_FOUND") + endforeach() + list(APPEND allWhatParts "DISABLED_FEATURES") + foreach(_fsPkgType ${_fsPkgTypes}) + list(APPEND allWhatParts "${_fsPkgType}_PACKAGES_NOT_FOUND") + endforeach() else() set(allWhatParts) foreach(part ${_FS_WHAT}) @@ -273,45 +377,49 @@ function(FEATURE_SUMMARY) set(title_DISABLED_FEATURES "The following features have been disabled:") set(title_PACKAGES_FOUND "The following packages have been found:") set(title_PACKAGES_NOT_FOUND "The following packages have not been found:") - set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:") - set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:") - set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:") - set(title_RECOMMENDED_PACKAGES_NOT_FOUND "The following RECOMMENDED packages have not been found:") - set(title_REQUIRED_PACKAGES_FOUND "The following REQUIRED packages have been found:") - set(title_REQUIRED_PACKAGES_NOT_FOUND "The following REQUIRED packages have not been found:") - set(title_RUNTIME_PACKAGES_FOUND "The following RUNTIME packages have been found:") - set(title_RUNTIME_PACKAGES_NOT_FOUND "The following RUNTIME packages have not been found:") + foreach(_fsPkgType ${_fsPkgTypes}) + set(title_${_fsPkgType}_PACKAGES_FOUND "The following ${_fsPkgType} packages have been found:") + set(title_${_fsPkgType}_PACKAGES_NOT_FOUND "The following ${_fsPkgType} packages have not been found:") + endforeach() set(_fullText "${_FS_DESCRIPTION}") foreach(part ${allWhatParts}) set(_tmp) _FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES}) if(_tmp) - string(APPEND _fullText "\n-- ${title_${part}}\n${_tmp}\n") - if("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") - set(requiredPackagesNotFound TRUE) + if(_fullText) + string(APPEND _fullText "\n-- ") endif() + string(APPEND _fullText "${title_${part}}\n${_tmp}\n") + foreach(_fsReqPkgType ${_fsReqPkgTypes}) + if("${part}" STREQUAL "${_fsReqPkgType}_PACKAGES_NOT_FOUND") + set(requiredPackagesNotFound TRUE) + break() + endif() + endforeach() endif() endforeach() endif() - if(_FS_FILENAME) - if(_FS_APPEND) - file(APPEND "${_FS_FILENAME}" "${_fullText}") + if(_fullText OR NOT _FS_QUIET_ON_EMPTY) + if(_FS_FILENAME) + if(_FS_APPEND) + file(APPEND "${_FS_FILENAME}" "${_fullText}") + else() + file(WRITE "${_FS_FILENAME}" "${_fullText}") + endif() + else() - file(WRITE "${_FS_FILENAME}" "${_fullText}") + if(NOT _FS_VAR) + message(STATUS "${_fullText}") + endif() endif() - else() - if(NOT _FS_VAR) - message(STATUS "${_fullText}") + if(_FS_VAR) + set(${_FS_VAR} "${_fullText}" PARENT_SCOPE) endif() endif() - if(_FS_VAR) - set(${_FS_VAR} "${_fullText}" PARENT_SCOPE) - endif() - if(requiredPackagesNotFound AND _FS_FATAL_ON_MISSING_REQUIRED_PACKAGES) message(FATAL_ERROR "feature_summary() Error: REQUIRED package(s) are missing, aborting CMake run.") endif() @@ -362,7 +470,8 @@ endfunction() TYPEs (``RUNTIME < OPTIONAL < RECOMMENDED < REQUIRED``), lower TYPEs are ignored. The ``TYPE`` property is project-specific, so it cannot be set by the Find-module, but must be set in the project. - + Type accepted can be changed by setting the + :variable:`FeatureSummary_PKG_TYPES` global property. ``PURPOSE <purpose>`` This describes which features this package enables in the @@ -435,25 +544,28 @@ function(SET_PACKAGE_PROPERTIES _name _props) set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_SPP_PURPOSE}" ) endif() - # handle the TYPE - if(NOT _SPP_TYPE) - set(_SPP_TYPE OPTIONAL) - endif() + get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES) + get_property(_fsDefaultPkgType GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE) - # List the supported types, according to their priority - set(validTypes "RUNTIME" "OPTIONAL" "RECOMMENDED" "REQUIRED" ) - list(FIND validTypes ${_SPP_TYPE} _typeIndexInList) - if("${_typeIndexInList}" STREQUAL "-1" ) - message(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). " - "Valid types are OPTIONAL, RECOMMENDED, REQUIRED and RUNTIME." ) - endif() + # handle the TYPE + if(DEFINED _SPP_TYPE) + # Supported types are listed in FeatureSummary_PKG_TYPES according to their priority + get_property(_fsPkgTypes GLOBAL PROPERTY FeatureSummary_PKG_TYPES) + list(FIND _fsPkgTypes ${_SPP_TYPE} _typeIndexInList) + if("${_typeIndexInList}" STREQUAL "-1" ) + string(REGEX REPLACE ";([^;]+)$" " and \\1" _fsPkgTypes_msg "${_fsPkgTypes}") + string(REPLACE ";" ", " _fsPkgTypes_msg "${_fsPkgTypes_msg}") + message(FATAL_ERROR "Bad package property type ${_SPP_TYPE} used in SET_PACKAGE_PROPERTIES(). " + "Valid types are ${_fsPkgTypes_msg}." ) + endif() - get_property(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE) - list(FIND validTypes "${_previousType}" _prevTypeIndexInList) + get_property(_previousType GLOBAL PROPERTY _CMAKE_${_name}_TYPE) + list(FIND _fsPkgTypes "${_previousType}" _prevTypeIndexInList) - # make sure a previously set TYPE is not overridden with a lower new TYPE: - if("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}") - set_property(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" ) + # make sure a previously set TYPE is not overridden with a lower new TYPE: + if("${_typeIndexInList}" GREATER "${_prevTypeIndexInList}") + set_property(GLOBAL PROPERTY _CMAKE_${_name}_TYPE "${_SPP_TYPE}" ) + endif() endif() endfunction() @@ -466,7 +578,8 @@ endfunction() add_feature_info(<name> <enabled> <description>) Use this macro to add information about a feature with the given ``<name>``. - ``<enabled>`` contains whether this feature is enabled or not. + ``<enabled>`` contains whether this feature is enabled or not. It can be a + variable or a list of conditions. ``<description>`` is a text describing the feature. The information can be displayed using ``feature_summary()`` for ``ENABLED_FEATURES`` and ``DISABLED_FEATURES`` respectively. @@ -478,7 +591,16 @@ endfunction() option(WITH_FOO "Help for foo" ON) add_feature_info(Foo WITH_FOO "The Foo feature provides very cool stuff.") #]=======================================================================] -function(ADD_FEATURE_INFO _name _enabled _desc) +function(ADD_FEATURE_INFO _name _depends _desc) + set(_enabled 1) + foreach(_d ${_depends}) + string(REGEX REPLACE " +" ";" _d "${_d}") + if(${_d}) + else() + set(_enabled 0) + break() + endif() + endforeach() if (${_enabled}) set_property(GLOBAL APPEND PROPERTY ENABLED_FEATURES "${_name}") else () @@ -511,6 +633,7 @@ CMake versions: can be set are added automatically by the ``find_package()`` command. #]=======================================================================] function(SET_PACKAGE_INFO _name _desc) + message(DEPRECATION "SET_PACKAGE_INFO is deprecated. Use SET_PACKAGE_PROPERTIES instead.") unset(_url) unset(_purpose) if(ARGC GREATER 2) @@ -540,6 +663,7 @@ endfunction() set_package_info(<name> <description> <url>) #]=======================================================================] function(SET_FEATURE_INFO) + message(DEPRECATION "SET_FEATURE_INFO is deprecated. Use ADD_FEATURE_INFO instead.") SET_PACKAGE_INFO(${ARGN}) endfunction() @@ -557,6 +681,8 @@ endfunction() feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:") #]=======================================================================] function(PRINT_ENABLED_FEATURES) + message(DEPRECATION "PRINT_ENABLED_FEATURES is deprecated. Use + feature_summary(WHAT ENABLED_FEATURES DESCRIPTION \"Enabled features:\")") FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:") endfunction() @@ -574,5 +700,7 @@ endfunction() feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:") #]=======================================================================] function(PRINT_DISABLED_FEATURES) + message(DEPRECATION "PRINT_DISABLED_FEATURES is deprecated. Use + feature_summary(WHAT DISABLED_FEATURES DESCRIPTION \"Disabled features:\")") FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:") endfunction() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 266d135..e795aad 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1463,7 +1463,7 @@ if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1) endif() # If the user changed any of our control inputs flush previous results. -if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME) +if(_Boost_CHANGE_LIBDIR_DEBUG OR _Boost_CHANGE_LIBDIR_RELEASE OR _Boost_CHANGE_LIBNAME) foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) string(TOUPPER ${COMPONENT} UPPERCOMPONENT) foreach(c DEBUG RELEASE) diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake index 5ce71a9..a96a8ca 100644 --- a/Modules/FindCUDA/select_compute_arch.cmake +++ b/Modules/FindCUDA/select_compute_arch.cmake @@ -44,9 +44,10 @@ endif () # function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE) if(NOT CUDA_GPU_DETECT_OUTPUT) - set(cufile ${PROJECT_BINARY_DIR}/detect_cuda_archs.cu) + set(file ${PROJECT_BINARY_DIR}/detect_cuda_compute_capabilities.cpp) - file(WRITE ${cufile} "" + file(WRITE ${file} "" + "#include <cuda_runtime.h>\n" "#include <cstdio>\n" "int main()\n" "{\n" @@ -62,14 +63,15 @@ function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE) " return 0;\n" "}\n") - execute_process(COMMAND "${CUDA_NVCC_EXECUTABLE}" "--run" "${cufile}" - WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/" - RESULT_VARIABLE nvcc_res OUTPUT_VARIABLE nvcc_out - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + try_run(run_result compile_result ${PROJECT_BINARY_DIR} ${file} + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CUDA_INCLUDE_DIRS}" + LINK_LIBRARIES ${CUDA_LIBRARIES} + RUN_OUTPUT_VARIABLE compute_capabilities) - if(nvcc_res EQUAL 0) - string(REPLACE "2.1" "2.1(2.0)" nvcc_out "${nvcc_out}") - set(CUDA_GPU_DETECT_OUTPUT ${nvcc_out} CACHE INTERNAL "Returned GPU architetures from detect_gpus tool" FORCE) + if(run_result EQUAL 0) + string(REPLACE "2.1" "2.1(2.0)" compute_capabilities "${compute_capabilities}") + set(CUDA_GPU_DETECT_OUTPUT ${compute_capabilities} + CACHE INTERNAL "Returned GPU architectures from detect_gpus tool" FORCE) endif() endif() diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake index 446c3a8..76059b3 100644 --- a/Modules/FindGSL.cmake +++ b/Modules/FindGSL.cmake @@ -135,7 +135,7 @@ if( NOT GSL_VERSION ) # 2. If gsl-config is not available, try looking in gsl/gsl_version.h if( NOT GSL_VERSION AND EXISTS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" ) file( STRINGS "${GSL_INCLUDE_DIRS}/gsl/gsl_version.h" gsl_version_h_contents REGEX "define GSL_VERSION" ) - string( REGEX REPLACE ".*([0-9].[0-9][0-9]).*" "\\1" GSL_VERSION ${gsl_version_h_contents} ) + string( REGEX REPLACE ".*([0-9]\\.[0-9][0-9]?).*" "\\1" GSL_VERSION ${gsl_version_h_contents} ) endif() # might also try scraping the directory name for a regex match "gsl-X.X" diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index e1b22b6..6747be5 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -529,52 +529,54 @@ function(_GTK2_ADD_TARGET _var) cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;GTK2_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN}) - if(GTK2_${_var}_FOUND AND NOT TARGET GTK2::${_basename}) - # Do not create the target if dependencies are missing - foreach(_dep ${_${_var}_GTK2_DEPENDS}) - if(NOT TARGET GTK2::${_dep}) - return() - endif() - endforeach() + if(GTK2_${_var}_FOUND) + if(NOT TARGET GTK2::${_basename}) + # Do not create the target if dependencies are missing + foreach(_dep ${_${_var}_GTK2_DEPENDS}) + if(NOT TARGET GTK2::${_dep}) + return() + endif() + endforeach() - add_library(GTK2::${_basename} UNKNOWN IMPORTED) + add_library(GTK2::${_basename} UNKNOWN IMPORTED) - set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename}) - set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE) + if(GTK2_${_var}_LIBRARY_RELEASE) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) + endif() - if(GTK2_${_var}_LIBRARY_RELEASE) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) - endif() + if(GTK2_${_var}_LIBRARY_DEBUG) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" ) + endif() - if(GTK2_${_var}_LIBRARY_DEBUG) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" ) - endif() + if(GTK2_${_var}_INCLUDE_DIR) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") + endif() - if(GTK2_${_var}_INCLUDE_DIR) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") - endif() + if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}") + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") + endif() - if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}") - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") - endif() + if(GTK2_DEFINITIONS) + set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") + endif() - if(GTK2_DEFINITIONS) - set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") - endif() + if(_${_var}_GTK2_DEPENDS) + _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS}) + endif() - if(_${_var}_GTK2_DEPENDS) - _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS}) + if(_${_var}_OPTIONAL_INCLUDES) + foreach(_D ${_${_var}_OPTIONAL_INCLUDES}) + if(_D) + _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D}) + endif() + endforeach() + endif() endif() - if(_${_var}_OPTIONAL_INCLUDES) - foreach(_D ${_${_var}_OPTIONAL_INCLUDES}) - if(_D) - _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D}) - endif() - endforeach() - endif() + set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename}) + set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE) if(GTK2_USE_IMPORTED_TARGETS) set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE) @@ -735,9 +737,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(APPLE) _GTK2_FIND_LIBRARY (GDK gdk-quartz false true) endif() - if(NOT GTK2_GDK_FOUND) - _GTK2_FIND_LIBRARY (GDK gdk-x11 false true) - endif() + _GTK2_FIND_LIBRARY (GDK gdk-x11 false true) else() _GTK2_FIND_LIBRARY (GDK gdk-win32 false true) endif() @@ -749,9 +749,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(APPLE) _GTK2_FIND_LIBRARY (GTK gtk-quartz false true) endif() - if(NOT GTK2_GTK_FOUND) - _GTK2_FIND_LIBRARY (GTK gtk-x11 false true) - endif() + _GTK2_FIND_LIBRARY (GTK gtk-x11 false true) else() _GTK2_FIND_LIBRARY (GTK gtk-win32 false true) endif() diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index c777970..b59b9b3 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -75,16 +75,9 @@ function(_lua_set_version_vars) include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} ) - list(APPEND _lua_library_names - lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} - lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - ) endforeach () set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) - set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE) endfunction(_lua_set_version_vars) @@ -152,6 +145,15 @@ endif () unset(_lua_include_subdirs) unset(_lua_append_versions) +if (LUA_VERSION_STRING) + set(_lua_library_names + lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR} + lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} + lua-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} + lua.${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} + ) +endif () + find_library(LUA_LIBRARY NAMES ${_lua_library_names} lua HINTS diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index dd700e3..ff2c4de 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -113,9 +113,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) # # Start out with the generic MPI compiler names, as these are most commonly used. -set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r) +set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r mpicc.bat) set(_MPI_CXX_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++ - mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r) + mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r + mpicxx.bat) set(_MPI_Fortran_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r mpif90 mpif90_r mpf90 mpf90_r mpif77 mpif77_r mpf77 mpf77_r) @@ -127,9 +128,9 @@ set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpig77 mpig77_r mpg77 mpg77_r) # Intel MPI compiler names -set(_MPI_Intel_C_COMPILER_NAMES mpiicc) -set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC) -set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77) +set(_MPI_Intel_C_COMPILER_NAMES mpiicc mpiicc.bat) +set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC mpiicpc.bat) +set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77 mpiifort.bat) # PGI compiler names set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc) @@ -328,6 +329,8 @@ function (interrogate_mpi_compiler lang try_libs) foreach(IPATH ${MPI_ALL_INCLUDE_PATHS}) string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH}) string(REPLACE "//" "/" IPATH ${IPATH}) + string(REPLACE "\"" "" IPATH ${IPATH}) + file(TO_CMAKE_PATH "${IPATH}" IPATH) list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH}) endforeach() diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 8b7131b..1958f4b 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -585,10 +585,13 @@ endmacro() 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}) # check cached value - if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) + if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND OR NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0};${ARGN}") _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} "${_prefix}" ${_pkg_modules}) _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) + if (${_prefix}_FOUND) + _pkgconfig_set(__pkg_config_arguments_${_prefix} "${_module0};${ARGN}") + endif() elseif (${_prefix}_FOUND AND ${_imp_target}) _pkg_create_imp_target("${_prefix}" _no_cmake_path _no_cmake_environment_path) endif() diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index 3899a2d..893a96f 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -348,7 +348,8 @@ function(FortranCInterface_VERIFY) try_compile(FortranCInterface_VERIFY_${lang}_COMPILED ${FortranCInterface_BINARY_DIR}/Verify${lang} ${FortranCInterface_SOURCE_DIR}/Verify - VerifyFortranC + VerifyFortranC # project name + VerifyFortranC # target name CMAKE_FLAGS -DVERIFY_CXX=${verify_cxx} -DCMAKE_VERBOSE_MAKEFILE=ON "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}" diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 9984efd..7612890 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -30,7 +30,8 @@ set(_result) try_compile(FortranCInterface_COMPILED ${FortranCInterface_BINARY_DIR} ${FortranCInterface_SOURCE_DIR} - FortranCInterface + FortranCInterface # project name + FortranCInterface # target name CMAKE_FLAGS "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}" "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake index 8755d4f..cf2785a 100644 --- a/Modules/Platform/Android-Common.cmake +++ b/Modules/Platform/Android-Common.cmake @@ -149,4 +149,13 @@ macro(__android_compiler_common lang) if("x${lang}" STREQUAL "xCXX") __android_stl(CXX) endif() + + # <ndk>/build/core/definitions.mk appends the sysroot's include directory + # explicitly at the end of the command-line include path so that it + # precedes the toolchain's builtin include directories. This is + # necessary so that Android API-version-specific headers are preferred + # over those in the toolchain's `include-fixed` directory (which cannot + # possibly match all versions). + list(APPEND CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_SYSROOT}/usr/include") + list(REMOVE_ITEM CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include") endmacro() diff --git a/Modules/Platform/Android/ndk-stl-c++.cmake b/Modules/Platform/Android/ndk-stl-c++.cmake index b27015d..a12411c 100644 --- a/Modules/Platform/Android/ndk-stl-c++.cmake +++ b/Modules/Platform/Android/ndk-stl-c++.cmake @@ -6,16 +6,15 @@ macro(__android_stl_cxx lang filename) if(EXISTS "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include/cstddef") # r12 and below __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include" 1) + __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0) __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/libcxxabi/include" 1) else() # r13 and above __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/include" 1) + __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0) __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/include" 1) endif() - # Add a secondary include directory if it exists. - __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0) - # Add the library file. __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/${filename}" 1) endmacro() diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 0279d1c..0478918 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -439,7 +439,7 @@ macro(QT4_CREATE_TRANSLATION _qm_files) get_filename_component(_abs_include "${_pro_include}" ABSOLUTE) string(APPEND _pro_includes " \\\n \"${_abs_include}\"") endforeach() - file(WRITE ${_ts_pro} "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n") + file(GENERATE OUTPUT ${_ts_pro} CONTENT "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n") endif() add_custom_command(OUTPUT ${_ts_file} COMMAND Qt4::lupdate diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index ba249e1..0b16aa4 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -20,6 +20,8 @@ # [VERSION <version>] # [PROLOG <prolog>] # [EPILOG <epilog>] +# [ALLOW_UNKNOWN_COMPILERS] +# [ALLOW_UNKNOWN_COMPILER_VERSIONS] # ) # # The ``write_compiler_detection_header`` function generates the @@ -81,6 +83,11 @@ # See the :manual:`cmake-compile-features(7)` manual for information on # compile features. # +# ``ALLOW_UNKNOWN_COMPILERS`` and ``ALLOW_UNKNOWN_COMPILER_VERSIONS`` cause +# the module to generate conditions that treat unknown compilers as simply +# lacking all features. Without these options the default behavior is to +# generate a ``#error`` for unknown compilers. +# # Feature Test Macros # =================== # @@ -232,6 +239,19 @@ function(_load_compiler_variables CompilerId lang) set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE) endfunction() +macro(_simpledefine FEATURE_NAME FEATURE_TESTNAME FEATURE_STRING FEATURE_DEFAULT_STRING) + if (feature STREQUAL "${FEATURE_NAME}") + set(def_value "${prefix_arg}_${FEATURE_TESTNAME}") + string(APPEND file_content " +# if defined(${def_name}) && ${def_name} +# define ${def_value} ${FEATURE_STRING} +# else +# define ${def_value} ${FEATURE_DEFAULT_STRING} +# endif +\n") + endif() +endmacro() + function(write_compiler_detection_header file_keyword file_arg prefix_keyword prefix_arg @@ -242,7 +262,7 @@ function(write_compiler_detection_header if (NOT "x${prefix_keyword}" STREQUAL "xPREFIX") message(FATAL_ERROR "write_compiler_detection_header: PREFIX parameter missing.") endif() - set(options) + set(options ALLOW_UNKNOWN_COMPILERS ALLOW_UNKNOWN_COMPILER_VERSIONS) set(oneValueArgs VERSION EPILOG PROLOG OUTPUT_FILES_VAR OUTPUT_DIR) set(multiValueArgs COMPILERS FEATURES) cmake_parse_arguments(_WCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -426,10 +446,12 @@ function(write_compiler_detection_header set(compiler_file_content file_content) endif() - set(${compiler_file_content} "${${compiler_file_content}} + if(NOT _WCD_ALLOW_UNKNOWN_COMPILER_VERSIONS) + set(${compiler_file_content} "${${compiler_file_content}} # if !(${_cmake_oldestSupported_${compiler}}) # error Unsupported compiler version # endif\n") + endif() set(PREFIX ${prefix_arg}_) if (_need_hex_conversion) @@ -460,67 +482,36 @@ function(write_compiler_detection_header endforeach() endforeach() if(pp_if STREQUAL "elif") - string(APPEND file_content " + if(_WCD_ALLOW_UNKNOWN_COMPILERS) + string(APPEND file_content " +# endif\n") + else() + string(APPEND file_content " # else # error Unsupported compiler # endif\n") + endif() endif() foreach(feature ${${_lang}_features}) string(TOUPPER ${feature} feature_upper) set(feature_PP "COMPILER_${feature_upper}") set(def_name ${prefix_arg}_${feature_PP}) - if (feature STREQUAL c_restrict) - set(def_value "${prefix_arg}_RESTRICT") - string(APPEND file_content " -# if ${def_name} -# define ${def_value} restrict -# else -# define ${def_value} -# endif -\n") - endif() - if (feature STREQUAL cxx_constexpr) - set(def_value "${prefix_arg}_CONSTEXPR") - string(APPEND file_content " -# if ${def_name} -# define ${def_value} constexpr -# else -# define ${def_value} -# endif -\n") - endif() - if (feature STREQUAL cxx_final) - set(def_value "${prefix_arg}_FINAL") - string(APPEND file_content " -# if ${def_name} -# define ${def_value} final -# else -# define ${def_value} -# endif -\n") - endif() - if (feature STREQUAL cxx_override) - set(def_value "${prefix_arg}_OVERRIDE") - string(APPEND file_content " -# if ${def_name} -# define ${def_value} override -# else -# define ${def_value} -# endif -\n") - endif() + _simpledefine(c_restrict RESTRICT restrict "") + _simpledefine(cxx_constexpr CONSTEXPR constexpr "") + _simpledefine(cxx_final FINAL final "") + _simpledefine(cxx_override OVERRIDE override "") if (feature STREQUAL cxx_static_assert) set(def_value "${prefix_arg}_STATIC_ASSERT(X)") set(def_value_msg "${prefix_arg}_STATIC_ASSERT_MSG(X, MSG)") set(static_assert_struct "template<bool> struct ${prefix_arg}StaticAssert;\ntemplate<> struct ${prefix_arg}StaticAssert<true>{};\n") set(def_standard "# define ${def_value} static_assert(X, #X)\n# define ${def_value_msg} static_assert(X, MSG)") set(def_alternative "${static_assert_struct}# define ${def_value} sizeof(${prefix_arg}StaticAssert<X>)\n# define ${def_value_msg} sizeof(${prefix_arg}StaticAssert<X>)") - string(APPEND file_content "# if ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n") + string(APPEND file_content "# if defined(${def_name}) && ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n") endif() if (feature STREQUAL cxx_alignas) set(def_value "${prefix_arg}_ALIGNAS(X)") string(APPEND file_content " -# if ${def_name} +# if defined(${def_name}) && ${def_name} # define ${def_value} alignas(X) # elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang # define ${def_value} __attribute__ ((__aligned__(X))) @@ -534,7 +525,7 @@ function(write_compiler_detection_header if (feature STREQUAL cxx_alignof) set(def_value "${prefix_arg}_ALIGNOF(X)") string(APPEND file_content " -# if ${def_name} +# if defined(${def_name}) && ${def_name} # define ${def_value} alignof(X) # elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang # define ${def_value} __alignof__(X) @@ -543,30 +534,12 @@ function(write_compiler_detection_header # endif \n") endif() - if (feature STREQUAL cxx_deleted_functions) - set(def_value "${prefix_arg}_DELETED_FUNCTION") - string(APPEND file_content " -# if ${def_name} -# define ${def_value} = delete -# else -# define ${def_value} -# endif -\n") - endif() - if (feature STREQUAL cxx_extern_templates) - set(def_value "${prefix_arg}_EXTERN_TEMPLATE") - string(APPEND file_content " -# if ${def_name} -# define ${def_value} extern -# else -# define ${def_value} -# endif -\n") - endif() + _simpledefine(cxx_deleted_functions DELETED_FUNCTION "= delete" "") + _simpledefine(cxx_extern_templates EXTERN_TEMPLATE extern "") if (feature STREQUAL cxx_noexcept) set(def_value "${prefix_arg}_NOEXCEPT") string(APPEND file_content " -# if ${def_name} +# if defined(${def_name}) && ${def_name} # define ${def_value} noexcept # define ${def_value}_EXPR(X) noexcept(X) # else @@ -575,20 +548,11 @@ function(write_compiler_detection_header # endif \n") endif() - if (feature STREQUAL cxx_nullptr) - set(def_value "${prefix_arg}_NULLPTR") - string(APPEND file_content " -# if ${def_name} -# define ${def_value} nullptr -# else -# define ${def_value} 0 -# endif -\n") - endif() + _simpledefine(cxx_nullptr NULLPTR nullptr 0) if (feature STREQUAL cxx_thread_local) set(def_value "${prefix_arg}_THREAD_LOCAL") string(APPEND file_content " -# if ${def_name} +# if defined(${def_name}) && ${def_name} # define ${def_value} thread_local # elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang # define ${def_value} __thread @@ -604,7 +568,7 @@ function(write_compiler_detection_header set(def_value "${prefix_arg}_DEPRECATED") string(APPEND file_content " # ifndef ${def_value} -# if ${def_name} +# if defined(${def_name}) && ${def_name} # define ${def_value} [[deprecated]] # define ${def_value}_MSG(MSG) [[deprecated(MSG)]] # elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cb3ba1c..8db6f58 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 7) -set(CMake_VERSION_PATCH 20170123) +set(CMake_VERSION_PATCH 20170206) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index c868a14..e23b1b9 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -62,6 +62,13 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct( } else if ((pos = dependence.find('>')) != std::string::npos) { Compare.Type = CompareGreater; Compare.Value = dependence.substr(pos + 1); + } else if ((pos = dependence.find('-')) != std::string::npos) { + Compare.Type = CompareNone; + Compare.Value = dependence.substr(pos + 1); + } + size_t dashPos = dependence.find('-'); + if (dashPos != std::string::npos) { + pos = dashPos; } Name = pos == std::string::npos ? dependence : dependence.substr(0, pos); } @@ -74,6 +81,10 @@ std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const std::string result = Name; + if (Compare.Type != CompareNone || !Compare.Value.empty()) { + result += "-"; + } + if (Compare.Type == CompareLessOrEqual) { result += "<="; } else if (Compare.Type == CompareGreaterOrEqual) { @@ -154,11 +165,14 @@ void cmCPackIFWPackage::DefaultConfiguration() Script = ""; Licenses.clear(); UserInterfaces.clear(); + Translations.clear(); SortingPriority = ""; + UpdateText = ""; Default = ""; Essential = ""; Virtual = ""; ForcedInstallation = ""; + RequiresAdminRights = ""; } // Defaul configuration (all in one package) @@ -245,24 +259,6 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) } } - // QtIFW dependencies - if (const char* option = this->GetOption(prefix + "DEPENDS")) { - std::vector<std::string> deps; - cmSystemTools::ExpandListArgument(option, deps); - for (std::vector<std::string>::iterator dit = deps.begin(); - dit != deps.end(); ++dit) { - DependenceStruct dep(*dit); - if (!Generator->Packages.count(dep.Name)) { - bool hasDep = Generator->DependentPackages.count(dep.Name) > 0; - DependenceStruct& depRef = Generator->DependentPackages[dep.Name]; - if (!hasDep) { - depRef = dep; - } - AlienDependencies.insert(&depRef); - } - } - } - // Licenses if (const char* option = this->GetOption(prefix + "LICENSES")) { Licenses.clear(); @@ -280,6 +276,11 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) // Priority if (const char* option = this->GetOption(prefix + "PRIORITY")) { SortingPriority = option; + cmCPackLogger( + cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set " + << "for component \"" << component->Name << "\", but there option is " + << "deprecated. Please use \"SORTING_PRIORITY\" option instead." + << std::endl); } // Default @@ -352,6 +353,12 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) // Priority if (const char* option = this->GetOption(prefix + "PRIORITY")) { SortingPriority = option; + cmCPackLogger( + cmCPackLog::LOG_WARNING, "The \"PRIORITY\" option is set " + << "for component group \"" << group->Name + << "\", but there option is " + << "deprecated. Please use \"SORTING_PRIORITY\" option instead." + << std::endl); } return ConfigureFromPrefix(prefix); @@ -420,6 +427,79 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) ReleaseDate = value; } + // Sorting priority + option = prefix + "SORTING_PRIORITY"; + if (IsSetToEmpty(option)) { + SortingPriority.clear(); + } else if (const char* value = GetOption(option)) { + SortingPriority = value; + } + + // Update text + option = prefix + "UPDATE_TEXT"; + if (IsSetToEmpty(option)) { + UpdateText.clear(); + } else if (const char* value = GetOption(option)) { + UpdateText = value; + } + + // Translations + option = prefix + "TRANSLATIONS"; + if (IsSetToEmpty(option)) { + Translations.clear(); + } else if (const char* value = this->GetOption(option)) { + Translations.clear(); + cmSystemTools::ExpandListArgument(value, Translations); + } + + // QtIFW dependencies + std::vector<std::string> deps; + option = prefix + "DEPENDS"; + if (const char* value = this->GetOption(option)) { + cmSystemTools::ExpandListArgument(value, deps); + } + option = prefix + "DEPENDENCIES"; + if (const char* value = this->GetOption(option)) { + cmSystemTools::ExpandListArgument(value, deps); + } + for (std::vector<std::string>::iterator dit = deps.begin(); + dit != deps.end(); ++dit) { + DependenceStruct dep(*dit); + if (Generator->Packages.count(dep.Name)) { + cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name]; + dep.Name = depPkg.Name; + } + bool hasDep = Generator->DependentPackages.count(dep.Name) > 0; + DependenceStruct& depRef = Generator->DependentPackages[dep.Name]; + if (!hasDep) { + depRef = dep; + } + AlienDependencies.insert(&depRef); + } + + // Automatic dependency on + option = prefix + "AUTO_DEPEND_ON"; + if (IsSetToEmpty(option)) { + AlienAutoDependOn.clear(); + } else if (const char* value = this->GetOption(option)) { + std::vector<std::string> depsOn; + cmSystemTools::ExpandListArgument(value, depsOn); + for (std::vector<std::string>::iterator dit = depsOn.begin(); + dit != depsOn.end(); ++dit) { + DependenceStruct dep(*dit); + if (Generator->Packages.count(dep.Name)) { + cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name]; + dep.Name = depPkg.Name; + } + bool hasDep = Generator->DependentPackages.count(dep.Name) > 0; + DependenceStruct& depRef = Generator->DependentPackages[dep.Name]; + if (!hasDep) { + depRef = dep; + } + AlienAutoDependOn.insert(&depRef); + } + } + // Visibility option = prefix + "VIRTUAL"; if (IsSetToEmpty(option)) { @@ -455,6 +535,16 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) ForcedInstallation = "false"; } + // Requires admin rights + option = prefix + "REQUIRES_ADMIN_RIGHTS"; + if (IsSetToEmpty(option)) { + RequiresAdminRights.clear(); + } else if (IsOn(option)) { + RequiresAdminRights = "true"; + } else if (IsSetToOff(option)) { + RequiresAdminRights = "false"; + } + return 1; } @@ -481,6 +571,12 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.Element("DisplayName", DisplayName); xout.Element("Description", Description); + + // Update text + if (!UpdateText.empty()) { + xout.Element("UpdateText", UpdateText); + } + xout.Element("Name", Name); xout.Element("Version", Version); @@ -515,6 +611,23 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.EndElement(); } + // Translations (copy to meta dir) + std::vector<std::string> translations = Translations; + for (size_t i = 0; i < translations.size(); i++) { + std::string name = cmSystemTools::GetFilenameName(translations[i]); + std::string path = Directory + "/meta/" + name; + cmsys::SystemTools::CopyFileIfDifferent(translations[i].data(), + path.data()); + translations[i] = name; + } + if (!translations.empty()) { + xout.StartElement("Translations"); + for (size_t i = 0; i < translations.size(); i++) { + xout.Element("Translation", translations[i]); + } + xout.EndElement(); + } + // Dependencies std::set<DependenceStruct> compDepSet; for (std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin(); @@ -538,6 +651,25 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.Element("Dependencies", dependencies.str()); } + // Automatic dependency on + std::set<DependenceStruct> compAutoDepSet; + for (std::set<DependenceStruct*>::iterator ait = AlienAutoDependOn.begin(); + ait != AlienAutoDependOn.end(); ++ait) { + compAutoDepSet.insert(*(*ait)); + } + // Write automatic dependency on + if (!compAutoDepSet.empty()) { + std::ostringstream dependencies; + std::set<DependenceStruct>::iterator it = compAutoDepSet.begin(); + dependencies << it->NameWithCompare(); + ++it; + while (it != compAutoDepSet.end()) { + dependencies << "," << it->NameWithCompare(); + ++it; + } + xout.Element("AutoDependOn", dependencies.str()); + } + // Licenses (copy to meta dir) std::vector<std::string> licenses = Licenses; for (size_t i = 1; i < licenses.size(); i += 2) { @@ -561,6 +693,10 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.Element("ForcedInstallation", ForcedInstallation); } + if (!RequiresAdminRights.empty()) { + xout.Element("RequiresAdminRights", RequiresAdminRights); + } + if (!Virtual.empty()) { xout.Element("Virtual", Virtual); } else if (!Default.empty()) { diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 76ed540..bd1d6c5 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -92,9 +92,15 @@ public: /// List of pages to load std::vector<std::string> UserInterfaces; + /// List of translation files to load + std::vector<std::string> Translations; + /// Priority of the component in the tree std::string SortingPriority; + /// Description added to the component description + std::string UpdateText; + /// Set to true to preselect the component in the installer std::string Default; @@ -107,6 +113,9 @@ public: /// Determines that the package must always be installed std::string ForcedInstallation; + /// Package needs to be installed with elevated permissions + std::string RequiresAdminRights; + public: // Internal implementation @@ -139,6 +148,8 @@ public: std::set<cmCPackIFWPackage*> Dependencies; // Collection of unresolved dependencies std::set<DependenceStruct*> AlienDependencies; + // Collection of unresolved automatic dependency on + std::set<DependenceStruct*> AlienAutoDependOn; // Patch to package directory std::string Directory; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index a062e64..620e237 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -607,9 +607,13 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterDynamicOptions.push_back("-E"); this->MemoryTesterDynamicOptions.push_back("env"); std::string envVar; - std::string extraOptions = ":" + - this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions"); + std::string extraOptions; std::string suppressionsOption; + if (!this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions") + .empty()) { + extraOptions = ":" + + this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions"); + } if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") .empty()) { suppressionsOption = ":suppressions=" + @@ -631,8 +635,10 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() cmCTestMemCheckHandler::UB_SANITIZER) { envVar = "UBSAN_OPTIONS"; } + // Quote log_path with single quotes; see + // https://bugs.chromium.org/p/chromium/issues/detail?id=467936 std::string outputFile = - envVar + "=log_path=\"" + this->MemoryTesterOutputFile + "\""; + envVar + "=log_path='" + this->MemoryTesterOutputFile + "'"; this->MemoryTesterEnvironmentVariable = outputFile + suppressionsOption + extraOptions; break; diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx index daf4bd1..6284ac9 100644 --- a/Source/QtDialog/AddCacheEntry.cxx +++ b/Source/QtDialog/AddCacheEntry.cxx @@ -46,7 +46,7 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames, QString AddCacheEntry::name() const { - return this->Name->text(); + return this->Name->text().trimmed(); } QVariant AddCacheEntry::value() const diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 398f95b..66202df 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -162,6 +162,27 @@ static const struct BoolNode : public cmGeneratorExpressionNode } } boolNode; +static const struct IfNode : public cmGeneratorExpressionNode +{ + IfNode() {} + + int NumExpectedParameters() const CM_OVERRIDE { return 3; } + + std::string Evaluate(const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + { + if (parameters[0] != "1" && parameters[0] != "0") { + reportError(context, content->GetOriginalExpression(), + "First parameter to $<IF> must resolve to exactly one '0' " + "or '1' value."); + return std::string(); + } + return parameters[0] == "1" ? parameters[1] : parameters[2]; + } +} ifNode; + static const struct StrEqualNode : public cmGeneratorExpressionNode { StrEqualNode() {} @@ -1757,6 +1778,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["UPPER_CASE"] = &upperCaseNode; nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; nodeMap["BOOL"] = &boolNode; + nodeMap["IF"] = &ifNode; nodeMap["ANGLE-R"] = &angle_rNode; nodeMap["COMMA"] = &commaNode; nodeMap["SEMICOLON"] = &semicolonNode; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b6db0d6..6ce8140 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -4419,9 +4419,10 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config, // The generator may add the configuration's subdirectory. if (!conf.empty()) { - bool iosPlatform = this->Makefile->PlatformIsAppleIos(); + bool useEPN = + this->GlobalGenerator->UseEffectivePlatformName(this->Makefile); std::string suffix = - usesDefaultOutputDir && iosPlatform ? "${EFFECTIVE_PLATFORM_NAME}" : ""; + usesDefaultOutputDir && useEPN ? "${EFFECTIVE_PLATFORM_NAME}" : ""; this->LocalGenerator->GetGlobalGenerator()->AppendDirectoryForConfig( "/", conf, suffix, out); } @@ -5307,7 +5308,8 @@ bool cmGeneratorTarget::IsLinkable() const bool cmGeneratorTarget::IsFrameworkOnApple() const { - return (this->GetType() == cmStateEnums::SHARED_LIBRARY && + return ((this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::STATIC_LIBRARY) && this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("FRAMEWORK")); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2808051..f118250 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2342,8 +2342,8 @@ void cmGlobalGenerator::AddGlobalTarget_Install( singleLine.push_back(cmd); if (cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.') { std::string cfgArg = "-DBUILD_TYPE="; - bool iosPlatform = mf->PlatformIsAppleIos(); - if (iosPlatform) { + bool useEPN = this->UseEffectivePlatformName(mf); + if (useEPN) { cfgArg += "$(CONFIGURATION)"; singleLine.push_back(cfgArg); cfgArg = "-DEFFECTIVE_PLATFORM_NAME=$(EFFECTIVE_PLATFORM_NAME)"; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 88ef8da..18e3730 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -333,6 +333,10 @@ public: virtual bool UseFolderProperty() const; + /** Return whether the generator should use EFFECTIVE_PLATFORM_NAME. This is + relevant for mixed macOS and iOS builds. */ + virtual bool UseEffectivePlatformName(cmMakefile*) const { return false; } + std::string GetSharedLibFlagsForLanguage(std::string const& lang) const; /** Generate an <output>.rule file path for a given command output. */ diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 5edb81f..cc2536c 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -856,6 +856,14 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( std::string objFile = obj_dir + map_it->second; objs.push_back(objFile); } + std::vector<cmSourceFile const*> externalObjectSources; + gt->GetExternalObjects(externalObjectSources, configName); + for (std::vector<cmSourceFile const*>::const_iterator it = + externalObjectSources.begin(); + it != externalObjectSources.end(); ++it) { + objs.push_back((*it)->GetFullPath()); + } + gt->UseObjectLibraries(objs, configName); for (std::vector<std::string>::iterator it = objs.begin(); it != objs.end(); ++it) { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 96535eb..8627cf2 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -22,6 +22,7 @@ #include "cmOutputConverter.h" #include "cmSourceFile.h" #include "cmSourceGroup.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -1815,8 +1816,34 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Handle settings for each target type. switch (gtgt->GetType()) { - case cmStateEnums::OBJECT_LIBRARY: - case cmStateEnums::STATIC_LIBRARY: { + case cmStateEnums::STATIC_LIBRARY: + if (gtgt->GetPropertyAsBool("FRAMEWORK")) { + std::string fw_version = gtgt->GetFrameworkVersion(); + buildSettings->AddAttribute("FRAMEWORK_VERSION", + this->CreateString(fw_version)); + const char* ext = gtgt->GetProperty("BUNDLE_EXTENSION"); + if (ext) { + buildSettings->AddAttribute("WRAPPER_EXTENSION", + this->CreateString(ext)); + } + + std::string plist = this->ComputeInfoPListLocation(gtgt); + // Xcode will create the final version of Info.plist at build time, + // so let it replace the framework name. This avoids creating + // a per-configuration Info.plist file. + this->CurrentLocalGenerator->GenerateFrameworkInfoPList( + gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); + buildSettings->AddAttribute("INFOPLIST_FILE", + this->CreateString(plist)); + buildSettings->AddAttribute("MACH_O_TYPE", + this->CreateString("staticlib")); + } else { + buildSettings->AddAttribute("LIBRARY_STYLE", + this->CreateString("STATIC")); + } + break; + + case cmStateEnums::OBJECT_LIBRARY: { buildSettings->AddAttribute("LIBRARY_STYLE", this->CreateString("STATIC")); break; @@ -2335,8 +2362,10 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType( switch (target->GetType()) { case cmStateEnums::OBJECT_LIBRARY: - case cmStateEnums::STATIC_LIBRARY: return "archive.ar"; + case cmStateEnums::STATIC_LIBRARY: + return (target->GetPropertyAsBool("FRAMEWORK") ? "wrapper.framework" + : "archive.ar"); case cmStateEnums::MODULE_LIBRARY: if (target->IsXCTestOnApple()) return "wrapper.cfbundle"; @@ -2366,8 +2395,11 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType( switch (target->GetType()) { case cmStateEnums::OBJECT_LIBRARY: - case cmStateEnums::STATIC_LIBRARY: return "com.apple.product-type.library.static"; + case cmStateEnums::STATIC_LIBRARY: + return (target->GetPropertyAsBool("FRAMEWORK") + ? "com.apple.product-type.framework" + : "com.apple.product-type.library.static"); case cmStateEnums::MODULE_LIBRARY: if (target->IsXCTestOnApple()) return "com.apple.product-type.bundle.unit-test"; @@ -3544,6 +3576,19 @@ bool cmGlobalXCodeGenerator::IsMultiConfig() const return true; } +bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const +{ + const char* epnValue = + this->GetCMakeInstance()->GetState()->GetGlobalProperty( + "XCODE_EMIT_EFFECTIVE_PLATFORM_NAME"); + + if (!epnValue) { + return mf->PlatformIsAppleIos(); + } + + return cmSystemTools::IsOn(epnValue); +} + void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory( cmGeneratorTarget* gt) const { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 42c39aa..1aaf9c7 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -86,6 +86,8 @@ public: i.e. "Can I build Debug and Release in the same tree?" */ bool IsMultiConfig() const CM_OVERRIDE; + bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE; + bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) CM_OVERRIDE; void AppendFlag(std::string& flags, std::string const& flag); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index fadebb4..4c331c7 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -471,17 +471,39 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) } } break; case cmStateEnums::STATIC_LIBRARY: { - // Static libraries use ARCHIVE properties. - if (!archiveArgs.GetDestination().empty()) { - archiveGenerator = - CreateInstallTargetGenerator(target, archiveArgs, false); + // If it is marked with FRAMEWORK property use the FRAMEWORK set of + // INSTALL properties. Otherwise, use the LIBRARY properties. + if (target.IsFrameworkOnApple()) { + // When in namelink only mode skip frameworks. + if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + continue; + } + + // Use the FRAMEWORK properties. + if (!frameworkArgs.GetDestination().empty()) { + frameworkGenerator = + CreateInstallTargetGenerator(target, frameworkArgs, false); + } else { + std::ostringstream e; + e << "TARGETS given no FRAMEWORK DESTINATION for static library " + "FRAMEWORK target \"" + << target.GetName() << "\"."; + this->SetError(e.str()); + return false; + } } else { - std::ostringstream e; - e << "TARGETS given no ARCHIVE DESTINATION for static library " - "target \"" - << target.GetName() << "\"."; - this->SetError(e.str()); - return false; + // Static libraries use ARCHIVE properties. + if (!archiveArgs.GetDestination().empty()) { + archiveGenerator = + CreateInstallTargetGenerator(target, archiveArgs, false); + } else { + std::ostringstream e; + e << "TARGETS given no ARCHIVE DESTINATION for static library " + "target \"" + << target.GetName() << "\"."; + this->SetError(e.str()); + return false; + } } } break; case cmStateEnums::MODULE_LIBRARY: { diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 27b7c21..ff8b604 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -597,12 +597,26 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Clean files associated with this library. std::vector<std::string> libCleanFiles; libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath)); - if (targetNameReal != targetName) { + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal)); + + std::vector<std::string> commands1; + // Add a command to remove any existing files for this library. + // for static libs only + if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { + this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles, + this->GeneratorTarget, "target"); + this->LocalGenerator->CreateCDCommand( + commands1, this->Makefile->GetCurrentBinaryDirectory(), + this->LocalGenerator->GetBinaryDirectory()); + commands.insert(commands.end(), commands1.begin(), commands1.end()); + commands1.clear(); + } + + if (targetName != targetNameReal) { libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal)); + this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath)); } - if (targetNameSO != targetName && targetNameSO != targetNameReal) { + if (targetNameSO != targetNameReal && targetNameSO != targetName) { libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO)); } @@ -634,19 +648,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( } #endif - std::vector<std::string> commands1; - // Add a command to remove any existing files for this library. - // for static libs only - if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { - this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles, - this->GeneratorTarget, "target"); - this->LocalGenerator->CreateCDCommand( - commands1, this->Makefile->GetCurrentBinaryDirectory(), - this->LocalGenerator->GetBinaryDirectory()); - commands.insert(commands.end(), commands1.begin(), commands1.end()); - commands1.clear(); - } - // Add the pre-build and pre-link rules building but not when relinking. if (!relink) { this->LocalGenerator->AppendCustomCommands( diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 379ae16..866c132 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -631,7 +631,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( const char* iwyu = this->GeneratorTarget->GetProperty(iwyu_prop); std::string const tidy_prop = lang + "_CLANG_TIDY"; const char* tidy = this->GeneratorTarget->GetProperty(tidy_prop); - if ((iwyu && *iwyu) || (tidy && *tidy)) { + std::string const cpplint_prop = lang + "_CPPLINT"; + const char* cpplint = this->GeneratorTarget->GetProperty(cpplint_prop); + if ((iwyu && *iwyu) || (tidy && *tidy) || (cpplint && *cpplint)) { std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_iwyu"; if (iwyu && *iwyu) { run_iwyu += " --iwyu="; @@ -640,6 +642,12 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( if (tidy && *tidy) { run_iwyu += " --tidy="; run_iwyu += this->LocalGenerator->EscapeForShell(tidy); + } + if (cpplint && *cpplint) { + run_iwyu += " --cpplint="; + run_iwyu += this->LocalGenerator->EscapeForShell(cpplint); + } + if ((tidy && *tidy) || (cpplint && *cpplint)) { run_iwyu += " --source="; run_iwyu += sourceFile; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 8ad2efe..0b33b19 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -600,7 +600,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) const char* iwyu = this->GeneratorTarget->GetProperty(iwyu_prop); std::string const tidy_prop = lang + "_CLANG_TIDY"; const char* tidy = this->GeneratorTarget->GetProperty(tidy_prop); - if ((iwyu && *iwyu) || (tidy && *tidy)) { + std::string const cpplint_prop = lang + "_CPPLINT"; + const char* cpplint = this->GeneratorTarget->GetProperty(cpplint_prop); + if ((iwyu && *iwyu) || (tidy && *tidy) || (cpplint && *cpplint)) { std::string run_iwyu = this->GetLocalGenerator()->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); run_iwyu += " -E __run_iwyu"; @@ -611,6 +613,12 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) if (tidy && *tidy) { run_iwyu += " --tidy="; run_iwyu += this->GetLocalGenerator()->EscapeForShell(tidy); + } + if (cpplint && *cpplint) { + run_iwyu += " --cpplint="; + run_iwyu += this->GetLocalGenerator()->EscapeForShell(cpplint); + } + if ((tidy && *tidy) || (cpplint && *cpplint)) { run_iwyu += " --source=$in"; } run_iwyu += " -- "; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d825e5c..fe3472d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -255,6 +255,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("MACOSX_RPATH", CM_NULLPTR); this->SetPropertyDefault("C_CLANG_TIDY", CM_NULLPTR); this->SetPropertyDefault("C_COMPILER_LAUNCHER", CM_NULLPTR); + this->SetPropertyDefault("C_CPPLINT", CM_NULLPTR); this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", CM_NULLPTR); this->SetPropertyDefault("LINK_WHAT_YOU_USE", CM_NULLPTR); this->SetPropertyDefault("C_STANDARD", CM_NULLPTR); @@ -262,6 +263,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("C_EXTENSIONS", CM_NULLPTR); this->SetPropertyDefault("CXX_CLANG_TIDY", CM_NULLPTR); this->SetPropertyDefault("CXX_COMPILER_LAUNCHER", CM_NULLPTR); + this->SetPropertyDefault("CXX_CPPLINT", CM_NULLPTR); this->SetPropertyDefault("CXX_INCLUDE_WHAT_YOU_USE", CM_NULLPTR); this->SetPropertyDefault("CXX_STANDARD", CM_NULLPTR); this->SetPropertyDefault("CXX_STANDARD_REQUIRED", CM_NULLPTR); @@ -449,7 +451,8 @@ bool cmTarget::HasImportLibrary() const bool cmTarget::IsFrameworkOnApple() const { - return (this->GetType() == cmStateEnums::SHARED_LIBRARY && + return ((this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::STATIC_LIBRARY) && this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("FRAMEWORK")); } diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 4a97114..3d42e26 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -5,6 +5,7 @@ #include <cmConfigure.h> #include <cstring> #include <sstream> +#include <stdlib.h> #include "cmSystemTools.h" @@ -12,6 +13,16 @@ std::string cmTimestamp::CurrentTime(const std::string& formatString, bool utcFlag) { time_t currentTimeT = time(CM_NULLPTR); + std::string source_date_epoch; + cmSystemTools::GetEnv("SOURCE_DATE_EPOCH", source_date_epoch); + if (!source_date_epoch.empty()) { + std::istringstream iss(source_date_epoch); + iss >> currentTimeT; + if (iss.fail() || !iss.eof()) { + cmSystemTools::Error("Cannot parse SOURCE_DATE_EPOCH as integer"); + exit(27); + } + } if (currentTimeT == time_t(-1)) { return std::string(); } @@ -125,6 +136,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag, case 'w': case 'y': case 'Y': + case '%': break; case 's': // Seconds since UNIX epoch (midnight 1-jan-1970) { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 89380eb..2e6c19b 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -610,30 +610,91 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() this->GeneratorTarget->GetResxSources(resxObjs, ""); if (!resxObjs.empty()) { this->WriteString("<ItemGroup>\n", 1); + std::string srcDir = this->Makefile->GetCurrentSourceDirectory(); + this->ConvertToWindowsSlash(srcDir); for (std::vector<cmSourceFile const*>::const_iterator oi = resxObjs.begin(); oi != resxObjs.end(); ++oi) { std::string obj = (*oi)->GetFullPath(); this->WriteString("<EmbeddedResource Include=\"", 2); this->ConvertToWindowsSlash(obj); + bool useRelativePath = false; + if (csproj == this->ProjectType && this->InSourceBuild) { + // If we do an in-source build and the resource file is in a + // subdirectory + // of the .csproj file, we have to use relative pathnames, otherwise + // visual studio does not show the file in the IDE. Sorry. + if (obj.find(srcDir) == 0) { + obj = this->ConvertPath(obj, true); + this->ConvertToWindowsSlash(obj); + useRelativePath = true; + } + } (*this->BuildFileStream) << obj << "\">\n"; - this->WriteString("<DependentUpon>", 3); - std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h"; - (*this->BuildFileStream) << hFileName << "</DependentUpon>\n"; - - for (std::vector<std::string>::const_iterator i = - this->Configurations.begin(); - i != this->Configurations.end(); ++i) { - this->WritePlatformConfigTag("LogicalName", i->c_str(), 3); - if (this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE") || - // Handle variant of VS_GLOBAL_<variable> for RootNamespace. - this->GeneratorTarget->GetProperty("VS_GLOBAL_RootNamespace")) { - (*this->BuildFileStream) << "$(RootNamespace)."; + if (csproj != this->ProjectType) { + this->WriteString("<DependentUpon>", 3); + std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h"; + (*this->BuildFileStream) << hFileName << "</DependentUpon>\n"; + + for (std::vector<std::string>::const_iterator i = + this->Configurations.begin(); + i != this->Configurations.end(); ++i) { + this->WritePlatformConfigTag("LogicalName", i->c_str(), 3); + if (this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE") || + // Handle variant of VS_GLOBAL_<variable> for RootNamespace. + this->GeneratorTarget->GetProperty("VS_GLOBAL_RootNamespace")) { + (*this->BuildFileStream) << "$(RootNamespace)."; + } + (*this->BuildFileStream) << "%(Filename)"; + (*this->BuildFileStream) << ".resources"; + (*this->BuildFileStream) << "</LogicalName>\n"; + } + } else { + std::string binDir = this->Makefile->GetCurrentBinaryDirectory(); + this->ConvertToWindowsSlash(binDir); + // If the resource was NOT added using a relative path (which should + // be the default), we have to provide a link here + if (!useRelativePath) { + std::string link; + if (obj.find(srcDir) == 0) { + link = obj.substr(srcDir.length() + 1); + } else if (obj.find(binDir) == 0) { + link = obj.substr(binDir.length() + 1); + } else { + link = cmsys::SystemTools::GetFilenameName(obj); + } + if (!link.empty()) { + this->WriteString("<Link>", 3); + (*this->BuildFileStream) << link << "</Link>\n"; + } + } + // Determine if this is a generated resource from a .Designer.cs file + std::string designerResource = + cmSystemTools::GetFilenamePath((*oi)->GetFullPath()) + "/" + + cmSystemTools::GetFilenameWithoutLastExtension( + (*oi)->GetFullPath()) + + ".Designer.cs"; + if (cmsys::SystemTools::FileExists(designerResource)) { + std::string generator = "PublicResXFileCodeGenerator"; + if (const char* g = (*oi)->GetProperty("VS_RESOURCE_GENERATOR")) { + generator = g; + } + this->WriteString("<Generator>", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(generator) + << "</Generator>\n"; + if (designerResource.find(srcDir) == 0) { + designerResource = designerResource.substr(srcDir.length() + 1); + } else if (designerResource.find(binDir) == 0) { + designerResource = designerResource.substr(binDir.length() + 1); + } else { + designerResource = + cmsys::SystemTools::GetFilenameName(designerResource); + } + this->ConvertToWindowsSlash(designerResource); + this->WriteString("<LastGenOutput>", 3); + (*this->BuildFileStream) << designerResource << "</LastGenOutput>\n"; } - (*this->BuildFileStream) << "%(Filename)"; - (*this->BuildFileStream) << ".resources"; - (*this->BuildFileStream) << "</LogicalName>\n"; } this->WriteString("</EmbeddedResource>\n", 2); @@ -661,6 +722,24 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup() } this->WriteSource(xamlType, *oi, ">\n"); + if (csproj == this->ProjectType && !this->InSourceBuild) { + // add <Link> tag to written XAML source if necessary + const std::string srcDir = this->Makefile->GetCurrentSourceDirectory(); + const std::string binDir = this->Makefile->GetCurrentBinaryDirectory(); + std::string link; + if (obj.find(srcDir) == 0) { + link = obj.substr(srcDir.length() + 1); + } else if (obj.find(binDir) == 0) { + link = obj.substr(binDir.length() + 1); + } else { + link = cmsys::SystemTools::GetFilenameName(obj); + } + if (!link.empty()) { + this->ConvertToWindowsSlash(link); + this->WriteString("<Link>", 3); + (*this->BuildFileStream) << link << "</Link>\n"; + } + } this->WriteString("<SubType>Designer</SubType>\n", 3); this->WriteString("</", 2); (*this->BuildFileStream) << xamlType << ">\n"; @@ -1348,7 +1427,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) std::string shaderEntryPoint; std::string shaderModel; std::string shaderAdditionalFlags; + std::string settingsGenerator; + std::string settingsLastGenOutput; std::string sourceLink; + std::string subType; + std::string copyToOutDir; + std::string includeInVsix; std::string ext = cmSystemTools::LowerCase(sf->GetExtension()); if (csproj == this->ProjectType) { // EVERY extra source file must have a <Link>, otherwise it might not @@ -1405,6 +1489,28 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) tool = "XML"; } else if (ext == "natvis") { tool = "Natvis"; + } else if (ext == "settings") { + // remove path to current source dir (if files are in current source dir) + if (!sourceLink.empty()) { + settingsLastGenOutput = sourceLink; + } else { + settingsLastGenOutput = sf->GetFullPath(); + } + std::size_t pos = settingsLastGenOutput.find(".settings"); + settingsLastGenOutput.replace(pos, 9, ".Designer.cs"); + settingsGenerator = "SettingsSingleFileGenerator"; + toolHasSettings = true; + } else if (ext == "vsixmanifest") { + subType = "Designer"; + } + if (const char* c = sf->GetProperty("VS_COPY_TO_OUT_DIR")) { + copyToOutDir = c; + toolHasSettings = true; + } + if (sf->GetPropertyAsBool("VS_INCLUDE_IN_VSIX")) { + includeInVsix = "True"; + tool = "Content"; + toolHasSettings = true; } if (this->NsightTegra) { @@ -1495,10 +1601,35 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) (*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags) << "</AdditionalOptions>\n"; } + if (!settingsGenerator.empty()) { + this->WriteString("<Generator>", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(settingsGenerator) + << "</Generator>\n"; + } + if (!settingsLastGenOutput.empty()) { + this->WriteString("<LastGenOutput>", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(settingsLastGenOutput) + << "</LastGenOutput>\n"; + } if (!sourceLink.empty()) { this->WriteString("<Link>", 3); (*this->BuildFileStream) << cmVS10EscapeXML(sourceLink) << "</Link>\n"; } + if (!subType.empty()) { + this->WriteString("<SubType>", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(subType) << "</SubType>\n"; + } + if (!copyToOutDir.empty()) { + this->WriteString("<CopyToOutputDirectory>", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(copyToOutDir) + << "</CopyToOutputDirectory>\n"; + } + if (!includeInVsix.empty()) { + this->WriteString("<IncludeInVSIX>", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(includeInVsix) + << "</IncludeInVSIX>\n"; + } + this->WriteString("</", 2); (*this->BuildFileStream) << tool << ">\n"; } else { @@ -1540,12 +1671,6 @@ void cmVisualStudio10TargetGenerator::WriteSource(std::string const& tool, this->GlobalGenerator->PathTooLong(this->GeneratorTarget, sf, sourceRel); } } - if (csproj == this->ProjectType && this->InSourceBuild) { - std::string srcdir = this->Makefile->GetCurrentSourceDirectory(); - if (sourceFile.find(srcdir) != std::string::npos) { - sourceFile = sourceFile.substr(srcdir.size() + 1); - } - } this->ConvertToWindowsSlash(sourceFile); this->WriteString("<", 2); (*this->BuildFileStream) << tool << " Include=\"" @@ -1815,9 +1940,43 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( sourceFileTags["Link"] = link; } } - // - // NOTE: in future commits additional props will be added! - // + // check if file is a generated .Designer.cs or .xaml.cs file + // to add additional necessary tags + const std::string fileExtension = + cmsys::SystemTools::GetFilenameExtension(f); + if (fileExtension == ".Designer.cs" || fileExtension == ".xaml.cs") { + f = f.substr(0, f.length() - fileExtension.length()); + if (sourceFileTags.find("Link") == sourceFileTags.end() && + !this->InSourceBuild) { + // add link fallback + sourceFileTags["Link"] = + cmsys::SystemTools::GetFilenameName(f) + fileExtension; + } + std::vector<std::string> extensions; + extensions.push_back(".resx"); + extensions.push_back(".settings"); + extensions.push_back(".xaml"); + extensions.push_back(".cs"); + std::string dependencyExtension; + for (std::vector<std::string>::iterator i = extensions.begin(); + i != extensions.end(); ++i) { + if (cmsys::SystemTools::FileExists(f + *i)) { + dependencyExtension = *i; + // There should never be more than one match. Otherwise + // one cannot tell on which match the file depends. + break; + } + } + if (dependencyExtension == ".resx") { + sourceFileTags["DesignTime"] = "True"; + sourceFileTags["AutoGen"] = "True"; + } else if (dependencyExtension == ".settings") { + sourceFileTags["DesignTimeSharedInput"] = "True"; + sourceFileTags["AutoGen"] = "True"; + } + sourceFileTags["DependentUpon"] = + cmsys::SystemTools::GetFilenameName(f) + dependencyExtension; + } // write source file specific tags if (!sourceFileTags.empty()) { hasFlags = true; @@ -1825,7 +1984,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( firstString = ""; for (CsPropMap::const_iterator i = sourceFileTags.begin(); i != sourceFileTags.end(); ++i) { - this->WriteString("<", 2); + this->WriteString("<", 3); (*this->BuildFileStream) << i->first << ">" << cmVS10EscapeXML(i->second) << "</" << i->first << ">\n"; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 5b12a75..823b38f 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -276,7 +276,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) if (args[1] == "__run_iwyu") { if (args.size() < 3) { std::cerr << "__run_iwyu Usage: -E __run_iwyu [--iwyu=/path/iwyu]" - " [--tidy=/path/tidy] -- compile command\n"; + " [--cpplint=/path/cpplint] [--tidy=/path/tidy]" + " -- compile command\n"; return 1; } bool doing_options = true; @@ -285,6 +286,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) std::string tidy; std::string sourceFile; std::string lwyu; + std::string cpplint; for (std::string::size_type cc = 2; cc < args.size(); cc++) { std::string const& arg = args[cc]; if (arg == "--") { @@ -297,6 +299,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) sourceFile = arg.substr(9); } else if (doing_options && cmHasLiteralPrefix(arg, "--lwyu=")) { lwyu = arg.substr(7); + } else if (doing_options && cmHasLiteralPrefix(arg, "--cpplint=")) { + cpplint = arg.substr(10); } else if (doing_options) { std::cerr << "__run_iwyu given unknown argument: " << arg << "\n"; return 1; @@ -304,12 +308,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) orig_cmd.push_back(arg); } } - if (tidy.empty() && iwyu.empty() && lwyu.empty()) { - std::cerr << "__run_iwyu missing --tidy= or --iwyu=\n"; + if (tidy.empty() && iwyu.empty() && lwyu.empty() && cpplint.empty()) { + std::cerr << "__run_iwyu missing --cpplint=, --iwyu=, --lwyu=, and/or" + " --tidy=\n"; return 1; } - if (!tidy.empty() && sourceFile.empty()) { - std::cerr << "__run_iwyu --tidy= requires --source=\n"; + if ((!cpplint.empty() || !tidy.empty()) && sourceFile.empty()) { + std::cerr << "__run_iwyu --cpplint= and/or __run_iwyu --tidy=" + " require --source=\n"; return 1; } if (orig_cmd.empty() && lwyu.empty()) { @@ -403,6 +409,32 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) std::cerr << "Warning: " << stdOut; } } + + if (!cpplint.empty()) { + // Construct the cpplint command line. + std::vector<std::string> cpplint_cmd; + cmSystemTools::ExpandListArgument(cpplint, cpplint_cmd, true); + cpplint_cmd.push_back(sourceFile); + + // Run the cpplint command line. Capture its output. + std::string stdOut; + if (!cmSystemTools::RunSingleCommand(cpplint_cmd, &stdOut, &stdOut, + &ret, CM_NULLPTR, + cmSystemTools::OUTPUT_NONE)) { + std::cerr << "Error running '" << cpplint_cmd[0] << "': " << stdOut + << "\n"; + return 1; + } + + // Output the output from cpplint to stderr + std::cerr << stdOut; + + // If cpplint exited with an error do the same. + if (ret != 0) { + return ret; + } + } + ret = 0; // Now run the real compiler command and return its result value. if (lwyu.empty() && diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index 3e0afa5..ecf6fa1 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -1,21 +1,26 @@ -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> +#include <ctype.h> /* NOLINT */ +#include <stdio.h> /* NOLINT */ +#include <stdlib.h> /* NOLINT */ +#include <string.h> /* NOLINT */ #if defined(_MSC_VER) -# pragma warning(disable:4996) /* deprecation */ +#pragma warning(disable : 4996) /* deprecation */ #endif @CMAKE_TESTDRIVER_EXTRA_INCLUDES@ - /* Forward declare test functions. */ @CMAKE_FORWARD_DECLARE_TESTS@ +#ifdef __cplusplus +#define CM_CAST(TYPE, EXPR) static_cast<TYPE>(EXPR) +#else +#define CM_CAST(TYPE, EXPR) (TYPE)(EXPR) +#endif + /* Create map. */ -typedef int (*MainFuncPointer)(int , char*[]); +typedef int (*MainFuncPointer)(int, char* []); typedef struct { const char* name; @@ -24,143 +29,108 @@ typedef struct static functionMapEntry cmakeGeneratedFunctionMapEntries[] = { @CMAKE_FUNCTION_TABLE_ENTIRES@ - {0,0} + { NULL, NULL } /* NOLINT */ }; +static const int NumTests = + (sizeof(cmakeGeneratedFunctionMapEntries) / sizeof(functionMapEntry)) - 1; + /* Allocate and create a lowercased copy of string (note that it has to be free'd manually) */ - -static char* lowercase(const char *string) +static char* lowercase(const char* string) { char *new_string, *p; size_t stringSize = 0; -#ifdef __cplusplus - stringSize = static_cast<size_t>(strlen(string) + 1); - new_string = static_cast<char *>(malloc(sizeof(char) * stringSize)); -#else - stringSize = (size_t)(strlen(string) + 1); - new_string = (char *)(malloc(sizeof(char) * stringSize)); -#endif + stringSize = CM_CAST(size_t, strlen(string) + 1); + new_string = CM_CAST(char*, malloc(sizeof(char) * stringSize)); - if (!new_string) - { - return 0; - } + if (new_string == NULL) { /* NOLINT */ + return NULL; /* NOLINT */ + } strncpy(new_string, string, stringSize); - p = new_string; - while (*p != 0) - { -#ifdef __cplusplus - *p = static_cast<char>(tolower(*p)); -#else - *p = (char)(tolower(*p)); -#endif - - ++p; - } + for (p = new_string; *p != 0; ++p) { + *p = CM_CAST(char, tolower(*p)); + } return new_string; } -int main(int ac, char *av[]) +int main(int ac, char* av[]) { - int i, NumTests, testNum = 0, partial_match; + int i, testNum = 0, partial_match; char *arg, *test_name; - int count; int testToRun = -1; @CMAKE_TESTDRIVER_ARGVC_FUNCTION@ - for(count =0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++) - { - } - NumTests = count; /* If no test name was given */ /* process command line with user function. */ - if (ac < 2) - { + if (ac < 2) { /* Ask for a test. */ printf("Available tests:\n"); - for (i =0; i < NumTests; ++i) - { + for (i = 0; i < NumTests; ++i) { printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name); - } + } printf("To run a test, enter the test number: "); fflush(stdout); - if( scanf("%d", &testNum) != 1 ) - { + if (scanf("%d", &testNum) != 1) { printf("Couldn't parse that input as a number\n"); return -1; - } - if (testNum >= NumTests) - { + } + if (testNum >= NumTests) { printf("%3d is an invalid test number.\n", testNum); return -1; - } + } testToRun = testNum; ac--; av++; - } + } partial_match = 0; - arg = 0; + arg = NULL; /* NOLINT */ /* If partial match is requested. */ - if(testToRun == -1 && ac > 1) - { + if (testToRun == -1 && ac > 1) { partial_match = (strcmp(av[1], "-R") == 0) ? 1 : 0; - } - if (partial_match && ac < 3) - { + } + if (partial_match != 0 && ac < 3) { printf("-R needs an additional parameter.\n"); return -1; - } - if(testToRun == -1) - { + } + if (testToRun == -1) { arg = lowercase(av[1 + partial_match]); - } - for (i =0; i < NumTests && testToRun == -1; ++i) - { + } + for (i = 0; i < NumTests && testToRun == -1; ++i) { test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name); - if (partial_match && strstr(test_name, arg) != NULL) - { + if (partial_match != 0 && strstr(test_name, arg) != NULL) { /* NOLINT */ testToRun = i; - ac -=2; + ac -= 2; av += 2; - } - else if (!partial_match && strcmp(test_name, arg) == 0) - { + } else if (partial_match == 0 && strcmp(test_name, arg) == 0) { testToRun = i; ac--; av++; - } - free(test_name); - } - if(arg) - { - free(arg); } - if(testToRun != -1) - { + free(test_name); + } + free(arg); + if (testToRun != -1) { int result; @CMAKE_TESTDRIVER_BEFORE_TESTMAIN@ - if (testToRun < 0 || testToRun >= NumTests) - { - printf( - "testToRun was modified by TestDriver code to an invalid value: %3d.\n", - testNum); + if (testToRun < 0 || testToRun >= NumTests) { + printf("testToRun was modified by TestDriver code to an invalid value: " + "%3d.\n", + testNum); return -1; - } + } result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av); @CMAKE_TESTDRIVER_AFTER_TESTMAIN@ return result; - } - + } /* Nothing was run, display the test names. */ printf("Available tests:\n"); - for (i =0; i < NumTests; ++i) - { + for (i = 0; i < NumTests; ++i) { printf("%3d. %s\n", i, cmakeGeneratedFunctionMapEntries[i].name); - } + } printf("Failed: %s is an invalid test name.\n", av[1]); return -1; diff --git a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt index 9b35f27..555a08f 100644 --- a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt @@ -26,7 +26,7 @@ if (CMAKE_C_COMPILE_FEATURES) target_link_libraries(restrict_user lib_restrict) endif() -if (CMAKE_CXX_COMPILE_FEATURES) +if (CMAKE_CXX_COMPILE_FEATURES AND ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;") if (CMAKE_C_COMPILE_FEATURES) set(target_suffix _cxx) endif() diff --git a/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake b/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake index d0e5fe3..f1aa390 100644 --- a/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake +++ b/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake @@ -1,6 +1,7 @@ set(STAMP_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/FileTimestamp-Stamp") set(STAMP_FORMAT "%Y-%m-%d") +unset(ENV{SOURCE_DATE_EPOCH}) string(TIMESTAMP timestamp1 "${STAMP_FORMAT}") file(WRITE "${STAMP_FILENAME}" "foo") diff --git a/Tests/CTestTestStopTime/GetDate.cmake b/Tests/CTestTestStopTime/GetDate.cmake index 1f4cb24..46ab2fb 100644 --- a/Tests/CTestTestStopTime/GetDate.cmake +++ b/Tests/CTestTestStopTime/GetDate.cmake @@ -49,6 +49,7 @@ macro(GET_DATE) # 01/12/2006 08:55:12 # mm/dd/YYYY HH:MM:SS # + unset(ENV{SOURCE_DATE_EPOCH}) string(TIMESTAMP "${GD_PREFIX}OV" "%m/%d/%Y %H:%M:%S") if(${GD_PREFIX}VERBOSE) diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 0405def..2a307d0 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -3,14 +3,6 @@ cmake_minimum_required(VERSION 3.1) project(CompileFeatures) -if (NOT CMAKE_C_COMPILE_FEATURES AND NOT CMAKE_CXX_COMPILE_FEATURES) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" - "int main(int,char**) { return 0; }\n" - ) - add_executable(CompileFeatures "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") - return() -endif() - macro(run_test feature lang) if (";${CMAKE_${lang}_COMPILE_FEATURES};" MATCHES ${feature}) add_library(test_${feature} OBJECT ${feature}) @@ -275,7 +267,16 @@ if (CMAKE_CXX_COMPILE_FEATURES) ) endif() endif() +endif () +# always add a target "CompileFeatures" +if (NOT ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_auto_type;") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" + "int main(int,char**) { return 0; }\n" + ) + add_executable(CompileFeatures "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") +else() + # these tests only work if at least cxx_auto_type is available add_executable(CompileFeatures main.cpp) set_property(TARGET CompileFeatures PROPERTY COMPILE_FEATURES "cxx_auto_type" diff --git a/Tests/Framework/CMakeLists.txt b/Tests/Framework/CMakeLists.txt index 271aaf1..a313c2c 100644 --- a/Tests/Framework/CMakeLists.txt +++ b/Tests/Framework/CMakeLists.txt @@ -57,29 +57,30 @@ add_custom_target(fooCustom ALL COMMAND ${CMAKE_COMMAND} -E copy foo-post-build add_dependencies(fooCustom foo) # Make a static library and apply the framework properties to it to verify -# that everything still builds correctly, but it will not actually produce -# a framework... The framework properties only apply when the library type -# is SHARED. +# that everything still builds correctly. Xcode prior to version 5 does not +# support static Frameworks. # -add_library(fooStatic STATIC - foo.cxx - foo.h - foo2.h - fooExtensionlessResource - fooPublic.h - fooPublicExtensionlessHeader - fooPrivate.h - fooPrivateExtensionlessHeader - fooNeither.h - fooBoth.h - test.lua - fooDeepPublic.h -) -set_target_properties(fooStatic PROPERTIES - FRAMEWORK TRUE - FRAMEWORK_VERSION none -) -add_executable(barStatic bar.cxx) -target_link_libraries(barStatic fooStatic) +if(NOT XCODE OR NOT XCODE_VERSION VERSION_LESS 5) + add_library(fooStatic STATIC + foo.cxx + foo.h + foo2.h + fooExtensionlessResource + fooPublic.h + fooPublicExtensionlessHeader + fooPrivate.h + fooPrivateExtensionlessHeader + fooNeither.h + fooBoth.h + test.lua + fooDeepPublic.h + ) + set_target_properties(fooStatic PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION none + ) + add_executable(barStatic bar.cxx) + target_link_libraries(barStatic fooStatic) +endif() include(CPack) diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index f0d6abf..adc87cd 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -145,13 +145,13 @@ add_library(imported1 SHARED IMPORTED) set_property(TARGET imported1 PROPERTY IMPORTED_LOCATION_RELEASE release_loc) set_property(TARGET imported1 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) set_property(TARGET imported1 PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) -set_property(TARGET imported1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES /imported1/include) +set_property(TARGET imported1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/imported1/include/with space") add_library(imported2 SHARED IMPORTED) set_property(TARGET imported2 PROPERTY IMPORTED_LOCATION_RELEASE release_loc) set_property(TARGET imported2 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) set_property(TARGET imported2 PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) -set_property(TARGET imported2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES /imported2/include) +set_property(TARGET imported2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/imported2/include/with space") add_library(imported3 SHARED IMPORTED) set_property(TARGET imported3 PROPERTY IMPORTED_LOCATION_RELEASE release_loc) @@ -161,6 +161,10 @@ set_property(TARGET imported3 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:DEBUG>:$<TARGET_PROPERTY:imported1,INTERFACE_INCLUDE_DIRECTORIES>>) set_property(TARGET imported3 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:RELEASE>:$<TARGET_PROPERTY:imported2,INTERFACE_INCLUDE_DIRECTORIES>>) +set_property(TARGET imported3 APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:RELWITHDEBINFO>:$<TARGET_PROPERTY:imported2,INTERFACE_INCLUDE_DIRECTORIES>>) +set_property(TARGET imported3 APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:MINSIZEREL>:$<TARGET_PROPERTY:imported2,INTERFACE_INCLUDE_DIRECTORIES>>) add_library(imported4 SHARED IMPORTED) set_property(TARGET imported4 APPEND PROPERTY @@ -187,10 +191,7 @@ add_custom_target(check-part3 ALL -Dtest_version_equal_1=$<VERSION_EQUAL:1.0.1,1.1> -Dtest_version_equal_2=$<VERSION_EQUAL:1.1,1.1> -Dconfig=$<CONFIGURATION> - -Dtest_imported_debug=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> - -Dtest_imported_release=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> - -Dtest_imported_relwithdebinfo=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> - -Dtest_imported_minsizerel=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> + -Dtest_imported_includes=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES> -Dtest_imported_fallback=$<STREQUAL:$<TARGET_FILE_NAME:importedFallback>,fallback_loc> -Dtest_alias_file_exe=$<STREQUAL:$<TARGET_FILE:Alias::SomeExe>,$<TARGET_FILE:someexe>> -Dtest_alias_file_lib=$<STREQUAL:$<TARGET_FILE:Alias::SomeLib>,$<TARGET_FILE:empty1>> @@ -246,6 +247,10 @@ add_custom_target(check-part4 ALL # CMake as command-line argument -Dtest_shell_path=${path_prefix}$<SHELL_PATH:${test_shell_path}> -Dpath_prefix=${path_prefix} + -Dif_1=$<IF:1,a,b> + -Dif_2=$<IF:0,a,b> + -Dif_3=$<IF:$<EQUAL:10,30>,a,b> + -Dif_4=$<IF:$<EQUAL:30,30>,a,b> -DWIN32=${WIN32} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part4.cmake diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index e12d8c6..9014406 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -8,18 +8,15 @@ check(test_version_less_2 "1") check(test_version_equal_1 "0") check(test_version_equal_2 "1") -foreach(c debug release relwithdebinfo minsizerel) - if(config AND NOT config STREQUAL NoConfig) - if(NOT "${test_imported_${c}}" MATCHES "^;/imported2/include$" - AND NOT "${test_imported_${c}}" MATCHES "^/imported1/include;$") - message(SEND_ERROR "test_imported_${c} is not correct: ${test_imported_${c}}") - endif() - else() - if(NOT "${test_imported_${c}}" MATCHES "^;$") - message(SEND_ERROR "test_imported_${c} is not an empty list: ${test_imported_${c}}") - endif() +if(config AND NOT config STREQUAL NoConfig) + if(NOT "${test_imported_includes}" MATCHES "^;*/imported[12]/include/with space;*$") + message(SEND_ERROR "test_imported_includes is not correct: ${test_imported_includes}") endif() -endforeach() +else() + if(NOT "${test_imported_includes}" MATCHES "^;;;$") + message(SEND_ERROR "test_imported_includes is not an empty list: ${test_imported_includes}") + endif() +endif() check(test_imported_fallback "1") diff --git a/Tests/GeneratorExpression/check-part4.cmake b/Tests/GeneratorExpression/check-part4.cmake index 9e516d5..f5d14dd 100644 --- a/Tests/GeneratorExpression/check-part4.cmake +++ b/Tests/GeneratorExpression/check-part4.cmake @@ -13,3 +13,8 @@ if(WIN32) else() check(test_shell_path [[/shell/path]]) endif() + +check(if_1 "a") +check(if_2 "b") +check(if_3 "b") +check(if_4 "a") diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index 8b251d7..2657aeb 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -4,6 +4,7 @@ project(WriteCompilerDetectionHeader) set(CMAKE_INCLUDE_CURRENT_DIR ON) include(WriteCompilerDetectionHeader) +include(CheckCXXSourceCompiles) get_property(cxx_known_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) get_property(c_known_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES) @@ -19,14 +20,78 @@ write_compiler_detection_header( ${cxx_known_features} ${c_known_features} ) -if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES) +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/multi_file_compiler_detection.h" + PREFIX MULTI + OUTPUT_FILES_VAR multi_files + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/compiler_support" + COMPILERS GNU Clang AppleClang MSVC SunPro Intel + VERSION 3.1 + FEATURES + ${cxx_known_features} ${c_known_features} +) + +macro(set_defines target true_defs false_defs) + set(defines) + foreach(def ${true_defs}) + list(APPEND defines ${def}=1) + endforeach() + foreach(def ${false_defs}) + list(APPEND defines ${def}=0) + endforeach() + target_compile_definitions(${target} + PRIVATE + ${defines} + EXPECTED_COMPILER_VERSION_MAJOR=${COMPILER_VERSION_MAJOR} + EXPECTED_COMPILER_VERSION_MINOR=${COMPILER_VERSION_MINOR} + EXPECTED_COMPILER_VERSION_PATCH=${COMPILER_VERSION_PATCH} + ) +endmacro() + +if (CMAKE_C_COMPILE_FEATURES) + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_C_COMPILER_VERSION}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_C_COMPILER_VERSION}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_C_COMPILER_VERSION}") + + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" + OR CMAKE_C_COMPILER_ID STREQUAL "Clang" + OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang" + OR CMAKE_C_COMPILER_ID STREQUAL "Intel") + add_executable(WriteCompilerDetectionHeader_C11 main.c) + set_property(TARGET WriteCompilerDetectionHeader_C11 PROPERTY C_STANDARD 11) + set_defines(WriteCompilerDetectionHeader_C11 "EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES;EXPECTED_COMPILER_C_RESTRICT" "") + + add_executable(WriteCompilerDetectionHeader_C11_multi main_multi.c) + set_property(TARGET WriteCompilerDetectionHeader_C11_multi PROPERTY C_STANDARD 11) + set_defines(WriteCompilerDetectionHeader_C11_multi "EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES;EXPECTED_COMPILER_C_RESTRICT" "") + target_include_directories(WriteCompilerDetectionHeader_C11_multi PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files) + + add_executable(C_undefined c_undefined.c) + set_property(TARGET C_undefined PROPERTY C_STANDARD 90) + include(CheckCCompilerFlag) + check_c_compiler_flag(-Werror=undef use_error_undef) + if (use_error_undef) + target_compile_options(C_undefined PRIVATE -Werror=undef) + endif() + + add_executable(WriteCompilerDetectionHeader_C main.c) + set_property(TARGET WriteCompilerDetectionHeader_C PROPERTY C_STANDARD 90) + set_defines(WriteCompilerDetectionHeader_C "EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES" "EXPECTED_COMPILER_C_RESTRICT") + + add_executable(WriteCompilerDetectionHeader_C_multi main_multi.c) + set_property(TARGET WriteCompilerDetectionHeader_C_multi PROPERTY C_STANDARD 90) + set_defines(WriteCompilerDetectionHeader_C_multi "EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES" "EXPECTED_COMPILER_C_RESTRICT") + target_include_directories(WriteCompilerDetectionHeader_C_multi PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files) + endif() +endif() + +if (NOT CMAKE_CXX_COMPILE_FEATURES) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp" "int main(int,char**) { return 0; }\n" ) add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp") if(UNIX OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - include(CheckCXXSourceCompiles) check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n" file_include_works ) @@ -41,23 +106,6 @@ string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJO string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}") string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_CXX_COMPILER_VERSION}") -macro(set_defines target true_defs false_defs) - set(defines) - foreach(def ${true_defs}) - list(APPEND defines ${def}=1) - endforeach() - foreach(def ${false_defs}) - list(APPEND defines ${def}=0) - endforeach() - target_compile_definitions(${target} - PRIVATE - ${defines} - EXPECTED_COMPILER_VERSION_MAJOR=${COMPILER_VERSION_MAJOR} - EXPECTED_COMPILER_VERSION_MINOR=${COMPILER_VERSION_MINOR} - EXPECTED_COMPILER_VERSION_PATCH=${COMPILER_VERSION_PATCH} - ) -endmacro() - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" @@ -79,40 +127,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") endif() endif() -if (CMAKE_C_COMPILER_ID STREQUAL "GNU" - OR CMAKE_C_COMPILER_ID STREQUAL "Clang" - OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_C_COMPILER_ID STREQUAL "Intel") - - add_executable(C_undefined c_undefined.c) - set_property(TARGET C_undefined PROPERTY C_STANDARD 90) - target_compile_options(C_undefined PRIVATE -Werror=undef) - - add_executable(WriteCompilerDetectionHeader_C main.c) - set_property(TARGET WriteCompilerDetectionHeader_C PROPERTY C_STANDARD 90) - set_defines(WriteCompilerDetectionHeader_C "EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES" "EXPECTED_COMPILER_C_RESTRICT") - - add_executable(WriteCompilerDetectionHeader_C_multi main_multi.c) - set_property(TARGET WriteCompilerDetectionHeader_C_multi PROPERTY C_STANDARD 90) - set_defines(WriteCompilerDetectionHeader_C_multi "EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES" "EXPECTED_COMPILER_C_RESTRICT") - target_include_directories(WriteCompilerDetectionHeader_C_multi PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files) -endif() - add_executable(WriteCompilerDetectionHeader main.cpp) set_property(TARGET WriteCompilerDetectionHeader PROPERTY CXX_STANDARD 98) set_defines(WriteCompilerDetectionHeader "${true_defs}" "${false_defs}") -write_compiler_detection_header( - FILE "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/multi_file_compiler_detection.h" - PREFIX MULTI - OUTPUT_FILES_VAR multi_files - OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/compiler_support" - COMPILERS GNU Clang AppleClang MSVC SunPro Intel - VERSION 3.1 - FEATURES - ${cxx_known_features} ${c_known_features} -) - add_executable(multi_files multi_files.cpp) set_property(TARGET multi_files PROPERTY CXX_STANDARD 98) target_include_directories(multi_files PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files) @@ -143,16 +161,30 @@ set_property(TARGET multi_files_11 PROPERTY CXX_STANDARD 11) target_include_directories(multi_files_11 PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files) set_defines(multi_files_11 "${true_defs}" "${false_defs}") -if (CMAKE_C_COMPILER_ID STREQUAL "GNU" - OR CMAKE_C_COMPILER_ID STREQUAL "Clang" - OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang" - OR CMAKE_C_COMPILER_ID STREQUAL "Intel") - add_executable(WriteCompilerDetectionHeader_C11 main.c) - set_property(TARGET WriteCompilerDetectionHeader_C11 PROPERTY C_STANDARD 11) - set_defines(WriteCompilerDetectionHeader_C11 "EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES;EXPECTED_COMPILER_C_RESTRICT" "") - - add_executable(WriteCompilerDetectionHeader_C11_multi main_multi.c) - set_property(TARGET WriteCompilerDetectionHeader_C11_multi PROPERTY C_STANDARD 11) - set_defines(WriteCompilerDetectionHeader_C11_multi "EXPECTED_COMPILER_C_FUNCTION_PROTOTYPES;EXPECTED_COMPILER_C_RESTRICT" "") - target_include_directories(WriteCompilerDetectionHeader_C11_multi PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files) +# test for ALLOW_UNKNOWN_COMPILERS + +# use a compiler does not match the current one, +# so one always hits the fallback code +if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") + set(OTHER_CXX "Intel") +else() + set(OTHER_CXX "SunPro") +endif() + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection_allow_unknown.h" + PREFIX TEST + COMPILERS ${OTHER_CXX} + FEATURES cxx_nullptr + ALLOW_UNKNOWN_COMPILERS +) + +# intentionally abuse the TEST_NULLPR variable: this will only work +# with the fallback code. +check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection_allow_unknown.h\" +int main() {\n int i = TEST_NULLPTR;\n return 0; }\n" + file_include_works_allow_unknown +) +if (NOT file_include_works_allow_unknown) + message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection_allow_unknown.h was expected to work, but did not.") endif() diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index 15f0338..807a427 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -214,18 +214,24 @@ set(FILE_PATH "${Preprocess_SOURCE_DIR}/file_def.h") set(TARGET_PATH "${Preprocess_SOURCE_DIR}/target_def.h") # Set some definition properties. -foreach(c "" "_DEBUG" "_RELEASE") +foreach(c "" "_DEBUG" "_RELEASE" "_RELWITHDEBINFO" "_MINSIZEREL") + set(FLAVOR "${c}") + # Treat RelWithDebInfo and MinSizeRel as Release to avoid having + # an exponentional matrix of inclusions and exclusions of defines + if("${c}" STREQUAL "_RELWITHDEBINFO" OR "${c}" STREQUAL "_MINSIZEREL") + set(FLAVOR "_RELEASE") + endif() set_property( DIRECTORY . - APPEND PROPERTY COMPILE_DEFINITIONS${c} "DIRECTORY_DEF${c}" + APPEND PROPERTY COMPILE_DEFINITIONS${c} "DIRECTORY_DEF${FLAVOR}" ) set_property( TARGET Preprocess - PROPERTY COMPILE_DEFINITIONS${c} "TARGET_DEF${c}" + PROPERTY COMPILE_DEFINITIONS${c} "TARGET_DEF${FLAVOR}" ) set_property( SOURCE preprocess.c preprocess.cxx - PROPERTY COMPILE_DEFINITIONS${c} "FILE_DEF${c}" + PROPERTY COMPILE_DEFINITIONS${c} "FILE_DEF${FLAVOR}" ) endforeach() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d2465c4..63016f1 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -255,6 +255,11 @@ if(PKG_CONFIG_FOUND) add_RunCMake_test(FindPkgConfig) endif() +find_package(GTK2 QUIET) +if (GTK2_FOUND) + add_RunCMake_test(FindGTK2) +endif() + if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") add_RunCMake_test(include_external_msproject) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([789]|10)" AND NOT CMAKE_VS_DEVENV_COMMAND) @@ -271,8 +276,7 @@ if(XCODE_VERSION AND NOT "${XCODE_VERSION}" VERSION_LESS 3) add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION}) endif() -if(NOT XCODE - AND CMAKE_C_COMPILER_ID STREQUAL "AppleClang" +if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) add_RunCMake_test(Framework) endif() @@ -340,12 +344,14 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") endif() add_executable(pseudo_tidy pseudo_tidy.c) add_executable(pseudo_iwyu pseudo_iwyu.c) + add_executable(pseudo_cpplint pseudo_cpplint.c) add_RunCMake_test(ClangTidy -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>) add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>) + add_RunCMake_test(Cpplint -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>) add_RunCMake_test(CompilerLauncher) endif() -add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP") +add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index ebaf792..65399db 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -16,7 +16,7 @@ run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT") run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT") -run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP" false "MONOLITHIC;COMPONENT") +run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT") run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT") diff --git a/Tests/RunCMake/CPack/STGZ/Helpers.cmake b/Tests/RunCMake/CPack/STGZ/Helpers.cmake new file mode 100644 index 0000000..08224d3 --- /dev/null +++ b/Tests/RunCMake/CPack/STGZ/Helpers.cmake @@ -0,0 +1,64 @@ +set(ALL_FILES_GLOB "*.sh") + +function(getPackageContent FILE RESULT_VAR) + get_filename_component(path_ "${FILE}" DIRECTORY) + file(REMOVE_RECURSE "${path_}/content") + file(MAKE_DIRECTORY "${path_}/content") + execute_process(COMMAND ${FILE} --prefix=${path_}/content --include-subdir + RESULT_VARIABLE extract_result_ + ERROR_VARIABLE extract_error_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(extract_result_) + message(FATAL_ERROR "Extracting STGZ archive failed: '${extract_result_}';" + " '${extract_error_}'.") + endif() + + file(GLOB_RECURSE package_content_ LIST_DIRECTORIES true RELATIVE + "${path_}/content" "${path_}/content/*") + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() + +function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR) + if(COMPONENT) + set(COMPONENT "-${COMPONENT}") + endif() + + set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.sh" PARENT_SCOPE) +endfunction() + +function(getPackageContentList FILE RESULT_VAR) + getPackageContent("${FILE}" package_content_) + + set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) +endfunction() + +function(toExpectedContentList FILE_NO CONTENT_VAR) + findExpectedFile("${FILE_NO}" "file_") + + get_filename_component(prefix_ "${file_}" NAME) + # NAME_WE removes everything after the dot and dot is in version so replace instead + string(REPLACE ".sh" "" prefix_ "${prefix_}") + + if(NOT PACKAGING_TYPE STREQUAL "MONOLITHIC") + # STGZ packages don't have component dir prefix in subdir + string(FIND "${prefix_}" "-" pos_ REVERSE) + string(SUBSTRING "${prefix_}" 0 ${pos_} prefix_) + endif() + + if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH) + set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr") + endif() + + set(filtered_ "${prefix_}") + foreach(part_ IN LISTS ${CONTENT_VAR}) + string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}") + + if(part_) + list(APPEND filtered_ "${prefix_}/${part_}") + endif() + endforeach() + + set(${CONTENT_VAR} "${filtered_}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/STGZ/Prerequirements.cmake b/Tests/RunCMake/CPack/STGZ/Prerequirements.cmake new file mode 100644 index 0000000..3b015ca --- /dev/null +++ b/Tests/RunCMake/CPack/STGZ/Prerequirements.cmake @@ -0,0 +1,11 @@ +function(get_test_prerequirements found_var config_file) + if(EXISTS "/bin/sh") + #gunzip is not part of posix so we should not rely on it being installed + find_program(GUNZIP_EXECUTABLE gunzip) + + if(GUNZIP_EXECUTABLE) + file(WRITE "${config_file}" "") + set(${found_var} true PARENT_SCOPE) + endif() + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/STGZ/packaging_COMPONENT_default.cmake b/Tests/RunCMake/CPack/STGZ/packaging_COMPONENT_default.cmake new file mode 100644 index 0000000..81a5035 --- /dev/null +++ b/Tests/RunCMake/CPack/STGZ/packaging_COMPONENT_default.cmake @@ -0,0 +1 @@ +set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt b/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt index 0d0d899..35f50b7 100644 --- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt +++ b/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt @@ -1 +1 @@ -^__run_iwyu missing --tidy= or --iwyu=$ +^__run_iwyu missing --cpplint=, --iwyu=, --lwyu=, and/or --tidy=$ diff --git a/Tests/RunCMake/Cpplint/C-Build-stdout.txt b/Tests/RunCMake/Cpplint/C-Build-stdout.txt new file mode 100644 index 0000000..6a22b79 --- /dev/null +++ b/Tests/RunCMake/Cpplint/C-Build-stdout.txt @@ -0,0 +1 @@ +Total errors found: 0 diff --git a/Tests/RunCMake/Cpplint/C-error-Build-result.txt b/Tests/RunCMake/Cpplint/C-error-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/Cpplint/C-error-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/Cpplint/C-error-Build-stdout.txt b/Tests/RunCMake/Cpplint/C-error-Build-stdout.txt new file mode 100644 index 0000000..3e7a1e9 --- /dev/null +++ b/Tests/RunCMake/Cpplint/C-error-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]Cpplint[/\]main\.c:0: message \[category/category\] \[0\] diff --git a/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt b/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/Cpplint/C-error-launch-Build-stdout.txt b/Tests/RunCMake/Cpplint/C-error-launch-Build-stdout.txt new file mode 100644 index 0000000..3e7a1e9 --- /dev/null +++ b/Tests/RunCMake/Cpplint/C-error-launch-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]Cpplint[/\]main\.c:0: message \[category/category\] \[0\] diff --git a/Tests/RunCMake/Cpplint/C-error-launch.cmake b/Tests/RunCMake/Cpplint/C-error-launch.cmake new file mode 100644 index 0000000..c76e2e2 --- /dev/null +++ b/Tests/RunCMake/Cpplint/C-error-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C-error.cmake) diff --git a/Tests/RunCMake/Cpplint/C-error.cmake b/Tests/RunCMake/Cpplint/C-error.cmake new file mode 100644 index 0000000..29cf7ba --- /dev/null +++ b/Tests/RunCMake/Cpplint/C-error.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --error) +add_executable(main main.c) diff --git a/Tests/RunCMake/Cpplint/C-launch-Build-stdout.txt b/Tests/RunCMake/Cpplint/C-launch-Build-stdout.txt new file mode 100644 index 0000000..6a22b79 --- /dev/null +++ b/Tests/RunCMake/Cpplint/C-launch-Build-stdout.txt @@ -0,0 +1 @@ +Total errors found: 0 diff --git a/Tests/RunCMake/Cpplint/C-launch.cmake b/Tests/RunCMake/Cpplint/C-launch.cmake new file mode 100644 index 0000000..e66ca20 --- /dev/null +++ b/Tests/RunCMake/Cpplint/C-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C.cmake) diff --git a/Tests/RunCMake/Cpplint/C.cmake b/Tests/RunCMake/Cpplint/C.cmake new file mode 100644 index 0000000..68e6ff4 --- /dev/null +++ b/Tests/RunCMake/Cpplint/C.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --verbose=0 --linelength=80) +add_executable(main main.c) diff --git a/Tests/RunCMake/Cpplint/CMakeLists.txt b/Tests/RunCMake/Cpplint/CMakeLists.txt new file mode 100644 index 0000000..a640c56 --- /dev/null +++ b/Tests/RunCMake/Cpplint/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.7) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Cpplint/CXX-Build-stdout.txt b/Tests/RunCMake/Cpplint/CXX-Build-stdout.txt new file mode 100644 index 0000000..6a22b79 --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX-Build-stdout.txt @@ -0,0 +1 @@ +Total errors found: 0 diff --git a/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt b/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/Cpplint/CXX-error-Build-stdout.txt b/Tests/RunCMake/Cpplint/CXX-error-Build-stdout.txt new file mode 100644 index 0000000..028cd37 --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX-error-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]Cpplint[/\]main\.cxx:0: message \[category\/category\] \[0\] diff --git a/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/Cpplint/CXX-error-launch-Build-stdout.txt b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-stdout.txt new file mode 100644 index 0000000..028cd37 --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]Cpplint[/\]main\.cxx:0: message \[category\/category\] \[0\] diff --git a/Tests/RunCMake/Cpplint/CXX-error-launch.cmake b/Tests/RunCMake/Cpplint/CXX-error-launch.cmake new file mode 100644 index 0000000..72dcbe9 --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX-error-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX-error.cmake) diff --git a/Tests/RunCMake/Cpplint/CXX-error.cmake b/Tests/RunCMake/Cpplint/CXX-error.cmake new file mode 100644 index 0000000..ad66ff5 --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX-error.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +set(CMAKE_CXX_CPPLINT "${PSEUDO_CPPLINT}" --error) +add_executable(main main.cxx) diff --git a/Tests/RunCMake/Cpplint/CXX-launch-Build-stdout.txt b/Tests/RunCMake/Cpplint/CXX-launch-Build-stdout.txt new file mode 100644 index 0000000..6a22b79 --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX-launch-Build-stdout.txt @@ -0,0 +1 @@ +Total errors found: 0 diff --git a/Tests/RunCMake/Cpplint/CXX-launch.cmake b/Tests/RunCMake/Cpplint/CXX-launch.cmake new file mode 100644 index 0000000..3002c9d --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX.cmake) diff --git a/Tests/RunCMake/Cpplint/CXX.cmake b/Tests/RunCMake/Cpplint/CXX.cmake new file mode 100644 index 0000000..35f05ee --- /dev/null +++ b/Tests/RunCMake/Cpplint/CXX.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +set(CMAKE_CXX_CPPLINT "${PSEUDO_CPPLINT}" --verbose=0 --linelength=80) +add_executable(main main.cxx) diff --git a/Tests/RunCMake/Cpplint/RunCMakeTest.cmake b/Tests/RunCMake/Cpplint/RunCMakeTest.cmake new file mode 100644 index 0000000..5a8471e --- /dev/null +++ b/Tests/RunCMake/Cpplint/RunCMakeTest.cmake @@ -0,0 +1,26 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS "-DPSEUDO_CPPLINT=${PSEUDO_CPPLINT}") + +function(run_cpplint lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${lang}-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${lang}) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build .) +endfunction() + +run_cpplint(C) +run_cpplint(CXX) +run_cpplint(C-error) +run_cpplint(CXX-error) + +if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_cpplint(C-launch) + run_cpplint(CXX-launch) + run_cpplint(C-error-launch) + run_cpplint(CXX-error-launch) +endif() diff --git a/Tests/RunCMake/Cpplint/main.c b/Tests/RunCMake/Cpplint/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/Cpplint/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/Cpplint/main.cxx b/Tests/RunCMake/Cpplint/main.cxx new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/Cpplint/main.cxx @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt new file mode 100644 index 0000000..58f6125 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + Bad package property type OPTIONAL used in global property + FeatureSummary_DEFAULT_PKG_TYPE. Valid types are TYPE1, TYPE2 and TYPE3. + Either update FeatureSummary_DEFAULT_PKG_TYPE or add OPTIONAL to the + FeatureSummary_PKG_TYPES global property. +Call Stack \(most recent call first\): + .*/Modules/FeatureSummary\.cmake:[0-9]+. \(_FS_GET_FEATURE_SUMMARY\) + FeatureSummaryCustomBadDefault.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake new file mode 100644 index 0000000..7e2fd55 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake @@ -0,0 +1,8 @@ +include(FeatureSummary) +set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo) + +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt new file mode 100644 index 0000000..e37b9f5 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake + run. +Call Stack \(most recent call first\): + FeatureSummaryCustomRequired.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt new file mode 100644 index 0000000..ecca71f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt @@ -0,0 +1,17 @@ +-- The following TYPE3 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE2 packages have not been found: + + \* Bar + +-- The following TYPE3 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE3 packages have not been found: + + \* Bar + +-- Configuring incomplete, errors occurred! diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake new file mode 100644 index 0000000..11cf04c --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake @@ -0,0 +1,16 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3) +set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE3) +set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE2) + +find_package(Foo) +find_package(Bar) + +set_package_properties(Foo PROPERTIES TYPE TYPE3) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) + +set_package_properties(Bar PROPERTIES TYPE TYPE3) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt new file mode 100644 index 0000000..c9d8b4b --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake + run. +Call Stack \(most recent call first\): + FeatureSummaryCustomRequiredListA.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt new file mode 100644 index 0000000..b12d53a --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt @@ -0,0 +1,17 @@ +-- The following TYPE2 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE1 packages have not been found: + + \* Bar + +-- The following TYPE2 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE2 packages have not been found: + + \* Bar + +-- Configuring incomplete, errors occurred! diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake new file mode 100644 index 0000000..53111be --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake @@ -0,0 +1,16 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3) +set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE2 TYPE3) +set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE1) + +find_package(Foo) +find_package(Bar) + +set_package_properties(Foo PROPERTIES TYPE TYPE2) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) + +set_package_properties(Bar PROPERTIES TYPE TYPE2) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt new file mode 100644 index 0000000..8ef7a8d --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake + run. +Call Stack \(most recent call first\): + FeatureSummaryCustomRequiredListB.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt new file mode 100644 index 0000000..5f07173 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt @@ -0,0 +1,17 @@ +-- The following TYPE3 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE1 packages have not been found: + + \* Bar + +-- The following TYPE3 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE3 packages have not been found: + + \* Bar + +-- Configuring incomplete, errors occurred! diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake new file mode 100644 index 0000000..526b979 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake @@ -0,0 +1,16 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3) +set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE2 TYPE3) +set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE1) + +find_package(Foo) +find_package(Bar) + +set_package_properties(Foo PROPERTIES TYPE TYPE3) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) + +set_package_properties(Bar PROPERTIES TYPE TYPE3) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt new file mode 100644 index 0000000..a7f973b --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt @@ -0,0 +1,29 @@ +-- The following TYPE2 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE1 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE2 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE2 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE3 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE3 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following TYPE3 packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake new file mode 100644 index 0000000..34b0c1f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake @@ -0,0 +1,36 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3) +set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE3) +set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE2) + +find_package(Foo) + +# Type not set => TYPE2 +feature_summary(WHAT ALL) + +# TYPE1 > not set => TYPE1 +set_package_properties(Foo PROPERTIES TYPE TYPE1) +feature_summary(WHAT ALL) + +# TYPE2 > TYPE1 => TYPE2 +set_package_properties(Foo PROPERTIES TYPE TYPE2) +feature_summary(WHAT ALL) + +# TYPE1 < TYPE2 => TYPE2 +set_package_properties(Foo PROPERTIES TYPE TYPE2) +feature_summary(WHAT ALL) + +# TYPE3 > TYPE2 => TYPE3 +set_package_properties(Foo PROPERTIES TYPE TYPE3) +feature_summary(WHAT ALL) + +# TYPE2 < TYPE3 => TYPE3 +set_package_properties(Foo PROPERTIES TYPE TYPE2) +feature_summary(WHAT ALL) + +# TYPE1 < TYPE3 => TYPE3 +set_package_properties(Foo PROPERTIES TYPE TYPE1) +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stderr.txt new file mode 100644 index 0000000..214d74a --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake + run. +Call Stack \(most recent call first\): + FeatureSummaryFatalOnMissingRequiredPackages.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stdout.txt new file mode 100644 index 0000000..6bd6427 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages-stdout.txt @@ -0,0 +1,17 @@ +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have not been found: + + \* Bar + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have not been found: + + \* Bar + +-- Configuring incomplete, errors occurred! diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages.cmake new file mode 100644 index 0000000..9563186 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryFatalOnMissingRequiredPackages.cmake @@ -0,0 +1,12 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo) +find_package(Bar) + +set_package_properties(Foo PROPERTIES TYPE REQUIRED) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) + +set_package_properties(Bar PROPERTIES TYPE REQUIRED) +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages-stdout.txt new file mode 100644 index 0000000..58599e0 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages-stdout.txt @@ -0,0 +1,14 @@ +-- The following OPTIONAL packages have not been found: + + \* Baz + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have not been found: + + \* Bar + \* Baz + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages.cmake new file mode 100644 index 0000000..5cdb443 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryIncludeQuietPackages.cmake @@ -0,0 +1,11 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo QUIET) +find_package(Bar QUIET) +find_package(Baz) + +feature_summary(WHAT ALL) + +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryMultipleDepends-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryMultipleDepends-stdout.txt new file mode 100644 index 0000000..d5875e0 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryMultipleDepends-stdout.txt @@ -0,0 +1,10 @@ +-- The following features have been enabled: + + \* Bar, Bar\. + \* Baz, Baz\. + \* Goo, Goo\. + +-- The following features have been disabled: + + \* Foo, Foo\. + \* Fez, Fez\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryMultipleDepends.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryMultipleDepends.cmake new file mode 100644 index 0000000..f355ae7 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryMultipleDepends.cmake @@ -0,0 +1,12 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo "WITH_FOO;WITH_BAR" "Foo.") +add_feature_info(Bar "WITH_FOO;NOT WITH_BAR" "Bar.") +add_feature_info(Baz "WITH_FOO AND NOT WITH_BAR" "Baz.") +add_feature_info(Goo "WITH_FOO OR WITH_BAR" "Goo.") +add_feature_info(Fez "NOT WITH_FOO OR WITH_BAR" "Fez.") + +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose-stdout.txt new file mode 100644 index 0000000..78e4fe1 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose-stdout.txt @@ -0,0 +1,16 @@ +The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + Because everyone needs some Foo. + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + Because everyone needs some Foo. + Because Foo is better than Bar. + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose.cmake new file mode 100644 index 0000000..64735b6 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryPurpose.cmake @@ -0,0 +1,16 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo) + +# Purpose not set +feature_summary(WHAT ALL) + +# Purpose set once +set_package_properties(Foo PROPERTIES PURPOSE "Because everyone needs some Foo.") +feature_summary(WHAT ALL) + +# Purpose set twice +set_package_properties(Foo PROPERTIES PURPOSE "Because Foo is better than Bar.") +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryQuietOnEmpty-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryQuietOnEmpty-stdout.txt new file mode 100644 index 0000000..65e97e0 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryQuietOnEmpty-stdout.txt @@ -0,0 +1,5 @@ +-- Enabled features: + \* Foo, Foo\. + \* Bar, Bar\. + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryQuietOnEmpty.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryQuietOnEmpty.cmake new file mode 100644 index 0000000..8d1d007 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryQuietOnEmpty.cmake @@ -0,0 +1,14 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 1) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES + DESCRIPTION "Enabled features:" + QUIET_ON_EMPTY) +feature_summary(WHAT DISABLED_FEATURES + DESCRIPTION "Disabled features:" + QUIET_ON_EMPTY) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes-stdout.txt new file mode 100644 index 0000000..79bb1e3 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes-stdout.txt @@ -0,0 +1,45 @@ +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following RUNTIME packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following RECOMMENDED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following RECOMMENDED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following RECOMMENDED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following REQUIRED packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes.cmake new file mode 100644 index 0000000..09d1e7a --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryTypes.cmake @@ -0,0 +1,48 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo) + +# Type not set => OPTIONAL +feature_summary(WHAT ALL) + +# RUNTIME > not set => RUNTIME +set_package_properties(Foo PROPERTIES TYPE RUNTIME) +feature_summary(WHAT ALL) + +# OPTIONAL > RUNTIME => OPTIONAL +set_package_properties(Foo PROPERTIES TYPE OPTIONAL) +feature_summary(WHAT ALL) + +# RUNTIME < OPTIONAL => OPTIONAL +set_package_properties(Foo PROPERTIES TYPE OPTIONAL) +feature_summary(WHAT ALL) + +# RECOMMENDED > OPTIONAL => RECOMMENDED +set_package_properties(Foo PROPERTIES TYPE RECOMMENDED) +feature_summary(WHAT ALL) + +# OPTIONAL < RECOMMENDED => RECOMMENDED +set_package_properties(Foo PROPERTIES TYPE OPTIONAL) +feature_summary(WHAT ALL) + +# RUNTIME < RECOMMENDED => RECOMMENDED +set_package_properties(Foo PROPERTIES TYPE RUNTIME) +feature_summary(WHAT ALL) + +# REQUIRED > RECOMMENDED => REQUIRED +set_package_properties(Foo PROPERTIES TYPE REQUIRED) +feature_summary(WHAT ALL) + +# RECOMMENDED < REQUIRED => REQUIRED +set_package_properties(Foo PROPERTIES TYPE RECOMMENDED) +feature_summary(WHAT ALL) + +# OPTIONAL < REQUIRED => REQUIRED +set_package_properties(Foo PROPERTIES TYPE OPTIONAL) +feature_summary(WHAT ALL) + +# RUNTIME < REQUIRED => REQUIRED +set_package_properties(Foo PROPERTIES TYPE RUNTIME) +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription-stdout.txt new file mode 100644 index 0000000..6a55bdf --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription-stdout.txt @@ -0,0 +1,32 @@ +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have not been found: + + \* Bar + \* Baz + +-- The following OPTIONAL packages have been found: + + \* Foo, The Foo package, <https://foo.example/> + +-- The following OPTIONAL packages have not been found: + + \* Bar, <https://bar.net/> + \* Baz, A Baz package + +-- Warning: Property DESCRIPTION for package Foo already set to "The Foo package", overriding it with "A Foo package" +-- Warning: Property URL already set to "https://foo.example/", overriding it with "https://foo.net/" +-- Warning: Property URL already set to "https://bar.net/", overriding it with "https://bar.example/" +-- Warning: Property DESCRIPTION for package Baz already set to "A Baz package", overriding it with "The Baz package" +-- The following OPTIONAL packages have been found: + + \* Foo, A Foo package, <https://foo.net/> + +-- The following OPTIONAL packages have not been found: + + \* Bar, The Bar package, <https://bar.example/> + \* Baz, The Baz package, <https://baz.example/> + +-- Configuring done diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription.cmake new file mode 100644 index 0000000..77fcf28 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryURLDescription.cmake @@ -0,0 +1,28 @@ +include(FeatureSummary) + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +find_package(Foo) # URL and DESCRIPTION are set in the FindFoo.cmake file +find_package(Bar) # URL and DESCRIPTION are not set +find_package(Baz) # URL and DESCRIPTION are not set + +feature_summary(WHAT ALL) + +set_package_properties(Bar PROPERTIES URL "https://bar.net/") # URL and no DESCRIPTION +set_package_properties(Baz PROPERTIES DESCRIPTION "A Baz package") # DESCRIPTION and no URL +feature_summary(WHAT ALL) + +# Overwrite with the same value (no warning) +set_package_properties(Foo PROPERTIES URL "https://foo.example/" + DESCRIPTION "The Foo package") +set_package_properties(Bar PROPERTIES URL "https://bar.net/") +set_package_properties(Baz PROPERTIES DESCRIPTION "A Baz package") + +# Overwrite with different values (warnings) +set_package_properties(Foo PROPERTIES URL "https://foo.net/" + DESCRIPTION "A Foo package") # Overwrite URL and DESCRIPTION +set_package_properties(Bar PROPERTIES URL "https://bar.example/" + DESCRIPTION "The Bar package") # Overwrite URL and add DESCRIPTION +set_package_properties(Baz PROPERTIES URL "https://baz.example/" + DESCRIPTION "The Baz package") # Overwrite URL and add DESCRIPTION +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt index 9a3f023..f0631ae 100644 --- a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt @@ -1,7 +1,7 @@ -- The following features have been enabled: - \* Foo , Foo\. + \* Foo, Foo\. -- The following features have been disabled: - \* Bar , Bar\. + \* Bar, Bar\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt index 4d8f25f..f121417 100644 --- a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt @@ -1,7 +1,7 @@ -- The following features have been disabled: - \* Bar , Bar\. + \* Bar, Bar\. -- The following features have been enabled: - \* Foo , Foo\. + \* Foo, Foo\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce-stdout.txt index 39be105..8b4cd43 100644 --- a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce-stdout.txt +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce-stdout.txt @@ -1,4 +1,4 @@ --( ) - \* Foo , Foo decscription\. + \* Foo, Foo description\. + -- diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce.cmake index 545fb92..eaea40e 100644 --- a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce.cmake +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatOnce.cmake @@ -2,7 +2,7 @@ include(FeatureSummary) set(WITH_FOO 1) -add_feature_info(Foo WITH_FOO "Foo decscription.") -add_feature_info(Foo WITH_FOO "Foo decscription.") +add_feature_info(Foo WITH_FOO "Foo description.") +add_feature_info(Foo WITH_FOO "Foo description.") feature_summary(WHAT ENABLED_FEATURES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt index 240632d..7485df9 100644 --- a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt @@ -1 +1 @@ - \* Foo , Foo\. + \* Foo, Foo\. diff --git a/Tests/RunCMake/FeatureSummary/FindBar.cmake b/Tests/RunCMake/FeatureSummary/FindBar.cmake new file mode 100644 index 0000000..45f4d54 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FindBar.cmake @@ -0,0 +1,2 @@ +include(FeatureSummary) +set(Bar_FOUND 0) diff --git a/Tests/RunCMake/FeatureSummary/FindBaz.cmake b/Tests/RunCMake/FeatureSummary/FindBaz.cmake new file mode 100644 index 0000000..73aafcd --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FindBaz.cmake @@ -0,0 +1,2 @@ +include(FeatureSummary) +set(Baz_FOUND 0) diff --git a/Tests/RunCMake/FeatureSummary/FindFoo.cmake b/Tests/RunCMake/FeatureSummary/FindFoo.cmake new file mode 100644 index 0000000..baec987 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FindFoo.cmake @@ -0,0 +1,4 @@ +include(FeatureSummary) +set_package_properties(Foo PROPERTIES URL "https://foo.example/" + DESCRIPTION "The Foo package") +set(Foo_FOUND 1) diff --git a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake index 6a5fc28..9caee4c 100644 --- a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake +++ b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake @@ -7,3 +7,15 @@ run_cmake(FeatureSummaryWhatList) run_cmake(FeatureSummaryWhatListUnknown) run_cmake(FeatureSummaryWhatListAll) run_cmake(FeatureSummaryWhatOnce) +run_cmake(FeatureSummaryPurpose) +run_cmake(FeatureSummaryURLDescription) +run_cmake(FeatureSummaryTypes) +run_cmake(FeatureSummaryFatalOnMissingRequiredPackages) +run_cmake(FeatureSummaryIncludeQuietPackages) +run_cmake(FeatureSummaryQuietOnEmpty) +run_cmake(FeatureSummaryMultipleDepends) +run_cmake(FeatureSummaryCustomTypes) +run_cmake(FeatureSummaryCustomBadDefault) +run_cmake(FeatureSummaryCustomRequired) +run_cmake(FeatureSummaryCustomRequiredListA) +run_cmake(FeatureSummaryCustomRequiredListB) diff --git a/Tests/RunCMake/FindGTK2/CMakeLists.txt b/Tests/RunCMake/FindGTK2/CMakeLists.txt new file mode 100644 index 0000000..93ee9df --- /dev/null +++ b/Tests/RunCMake/FindGTK2/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake b/Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake new file mode 100644 index 0000000..e0585ee --- /dev/null +++ b/Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.7) +project(testFindGTK2 C) + +# First call +find_package(GTK2 REQUIRED) + +# Backup variables +set(GTK2_LIBRARIES_BAK ${GTK2_LIBRARIES}) +set(GTK2_TARGETS_BAK ${GTK2_TARGETS}) + +# Second call +find_package(GTK2 REQUIRED) + +# Check variables +if(NOT "${GTK2_LIBRARIES_BAK}" STREQUAL "${GTK2_LIBRARIES}") + message(SEND_ERROR "GTK2_LIBRARIES is different:\nbefore: ${GTK2_LIBRARIES_BAK}\nafter: ${GTK2_LIBRARIES}") +endif() + +if(NOT "${GTK2_TARGETS_BAK}" STREQUAL "${GTK2_TARGETS}") + message(SEND_ERROR "GTK2_TARGETS is different:\nbefore: ${GTK2_TARGETS_BAK}\nafter: ${GTK2_TARGETS}") +endif() diff --git a/Tests/RunCMake/FindGTK2/RunCMakeTest.cmake b/Tests/RunCMake/FindGTK2/RunCMakeTest.cmake new file mode 100644 index 0000000..66364ca --- /dev/null +++ b/Tests/RunCMake/FindGTK2/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(FindGTK2RunTwice) diff --git a/Tests/RunCMake/Framework/FrameworkLayout.cmake b/Tests/RunCMake/Framework/FrameworkLayout.cmake index 5184755..ae32134 100644 --- a/Tests/RunCMake/Framework/FrameworkLayout.cmake +++ b/Tests/RunCMake/Framework/FrameworkLayout.cmake @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.4) enable_language(C) -add_library(Framework SHARED +add_library(Framework ${FRAMEWORK_TYPE} foo.c foo.h res.txt) @@ -9,3 +9,6 @@ set_target_properties(Framework PROPERTIES FRAMEWORK TRUE PUBLIC_HEADER foo.h RESOURCE "res.txt") + +add_custom_command(TARGET Framework POST_BUILD + COMMAND /usr/bin/file $<TARGET_FILE:Framework>) diff --git a/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt b/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt new file mode 100644 index 0000000..8d90f5f --- /dev/null +++ b/Tests/RunCMake/Framework/FrameworkTypeSHARED-build-stdout.txt @@ -0,0 +1 @@ +.*/Framework: Mach-O[^\n]* dynamically linked shared library.* diff --git a/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt new file mode 100644 index 0000000..c9f50b6 --- /dev/null +++ b/Tests/RunCMake/Framework/FrameworkTypeSTATIC-build-stdout.txt @@ -0,0 +1 @@ +.*/Framework: current ar archive random library.* diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index eeea6f1..e64892d 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -1,33 +1,40 @@ include(RunCMake) -# iOS - -set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/iOSFrameworkLayout-build) -set(RunCMake_TEST_NO_CLEAN 1) -set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/ios.cmake") - -file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") -file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - -run_cmake(FrameworkLayout) -run_cmake_command(iOSFrameworkLayout-build ${CMAKE_COMMAND} --build .) - -unset(RunCMake_TEST_BINARY_DIR) -unset(RunCMake_TEST_NO_CLEAN) -unset(RunCMake_TEST_OPTIONS) - -# OSX - -set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/OSXFrameworkLayout-build) -set(RunCMake_TEST_NO_CLEAN 1) -set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake") - -file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") -file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - -run_cmake(FrameworkLayout) -run_cmake_command(OSXFrameworkLayout-build ${CMAKE_COMMAND} --build .) - -unset(RunCMake_TEST_BINARY_DIR) -unset(RunCMake_TEST_NO_CLEAN) -unset(RunCMake_TEST_OPTIONS) +function(framework_layout_test Name Toolchain Type) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}${Type}FrameworkLayout-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/${Toolchain}.cmake") + list(APPEND RunCMake_TEST_OPTIONS "-DFRAMEWORK_TYPE=${Type}") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(FrameworkLayout) + run_cmake_command(${Name} ${CMAKE_COMMAND} --build .) +endfunction() + +# build check cannot cope with multi-configuration generators directory layout +if(NOT RunCMake_GENERATOR STREQUAL "Xcode") + framework_layout_test(iOSFrameworkLayout-build ios SHARED) + framework_layout_test(iOSFrameworkLayout-build ios STATIC) + framework_layout_test(OSXFrameworkLayout-build osx SHARED) + framework_layout_test(OSXFrameworkLayout-build osx STATIC) +endif() + +function(framework_type_test Toolchain Type) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}${Type}FrameworkType-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/${Toolchain}.cmake") + list(APPEND RunCMake_TEST_OPTIONS "-DFRAMEWORK_TYPE=${Type}") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(FrameworkLayout) + run_cmake_command(FrameworkType${Type}-build ${CMAKE_COMMAND} --build .) +endfunction() + +framework_type_test(ios SHARED) +framework_type_test(ios STATIC) +framework_type_test(osx SHARED) +framework_type_test(osx STATIC) diff --git a/Tests/RunCMake/GeneratorExpression/BadIF-result.txt b/Tests/RunCMake/GeneratorExpression/BadIF-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadIF-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt new file mode 100644 index 0000000..7c7506c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt @@ -0,0 +1,15 @@ +CMake Error at BadIF.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<IF:asdf,a,b> + + First parameter to \$<IF> must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadIF.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<IF:asdf,a> + + \$<IF> expression requires 3 comma separated parameters, but got 2 instead. diff --git a/Tests/RunCMake/GeneratorExpression/BadIF.cmake b/Tests/RunCMake/GeneratorExpression/BadIF.cmake new file mode 100644 index 0000000..583f68d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/BadIF.cmake @@ -0,0 +1,5 @@ + +add_custom_target(check ALL COMMAND check + $<IF:asdf,a,b> + $<IF:asdf,a> + ) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index f5584d5..084b5c3 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(BadIF) run_cmake(BadCONFIG) run_cmake(BadOR) run_cmake(BadAND) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 6cc3054..5f66da0 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -101,7 +101,7 @@ function(run_cmake test) endif() foreach(o out err) string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}") - string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:|Error kstat returned|[^\n]*from Time Machine by path|[^\n]*Bullseye Testing Technology)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") + string(REGEX REPLACE "(^|\n)((==[0-9]+==|BullseyeCoverage|[a-z]+\\([0-9]+\\) malloc:|Error kstat returned|[^\n]*is a member of multiple groups|[^\n]*from Time Machine by path|[^\n]*Bullseye Testing Technology)[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") set(expect_${o} "") if(DEFINED expect_std${o}) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 60912c2..f51a107 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -166,3 +166,24 @@ if(NOT XCODE_VERSION VERSION_LESS 6) unset(RunCMake_TEST_NO_CLEAN) unset(RunCMake_TEST_OPTIONS) endif() + +if(NOT XCODE_VERSION VERSION_LESS 5) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeMultiplatform-build) + set(RunCMake_TEST_NO_CLEAN 1) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeMultiplatform) + + # build ios before macos + run_cmake_command(XcodeMultiplatform-iphonesimulator-build ${CMAKE_COMMAND} --build . -- -sdk iphonesimulator) + run_cmake_command(XcodeMultiplatform-iphonesimulator-install ${CMAKE_COMMAND} --build . --target install -- -sdk iphonesimulator DESTDIR=${RunCMake_TEST_BINARY_DIR}/_install_iphonesimulator) + + run_cmake_command(XcodeMultiplatform-macosx-build ${CMAKE_COMMAND} --build . -- -sdk macosx) + run_cmake_command(XcodeMultiplatform-macosx-install ${CMAKE_COMMAND} --build . --target install -- -sdk macosx DESTDIR=${RunCMake_TEST_BINARY_DIR}/_install_macosx) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake index ad4268d..833eb85 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake @@ -50,30 +50,56 @@ if (NOT TEST_IOS AND NOT TEST_WATCHOS AND NOT TEST_TVOS) add_dependencies(AppBundleExtTest AppBundleExt) endif() -# Framework (not supported for iOS on Xcode < 6) +# Shared Framework (not supported for iOS on Xcode < 6) if(NOT TEST_IOS OR NOT XCODE_VERSION VERSION_LESS 6) - add_library(Framework SHARED main.c) - set_target_properties(Framework PROPERTIES FRAMEWORK TRUE) + add_library(SharedFramework SHARED main.c) + set_target_properties(SharedFramework PROPERTIES FRAMEWORK TRUE) - add_custom_target(FrameworkTest ALL + add_custom_target(SharedFrameworkTest ALL COMMAND ${CMAKE_COMMAND} -E copy - "$<TARGET_FILE:Framework>" "$<TARGET_FILE:Framework>.old") + "$<TARGET_FILE:SharedFramework>" "$<TARGET_FILE:SharedFramework>.old") - add_dependencies(FrameworkTest Framework) + add_dependencies(SharedFrameworkTest SharedFramework) # with custom extension - add_library(FrameworkExt SHARED main.c) - set_target_properties(FrameworkExt PROPERTIES FRAMEWORK TRUE) - set_target_properties(FrameworkExt PROPERTIES BUNDLE_EXTENSION "foo") - install(TARGETS FrameworkExt FRAMEWORK DESTINATION FooExtension) + add_library(SharedFrameworkExt SHARED main.c) + set_target_properties(SharedFrameworkExt PROPERTIES FRAMEWORK TRUE) + set_target_properties(SharedFrameworkExt PROPERTIES BUNDLE_EXTENSION "foo") + install(TARGETS SharedFrameworkExt FRAMEWORK DESTINATION FooExtension) - add_custom_target(FrameworkExtTest ALL + add_custom_target(SharedFrameworkExtTest ALL COMMAND ${CMAKE_COMMAND} -E copy - "$<TARGET_FILE:FrameworkExt>" "$<TARGET_FILE:FrameworkExt>.old") + "$<TARGET_FILE:SharedFrameworkExt>" "$<TARGET_FILE:SharedFrameworkExt>.old") - add_dependencies(FrameworkExtTest FrameworkExt) + add_dependencies(SharedFrameworkExtTest SharedFrameworkExt) +endif() + +# Static Framework (not supported for Xcode < 6) + +if(NOT XCODE_VERSION VERSION_LESS 6) + add_library(StaticFramework STATIC main.c) + set_target_properties(StaticFramework PROPERTIES FRAMEWORK TRUE) + + add_custom_target(StaticFrameworkTest ALL + COMMAND ${CMAKE_COMMAND} -E copy + "$<TARGET_FILE:StaticFramework>" "$<TARGET_FILE:StaticFramework>.old") + + add_dependencies(StaticFrameworkTest StaticFramework) + + # with custom extension + + add_library(StaticFrameworkExt STATIC main.c) + set_target_properties(StaticFrameworkExt PROPERTIES FRAMEWORK TRUE) + set_target_properties(StaticFrameworkExt PROPERTIES BUNDLE_EXTENSION "foo") + install(TARGETS StaticFrameworkExt FRAMEWORK DESTINATION StaticFooExtension) + + add_custom_target(StaticFrameworkExtTest ALL + COMMAND ${CMAKE_COMMAND} -E copy + "$<TARGET_FILE:StaticFrameworkExt>" "$<TARGET_FILE:StaticFrameworkExt>.old") + + add_dependencies(StaticFrameworkExtTest StaticFrameworkExt) endif() # Bundle diff --git a/Tests/RunCMake/XcodeProject/XcodeMultiplatform.cmake b/Tests/RunCMake/XcodeProject/XcodeMultiplatform.cmake new file mode 100644 index 0000000..a1064f4 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeMultiplatform.cmake @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.3) +enable_language(CXX) + +set_property(GLOBAL PROPERTY XCODE_EMIT_EFFECTIVE_PLATFORM_NAME ON) + +set(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "macosx iphonesimulator") +set(CMAKE_MACOSX_BUNDLE true) + +add_library(library STATIC foo.cpp) + +add_executable(main main.cpp) +target_link_libraries(main library) + +install(TARGETS library ARCHIVE DESTINATION lib) diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake index 352a381..ab4c5ab 100644 --- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake @@ -19,7 +19,7 @@ unset(CMAKELISTS_EXTRA_CODE) #----------------------------------------------------------------------------- # add ThreadSanitizer test set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"report_bugs=1:history_size=5:exitcode=55\") ") set(CMAKELISTS_EXTRA_CODE "add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" @@ -71,7 +71,7 @@ unset(CTEST_EXTRA_CODE) #----------------------------------------------------------------------------- # add MemorySanitizer test set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55\") +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55\") ") set(CMAKELISTS_EXTRA_CODE "add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" diff --git a/Tests/RunCMake/ctest_memcheck/testAddressLeakSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testAddressLeakSanitizer.cmake index 2a57b11..ca36a7c 100644 --- a/Tests/RunCMake/ctest_memcheck/testAddressLeakSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testAddressLeakSanitizer.cmake @@ -2,7 +2,7 @@ # options message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate AddressSanitizer don't do it diff --git a/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake index 3082e4b..1219666 100644 --- a/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake @@ -2,7 +2,7 @@ # options message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate address sanitizer don't do it diff --git a/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake index af214c8..6d51f83 100644 --- a/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake @@ -2,7 +2,7 @@ # options message("LSAN_OPTIONS = [$ENV{LSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{LSAN_OPTIONS}") +string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{LSAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate LeakSanitizer don't do it diff --git a/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake index c87af9a..3b3ac22 100644 --- a/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake @@ -1,8 +1,8 @@ -# this file simulates a program that has been built with thread sanitizer +# this file simulates a program that has been built with MemorySanitizer # options message("MSAN_OPTIONS = [$ENV{MSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{MSAN_OPTIONS}") +string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{MSAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate address sanitizer don't do it diff --git a/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake index d591931..e7a5c9f 100644 --- a/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake @@ -1,8 +1,8 @@ -# this file simulates a program that has been built with thread sanitizer +# this file simulates a program that has been built with ThreadSanitizer # options message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") +string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") set(error_types diff --git a/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake index 8ef3c0a..ba6122d 100644 --- a/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake +++ b/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake @@ -1,8 +1,8 @@ -# this file simulates a program that has been built with undefined behavior -# sanitizer options +# this file simulates a program that has been built with +# UndefinedBehaviorSanitizer options message("UBSAN_OPTIONS = [$ENV{UBSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}") +string(REGEX REPLACE ".*log_path=\'([^\']*)\'.*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}") message("LOG_FILE=[${LOG_FILE}]") # if we are not asked to simulate address sanitizer don't do it diff --git a/Tests/RunCMake/pseudo_cpplint.c b/Tests/RunCMake/pseudo_cpplint.c new file mode 100644 index 0000000..8b9ebf4 --- /dev/null +++ b/Tests/RunCMake/pseudo_cpplint.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <string.h> + +int main(int argc, char* argv[]) +{ + int error = 0; + int i; + for (i = 1; i < argc; ++i) { + if (strcmp(argv[i], "--error") == 0) { + error = 1; + } + if (argv[i][0] != '-') { + if (error) { + fprintf(stderr, "%s:0: message [category/category] [0]\n", argv[i]); + } + fprintf(stdout, "Done processing %s\nTotal errors found: %i\n", argv[i], + error); + } + } + return error; +} diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index 8067d9d..38a77b0 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -6,6 +6,11 @@ run_cmake(AppendNoArgs) run_cmake(Concat) run_cmake(ConcatNoArgs) +run_cmake(Timestamp) +run_cmake(TimestampEmpty) +run_cmake(TimestampInvalid) +run_cmake(TimestampInvalid2) + run_cmake(Uuid) run_cmake(UuidMissingNamespace) run_cmake(UuidMissingNamespaceValue) diff --git a/Tests/RunCMake/string/Timestamp-result.txt b/Tests/RunCMake/string/Timestamp-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/string/Timestamp-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/string/Timestamp-stderr.txt b/Tests/RunCMake/string/Timestamp-stderr.txt new file mode 100644 index 0000000..653974c --- /dev/null +++ b/Tests/RunCMake/string/Timestamp-stderr.txt @@ -0,0 +1 @@ +RESULT=2005-08-07 23:19:49 Sun Aug 05 day=219 wd=0 week=32 %I=11 epoch=1123456789 diff --git a/Tests/RunCMake/string/Timestamp.cmake b/Tests/RunCMake/string/Timestamp.cmake new file mode 100644 index 0000000..d242039 --- /dev/null +++ b/Tests/RunCMake/string/Timestamp.cmake @@ -0,0 +1,3 @@ +set(ENV{SOURCE_DATE_EPOCH} "1123456789") +string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S %a %b %y day=%j wd=%w week=%U %%I=%I epoch=%s" UTC) +message("RESULT=${RESULT}") diff --git a/Tests/RunCMake/string/TimestampEmpty-result.txt b/Tests/RunCMake/string/TimestampEmpty-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/string/TimestampEmpty-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/string/TimestampEmpty-stderr.txt b/Tests/RunCMake/string/TimestampEmpty-stderr.txt new file mode 100644 index 0000000..35cbd3c --- /dev/null +++ b/Tests/RunCMake/string/TimestampEmpty-stderr.txt @@ -0,0 +1 @@ +RESULT=2 diff --git a/Tests/RunCMake/string/TimestampEmpty.cmake b/Tests/RunCMake/string/TimestampEmpty.cmake new file mode 100644 index 0000000..21b770f --- /dev/null +++ b/Tests/RunCMake/string/TimestampEmpty.cmake @@ -0,0 +1,3 @@ +set(ENV{SOURCE_DATE_EPOCH} "") +string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S" UTC) +message("RESULT=${RESULT}") diff --git a/Tests/RunCMake/string/TimestampInvalid-result.txt b/Tests/RunCMake/string/TimestampInvalid-result.txt new file mode 100644 index 0000000..f64f5d8 --- /dev/null +++ b/Tests/RunCMake/string/TimestampInvalid-result.txt @@ -0,0 +1 @@ +27 diff --git a/Tests/RunCMake/string/TimestampInvalid-stderr.txt b/Tests/RunCMake/string/TimestampInvalid-stderr.txt new file mode 100644 index 0000000..75566da --- /dev/null +++ b/Tests/RunCMake/string/TimestampInvalid-stderr.txt @@ -0,0 +1 @@ +CMake Error: Cannot parse SOURCE_DATE_EPOCH as integer diff --git a/Tests/RunCMake/string/TimestampInvalid.cmake b/Tests/RunCMake/string/TimestampInvalid.cmake new file mode 100644 index 0000000..ab36270 --- /dev/null +++ b/Tests/RunCMake/string/TimestampInvalid.cmake @@ -0,0 +1,3 @@ +set(ENV{SOURCE_DATE_EPOCH} "invalid-integer") +string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S" UTC) +message("RESULT=${RESULT}") diff --git a/Tests/RunCMake/string/TimestampInvalid2-result.txt b/Tests/RunCMake/string/TimestampInvalid2-result.txt new file mode 100644 index 0000000..f64f5d8 --- /dev/null +++ b/Tests/RunCMake/string/TimestampInvalid2-result.txt @@ -0,0 +1 @@ +27 diff --git a/Tests/RunCMake/string/TimestampInvalid2-stderr.txt b/Tests/RunCMake/string/TimestampInvalid2-stderr.txt new file mode 100644 index 0000000..75566da --- /dev/null +++ b/Tests/RunCMake/string/TimestampInvalid2-stderr.txt @@ -0,0 +1 @@ +CMake Error: Cannot parse SOURCE_DATE_EPOCH as integer diff --git a/Tests/RunCMake/string/TimestampInvalid2.cmake b/Tests/RunCMake/string/TimestampInvalid2.cmake new file mode 100644 index 0000000..5cc61b8 --- /dev/null +++ b/Tests/RunCMake/string/TimestampInvalid2.cmake @@ -0,0 +1,3 @@ +set(ENV{SOURCE_DATE_EPOCH} "123trailing-garbage") +string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S" UTC) +message("RESULT=${RESULT}") diff --git a/Utilities/.gitattributes b/Utilities/.gitattributes index e3a9e61..c6345eb 100644 --- a/Utilities/.gitattributes +++ b/Utilities/.gitattributes @@ -1,2 +1,3 @@ /Git export-ignore +/GitSetup export-ignore SetupForDevelopment.sh export-ignore diff --git a/Utilities/Git/pre-commit b/Utilities/Git/pre-commit index b232ac0..b63ae5e 100755 --- a/Utilities/Git/pre-commit +++ b/Utilities/Git/pre-commit @@ -29,6 +29,19 @@ die 'The following changes add lines too long for our C++ style: Use lines strictly less than '"$line_too_long"' characters in C++ code.' +#----------------------------------------------------------------------------- + +# Check that development setup is up-to-date. +lastSetupForDevelopment=$(git config --get hooks.SetupForDevelopment || echo 0) +eval $(grep '^SetupForDevelopment_VERSION=' "${BASH_SOURCE%/*}/../SetupForDevelopment.sh") +test -n "$SetupForDevelopment_VERSION" || SetupForDevelopment_VERSION=0 +if test $lastSetupForDevelopment -lt $SetupForDevelopment_VERSION; then + die 'Developer setup in this work tree is out of date. Please re-run + + Utilities/SetupForDevelopment.sh +' +fi + #------------------------------------------------------------------------------- if test -z "$HOOKS_ALLOW_KWSYS"; then # Disallow changes to KWSys diff --git a/Utilities/GitSetup/.gitattributes b/Utilities/GitSetup/.gitattributes index facbbb2..e96d1f8 100644 --- a/Utilities/GitSetup/.gitattributes +++ b/Utilities/GitSetup/.gitattributes @@ -1,7 +1,6 @@ .git* export-ignore -# Exclude from source archives files specific to Git work tree. -* export-ignore - +config* eol=lf whitespace=indent-with-non-tab +git-* eol=lf whitespace=indent-with-non-tab tips eol=lf whitespace=indent-with-non-tab setup-* eol=lf whitespace=indent-with-non-tab diff --git a/Utilities/GitSetup/README b/Utilities/GitSetup/README index cf468fb..2f9f1ec 100644 --- a/Utilities/GitSetup/README +++ b/Utilities/GitSetup/README @@ -37,6 +37,13 @@ Commit the merge with an informative message: the general GitSetup repository "setup" branch. ------------------------------------------------------------------------ +Optionally add to the project ".gitattributes" file the line + + /Utilities/GitSetup export-ignore + +to exclude the GitSetup directory from inclusion by "git archive" +since it does not make sense in source tarballs. + Configuration ------------- diff --git a/Utilities/GitSetup/config.sample b/Utilities/GitSetup/config.sample index bba2382..eeb468b 100644 --- a/Utilities/GitSetup/config.sample +++ b/Utilities/GitSetup/config.sample @@ -20,3 +20,13 @@ site = http://review.source.kitware.com # pushurl placeholder "$username" is literal pushurl = $username@review.source.kitware.com:Project + +[upstream] + url = git://public.kitware.com/Project.git + +[gitlab] + host = gitlab.kitware.com + group-path = group + group-name = Group + project-path = project + project-name = Project diff --git a/Utilities/GitSetup/git-gerrit-push b/Utilities/GitSetup/git-gerrit-push new file mode 100755 index 0000000..b46f753 --- /dev/null +++ b/Utilities/GitSetup/git-gerrit-push @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +#============================================================================= +# Copyright 2010-2015 Kitware, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +USAGE="[<remote>] [--no-topic] [--dry-run] [--]" +OPTIONS_SPEC= +SUBDIRECTORY_OK=Yes +. "$(git --exec-path)/git-sh-setup" + +#----------------------------------------------------------------------------- + +remote='' +refspecs='' +no_topic='' +dry_run='' + +# Parse the command line options. +while test $# != 0; do + case "$1" in + --no-topic) no_topic=1 ;; + --dry-run) dry_run=--dry-run ;; + --) shift; break ;; + -*) usage ;; + *) test -z "$remote" || usage ; remote="$1" ;; + esac + shift +done +test $# = 0 || usage + +# Default remote. +test -n "$remote" || remote="gerrit" + +if test -z "$no_topic"; then + # Identify and validate the topic branch name. + head="$(git symbolic-ref HEAD)" && topic="${head#refs/heads/}" || topic='' + if test -z "$topic" -o "$topic" = "master"; then + die 'Please name your topic: + git checkout -b descriptive-name' + fi + # The topic branch will be pushed by name. + refspecs="HEAD:refs/for/master/$topic $refspecs" +fi + +# Fetch the current upstream master branch head. +# This helps computation of a minimal pack to push. +echo "Fetching $remote master" +fetch_out=$(git fetch "$remote" master 2>&1) || die "$fetch_out" + +# Exit early if we have nothing to push. +if test -z "$refspecs"; then + echo 'Nothing to push!' + exit 0 +fi + +# Push. Save output and exit code. +echo "Pushing to $remote" +push_stdout=$(git push --porcelain $dry_run "$remote" $refspecs); push_exit=$? +echo "$push_stdout" + +# Reproduce the push exit code. +exit $push_exit diff --git a/Utilities/GitSetup/git-gitlab-push b/Utilities/GitSetup/git-gitlab-push new file mode 100755 index 0000000..768f853 --- /dev/null +++ b/Utilities/GitSetup/git-gitlab-push @@ -0,0 +1,177 @@ +#!/usr/bin/env bash +#============================================================================= +# Copyright 2010-2015 Kitware, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +USAGE='[<remote>] [<options>...] [--] + +OPTIONS + +--dry-run + Show what would be pushed without actually updating the destination + +-f,--force + Force-push the topic HEAD to rewrite the destination branch + +--no-default + Do not push the default branch (e.g. master) + +--no-topic + Do not push the topic HEAD. +' +OPTIONS_SPEC= +SUBDIRECTORY_OK=Yes +. "$(git --exec-path)/git-sh-setup" + +egrep-q() { + egrep "$@" >/dev/null 2>/dev/null +} + +# Load the project configuration. +gitlab_upstream='' && +gitlab_configured='' && +config="${BASH_SOURCE%/*}/config" && +protocol=$(git config -f "$config" --get gitlab.protocol || + echo "https") && +host=$(git config -f "$config" --get gitlab.host) && +site=$(git config -f "$config" --get gitlab.site || + echo "$protocol://$host") && +group_path=$(git config -f "$config" --get gitlab.group-path) && +project_path=$(git config -f "$config" --get gitlab.project-path) && +gitlab_upstream="$site/$group_path/$project_path.git" && +gitlab_pushurl=$(git config --get remote.gitlab.pushurl || + git config --get remote.gitlab.url) && +gitlab_configured=1 + +#----------------------------------------------------------------------------- + +remote='' +refspecs='' +force='' +lease=false +lease_flag='' +no_topic='' +no_default='' +dry_run='' + +# Parse the command line options. +while test $# != 0; do + case "$1" in + -f|--force) force='+'; lease=true ;; + --no-topic) no_topic=1 ;; + --dry-run) dry_run=--dry-run ;; + --no-default) no_default=1 ;; + --) shift; break ;; + -*) usage ;; + *) test -z "$remote" || usage ; remote="$1" ;; + esac + shift +done +test $# = 0 || usage + +# Default remote. +test -n "$remote" || remote="gitlab" + +if test -z "$no_topic"; then + # Identify and validate the topic branch name. + head="$(git symbolic-ref HEAD)" && topic="${head#refs/heads/}" || topic='' + if test -z "$topic" -o "$topic" = "master"; then + die 'Please name your topic: + git checkout -b descriptive-name' + fi + + if $lease; then + have_ref=false + remoteref="refs/remotes/$remote/$topic" + if git rev-parse --verify -q "$remoteref"; then + have_ref=true + else + die "It seems that a local ref for the branch is +missing; forcing a push is dangerous and may overwrite +previous work. Fetch from the $remote remote first or +push without '-f' or '--force'." + fi + + have_lease_flag=false + if git push -h | egrep-q -e '--force-with-lease'; then + have_lease_flag=true + fi + + if $have_lease_flag && $have_ref; then + # Set the lease flag. + lease_flag="--force-with-lease=$topic:$remoteref" + # Clear the force string. + force='' + fi + fi + + # The topic branch will be pushed by name. + refspecs="${force}HEAD:refs/heads/$topic $refspecs" +fi + +# Fetch the current remote master branch head. +# This helps computation of a minimal pack to push. +echo "Fetching $remote master" +fetch_out=$(git fetch "$remote" master 2>&1) || die "$fetch_out" +gitlab_head=$(git rev-parse FETCH_HEAD) || exit + +# Fetch the current upstream master branch head. +if origin_fetchurl=$(git config --get remote.origin.url) && + test "$origin_fetchurl" = "$gitlab_upstream"; then + upstream_remote='origin' +else + upstream_remote="$gitlab_upstream" +fi +echo "Fetching $upstream_remote master" +fetch_out=$(git fetch "$upstream_remote" master 2>&1) || die "$fetch_out" +upstream_head=$(git rev-parse FETCH_HEAD) || exit + +# Add a refspec to keep the remote master up to date if possible. +if test -z "$no_default" && + base=$(git merge-base "$gitlab_head" "$upstream_head") && + test "$base" = "$gitlab_head"; then + refspecs="$upstream_head:refs/heads/master $refspecs" +fi + +# Exit early if we have nothing to push. +if test -z "$refspecs"; then + echo 'Nothing to push!' + exit 0 +fi + +# Push. Save output and exit code. +echo "Pushing to $remote" +push_config='-c advice.pushUpdateRejected=false' +push_stdout=$(git $push_config push $lease_flag --porcelain $dry_run "$remote" $refspecs); push_exit=$? +echo "$push_stdout" + +if test "$push_exit" -ne 0 && test -z "$force"; then + # Advise the user to fetch if needed. + if echo "$push_stdout" | egrep-q 'stale info'; then + echo " +You have pushed to your branch from another machine; you may be overwriting +commits unintentionally. Fetch from the $remote remote and check that you are +not pushing an outdated branch." + fi + + # Advise the user to force-push if needed. + if echo "$push_stdout" | egrep-q 'non-fast-forward'; then + echo ' +Add "-f" or "--force" to push a rewritten topic.' + fi +fi + +# Reproduce the push exit code. +exit $push_exit diff --git a/Utilities/GitSetup/setup-gerrit b/Utilities/GitSetup/setup-gerrit index 9e8fa62..6d46e3c 100755 --- a/Utilities/GitSetup/setup-gerrit +++ b/Utilities/GitSetup/setup-gerrit @@ -28,6 +28,7 @@ # gerrit.pushurl = Review site push URL with "$username" placeholder # gerrit.remote = Gerrit remote name, if not "gerrit" # gerrit.url = Gerrit project URL, if not "$site/p/$project" +# optionally with "$username" placeholder die() { echo 1>&2 "$@" ; exit 1 @@ -39,11 +40,12 @@ cd "${BASH_SOURCE%/*}" && # Load the project configuration. site=$(git config -f config --get gerrit.site) && project=$(git config -f config --get gerrit.project) && -pushurl_=$(git config -f config --get gerrit.pushurl) && remote=$(git config -f config --get gerrit.remote || echo "gerrit") && -fetchurl=$(git config -f config --get gerrit.url || - echo "$site/p/$project") || +fetchurl_=$(git config -f config --get gerrit.url || + echo "$site/p/$project") && +pushurl_=$(git config -f config --get gerrit.pushurl || + git config -f config --get gerrit.url) || die 'This project is not configured to use Gerrit.' # Get current gerrit push URL. @@ -67,7 +69,7 @@ else '"$project"' changes must be pushed to our Gerrit Code Review site: - '"$fetchurl"' + '"$site/p/$project"' Register a Gerrit account and select a username (used below). You will need an OpenID: @@ -96,13 +98,16 @@ Add your SSH public keys at if test -z "$gu"; then gu="$USER" fi && + fetchurl="${fetchurl_/\$username/$gu}" && if test -z "$pushurl"; then git remote add "$remote" "$fetchurl" else git config remote."$remote".url "$fetchurl" fi && pushurl="${pushurl_/\$username/$gu}" && - git config remote."$remote".pushurl "$pushurl" && + if test "$pushurl" != "$fetchurl"; then + git config remote."$remote".pushurl "$pushurl" + fi && echo 'Remote "'"$remote"'" is now configured to push to '"$pushurl"' diff --git a/Utilities/GitSetup/setup-gitlab b/Utilities/GitSetup/setup-gitlab new file mode 100755 index 0000000..9c7574d --- /dev/null +++ b/Utilities/GitSetup/setup-gitlab @@ -0,0 +1,140 @@ +#!/usr/bin/env bash +#============================================================================= +# Copyright 2010-2015 Kitware, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +# Run this script to set up the local Git repository to push to +# a personal fork for this project in GitLab. + +# Project configuration instructions: +# +# - Run a GitLab server +# +# - Populate adjacent "config" file with: +# gitlab.protocol = Top GitLab protocol, if not 'https' +# gitlab.host = Top GitLab fully qualified host name +# gitlab.site = Top GitLab URL, if not "<protocol>://<host>" +# gitlab.group-name = Name of group containing project in GitLab +# gitlab.group-path = Path of group containing project in GitLab +# gitlab.project-name = Name of project within GitLab group +# gitlab.project-path = Path of project within GitLab group +# gitlab.url = GitLab push URL with "$username" placeholder, +# if not "<site>/$username/<project-path>.git" +# gitlab.pushurl = GitLab push URL with "$username" placeholder, +# if not "git@<host>:$username/<project-path>.git" +# gitlab.remote = GitLab remote name, if not "gitlab" + +die() { + echo 1>&2 "$@" ; exit 1 +} + +# Make sure we are inside the repository. +cd "${BASH_SOURCE%/*}" && + +# Load the project configuration. +protocol=$(git config -f config --get gitlab.protocol || + echo "https") && +host=$(git config -f config --get gitlab.host) && +site=$(git config -f config --get gitlab.site || + echo "$protocol://$host") && +group_path=$(git config -f config --get gitlab.group-path) && +group_name=$(git config -f config --get gitlab.group-name) && +project_name=$(git config -f config --get gitlab.project-name) && +project_path=$(git config -f config --get gitlab.project-path) && +pushurl_=$(git config -f config --get gitlab.pushurl || + echo "git@$host:\$username/$project_path.git") && +remote=$(git config -f config --get gitlab.remote || + echo "gitlab") && +fetchurl_=$(git config -f config --get gitlab.url || + echo "$site/\$username/$project_path.git") || +die 'This project is not configured to use GitLab.' + +# Get current gitlab push URL. +pushurl=$(git config --get remote."$remote".pushurl || + git config --get remote."$remote".url || echo '') && + +# Tell user about current configuration. +if test -n "$pushurl"; then + echo 'Remote "'"$remote"'" is currently configured to push to + + '"$pushurl"' +' && + read -ep 'Reconfigure GitLab? [y/N]: ' ans && + if [ "$ans" == "y" ] || [ "$ans" == "Y" ]; then + setup=1 + else + setup='' + fi +else + echo 'Remote "'"$remote"'" is not yet configured. +' && + read -ep 'Configure GitLab to contribute to '"$project_name"'? [Y/n]: ' ans && + if [ "$ans" == "n" ] || [ "$ans" == "N" ]; then + exit 0 + else + setup=1 + fi +fi && + +setup_instructions='Add your SSH public keys at + + '"$site"'/profile/keys + +Then visit the main repository at: + + '"$site/$group_path/$project_path"' + +and use the Fork button in the upper right. +' + +# Perform setup if necessary. +if test -n "$setup"; then + echo 'Sign-in to GitLab to get/set your username at + + '"$site/profile/account"' + +'"$setup_instructions" && + read -ep "GitLab username? [$USER]: " gu && + if test -z "$gu"; then + gu="$USER" + fi && + fetchurl="${fetchurl_/\$username/$gu}" && + if test -z "$pushurl"; then + git remote add "$remote" "$fetchurl" + else + git config remote."$remote".url "$fetchurl" + fi && + pushurl="${pushurl_/\$username/$gu}" && + git config remote."$remote".pushurl "$pushurl" && + echo 'Remote "'"$remote"'" is now configured to push to + + '"$pushurl"' +' +fi && + +# Optionally test GitLab access. +if test -n "$pushurl"; then + read -ep 'Test access to GitLab (SSH)? [y/N]: ' ans && + if [ "$ans" == "y" ] || [ "$ans" == "Y" ]; then + echo -n 'Testing GitLab access by SSH...' + if git ls-remote --heads "$pushurl" >/dev/null; then + echo 'passed.' + else + echo 'failed.' && + die 'Could not access your GitLab fork of this project. +'"$setup_instructions" + fi + fi +fi diff --git a/Utilities/GitSetup/setup-hooks b/Utilities/GitSetup/setup-hooks index c07985a..ca07712 100755 --- a/Utilities/GitSetup/setup-hooks +++ b/Utilities/GitSetup/setup-hooks @@ -55,6 +55,7 @@ fi && # Populate ".git/hooks". echo 'Setting up git hooks...' && git_dir=$(git rev-parse --git-dir) && +mkdir -p "$git_dir/hooks" && cd "$git_dir/hooks" && if ! test -e .git; then git init -q || die 'Could not run git init for hooks.' diff --git a/Utilities/GitSetup/setup-stage b/Utilities/GitSetup/setup-stage index 323e47a..ce6ec45 100755 --- a/Utilities/GitSetup/setup-stage +++ b/Utilities/GitSetup/setup-stage @@ -37,8 +37,8 @@ die() { cd "${BASH_SOURCE%/*}" && # Load the project configuration. -fetchurl=$(git config -f config --get stage.url) && -pushurl_=$(git config -f config --get stage.pushurl || echo '') && +fetchurl_=$(git config -f config --get stage.url) && +pushurl_=$(git config -f config --get stage.pushurl || echo "$fetchurl_") && remote=$(git config -f config --get stage.remote || echo 'stage') || die 'This project is not configured to use a topic stage.' @@ -65,13 +65,16 @@ fi # Perform setup if necessary. if test -n "$setup"; then echo 'Setting up the topic stage...' && + fetchurl="${fetchurl_}" && if test -z "$pushurl"; then git remote add "$remote" "$fetchurl" else git config remote."$remote".url "$fetchurl" fi && pushurl="${pushurl_}" && - git config remote."$remote".pushurl "$pushurl" && + if test "$pushurl" != "$fetchurl"; then + git config remote."$remote".pushurl "$pushurl" + fi && echo 'Remote "'"$remote"'" is now configured to push to '"$pushurl"' diff --git a/Utilities/GitSetup/setup-upstream b/Utilities/GitSetup/setup-upstream new file mode 100755 index 0000000..92ce1da --- /dev/null +++ b/Utilities/GitSetup/setup-upstream @@ -0,0 +1,104 @@ +#!/usr/bin/env bash +#============================================================================= +# Copyright 2010-2015 Kitware, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +# Run this script to set up the local Git repository to use the +# preferred upstream repository URLs. + +# Project configuration instructions: +# +# - Populate adjacent "config" file with: +# upstream.url = Preferred fetch url for upstream remote +# upstream.remote = Preferred name for upstream remote, if not "origin" + +die() { + echo 1>&2 "$@" ; exit 1 +} + +# Make sure we are inside the repository. +cd "${BASH_SOURCE%/*}" && + +# Load the project configuration. +url=$(git config -f config --get upstream.url) && +remote=$(git config -f config --get upstream.remote || + echo 'origin') || +die 'This project is not configured to use a preferred upstream repository.' + +# Get current upstream URLs. +fetchurl=$(git config --get remote."$remote".url || echo '') && +pushurl=$(git config --get remote."$remote".pushurl || echo '') && + +if test "$fetchurl" = "$url"; then + echo 'Remote "'"$remote"'" already uses recommended upstream repository.' + exit 0 +fi + +upstream_recommend=' +We recommended configuring the "'"$remote"'" remote to fetch from upstream at + + '"$url"' +' + +# Tell user about current configuration. +if test -n "$fetchurl"; then + echo 'Remote "'"$remote"'" is currently configured to fetch from + + '"$fetchurl"' +' && + if test -n "$pushurl"; then + echo 'and push to + + '"$pushurl" + fi && + echo "$upstream_recommend" && + if test -n "$pushurl"; then + echo 'and to never push to it directly. +' + fi && + + read -ep 'Reconfigure "'"$remote"'" remote as recommended? [y/N]: ' ans && + if [ "$ans" == "y" ] || [ "$ans" == "Y" ]; then + setup=1 + else + setup='' + fi +else + echo 'Remote "'"$remote"'" is not yet configured.' && + echo "$upstream_recommend" && + read -ep 'Configure "'"$remote"'" remote as recommended? [Y/n]: ' ans && + if [ "$ans" == "n" ] || [ "$ans" == "N" ]; then + exit 0 + else + setup=1 + fi +fi && + +# Perform setup if necessary. +if test -n "$setup"; then + if test -z "$fetchurl"; then + git remote add "$remote" "$url" + else + git config remote."$remote".url "$url" && + if old=$(git config --get remote."$remote".pushurl); then + git config --unset remote."$remote".pushurl || + echo 'Warning: failed to unset remote.'"$remote"'.pushurl' + fi + fi && + echo 'Remote "'"$remote"'" is now configured to fetch from + + '"$url"' +' +fi diff --git a/Utilities/Scripts/update-gitsetup.bash b/Utilities/Scripts/update-gitsetup.bash new file mode 100755 index 0000000..8f0da76 --- /dev/null +++ b/Utilities/Scripts/update-gitsetup.bash @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +set -x +shopt -s dotglob + +readonly name="GitSetup" +readonly ownership="GitSetup Upstream <kwrobot@kitware.com>" +readonly subtree="Utilities/GitSetup" +readonly repo="https://gitlab.kitware.com/utils/gitsetup.git" +readonly tag="setup" +readonly shortlog=false +readonly paths=" +" + +extract_source () { + git_archive +} + +. "${BASH_SOURCE%/*}/update-third-party.bash" diff --git a/Utilities/SetupForDevelopment.sh b/Utilities/SetupForDevelopment.sh index 0a9df7e..39152bc 100755 --- a/Utilities/SetupForDevelopment.sh +++ b/Utilities/SetupForDevelopment.sh @@ -11,3 +11,7 @@ Utilities/GitSetup/tips # Rebase master by default git config rebase.stat true git config branch.master.rebase true + +# Record the version of this setup so Git/pre-commit can check it. +SetupForDevelopment_VERSION=1 +git config hooks.SetupForDevelopment ${SetupForDevelopment_VERSION} |