diff options
61 files changed, 713 insertions, 165 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 28fd02f..e61621d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -336,7 +336,7 @@ macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- # Build or use system libarchive for CMake and CTest. if(CMAKE_USE_SYSTEM_LIBARCHIVE) - find_package(LibArchive) + find_package(LibArchive 3.0.0) if(NOT LibArchive_FOUND) message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!") endif() @@ -628,7 +628,6 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) if(BUILD_TESTING) CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests") endif() - CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat") if(TARGET documentation) CMAKE_SET_TARGET_FOLDER(documentation "Documentation") endif() diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 65b3a72..e18250c 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -80,7 +80,9 @@ When adding the first supported feature to a particular CompilerId, it is necessary to list support for all features known to cmake (See :variable:`CMAKE_C_COMPILE_FEATURES` and :variable:`CMAKE_CXX_COMPILE_FEATURES` as appropriate), where available for -the compiler. +the compiler. Furthermore, set ``CMAKE_<LANG>_STANDARD_DEFAULT`` to the +default language standard level the compiler uses, or to the empty string +if the compiler has no notion of standard levels (such as ``MSVC``). It is sensible to record the features for the most recent version of a particular CompilerId first, and then work backwards. It is sensible to diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 68954c5..25f989f 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -294,6 +294,7 @@ Properties on Source Files /prop_sf/VS_DEPLOYMENT_CONTENT /prop_sf/VS_DEPLOYMENT_LOCATION /prop_sf/VS_SHADER_ENTRYPOINT + /prop_sf/VS_SHADER_FLAGS /prop_sf/VS_SHADER_MODEL /prop_sf/VS_SHADER_TYPE /prop_sf/WRAP_EXCLUDE diff --git a/Help/prop_sf/VS_SHADER_FLAGS.rst b/Help/prop_sf/VS_SHADER_FLAGS.rst new file mode 100644 index 0000000..0901123 --- /dev/null +++ b/Help/prop_sf/VS_SHADER_FLAGS.rst @@ -0,0 +1,4 @@ +VS_SHADER_FLAGS +--------------- + +Set additional VS shader flags of a ``.hlsl`` source file. diff --git a/Help/prop_tgt/CXX_STANDARD.rst b/Help/prop_tgt/CXX_STANDARD.rst index 6329e34..65b30ec 100644 --- a/Help/prop_tgt/CXX_STANDARD.rst +++ b/Help/prop_tgt/CXX_STANDARD.rst @@ -5,7 +5,8 @@ The C++ standard whose features are requested to build this target. This property specifies the C++ standard whose features are requested to build this target. For some compilers, this results in adding a -flag such as ``-std=gnu++11`` to the compile line. +flag such as ``-std=gnu++11`` to the compile line. For compilers that +have no notion of a standard level, such as MSVC, this has no effect. Supported values are ``98``, ``11`` and ``14``. diff --git a/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst b/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst index ac103a4..4e24e5e 100644 --- a/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst +++ b/Help/prop_tgt/CXX_STANDARD_REQUIRED.rst @@ -7,7 +7,8 @@ If this property is set to ``ON``, then the value of the :prop_tgt:`CXX_STANDARD` target property is treated as a requirement. If this property is ``OFF`` or unset, the :prop_tgt:`CXX_STANDARD` target property is treated as optional and may "decay" to a previous standard if the requested is -not available. +not available. For compilers that have no notion of a standard level, such as +MSVC, this has no effect. See the :manual:`cmake-compile-features(7)` manual for information on compile features. diff --git a/Help/prop_tgt/C_STANDARD.rst b/Help/prop_tgt/C_STANDARD.rst index 88ca926..3aa74af 100644 --- a/Help/prop_tgt/C_STANDARD.rst +++ b/Help/prop_tgt/C_STANDARD.rst @@ -5,7 +5,8 @@ The C standard whose features are requested to build this target. This property specifies the C standard whose features are requested to build this target. For some compilers, this results in adding a -flag such as ``-std=gnu11`` to the compile line. +flag such as ``-std=gnu11`` to the compile line. For compilers that +have no notion of a standard level, such as MSVC, this has no effect. Supported values are ``90``, ``99`` and ``11``. diff --git a/Help/prop_tgt/C_STANDARD_REQUIRED.rst b/Help/prop_tgt/C_STANDARD_REQUIRED.rst index a7304f4..743d568 100644 --- a/Help/prop_tgt/C_STANDARD_REQUIRED.rst +++ b/Help/prop_tgt/C_STANDARD_REQUIRED.rst @@ -7,7 +7,8 @@ If this property is set to ``ON``, then the value of the :prop_tgt:`C_STANDARD` target property is treated as a requirement. If this property is ``OFF`` or unset, the :prop_tgt:`C_STANDARD` target property is treated as optional and may "decay" to a previous standard if the requested is -not available. +not available. For compilers that have no notion of a standard level, such as +MSVC, this has no effect. See the :manual:`cmake-compile-features(7)` manual for information on compile features. diff --git a/Help/release/dev/feature-record-msvc.rst b/Help/release/dev/feature-record-msvc.rst new file mode 100644 index 0000000..a8c9fd1 --- /dev/null +++ b/Help/release/dev/feature-record-msvc.rst @@ -0,0 +1,5 @@ +feature-record-msvc +------------------- + +* The :manual:`Compile Features <cmake-compile-features(7)>` functionality + is now aware of features supported by Microsoft Visual Studio (``MSVC``). diff --git a/Help/release/dev/rpm_multi_prefix.rst b/Help/release/dev/rpm_multi_prefix.rst new file mode 100644 index 0000000..0329592 --- /dev/null +++ b/Help/release/dev/rpm_multi_prefix.rst @@ -0,0 +1,11 @@ +rpm_multi_prefix +---------------- + +* The :module:`CPackRPM` module learned a new + :variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` variable to + specify a component-specific value to use instead of + :variable:`CPACK_PACKAGING_INSTALL_PREFIX`. + +* The :module:`CPackRPM` module learned a new + :variable:`CPACK_RPM_RELOCATION_PATHS` variable to + specify multiple relocation prefixes for a single rpm package. diff --git a/Help/release/dev/vs-shader-flags.rst b/Help/release/dev/vs-shader-flags.rst new file mode 100644 index 0000000..0d3f6cc --- /dev/null +++ b/Help/release/dev/vs-shader-flags.rst @@ -0,0 +1,5 @@ +vs-shader-flags +--------------- + +* A :prop_sf:`VS_SHADER_FLAGS` source file property was added to specify + additional shader flags to ``.hlsl`` files, for the Visual Studio generators. diff --git a/Help/release/dev/xcode-revise-make-program.rst b/Help/release/dev/xcode-revise-make-program.rst new file mode 100644 index 0000000..f50cf44 --- /dev/null +++ b/Help/release/dev/xcode-revise-make-program.rst @@ -0,0 +1,6 @@ +xcode-revise-make-program +------------------------- + +* The :generator:`Xcode` generator no longer requires a value for + the :variable:`CMAKE_MAKE_PROGRAM` variable to be located up front. + It now locates ``xcodebuild`` when needed at build time. diff --git a/Help/variable/CMAKE_MAKE_PROGRAM.rst b/Help/variable/CMAKE_MAKE_PROGRAM.rst index 97caa8a..f1d88a5 100644 --- a/Help/variable/CMAKE_MAKE_PROGRAM.rst +++ b/Help/variable/CMAKE_MAKE_PROGRAM.rst @@ -23,8 +23,15 @@ to configure the project: otherwise undocumented ``cmakexbuild`` wrapper implementing some workarounds). - This generator stores ``CMAKE_MAKE_PROGRAM`` in the CMake cache - so that it may be edited by the user. + This generator prefers to lookup the build tool at build time + rather than to store ``CMAKE_MAKE_PROGRAM`` in the CMake cache + ahead of time. This is because ``xcodebuild`` is easy to find, + the ``cmakexbuild`` wrapper is needed only for older Xcode versions, + and the path to ``cmakexbuild`` may be outdated if CMake itself moves. + + For compatibility with versions of CMake prior to 3.2, if + a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to + the CMake cache then CMake will use the specified value. * The Visual Studio generators set this to the full path to ``MSBuild.exe`` (VS >= 10), ``devenv.com`` (VS 7,8,9), diff --git a/Modules/CMakeFindXCode.cmake b/Modules/CMakeFindXCode.cmake index 5c4f596..da0b97b 100644 --- a/Modules/CMakeFindXCode.cmake +++ b/Modules/CMakeFindXCode.cmake @@ -12,9 +12,5 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_program(CMAKE_MAKE_PROGRAM - NAMES xcodebuild - PATHS - /usr/bin - ) -mark_as_advanced(CMAKE_MAKE_PROGRAM) +# Empty placeholder for input dependencies in existing +# build trees produced by older versions of CMake. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index d2cb2ee..43e3fe0 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -379,6 +379,34 @@ # # May be used to add more exclude path (directories or files) from the initial # default list of excluded paths. See CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST. +# +# .. variable:: CPACK_RPM_RELOCATION_PATHS +# +# * Mandatory : NO +# * Default : - +# +# May be used to specify more than one relocation path per relocatable RPM. +# Variable contains a list of relocation paths that if relative are prefixed +# by the value of CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX or by the value of +# CPACK_PACKAGING_INSTALL_PREFIX if the component version is not provided. +# Variable is not component based as its content can be used to set a different +# path prefix for e.g. binary dir and documentation dir at the same time. +# Only prefixes that are required by a certain component are added to that +# component - component must contain at least one file/directory/symbolic link +# with CPACK_RPM_RELOCATION_PATHS prefix for a certain relocation path +# to be added. Package will not contain any relocation paths if there are no +# files/directories/symbolic links on any of the provided prefix locations. +# Packages that either do not contain any relocation paths or contain +# files/directories/symbolic links that are outside relocation paths print +# out an AUTHOR_WARNING that RPM will be partially relocatable. +# +# .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX +# +# * Mandatory : NO +# * Default : CPACK_PACKAGING_INSTALL_PREFIX +# +# May be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for +# relocatable RPM packages. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -395,6 +423,62 @@ # Author: Eric Noulard with the help of Alexander Neundorf. +function(cpack_rpm_prepare_relocation_paths) + # set appropriate prefix, remove possible trailing slash and convert backslashes to slashes + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX) + file(TO_CMAKE_PATH "${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX}" PATH_PREFIX) + else() + file(TO_CMAKE_PATH "${CPACK_PACKAGING_INSTALL_PREFIX}" PATH_PREFIX) + endif() + + set(RPM_RELOCATION_PATHS "${CPACK_RPM_RELOCATION_PATHS}") + list(REMOVE_DUPLICATES RPM_RELOCATION_PATHS) + + # set base path prefix + if(EXISTS "${WDIR}/${PATH_PREFIX}") + set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n") + list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}") + endif() + + # set other path prefixes + foreach(RELOCATION_PATH ${RPM_RELOCATION_PATHS}) + if(IS_ABSOLUTE "${RELOCATE_PATH}") + set(PREPARED_RELOCATION_PATH "${RELOCATION_PATH}") + else() + set(PREPARED_RELOCATION_PATH "${PATH_PREFIX}/${RELOCATION_PATH}") + endif() + + if(EXISTS "${WDIR}/${PREPARED_RELOCATION_PATH}") + set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PREPARED_RELOCATION_PATH}\n") + list(APPEND RPM_USED_PACKAGE_PREFIXES "${PREPARED_RELOCATION_PATH}") + endif() + endforeach() + + # warn about all the paths that are not relocatable + file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*") + foreach(TMP_PATH ${FILE_PATHS_}) + string(LENGTH "${WDIR}" WDIR_LEN) + string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH) + unset(TMP_PATH_FOUND_) + + foreach(RELOCATION_PATH ${RPM_USED_PACKAGE_PREFIXES}) + file(RELATIVE_PATH REL_PATH_ "${RELOCATION_PATH}" "${TMP_PATH}") + string(SUBSTRING "${REL_PATH_}" 0 2 PREFIX_) + + if(NOT "${PREFIX_}" STREQUAL "..") + set(TPM_PATH_FOUND_ TRUE) + break() + endif() + endforeach() + + if(NOT TPM_PATH_FOUND_) + message(AUTHOR_WARNING "CPackRPM:Warning: Path ${TMP_PATH} is not on one of the relocatable paths! Package will be partially relocatable.") + endif() + endforeach() + + set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE) +endfunction() + if(CMAKE_BINARY_DIR) message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") endif() @@ -636,13 +720,16 @@ if(CPACK_PACKAGE_RELOCATABLE) set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) endif() if(CPACK_RPM_PACKAGE_RELOCATABLE) + unset(TMP_RPM_PREFIXES) + if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: Trying to build a relocatable package") endif() if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") else() - set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) + set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files) + cpack_rpm_prepare_relocation_paths() endif() endif() @@ -856,15 +943,21 @@ if(CPACK_RPM_PACKAGE_RELOCATABLE) # get a list of the elements in CPACK_RPM_PACKAGE_PREFIX and remove # the final element (so the install-prefix dir itself is not omitted # from the RPM's content-list) - string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${CPACK_RPM_PACKAGE_PREFIX}") - list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) - # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX - foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) - list(APPEND _TMP_LIST "${_ELEM}") - string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") - set(_OMIT_DIR "-o -path ${_OMIT_DIR}") - separate_arguments(_OMIT_DIR) - list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) + foreach(CPACK_RPM_PACKAGE_PREFIX ${RPM_PACKAGE_PREFIXES}) + string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${CPACK_RPM_PACKAGE_PREFIX}") + list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) + unset(_TMP_LIST) + # Now generate all of the parent dirs of CPACK_RPM_PACKAGE_PREFIX + foreach(_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) + list(APPEND _TMP_LIST "${_ELEM}") + string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") + list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND) + if(_DUPLICATE_FOUND EQUAL -1) + set(_OMIT_DIR "-o -path ${_OMIT_DIR}") + separate_arguments(_OMIT_DIR) + list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) + endif() + endforeach() endforeach() endif() @@ -1101,7 +1194,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ \@TMP_RPM_AUTOREQ\@ \@TMP_RPM_AUTOREQPROV\@ \@TMP_RPM_BUILDARCH\@ -\@TMP_RPM_PREFIX\@ +\@TMP_RPM_PREFIXES\@ %define _rpmdir \@CPACK_RPM_DIRECTORY\@ %define _rpmfilename \@CPACK_RPM_FILE_NAME\@ diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 5fc3deb..d18adaf 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -6,6 +6,8 @@ set(_cmake_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 404") set(GNU50_CXX14 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L") set(_cmake_feature_test_cxx_variable_templates "${GNU50_CXX14}") +set(_cmake_feature_test_cxx_relaxed_constexpr "${GNU50_CXX14}") +set(_cmake_feature_test_cxx_aggregate_default_initializers "${GNU50_CXX14}") # GNU 4.9 in c++14 mode sets __cplusplus to 201300L, so don't test for the # correct value of it below. diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake new file mode 100644 index 0000000..c770211 --- /dev/null +++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake @@ -0,0 +1,106 @@ + +# Reference: http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx +# http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx +# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx +# http://www.visualstudio.com/en-us/news/vs2015-preview-vs.aspx + + +set(_cmake_oldestSupported "_MSC_VER >= 1600") + +set(MSVC_2015 "_MSC_VER >= 1900") +set(_cmake_feature_test_cxx_alignas "${MSVC_2015}") +set(_cmake_feature_test_cxx_alignof "${MSVC_2015}") +set(_cmake_feature_test_cxx_binary_literals "${MSVC_2015}") +set(_cmake_feature_test_cxx_decltype_auto "${MSVC_2015}") +# Digit separators are not available as of VS 2015 Preview, but a footnote +# says they will be available in the RTM. +set(_cmake_feature_test_cxx_digit_separators "${MSVC_2015}") +set(_cmake_feature_test_cxx_func_identifier "${MSVC_2015}") +# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx +# Note 1. While previous version of VisualStudio said they supported these +# they silently produced bad code, and are now marked as having partial +# support in previous versions. The footnote says the support will be complete +# in MSVC 2015, so support the feature for that version, assuming that is true. +set(_cmake_feature_test_cxx_generalized_initializers "${MSVC_2015}") +set(_cmake_feature_test_cxx_nonstatic_member_init "${MSVC_2015}") +# Microsoft calls this 'rvalue references v3' +set(_cmake_feature_test_cxx_defaulted_move_initializers "${MSVC_2015}") +set(_cmake_feature_test_cxx_generic_lambdas "${MSVC_2015}") +set(_cmake_feature_test_cxx_inheriting_constructors "${MSVC_2015}") +set(_cmake_feature_test_cxx_inline_namespaces "${MSVC_2015}") +set(_cmake_feature_test_cxx_lambda_init_captures "${MSVC_2015}") +set(_cmake_feature_test_cxx_noexcept "${MSVC_2015}") +set(_cmake_feature_test_cxx_return_type_deduction "${MSVC_2015}") +set(_cmake_feature_test_cxx_sizeof_member "${MSVC_2015}") +set(_cmake_feature_test_cxx_thread_local "${MSVC_2015}") +set(_cmake_feature_test_cxx_unicode_literals "${MSVC_2015}") +set(_cmake_feature_test_cxx_unrestricted_unions "${MSVC_2015}") +set(_cmake_feature_test_cxx_user_literals "${MSVC_2015}") +set(_cmake_feature_test_cxx_reference_qualified_functions "${MSVC_2015}") +# "The copies and moves don't interact precisely like the Standard says they +# should. For example, deletion of moves is specified to also suppress +# copies, but Visual C++ in Visual Studio 2013 does not." +# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx +# lists this as 'partial' in 2013 +set(_cmake_feature_test_cxx_deleted_functions "${MSVC_2015}") + +set(MSVC_2013 "_MSC_VER >= 1800") +set(_cmake_feature_test_cxx_alias_templates "${MSVC_2013}") +# Microsoft now states they support contextual conversions in 2013 and above. +# See footnote 6 at: +# http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx +set(_cmake_feature_test_cxx_contextual_conversions "${MSVC_2013}") +set(_cmake_feature_test_cxx_default_function_template_args "${MSVC_2013}") +set(_cmake_feature_test_cxx_defaulted_functions "${MSVC_2013}") +set(_cmake_feature_test_cxx_delegating_constructors "${MSVC_2013}") +set(_cmake_feature_test_cxx_explicit_conversions "${MSVC_2013}") +set(_cmake_feature_test_cxx_raw_string_literals "${MSVC_2013}") +set(_cmake_feature_test_cxx_uniform_initialization "${MSVC_2013}") +# Support is documented, but possibly partly broken: +# https://msdn.microsoft.com/en-us/library/hh567368.aspx +# http://thread.gmane.org/gmane.comp.lib.boost.devel/244986/focus=245333 +set(_cmake_feature_test_cxx_variadic_templates "${MSVC_2013}") + +set(MSVC_2012 "_MSC_VER >= 1700") +set(_cmake_feature_test_cxx_enum_forward_declarations "${MSVC_2012}") +set(_cmake_feature_test_cxx_final "${MSVC_2012}") +set(_cmake_feature_test_cxx_range_for "${MSVC_2012}") +set(_cmake_feature_test_cxx_strong_enums "${MSVC_2012}") + +set(MSVC_2010 "_MSC_VER >= 1600") +set(_cmake_feature_test_cxx_auto_type "${MSVC_2010}") +set(_cmake_feature_test_cxx_decltype "${MSVC_2010}") +set(_cmake_feature_test_cxx_extended_friend_declarations "${MSVC_2010}") +set(_cmake_feature_test_cxx_extern_templates "${MSVC_2010}") +set(_cmake_feature_test_cxx_lambdas "${MSVC_2010}") +set(_cmake_feature_test_cxx_local_type_template_args "${MSVC_2010}") +set(_cmake_feature_test_cxx_long_long_type "${MSVC_2010}") +set(_cmake_feature_test_cxx_nullptr "${MSVC_2010}") +set(_cmake_feature_test_cxx_override "${MSVC_2010}") +set(_cmake_feature_test_cxx_right_angle_brackets "${MSVC_2010}") +set(_cmake_feature_test_cxx_rvalue_references "${MSVC_2010}") +set(_cmake_feature_test_cxx_static_assert "${MSVC_2010}") +set(_cmake_feature_test_cxx_template_template_parameters "${MSVC_2010}") +set(_cmake_feature_test_cxx_trailing_return_types "${MSVC_2010}") +set(_cmake_feature_test_cxx_variadic_macros "${MSVC_2010}") + +# Currently unsupported: +# set(_cmake_feature_test_cxx_constexpr ) +# set(_cmake_feature_test_cxx_relaxed_constexpr ) +# set(_cmake_feature_test_cxx_attributes ) +# set(_cmake_feature_test_cxx_attribute_deprecated ) +# 'NSDMIs for aggregates' +# set(_cmake_feature_test_cxx_aggregate_default_initializers ) +# set(_cmake_feature_test_cxx_variable_templates ) + +# In theory decltype incomplete return types was added in 2012 +# but without support for decltype_auto and return type deduction this +# feature is unusable. This remains so as of VS 2015 Preview. +# set(_cmake_feature_test_cxx_decltype_incomplete_return_types ) + +# Unset all the variables that we don't need exposed. +# _cmake_oldestSupported is required by WriteCompilerDetectionHeader +set(MSVC_2015) +set(MSVC_2013) +set(MSVC_2012) +set(MSVC_2010) diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake new file mode 100644 index 0000000..962aaeb --- /dev/null +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -0,0 +1,6 @@ +# MSVC has no specific language level or flags to change it. +set(CMAKE_CXX_STANDARD_DEFAULT "") + +macro(cmake_record_cxx_compile_features) + record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES) +endmacro() diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index bfbe01f..3adc269 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -285,7 +285,7 @@ endfunction() if (OPENSSL_INCLUDE_DIR) if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str - REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") + REGEX "^# *define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") # The version number is encoded as 0xMNNFFPPS: major minor fix patch status # The status gives if this is a developer or prerelease and is ignored here. diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index e81bc08..d18f47c 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -36,7 +36,7 @@ # PREFIX ClimbingStats # OUTPUT_FILES_VAR support_files # OUTPUT_DIR compilers -# COMPILERS GNU Clang +# COMPILERS GNU Clang MSVC # FEATURES cxx_variadic_templates # ) # install(FILES @@ -100,7 +100,7 @@ # write_compiler_detection_header( # FILE climbingstats_compiler_detection.h # PREFIX ClimbingStats -# COMPILERS GNU Clang AppleClang +# COMPILERS GNU Clang AppleClang MSVC # FEATURES cxx_variadic_templates # ) # @@ -321,6 +321,7 @@ function(write_compiler_detection_header GNU Clang AppleClang + MSVC SunPro ) @@ -528,6 +529,8 @@ function(write_compiler_detection_header # 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))) +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __declspec(align(X)) # else # define ${def_value} # endif @@ -540,6 +543,8 @@ function(write_compiler_detection_header # 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) +# elif ${prefix_arg}_COMPILER_IS_MSVC +# define ${def_value} __alignof(X) # endif \n") endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index edd2e5a..8722425 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 1) -set(CMake_VERSION_PATCH 20150127) +set(CMake_VERSION_PATCH 20150204) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index f21fcf6..1c670d2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -437,6 +437,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: " << symlinkedIt->second << "--> " << symlinkedIt->first << std::endl); + // make sure directory exists for symlink + std::string destDir = + cmSystemTools::GetFilenamePath(symlinkedIt->second); + if(!destDir.empty() && !cmSystemTools::MakeDirectory(destDir)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create dir: " + << destDir + << "\nTrying to create symlink: " + << symlinkedIt->second << "--> " + << symlinkedIt->first + << std::endl); + } if (!cmSystemTools::CreateSymlink(symlinkedIt->first, symlinkedIt->second)) { diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 8f087ab..f941408 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -67,13 +67,13 @@ static const char* cmCTestErrorMatches[] = { "^CMake Error.*:", ":[ \\t]cannot find", ":[ \\t]can't find", - ": \\*\\*\\* No rule to make target \\`.*\\'. Stop", + ": \\*\\*\\* No rule to make target \\[`'].*\\'. Stop", ": \\*\\*\\* No targets specified and no makefile found", ": Invalid loader fixup for symbol", ": Invalid fixups exist", ": Can't find library for", ": internal link edit command failed", - ": Unrecognized option \\`.*\\'", + ": Unrecognized option \\[`'].*\\'", "\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\([^WI]\\)", "ld: 0706-006 Cannot find or open library file: -l ", "ild: \\(argument error\\) can't find library argument ::", diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 5f246f9..6692a92 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1370,6 +1370,8 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode { std::vector<std::string> const& langAvailable = availableFeatures[lit->first]; + const char* standardDefault = context->Makefile + ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT"); for (std::vector<std::string>::const_iterator it = lit->second.begin(); it != lit->second.end(); ++it) { @@ -1378,6 +1380,12 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode { return "0"; } + if (standardDefault && !*standardDefault) + { + // This compiler has no notion of language standard levels. + // All features known for the language are always available. + continue; + } if (!context->Makefile->HaveStandardAvailable(target, lit->first, *it)) { @@ -1386,8 +1394,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode const char* l = target->GetProperty(lit->first + "_STANDARD"); if (!l) { - l = context->Makefile - ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT"); + l = standardDefault; } assert(l); context->MaxLanguageStandard[target][lit->first] = l; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 8d18c3a..a4f099b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -663,6 +663,14 @@ void cmTargetTraceDependencies::Trace() { std::vector<std::string> objDeps; cmSystemTools::ExpandListArgument(additionalDeps, objDeps); + for(std::vector<std::string>::iterator odi = objDeps.begin(); + odi != objDeps.end(); ++odi) + { + if (cmSystemTools::FileIsFullPath(*odi)) + { + *odi = cmSystemTools::CollapseFullPath(*odi); + } + } this->FollowNames(objDeps); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4c95a9f..6d0fedc 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -315,25 +315,6 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) "make program", cmCacheManager::FILEPATH); } - - if(makeProgram.find("xcodebuild") != makeProgram.npos) - { - // due to the text file busy /bin/sh problem with xcodebuild - // use the cmakexbuild wrapper instead. This program - // will run xcodebuild and if it sees the error text file busy - // it will stop forwarding output, and let the build finish. - // Then it will retry the build. It will continue this - // until no text file busy errors occur. - std::string cmakexbuild = - this->CMakeInstance->GetCacheManager()->GetCacheValue("CMAKE_COMMAND"); - cmakexbuild = cmakexbuild.substr(0, cmakexbuild.length()-5); - cmakexbuild += "cmakexbuild"; - - mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", - cmakexbuild.c_str(), - "make program", - cmCacheManager::FILEPATH); - } } // enable the given language diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b6c428b..cd0dcc6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -136,13 +136,13 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version) sscanf(this->VersionString.c_str(), "%u.%u", &v[0], &v[1]); this->XcodeVersion = 10*v[0] + v[1]; - this->FindMakeProgramFile = "CMakeFindXCode.cmake"; this->RootObject = 0; this->MainGroupChildren = 0; this->SourcesGroupChildren = 0; this->ResourcesGroupChildren = 0; this->CurrentMakefile = 0; this->CurrentLocalGenerator = 0; + this->XcodeBuildCommandInitialized = false; } //---------------------------------------------------------------------------- @@ -202,6 +202,49 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory } //---------------------------------------------------------------------------- +void cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf) +{ + // The Xcode generator knows how to lookup its build tool + // directly instead of needing a helper module to do it, so we + // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. + if(cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) + { + mf->AddDefinition("CMAKE_MAKE_PROGRAM", + this->GetXcodeBuildCommand().c_str()); + } +} + +//---------------------------------------------------------------------------- +std::string const& cmGlobalXCodeGenerator::GetXcodeBuildCommand() +{ + if(!this->XcodeBuildCommandInitialized) + { + this->XcodeBuildCommandInitialized = true; + this->XcodeBuildCommand = this->FindXcodeBuildCommand(); + } + return this->XcodeBuildCommand; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand() +{ + if (this->XcodeVersion >= 40) + { + std::string makeProgram = cmSystemTools::FindProgram("xcodebuild"); + if (makeProgram.empty()) + { + makeProgram = "xcodebuild"; + } + return makeProgram; + } + else + { + // Use cmakexbuild wrapper to suppress environment dump from output. + return cmSystemTools::GetCMakeCommand() + "xbuild"; + } +} + +//---------------------------------------------------------------------------- bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts, cmMakefile* mf) { @@ -272,7 +315,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( { // now build the test makeCommand.push_back( - this->SelectMakeProgram(makeProgram, "xcodebuild") + this->SelectMakeProgram(makeProgram, this->GetXcodeBuildCommand()) ); makeCommand.push_back("-project"); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index a39c8c7..f513e28 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -70,6 +70,8 @@ public: const std::string& suffix, std::string& dir); + virtual void FindMakeProgram(cmMakefile*); + ///! What is the configurations directory variable called? virtual const char* GetCMakeCFGIntDir() const; ///! expand CFGIntDir @@ -212,6 +214,11 @@ protected: std::vector<cmXCodeObject*> XCodeObjects; cmXCodeObject* RootObject; private: + std::string const& GetXcodeBuildCommand(); + std::string FindXcodeBuildCommand(); + std::string XcodeBuildCommand; + bool XcodeBuildCommandInitialized; + void PrintCompilerAdvice(std::ostream&, std::string const&, const char*) const {} diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 834f705..af4c950 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2207,6 +2207,13 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target, { return; } + const char* defaultStd + = this->Makefile->GetDefinition("CMAKE_" + lang + "_STANDARD_DEFAULT"); + if (defaultStd && !*defaultStd) + { + // This compiler has no notion of language standard levels. + return; + } std::string stdProp = lang + "_STANDARD"; const char *standardProp = target->GetProperty(stdProp); if (!standardProp) @@ -2269,8 +2276,6 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target, std::find(stds.begin(), stds.end(), standard); assert(stdIt != stds.end()); - const char* defaultStd - = this->Makefile->GetDefinition("CMAKE_" + lang + "_STANDARD_DEFAULT"); std::vector<std::string>::const_iterator defaultStdIt; if (defaultStd) { diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f825f5f..fbf2140 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1826,7 +1826,7 @@ void cmLocalUnixMakefileGenerator3 std::vector<std::string> no_depends; this->WriteMakeRule(ruleFileStream, "Allow only one \"make -f Makefile2\" at a time, but pass parallelism.", - ".NOTPARALLEL", no_depends, no_commands, true); + ".NOTPARALLEL", no_depends, no_commands, false); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 87e62d7..ba914e1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -5253,6 +5253,27 @@ bool cmMakefile:: HaveCStandardAvailable(cmTarget const* target, const std::string& feature) const { + const char* defaultCStandard = + this->GetDefinition("CMAKE_C_STANDARD_DEFAULT"); + if (!defaultCStandard) + { + std::ostringstream e; + e << "CMAKE_C_STANDARD_DEFAULT is not set. COMPILE_FEATURES support " + "not fully configured for this compiler."; + this->IssueMessage(cmake::INTERNAL_ERROR, e.str()); + // Return true so the caller does not try to lookup the default standard. + return true; + } + if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS), + cmStrCmp(defaultCStandard)) == cmArrayEnd(C_STANDARDS)) + { + std::ostringstream e; + e << "The CMAKE_C_STANDARD_DEFAULT variable contains an " + "invalid value: \"" << defaultCStandard << "\"."; + this->IssueMessage(cmake::INTERNAL_ERROR, e.str()); + return false; + } + bool needC90 = false; bool needC99 = false; bool needC11 = false; @@ -5262,7 +5283,7 @@ HaveCStandardAvailable(cmTarget const* target, const char *existingCStandard = target->GetProperty("C_STANDARD"); if (!existingCStandard) { - existingCStandard = this->GetDefinition("CMAKE_C_STANDARD_DEFAULT"); + existingCStandard = defaultCStandard; } if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS), @@ -5331,6 +5352,27 @@ bool cmMakefile::IsLaterStandard(std::string const& lang, bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, const std::string& feature) const { + const char* defaultCxxStandard = + this->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT"); + if (!defaultCxxStandard) + { + std::ostringstream e; + e << "CMAKE_CXX_STANDARD_DEFAULT is not set. COMPILE_FEATURES support " + "not fully configured for this compiler."; + this->IssueMessage(cmake::INTERNAL_ERROR, e.str()); + // Return true so the caller does not try to lookup the default standard. + return true; + } + if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS), + cmStrCmp(defaultCxxStandard)) == cmArrayEnd(CXX_STANDARDS)) + { + std::ostringstream e; + e << "The CMAKE_CXX_STANDARD_DEFAULT variable contains an " + "invalid value: \"" << defaultCxxStandard << "\"."; + this->IssueMessage(cmake::INTERNAL_ERROR, e.str()); + return false; + } + bool needCxx98 = false; bool needCxx11 = false; bool needCxx14 = false; @@ -5339,7 +5381,7 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, const char *existingCxxStandard = target->GetProperty("CXX_STANDARD"); if (!existingCxxStandard) { - existingCxxStandard = this->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT"); + existingCxxStandard = defaultCxxStandard; } if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS), diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 67824c6..cfd8937 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -200,21 +200,21 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, return flags; } - -bool cmNinjaTargetGenerator::needsDepFile(const std::string& lang) +bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const { - cmMakefile* mf = this->GetMakefile(); - - const bool usingMSVC = std::string("MSVC") == - (mf->GetDefinition("CMAKE_C_COMPILER_ID") ? - mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") : - mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID")); - - return !usingMSVC || lang == "RC"; + if (lang == "C" || lang == "CXX") + { + cmMakefile* mf = this->GetMakefile(); + return ( + strcmp(mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"), "MSVC") == 0 || + strcmp(mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"), "MSVC") == 0 || + strcmp(mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID"), "MSVC") == 0 || + strcmp(mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID"), "MSVC") == 0 + ); + } + return false; } - - // TODO: Refactor with // void cmMakefileTargetGenerator::WriteTargetLanguageFlags(). std::string @@ -391,22 +391,22 @@ cmNinjaTargetGenerator cmMakefile* mf = this->GetMakefile(); - const std::string cId = mf->GetDefinition("CMAKE_C_COMPILER_ID") - ? mf->GetSafeDefinition("CMAKE_C_COMPILER_ID") - : mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"); - const std::string sId = mf->GetDefinition("CMAKE_C_SIMULATE_ID") - ? mf->GetSafeDefinition("CMAKE_C_SIMULATE_ID") - : mf->GetSafeDefinition("CMAKE_CXX_SIMULATE_ID"); - const bool usingMSVC = (cId == "MSVC" || sId == "MSVC"); - // Tell ninja dependency format so all deps can be loaded into a database std::string deptype; std::string depfile; std::string cldeps; std::string flags = "$FLAGS"; - if (usingMSVC) + if (this->NeedDepTypeMSVC(lang)) + { + deptype = "msvc"; + depfile = ""; + flags += " /showIncludes"; + } + else if (lang == "RC" && this->NeedDepTypeMSVC("C")) { - if (!mf->GetIsSourceFileTryCompile() && lang == "RC") + // For the MS resource compiler we need cmcldeps, but skip dependencies + // for source-file try_compile cases because they are always fresh. + if (!mf->GetIsSourceFileTryCompile()) { deptype = "gcc"; depfile = "$DEP_FILE"; @@ -419,12 +419,6 @@ cmNinjaTargetGenerator cldeps += mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX"); cldeps += "\" \"" + cl + "\" "; } - else - { - deptype = "msvc"; - depfile = ""; - flags += " /showIncludes"; - } } else { @@ -605,6 +599,14 @@ cmNinjaTargetGenerator if(const char* objectDeps = source->GetProperty("OBJECT_DEPENDS")) { std::vector<std::string> depList; cmSystemTools::ExpandListArgument(objectDeps, depList); + for(std::vector<std::string>::iterator odi = depList.begin(); + odi != depList.end(); ++odi) + { + if (cmSystemTools::FileIsFullPath(*odi)) + { + *odi = cmSystemTools::CollapseFullPath(*odi); + } + } std::transform(depList.begin(), depList.end(), std::back_inserter(implicitDeps), MapToNinjaPath()); } @@ -628,7 +630,7 @@ cmNinjaTargetGenerator cmNinjaVars vars; vars["FLAGS"] = this->ComputeFlagsForObject(source, language); vars["DEFINES"] = this->ComputeDefines(source, language); - if (needsDepFile(language)) { + if (!this->NeedDepTypeMSVC(language)) { vars["DEP_FILE"] = cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d"); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 17cf517..5733fde 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -42,7 +42,7 @@ public: std::string GetTargetName() const; - bool needsDepFile(const std::string& lang); + bool NeedDepTypeMSVC(const std::string& lang) const; protected: diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b265c0e..a286049 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1211,6 +1211,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) std::string shaderType; std::string shaderEntryPoint; std::string shaderModel; + std::string shaderAdditionalFlags; std::string ext = cmSystemTools::LowerCase(sf->GetExtension()); if(ext == "hlsl") { @@ -1233,6 +1234,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) shaderModel = sm; toolHasSettings = true; } + // Figure out if there's any additional flags to use + if (const char* saf = sf->GetProperty("VS_SHADER_FLAGS")) + { + shaderAdditionalFlags = saf; + toolHasSettings = true; + } } else if(ext == "jpg" || ext == "png") @@ -1342,6 +1349,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) (*this->BuildFileStream) << cmVS10EscapeXML(shaderModel) << "</ShaderModel>\n"; } + if(!shaderAdditionalFlags.empty()) + { + this->WriteString("<AdditionalOptions>", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags) + << "</AdditionalOptions>\n"; + } this->WriteString("</", 2); (*this->BuildFileStream) << tool << ">\n"; } @@ -2749,6 +2762,8 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() this->WriteString("<ApplicationTypeRevision>", 2); (*this->BuildFileStream) << cmVS10EscapeXML(v) << "</ApplicationTypeRevision>\n"; + this->WriteString("<DefaultLanguage>en-US" + "</DefaultLanguage>\n", 2); if(v == "8.1") { // Visual Studio 12.0 is necessary for building 8.1 apps @@ -2783,12 +2798,12 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() if(isAppContainer) { this->WriteString("<AppContainerApplication>true" - "</AppContainerApplication>", 2); + "</AppContainerApplication>\n", 2); } else if (this->Platform == "ARM") { this->WriteString("<WindowsSDKDesktopARMSupport>true" - "</WindowsSDKDesktopARMSupport>", 2); + "</WindowsSDKDesktopARMSupport>\n", 2); } } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1a79854..7e7aa2e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -51,7 +51,7 @@ if(BUILD_TESTING) set(CMake_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") endif() - if(CMAKE_GENERATOR MATCHES "Visual Studio") + if(CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "") else() set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index ff40e30..b55594e 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -110,6 +110,12 @@ set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full) set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) +# set CPACK_RPM_RELOCATION_PATHS here as GNUInstallDirs script +# can not be used in CPack scripts due to CMAKE_SIZEOF_VOID_P +# variable not being set +set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}" + "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}") + # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way # (Behavior would be different for RPM or TGZ or DEB ...) diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index 8c01b32..de0ee46 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -6,15 +6,17 @@ if(CPACK_GENERATOR MATCHES "ZIP") endif() if(CPACK_GENERATOR MATCHES "RPM") - set(CPACK_RPM_COMPONENT_INSTALL "ON") - set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") + set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") - # test package summary override - set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + set(CPACK_RPM_COMPONENT_INSTALL "ON") + set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") - # test package description override - set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") + # test package summary override + set(CPACK_RPM_PACKAGE_SUMMARY "default summary") + set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + + # test package description override + set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 4d56218..68d846f 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -140,6 +140,12 @@ if(CPackGen MATCHES "RPM") "C/C\\+\\+ header files for use with MyLib") if(${CPackComponentWay} STREQUAL "IgnoreGroup") + # set gnu install prefixes to what they are set during rpm creation + # CMAKE_SIZEOF_VOID_P is not set here but lib is prefix of lib64 so + # relocation path test won't fail on OSes with lib64 library location + include(GNUInstallDirs) + set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") + foreach(check_file ${expected_file}) string(REGEX MATCH ".*libraries.*" check_file_libraries_match ${check_file}) string(REGEX MATCH ".*headers.*" check_file_headers_match ${check_file}) @@ -154,15 +160,23 @@ if(CPackGen MATCHES "RPM") if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") + set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(spec_regex "*libraries*") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") + set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") + set(spec_regex "*headers*") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") + set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(spec_regex "*applications*") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") + set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(spec_regex "*Unspecified*") else() message(FATAL_ERROR "error: unexpected rpm package '${check_file}'") endif() @@ -170,13 +184,25 @@ if(CPackGen MATCHES "RPM") string(REGEX MATCH ${check_file_match_expected_summary} check_file_match_summary ${check_file_content}) if(NOT check_file_match_summary) - message(FATAL_ERROR "error: '${check_file}' rpm package summary does not match expected value - regex '${check_file_match_expected_summary}'") + message(FATAL_ERROR "error: '${check_file}' rpm package summary does not match expected value - regex '${check_file_match_expected_summary}'; RPM output: '${check_file_content}'") endif() string(REGEX MATCH ${check_file_match_expected_description} check_file_match_description ${check_file_content}) if(NOT check_file_match_description) - message(FATAL_ERROR "error: '${check_file}' rpm package description does not match expected value - regex '${check_file_match_expected_description}'") + message(FATAL_ERROR "error: '${check_file}' rpm package description does not match expected value - regex '${check_file_match_expected_description}'; RPM output: '${check_file_content}'") + endif() + + string(REGEX MATCH ${check_file_match_expected_relocation_path} check_file_match_relocation_path ${check_file_content}) + + if(NOT check_file_match_relocation_path) + file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/${spec_regex}.spec") + + if(spec_file) + file(READ ${spec_file} spec_file_content) + endif() + + message(FATAL_ERROR "error: '${check_file}' rpm package relocation path does not match expected value - regex '${check_file_match_expected_relocation_path}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") endif() endforeach() elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt index 930d220..13d1b01 100644 --- a/Tests/CompileDefinitions/CMakeLists.txt +++ b/Tests/CompileDefinitions/CMakeLists.txt @@ -1,6 +1,4 @@ - cmake_minimum_required(VERSION 2.8) - project(CompileDefinitions) if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6") @@ -19,8 +17,8 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "BUILD_CONFIG_NAME=\"$<CONFIGURATION>\"" ) -add_subdirectory(add_definitions_command) +add_subdirectory(add_def_cmd) add_subdirectory(target_prop) -add_subdirectory(add_definitions_command_with_target_prop) +add_subdirectory(add_def_cmd_tprop) add_executable(CompileDefinitions runtest.c) diff --git a/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt b/Tests/CompileDefinitions/add_def_cmd/CMakeLists.txt index 23e0134..2bce602 100644 --- a/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt +++ b/Tests/CompileDefinitions/add_def_cmd/CMakeLists.txt @@ -1,6 +1,3 @@ - -project(add_definitions_command) - add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun -DCMAKE_IS_="Fun") if (NOT NO_SPACES_IN_DEFINE_VALUES) add_definitions(-DCMAKE_IS_REALLY="Very Fun") @@ -12,4 +9,4 @@ endif() add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun) add_definitions(-DBUILD_IS_DEBUG=$<CONFIG:Debug> -DBUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>) -add_executable(add_definitions_command_executable ../compiletest.cpp) +add_executable(add_def_cmd_exe ../compiletest.cpp) diff --git a/Tests/CompileDefinitions/add_def_cmd_tprop/CMakeLists.txt b/Tests/CompileDefinitions/add_def_cmd_tprop/CMakeLists.txt new file mode 100644 index 0000000..4ef8a09 --- /dev/null +++ b/Tests/CompileDefinitions/add_def_cmd_tprop/CMakeLists.txt @@ -0,0 +1,16 @@ +add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun) + +add_executable(add_def_cmd_tprop_exe ../compiletest.cpp) + +set_target_properties(add_def_cmd_tprop_exe PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_="Fun") + +if (NOT NO_SPACES_IN_DEFINE_VALUES) + set_property(TARGET add_def_cmd_tprop_exe APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun") +endif() + +add_definitions(-DCMAKE_IS_FUN) + +set_property(TARGET add_def_cmd_tprop_exe APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun CMAKE_IS_="Fun") + +add_definitions(-DBUILD_IS_DEBUG=$<CONFIG:Debug>) +set_property(TARGET add_def_cmd_tprop_exe APPEND PROPERTY COMPILE_DEFINITIONS BUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>) diff --git a/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt b/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt deleted file mode 100644 index 55108db..0000000 --- a/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ - -project(add_definitions_command_with_target_prop) - -add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun) - -add_executable(add_definitions_command_with_target_prop_executable ../compiletest.cpp) - -set_target_properties(add_definitions_command_with_target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_="Fun") - -if (NOT NO_SPACES_IN_DEFINE_VALUES) - set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun") -endif() - -add_definitions(-DCMAKE_IS_FUN) - -set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun CMAKE_IS_="Fun") - -add_definitions(-DBUILD_IS_DEBUG=$<CONFIG:Debug>) -set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS BUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>) diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index aacf4c1..38c44c8 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -100,6 +100,31 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0) + list(REMOVE_ITEM CXX_non_features + # The cxx_contextual_conversions feature happens to work + # (for *this* testcase) with VS 2010 and VS 2012, but + # they do not document support until VS 2013. + cxx_contextual_conversions + ) + elseif (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0) + list(REMOVE_ITEM CXX_non_features + # The cxx_deleted_functions and cxx_nonstatic_member_init + # features happen to work (for *this* testcase) with VS 2013, + # but they do not document support until VS 2015. + cxx_deleted_functions + cxx_nonstatic_member_init + ) + else() + list(REMOVE_ITEM CXX_non_features + # The cxx_constexpr feature happens to work (for *this* testcase) + # with VS 2015, but they document only partial support. + cxx_constexpr + ) + endif() +endif() + set(C_ext c) set(C_standard_flag 11) set(CXX_ext cpp) @@ -128,26 +153,30 @@ foreach(lang CXX C) endforeach() if (CMAKE_C_COMPILE_FEATURES) - string(FIND "${CMAKE_C_FLAGS}" "-std=" std_flag_idx) - if (std_flag_idx EQUAL -1) - add_executable(default_dialect_C default_dialect.c) - target_compile_definitions(default_dialect_C PRIVATE - DEFAULT_C11=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},11> - DEFAULT_C99=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},99> - DEFAULT_C90=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},90> - ) + if (CMAKE_C_STANDARD_DEFAULT) + string(FIND "${CMAKE_C_FLAGS}" "-std=" std_flag_idx) + if (std_flag_idx EQUAL -1) + add_executable(default_dialect_C default_dialect.c) + target_compile_definitions(default_dialect_C PRIVATE + DEFAULT_C11=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},11> + DEFAULT_C99=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},99> + DEFAULT_C90=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},90> + ) + endif() endif() endif() if (CMAKE_CXX_COMPILE_FEATURES) - string(FIND "${CMAKE_CXX_FLAGS}" "-std=" std_flag_idx) - if (std_flag_idx EQUAL -1) - add_executable(default_dialect default_dialect.cpp) - target_compile_definitions(default_dialect PRIVATE - DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14> - DEFAULT_CXX11=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},11> - DEFAULT_CXX98=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},98> - ) + if (CMAKE_CXX_STANDARD_DEFAULT) + string(FIND "${CMAKE_CXX_FLAGS}" "-std=" std_flag_idx) + if (std_flag_idx EQUAL -1) + add_executable(default_dialect default_dialect.cpp) + target_compile_definitions(default_dialect PRIVATE + DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14> + DEFAULT_CXX11=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},11> + DEFAULT_CXX98=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},98> + ) + endif() endif() add_executable(CompileFeatures main.cpp) @@ -216,6 +245,29 @@ if (CMAKE_CXX_COMPILE_FEATURES) -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 ) endif() + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0) + add_definitions( + -DEXPECT_OVERRIDE_CONTROL=1 + -DEXPECT_INHERITING_CONSTRUCTORS=1 + -DEXPECT_FINAL=1 + -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=1 + ) + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0) + add_definitions( + -DEXPECT_OVERRIDE_CONTROL=1 + -DEXPECT_INHERITING_CONSTRUCTORS=0 + -DEXPECT_FINAL=1 + -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 + ) + else() + add_definitions( + -DEXPECT_OVERRIDE_CONTROL=0 + -DEXPECT_INHERITING_CONSTRUCTORS=0 + -DEXPECT_FINAL=0 + -DEXPECT_INHERITING_CONSTRUCTORS_AND_FINAL=0 + ) + endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") add_definitions( -DEXPECT_OVERRIDE_CONTROL=1 diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 57ffeec..268069d 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -154,6 +154,19 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/foo.c ${PROJECT_BINARY_DIR}/foo.c ) +# Test using OBJECT_DEPENDS to bring in a custom command. +# Use a path that can be simplified to make sure paths +# are consistently normalized. +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/subdir/../subdir/subdir.h + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/subdir.h.in + ${CMAKE_CURRENT_BINARY_DIR}/subdir/subdir.h + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/subdir.h.in + ) +set_property(SOURCE ${PROJECT_BINARY_DIR}/foo.c PROPERTY + OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/subdir/../subdir/subdir.h) + # Add custom command to generate not_included.h, which is a header # file that is not included by any source in this project. This will # test whether all custom command outputs explicitly listed as sources diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in index e43aed1..15d2d2c 100644 --- a/Tests/CustomCommand/foo.in +++ b/Tests/CustomCommand/foo.in @@ -6,6 +6,11 @@ int generated(); int wrapped(); +#include "subdir/subdir.h" +#ifndef SUBDIR_DEF +# error SUBDIR_DEF not defined +#endif + int main () { if (generated()*wrapped()*doc() == 3*5*7) diff --git a/Tests/CustomCommand/subdir.h.in b/Tests/CustomCommand/subdir.h.in new file mode 100644 index 0000000..1e50750 --- /dev/null +++ b/Tests/CustomCommand/subdir.h.in @@ -0,0 +1 @@ +#define SUBDIR_DEF diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt index 9476ab4..e1a67db 100644 --- a/Tests/ExternalProjectLocal/CMakeLists.txt +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -15,7 +15,7 @@ endif() set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakePredefinedTargets-in-ExternalProjectTest") -set(base "${CMAKE_BINARY_DIR}/CMakeExternals") +set(base "${CMAKE_BINARY_DIR}/Ext") set(binary_base "${base}/Build") set_property(DIRECTORY PROPERTY EP_BASE ${base}) set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index 78c4a6a..e70a977 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -11,7 +11,7 @@ get_property(c_known_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES) write_compiler_detection_header( FILE "${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h" PREFIX TEST - COMPILERS GNU Clang AppleClang SunPro + COMPILERS GNU Clang AppleClang MSVC SunPro VERSION 3.1 PROLOG "// something" EPILOG "// more" @@ -67,6 +67,17 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" list(APPEND false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES) endif() +# for msvc the compiler version determines which c++11 features are available. +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + if(";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;") + list(APPEND true_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS) + list(APPEND true_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES) + else() + list(APPEND false_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS) + list(APPEND false_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES) + endif() +endif() + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang") @@ -84,7 +95,7 @@ write_compiler_detection_header( PREFIX MULTI OUTPUT_FILES_VAR multi_files OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/compiler_support" - COMPILERS GNU Clang AppleClang SunPro + COMPILERS GNU Clang AppleClang MSVC SunPro VERSION 3.1 FEATURES ${cxx_known_features} ${c_known_features} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d1457a7..801655f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -177,3 +177,7 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) + +if(RPMBUILD) + add_RunCMake_test(CPackRPM) +endif() diff --git a/Tests/RunCMake/CPackRPM/CMakeLists.txt b/Tests/RunCMake/CPackRPM/CMakeLists.txt new file mode 100644 index 0000000..b7d170b --- /dev/null +++ b/Tests/RunCMake/CPackRPM/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) + +set(CPACK_GENERATOR "RPM") +include(CPack) diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt new file mode 100644 index 0000000..3b63d5b --- /dev/null +++ b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt @@ -0,0 +1 @@ +CPackRPM:Warning: Path /not_relocatable/CMakeLists.txt is not on one of the.*relocatable paths! Package will be partially relocatable. diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake new file mode 100644 index 0000000..3ace6a8 --- /dev/null +++ b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake @@ -0,0 +1,7 @@ +install(FILES CMakeLists.txt DESTINATION /not_relocatable COMPONENT static) +install(FILES CMakeLists.txt DESTINATION relocatable COMPONENT relocatable) + +set(CPACK_PACKAGE_RELOCATABLE TRUE) +set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") + +set(CPACK_RPM_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake b/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake new file mode 100644 index 0000000..1935e32 --- /dev/null +++ b/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake @@ -0,0 +1,17 @@ +include(RunCMake) + +function(run_cpack_rpm_test TEST_NAME) + set(RunCMake_TEST_NO_CLEAN TRUE) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + execute_process( + COMMAND "${CMAKE_COMMAND}" -D RunCMake_TEST=${TEST_NAME} "${RunCMake_SOURCE_DIR}" + WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" + OUTPUT_QUIET + ERROR_QUIET + ) + run_cmake_command(${TEST_NAME} ${CMAKE_CPACK_COMMAND}) +endfunction() + +run_cpack_rpm_test(CPackRPM_PARTIALLY_RELOCATABLE_WARNING) diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-result.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugCommand-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-result.txt +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugCommand-result.txt diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-stderr.txt b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugCommand-stderr.txt index d819d15..1f2c113 100644 --- a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features-stderr.txt +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugCommand-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at NotAFeature_OriginDebug_target_compile_features.cmake:4 \(target_compile_features\): +CMake Error at NotAFeature_OriginDebugCommand.cmake:4 \(target_compile_features\): target_compile_features specified unknown feature "not_a_feature" for target "somelib". Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features.cmake b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugCommand.cmake index 467d9a1..467d9a1 100644 --- a/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebug_target_compile_features.cmake +++ b/Tests/RunCMake/CompileFeatures/NotAFeature_OriginDebugCommand.cmake diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake index 1892a5c..833a315 100644 --- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake @@ -6,7 +6,7 @@ run_cmake(NotAFeatureTransitive) run_cmake(NotAFeature_OriginDebug) run_cmake(NotAFeature_OriginDebugGenex) run_cmake(NotAFeature_OriginDebugTransitive) -run_cmake(NotAFeature_OriginDebug_target_compile_features) +run_cmake(NotAFeature_OriginDebugCommand) run_cmake(generate_feature_list) file(READ @@ -17,6 +17,8 @@ file(READ "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_features.txt" CXX_FEATURES ) +include("${RunCMake_BINARY_DIR}/generate_feature_list-build/c_standard_default.cmake") +include("${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_standard_default.cmake") if (NOT C_FEATURES) run_cmake(NoSupportedCFeatures) @@ -27,7 +29,9 @@ if (NOT CXX_FEATURES) run_cmake(NoSupportedCxxFeatures) run_cmake(NoSupportedCxxFeaturesGenex) else() - run_cmake(LinkImplementationFeatureCycle) + if(CXX_STANDARD_DEFAULT) + run_cmake(LinkImplementationFeatureCycle) + endif() run_cmake(LinkImplementationFeatureCycleSolved) if (";${CXX_FEATURES};" MATCHES ";cxx_final;") @@ -38,17 +42,19 @@ else() unset(RunCMake_TEST_OPTIONS) endif() -foreach(standard 98 11) - file(READ - "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt" - CXX${standard}_FLAG - ) - if (CXX${standard}_FLAG STREQUAL NOTFOUND) - run_cmake(RequireCXX${standard}) - run_cmake(RequireCXX${standard}Variable) - endif() - if (CXX${standard}EXT_FLAG STREQUAL NOTFOUND) - run_cmake(RequireCXX${standard}Ext) - run_cmake(RequireCXX${standard}ExtVariable) - endif() -endforeach() +if(CXX_STANDARD_DEFAULT) + foreach(standard 98 11) + file(READ + "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt" + CXX${standard}_FLAG + ) + if (CXX${standard}_FLAG STREQUAL NOTFOUND) + run_cmake(RequireCXX${standard}) + run_cmake(RequireCXX${standard}Variable) + endif() + if (CXX${standard}EXT_FLAG STREQUAL NOTFOUND) + run_cmake(RequireCXX${standard}Ext) + run_cmake(RequireCXX${standard}ExtVariable) + endif() + endforeach() +endif() diff --git a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake index 09e17b1..5c58052 100644 --- a/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake +++ b/Tests/RunCMake/CompileFeatures/generate_feature_list.cmake @@ -9,6 +9,20 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_features.txt" "${CMAKE_CXX_COMPILE_FEATURES}" ) +if(DEFINED CMAKE_C_STANDARD_DEFAULT) + set(c_standard_default_code "set(C_STANDARD_DEFAULT \"${CMAKE_C_STANDARD_DEFAULT}\")\n") +else() + set(c_standard_default_code "unset(C_STANDARD_DEFAULT)\n") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/c_standard_default.cmake" "${c_standard_default_code}") + +if(DEFINED CMAKE_CXX_STANDARD_DEFAULT) + set(cxx_standard_default_code "set(CXX_STANDARD_DEFAULT \"${CMAKE_CXX_STANDARD_DEFAULT}\")\n") +else() + set(cxx_standard_default_code "unset(CXX_STANDARD_DEFAULT)\n") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_standard_default.cmake" "${cxx_standard_default_code}") + foreach(standard 98 11) set(CXX${standard}_FLAG NOTFOUND) if (DEFINED CMAKE_CXX${standard}_STANDARD_COMPILE_OPTION) diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index 7227fcc..8357d5f 100644 --- a/Tests/VSWinStorePhone/CMakeLists.txt +++ b/Tests/VSWinStorePhone/CMakeLists.txt @@ -110,10 +110,12 @@ set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel) set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainPS) set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3) +set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"") set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex) set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainVS) set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3) +set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"") source_group("Source Files" FILES ${SOURCE_FILES}) diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl index 6796da1..b2fe7be 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl +++ b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl @@ -1,3 +1,7 @@ +#if !defined(FLAGS_ADDED) +# error FLAGS_ADDED not defined +#endif + struct PixelShaderInput { float4 pos : SV_POSITION; diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl index 0963060..3f9a4eb 100644 --- a/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl +++ b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl @@ -1,3 +1,7 @@ +#if !defined(FLAGS_ADDED) +# error FLAGS_ADDED not defined +#endif + cbuffer ModelViewProjectionConstantBuffer : register(b0) { matrix model; |