diff options
116 files changed, 1508 insertions, 979 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index b67ef06..1083036 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -733,7 +733,7 @@ syn keyword cmakeVariable contained \ CTEST_CUSTOM_POST_TEST \ CTEST_CUSTOM_PRE_MEMCHECK \ CTEST_CUSTOM_PRE_TEST - \ CTEST_CUSTOM_TEST_IGNORE + \ CTEST_CUSTOM_TESTS_IGNORE \ CTEST_CUSTOM_WARNING_EXCEPTION \ CTEST_CUSTOM_WARNING_MATCH \ CTEST_CVS_CHECKOUT diff --git a/CompileFlags.cmake b/CompileFlags.cmake index ec9b31b..5d0e144 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -28,13 +28,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "AIX") endif() endif() -if(CMAKE_SYSTEM_NAME MATCHES "IRIX") - if(NOT CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15") - endif() -endif() - if(CMAKE_SYSTEM MATCHES "OSF1-V") if(NOT CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst index 0446b8c..4bf9a8f 100644 --- a/Help/generator/Visual Studio 10 2010.rst +++ b/Help/generator/Visual Studio 10 2010.rst @@ -15,6 +15,8 @@ projects (Database, Website, etc.) are not supported. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst index 8fddbb3..5d89a6e 100644 --- a/Help/generator/Visual Studio 11 2012.rst +++ b/Help/generator/Visual Studio 11 2012.rst @@ -15,6 +15,8 @@ projects (JavaScript, Database, Website, etc.) are not supported. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst index 8b4c162..d342c53 100644 --- a/Help/generator/Visual Studio 12 2013.rst +++ b/Help/generator/Visual Studio 12 2013.rst @@ -15,6 +15,8 @@ projects (JavaScript, Powershell, Python, etc.) are not supported. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 14 2015.rst b/Help/generator/Visual Studio 14 2015.rst index 917d8e5..106b7c5 100644 --- a/Help/generator/Visual Studio 14 2015.rst +++ b/Help/generator/Visual Studio 14 2015.rst @@ -12,6 +12,8 @@ projects (JavaScript, Powershell, Python, etc.) are not supported. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst index 42a3bb6..52c1fa0 100644 --- a/Help/generator/Visual Studio 15 2017.rst +++ b/Help/generator/Visual Studio 15 2017.rst @@ -28,6 +28,8 @@ by default. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/generator/Visual Studio 9 2008.rst b/Help/generator/Visual Studio 9 2008.rst index a29033f..a09d047 100644 --- a/Help/generator/Visual Studio 9 2008.rst +++ b/Help/generator/Visual Studio 9 2008.rst @@ -6,6 +6,8 @@ Generates Visual Studio 9 2008 project files. Platform Selection ^^^^^^^^^^^^^^^^^^ +The default target platform name (architecture) is ``Win32``. + The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps via the :manual:`cmake(1)` ``-A`` option, to specify a target platform name (architecture). For example: diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index aec9ba5..ee13e40 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -22,8 +22,8 @@ These commands are always available. /command/cmake_policy /command/configure_file /command/continue - /command/elseif /command/else + /command/elseif /command/endforeach /command/endfunction /command/endif @@ -53,9 +53,9 @@ These commands are always available. /command/option /command/return /command/separate_arguments + /command/set /command/set_directory_properties /command/set_property - /command/set /command/site_name /command/string /command/unset diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 40ec1ef..409b5b1 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.14 .. toctree:: :maxdepth: 1 + CMP0088: FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing. </policy/CMP0088> CMP0087: install(SCRIPT | CODE) supports generator expressions. </policy/CMP0087> CMP0086: UseSWIG honors SWIG_MODULE_NAME via -module flag. </policy/CMP0086> CMP0085: IN_LIST generator expression handles empty list items. </policy/CMP0085> diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 047859d..df8f12c 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -129,13 +129,16 @@ Properties on Targets /prop_tgt/AUTOGEN_TARGET_DEPENDS /prop_tgt/AUTOMOC_COMPILER_PREDEFINES /prop_tgt/AUTOMOC_DEPEND_FILTERS + /prop_tgt/AUTOMOC_EXECUTABLE /prop_tgt/AUTOMOC_MACRO_NAMES /prop_tgt/AUTOMOC_MOC_OPTIONS /prop_tgt/AUTOMOC /prop_tgt/AUTOUIC + /prop_tgt/AUTOUIC_EXECUTABLE /prop_tgt/AUTOUIC_OPTIONS /prop_tgt/AUTOUIC_SEARCH_PATHS /prop_tgt/AUTORCC + /prop_tgt/AUTORCC_EXECUTABLE /prop_tgt/AUTORCC_OPTIONS /prop_tgt/BINARY_DIR /prop_tgt/BUILD_RPATH diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index d808b1c..e464b0c 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -541,7 +541,7 @@ Variables for CTest /variable/CTEST_CUSTOM_POST_TEST /variable/CTEST_CUSTOM_PRE_MEMCHECK /variable/CTEST_CUSTOM_PRE_TEST - /variable/CTEST_CUSTOM_TEST_IGNORE + /variable/CTEST_CUSTOM_TESTS_IGNORE /variable/CTEST_CUSTOM_WARNING_EXCEPTION /variable/CTEST_CUSTOM_WARNING_MATCH /variable/CTEST_CVS_CHECKOUT diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 1ef20ab..8490e3d 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -109,13 +109,23 @@ Options This option tells CTest to write all its output to a log file. -``-N,--show-only`` +``-N,--show-only[=<format>]`` Disable actual execution of tests. This option tells CTest to list the tests that would be run but not actually run them. Useful in conjunction with the ``-R`` and ``-E`` options. + ``<format>`` can be one of the following values. + + ``human`` + Human-friendly output. This is not guaranteed to be stable. + This is the default. + + ``json-v1`` + Dump the test information in JSON format. + See `Show as JSON Object Model`_. + ``-L <regex>, --label-regex <regex>`` Run tests with labels matching regular expression. @@ -1163,6 +1173,65 @@ Configuration settings include: * :module:`CTest` module variable: ``TRIGGER_SITE`` if set, else ``CTEST_TRIGGER_SITE`` +.. _`Show as JSON Object Model`: + +Show as JSON Object Model +========================= + +When the ``--show-only=json-v1`` command line option is given, the test +information is output in JSON format. Version 1.0 of the JSON object +model is defined as follows: + +``kind`` + The string "ctestInfo". + +``version`` + A JSON object specifying the version components. Its members are + + ``major`` + A non-negative integer specifying the major version component. + ``minor`` + A non-negative integer specifying the minor version component. + +``backtraceGraph`` + JSON object representing backtrace information with the + following members: + + ``commands`` + List of command names. + ``files`` + List of file names. + ``nodes`` + List of node JSON objects with members: + + ``command`` + Index into the ``commands`` member of the ``backtraceGraph``. + ``file`` + Index into the ``files`` member of the ``backtraceGraph``. + ``line`` + Line number in the file where the backtrace was added. + ``parent`` + Index into the ``nodes`` member of the ``backtraceGraph`` + representing the parent in the graph. + +``tests`` + A JSON array listing information about each test. Each entry + is a JSON object with members: + + ``name`` + Test name. + ``config`` + Configuration that the test can run on. + Empty string means any config. + ``command`` + List where the first element is the test command and the + remaining elements are the command arguments. + ``backtrace`` + Index into the ``nodes`` member of the ``backtraceGraph``. + ``properties`` + Test properties. + Can contain keys for each of the supported test properties. + See Also ======== diff --git a/Help/policy/CMP0088.rst b/Help/policy/CMP0088.rst new file mode 100644 index 0000000..82c04ef --- /dev/null +++ b/Help/policy/CMP0088.rst @@ -0,0 +1,29 @@ +CMP0088 +------- + +:module:`FindBISON` runs bison in :variable:`CMAKE_CURRENT_BINARY_DIR` +when executing. + +The module provides a ``BISON_TARGET`` macro which generates BISON output. +In CMake 3.13 and below the macro would generate a custom command that runs +``bison`` in the source directory. CMake 3.14 and later prefer to run it +in the build directory and use :variable:`CMAKE_CURRENT_BINARY_DIR` as the +``WORKING_DIRECTORY`` of its :command:`add_custom_command` invocation. +This ensures that any implicitly generated file is written to the build +tree rather than the source. + +This policy provides compatibility for projects that have not been updated +to expect the new behavior. + +The ``OLD`` behavior for this policy is for ``BISON_TARGET`` to use +the current source directory for the ``WORKING_DIRECTORY`` and where +to generate implicit files. The ``NEW`` behavior of this policy is to +use the current binary directory for the ``WORKING_DIRECTORY`` and where +to generate implicit files. + +This policy was introduced in CMake version 3.14. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike most policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst index bc67380..d0cd29d 100644 --- a/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst +++ b/Help/prop_tgt/ANDROID_NATIVE_LIB_DIRECTORIES.rst @@ -1,8 +1,8 @@ ANDROID_NATIVE_LIB_DIRECTORIES ------------------------------ -Set the Android property that specifies directories to search for the -.so libraries. +Set the Android property that specifies directories to search for the ``.so`` +libraries. This a string property that contains the directory paths separated by semicolons. diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst index 7a3fd48..3e6d560 100644 --- a/Help/prop_tgt/AUTOMOC.rst +++ b/Help/prop_tgt/AUTOMOC.rst @@ -58,6 +58,9 @@ source files at build time and invoke moc accordingly. This property is initialized by the value of the :variable:`CMAKE_AUTOMOC` variable if it is set when a target is created. +The ``moc`` executable will be detected automatically, but can be forced to +a certain binary using the :prop_tgt:`AUTOMOC_EXECUTABLE` property. + Additional command line options for ``moc`` can be set via the :prop_tgt:`AUTOMOC_MOC_OPTIONS` property. diff --git a/Help/prop_tgt/AUTOMOC_EXECUTABLE.rst b/Help/prop_tgt/AUTOMOC_EXECUTABLE.rst new file mode 100644 index 0000000..6b66ce8 --- /dev/null +++ b/Help/prop_tgt/AUTOMOC_EXECUTABLE.rst @@ -0,0 +1,15 @@ +AUTOMOC_EXECUTABLE +------------------ + +:prop_tgt:`AUTOMOC_EXECUTABLE` is file path pointing to the ``moc`` +executable to use for :prop_tgt:`AUTOMOC` enabled files. Setting +this property will make CMake skip the automatic detection of the +``moc`` binary as well as the sanity-tests normally run to ensure +that the binary is available and working as expected. + +Usually this property does not need to be set. Only consider this +property if auto-detection of ``moc`` can not work -- e.g. because +you are building the ``moc`` binary as part of your project. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/prop_tgt/AUTORCC.rst b/Help/prop_tgt/AUTORCC.rst index 27fb149..5db6ed0 100644 --- a/Help/prop_tgt/AUTORCC.rst +++ b/Help/prop_tgt/AUTORCC.rst @@ -21,6 +21,9 @@ If the ``.qrc`` file is :prop_sf:`GENERATED` though, a Additional command line options for rcc can be set via the :prop_sf:`AUTORCC_OPTIONS` source file property on the ``.qrc`` file. +The ``rcc`` executable will be detected automatically, but can be forced to +a certain binary using the :prop_tgt:`AUTORCC_EXECUTABLE` property. + The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the autorcc targets together in an IDE, e.g. in MSVS. diff --git a/Help/prop_tgt/AUTORCC_EXECUTABLE.rst b/Help/prop_tgt/AUTORCC_EXECUTABLE.rst new file mode 100644 index 0000000..ca0fbd7 --- /dev/null +++ b/Help/prop_tgt/AUTORCC_EXECUTABLE.rst @@ -0,0 +1,15 @@ +AUTORCC_EXECUTABLE +------------------ + +:prop_tgt:`AUTORCC_EXECUTABLE` is file path pointing to the ``rcc`` +executable to use for :prop_tgt:`AUTORCC` enabled files. Setting +this property will make CMake skip the automatic detection of the +``rcc`` binary as well as the sanity-tests normally run to ensure +that the binary is available and working as expected. + +Usually this property does not need to be set. Only consider this +property if auto-detection of ``rcc`` can not work -- e.g. because +you are building the ``rcc`` binary as part of your project. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst index 4f58b35..85226c1 100644 --- a/Help/prop_tgt/AUTOUIC.rst +++ b/Help/prop_tgt/AUTOUIC.rst @@ -30,6 +30,9 @@ Additional command line options for ``uic`` can be set via the The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the autouic targets together in an IDE, e.g. in MSVS. +The ``uic`` executable will be detected automatically, but can be forced to +a certain binary using the :prop_tgt:`AUTOUIC_EXECUTABLE` property. + Source files can be excluded from :prop_tgt:`AUTOUIC` processing by enabling :prop_sf:`SKIP_AUTOUIC` or the broader :prop_sf:`SKIP_AUTOGEN`. diff --git a/Help/prop_tgt/AUTOUIC_EXECUTABLE.rst b/Help/prop_tgt/AUTOUIC_EXECUTABLE.rst new file mode 100644 index 0000000..03bd554 --- /dev/null +++ b/Help/prop_tgt/AUTOUIC_EXECUTABLE.rst @@ -0,0 +1,15 @@ +AUTOUIC_EXECUTABLE +------------------ + +:prop_tgt:`AUTOUIC_EXECUTABLE` is file path pointing to the ``uic`` +executable to use for :prop_tgt:`AUTOUIC` enabled files. Setting +this property will make CMake skip the automatic detection of the +``uic`` binary as well as the sanity-tests normally run to ensure +that the binary is available and working as expected. + +Usually this property does not need to be set. Only consider this +property if auto-detection of ``uic`` can not work -- e.g. because +you are building the ``uic`` binary as part of your project. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/release/dev/FindICE-more-exe.rst b/Help/release/dev/FindICE-more-exe.rst new file mode 100644 index 0000000..fa18a88 --- /dev/null +++ b/Help/release/dev/FindICE-more-exe.rst @@ -0,0 +1,5 @@ +FindICE-more-exe +---------------- + +* The :module:`FindIce` module learned to find + ``slice2confluence`` and ``slice2matlab``. diff --git a/Help/release/dev/autogen_executables.rst b/Help/release/dev/autogen_executables.rst new file mode 100644 index 0000000..5e967ea --- /dev/null +++ b/Help/release/dev/autogen_executables.rst @@ -0,0 +1,9 @@ +AUTO*_EXECUTABLE +---------------- + +* The :prop_tgt:`AUTOMOC_EXECUTABLE`, :prop_tgt:`AUTORCC_EXECUTABLE` and + :prop_tgt:`AUTOUIC_EXECUTABLE` target properties all take a path to an + executable and force automoc/autorcc/autouic to use this executable. + + Setting these will also prevent the configure time testing for these + executables. This is mainly useful when you build these tools yourself. diff --git a/Help/release/dev/bison_target_policy.rst b/Help/release/dev/bison_target_policy.rst new file mode 100644 index 0000000..3240318 --- /dev/null +++ b/Help/release/dev/bison_target_policy.rst @@ -0,0 +1,6 @@ +bison_target_policy +------------------- + +* The :module:`FindBISON` module's ``BISON_TARGET`` command now runs ``bison`` + with :variable:`CMAKE_CURRENT_BINARY_DIR` as the working directory. + See policy :policy:`CMP0088`. diff --git a/Help/release/dev/ctest-show-only-json-v1.rst b/Help/release/dev/ctest-show-only-json-v1.rst new file mode 100644 index 0000000..f593e7e --- /dev/null +++ b/Help/release/dev/ctest-show-only-json-v1.rst @@ -0,0 +1,6 @@ +ctest-show-only-json-v1 +----------------------- + +* :manual:`ctest(1)` gained a ``--show-only=json-v1`` option to show the + list of tests in a machine-readable JSON format. + See the :ref:`Show as JSON Object Model` section of the manual. diff --git a/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst index 6114e60..57222ca 100644 --- a/Help/variable/CTEST_CUSTOM_TEST_IGNORE.rst +++ b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst @@ -1,5 +1,5 @@ -CTEST_CUSTOM_TEST_IGNORE ------------------------- +CTEST_CUSTOM_TESTS_IGNORE +------------------------- A list of regular expressions to use to exclude tests during the :command:`ctest_test` command. diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake index 628b541..02744a9 100644 --- a/Modules/CMakeBackwardCompatibilityCXX.cmake +++ b/Modules/CMakeBackwardCompatibilityCXX.cmake @@ -22,9 +22,6 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) if(NOT CMAKE_COMPILER_IS_GNUCXX) include(TestCXXAcceptsFlag) set(CMAKE_TRY_ANSI_CXX_FLAGS "") - if(CMAKE_SYSTEM_NAME MATCHES "IRIX") - set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std") - endif() if(CMAKE_SYSTEM_NAME MATCHES "OSF") set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname") endif() diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h index 6f36b03..45532af 100644 --- a/Modules/CMakeCompilerABI.h +++ b/Modules/CMakeCompilerABI.h @@ -10,16 +10,10 @@ const char info_sizeof_dptr[] = { }; /* Application Binary Interface. */ -#if defined(__sgi) && defined(_ABIO32) -# define ABI_ID "ELF O32" -#elif defined(__sgi) && defined(_ABIN32) -# define ABI_ID "ELF N32" -#elif defined(__sgi) && defined(_ABI64) -# define ABI_ID "ELF 64" /* Check for (some) ARM ABIs. * See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */ -#elif defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__) +#if defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__) # define ABI_ID "ELF ARMEABI" #elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__) # define ABI_ID "ELF ARM" diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index f2d43b6..9b2a91f 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -135,9 +135,6 @@ function(compiler_id_detection outvar lang) /* These compilers are either not known or too old to define an identification macro. Try to identify the platform and guess that it is the native compiler. */ -#elif defined(__sgi) -# define ${CID_PREFIX}COMPILER_ID \"MIPSpro\" - #elif defined(__hpux) || defined(__hpua) # define ${CID_PREFIX}COMPILER_ID \"HP\" diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 600d558..dc208c6 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -13,7 +13,6 @@ # BSD/OS BSD/OS # FreeBSD FreeBSD # HP-UX HP-UX -# IRIX IRIX # Linux Linux # GNU/kFreeBSD GNU/kFreeBSD # NetBSD NetBSD diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F index b34c284..f4a5489 100644 --- a/Modules/CMakeFortranCompilerABI.F +++ b/Modules/CMakeFortranCompilerABI.F @@ -33,13 +33,7 @@ #if 0 ! Application Binary Interface #endif -#if defined(__sgi) && defined(_ABIO32) - PRINT *, 'INFO:abi[ELF O32]' -#elif defined(__sgi) && defined(_ABIN32) - PRINT *, 'INFO:abi[ELF N32]' -#elif defined(__sgi) && defined(_ABI64) - PRINT *, 'INFO:abi[ELF 64]' -#elif defined(__ELF__) +#if defined(__ELF__) PRINT *, 'INFO:abi[ELF]' #endif PRINT *, 'ABI Detection' diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index da3d953..5995694 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -105,8 +105,6 @@ # endif #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) PRINT *, 'INFO:compiler[VisualAge]' -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) - PRINT *, 'INFO:compiler[MIPSpro]' #elif defined(__hpux) || defined(__hpux__) PRINT *, 'INFO:compiler[HP]' #elif defined(NAGFOR) @@ -114,11 +112,7 @@ #define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10) #define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10) #define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD) -#elif 1 -# if 0 -! The above 'elif 1' instead of 'else' is to work around a bug in the -! SGI preprocessor which produces both the __sgi and else blocks. -# endif +#else PRINT *, 'INFO:compiler[]' #endif #if defined(__CRAYXE) || defined(__CRAYXC) @@ -148,8 +142,6 @@ PRINT *, 'INFO:platform[SunOS]' #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) PRINT *, 'INFO:platform[AIX]' -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) - PRINT *, 'INFO:platform[IRIX]' #elif defined(__hpux) || defined(__hpux__) PRINT *, 'INFO:platform[HP-UX]' #elif defined(__HAIKU__) @@ -178,11 +170,7 @@ PRINT *, 'INFO:platform[ULTRIX]' #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) PRINT *, 'INFO:platform[Xenix]' -#elif 1 -# if 0 -! The above 'elif 1' instead of 'else' is to work around a bug in the -! SGI preprocessor which produces both the __sgi and else blocks. -# endif +#else PRINT *, 'INFO:platform[]' #endif #if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC)) diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index dd77379..c2b5aa9 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -32,9 +32,6 @@ #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) # define PLATFORM_ID "AIX" -#elif defined(__sgi) || defined(__sgi__) || defined(_SGI) -# define PLATFORM_ID "IRIX" - #elif defined(__hpux) || defined(__hpux__) # define PLATFORM_ID "HP-UX" diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index 21fe5e8..68dc28a 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -48,7 +48,7 @@ macro(__compiler_xl lang) # files so that we export only the symbols actually provided by the sources. set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>" - "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" + "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" ) endif() endmacro() diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index d59dc27..06ac2d9 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -151,7 +151,15 @@ if(BISON_EXECUTABLE) list(APPEND BISON_TARGET_cmdopt "--report-file=${BISON_TARGET_verbose_file}") endif() if(NOT IS_ABSOLUTE "${BISON_TARGET_verbose_file}") - set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_SOURCE_DIR}/${BISON_TARGET_verbose_file}") + cmake_policy(GET CMP0088 _BISON_CMP0088 + PARENT_SCOPE # undocumented, do not use outside of CMake + ) + if("x${_BISON_CMP0088}x" STREQUAL "xNEWx") + set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_BINARY_DIR}/${BISON_TARGET_verbose_file}") + else() + set(BISON_TARGET_verbose_file "${CMAKE_CURRENT_SOURCE_DIR}/${BISON_TARGET_verbose_file}") + endif() + unset(_BISON_CMP0088) endif() endmacro() @@ -159,6 +167,15 @@ if(BISON_EXECUTABLE) # adds a custom command and sets # BISON_TARGET_cmdopt, BISON_TARGET_extraoutputs macro(BISON_TARGET_option_verbose Name BisonOutput filename) + cmake_policy(GET CMP0088 _BISON_CMP0088 + PARENT_SCOPE # undocumented, do not use outside of CMake + ) + set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + if("x${_BISON_CMP0088}x" STREQUAL "xNEWx") + set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() + unset(_BISON_CMP0088) + list(APPEND BISON_TARGET_cmdopt "--verbose") list(APPEND BISON_TARGET_outputs "${BISON_TARGET_verbose_file}") @@ -166,8 +183,9 @@ if(BISON_EXECUTABLE) if(IS_ABSOLUTE "${filename}") set(BISON_TARGET_verbose_extra_file "${filename}") else() - set(BISON_TARGET_verbose_extra_file "${CMAKE_CURRENT_SOURCE_DIR}/${filename}") + set(BISON_TARGET_verbose_extra_file "${_BISON_WORKING_DIRECTORY}/${filename}") endif() + add_custom_command(OUTPUT ${BISON_TARGET_verbose_extra_file} COMMAND ${CMAKE_COMMAND} -E copy "${BISON_TARGET_verbose_file}" @@ -176,10 +194,11 @@ if(BISON_EXECUTABLE) DEPENDS "${BISON_TARGET_verbose_file}" COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${_BISON_WORKING_DIRECTORY}) list(APPEND BISON_TARGET_extraoutputs "${BISON_TARGET_verbose_extra_file}") unset(BISON_TARGET_verbose_extra_file) + unset(_BISON_WORKING_DIRECTORY) endif() endmacro() @@ -234,12 +253,23 @@ if(BISON_EXECUTABLE) list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}") + cmake_policy(GET CMP0088 _BISON_CMP0088 + PARENT_SCOPE # undocumented, do not use outside of CMake + ) + set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + if("x${_BISON_CMP0088}x" STREQUAL "xNEWx") + set(_BISON_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() + unset(_BISON_CMP0088) + add_custom_command(OUTPUT ${BISON_TARGET_outputs} COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput} VERBATIM DEPENDS ${BisonInput} COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${_BISON_WORKING_DIRECTORY}) + + unset(_BISON_WORKING_DIRECTORY) # define target variables set(BISON_${Name}_DEFINED TRUE) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index ce307fa..8c112d4 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -862,8 +862,22 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106900 AND Boost_VERSION VERSION_LESS 107000) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) + set(_Boost_COROUTINE_DEPENDENCIES context) + set(_Boost_FIBER_DEPENDENCIES context) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) else() - if(NOT Boost_VERSION VERSION_LESS 106900) + if(NOT Boost_VERSION VERSION_LESS 107000) set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) set(_Boost_COROUTINE_DEPENDENCIES context) set(_Boost_FIBER_DEPENDENCIES context) @@ -878,7 +892,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) endif() - if(NOT Boost_VERSION VERSION_LESS 107000) + if(NOT Boost_VERSION VERSION_LESS 107100) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -1126,7 +1140,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.69.0" "1.69" + "1.70.0" "1.70" "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 42d3d47..1e0f0b8 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -40,6 +40,7 @@ Where ``<C>`` is the name of an Ice component, for example Ice slice programs are reported in:: + Ice_SLICE2CONFLUENCE_EXECUTABLE - path to slice2confluence executable Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable @@ -47,6 +48,7 @@ Ice slice programs are reported in:: Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable Ice_SLICE2JS_EXECUTABLE - path to slice2js executable + Ice_SLICE2MATLAB_EXECUTABLE - path to slice2matlab executable Ice_SLICE2OBJC_EXECUTABLE - path to slice2objc executable Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable Ice_SLICE2PY_EXECUTABLE - path to slice2py executable @@ -185,6 +187,7 @@ Other variables one may set to control this module are:: icestormmigrate) set(_Ice_slice_programs + slice2confluence slice2cpp slice2cs slice2freezej @@ -192,6 +195,7 @@ Other variables one may set to control this module are:: slice2html slice2java slice2js + slice2matlab slice2objc slice2php slice2py diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 9c96a1b..5d894c8 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -29,9 +29,12 @@ caller can set THREADS_PREFER_PTHREAD_FLAG -Please note that the compiler flag can only be used with the imported +The compiler flag can only be used with the imported target. Use of both the imported target as well as this switch is highly recommended for new code. + +This module is not needed for C++11 and later if threading is done using +``std::thread`` from the standard library. #]=======================================================================] include (CheckLibraryExists) diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake deleted file mode 100644 index 12b0f37..0000000 --- a/Modules/Platform/IRIX.cmake +++ /dev/null @@ -1,53 +0,0 @@ -set(CMAKE_DL_LIBS "") -set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -if(NOT CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_CREATE_STATIC_LIBRARY - "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>") - set (CMAKE_CXX_FLAGS_INIT "") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") - set (CMAKE_C_FLAGS_INIT "") -endif() -# set flags for gcc support -include(Platform/UnixPaths) - -if(NOT CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_C_CREATE_ASSEMBLY_SOURCE - "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -if(NOT CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -if(NOT CMAKE_COMPILER_IS_GNUG77) - set (CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE - "<CMAKE_Fortran_COMPILER> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -# Initialize C link type selection flags. These flags are used when -# building a shared library, shared module, or executable that links -# to other libraries to select whether to use the static or shared -# versions of the libraries. -foreach(type SHARED_LIBRARY SHARED_MODULE EXE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -endforeach() - -# The IRIX linker needs to find transitive shared library dependencies -# in the -L path. -set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake deleted file mode 100644 index ee9b96e..0000000 --- a/Modules/Platform/IRIX64.cmake +++ /dev/null @@ -1,73 +0,0 @@ -set(CMAKE_DL_LIBS "") -set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath -set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -if(NOT CMAKE_COMPILER_IS_GNUCC) - # Set default flags init. - set(CMAKE_C_FLAGS_INIT "") - set(CMAKE_CXX_FLAGS_INIT "") - set(CMAKE_Fortran_FLAGS_INIT "") - set(CMAKE_EXE_LINKER_FLAGS_INIT "") - set(CMAKE_SHARED_LINKER_FLAGS_INIT "") - set(CMAKE_MODULE_LINKER_FLAGS_INIT "") - - # If no -o32, -n32, or -64 flag is given, set a reasonable default. - if("$ENV{CFLAGS} $ENV{CXXFLAGS} $ENV{LDFLAGS}" MATCHES "-([no]32|64)") - else() - # Check if this is a 64-bit CMake. - if(CMAKE_FILE_SELF MATCHES "^CMAKE_FILE_SELF$") - exec_program(file ARGS ${CMAKE_COMMAND} OUTPUT_VARIABLE CMAKE_FILE_SELF) - set(CMAKE_FILE_SELF "${CMAKE_FILE_SELF}" CACHE INTERNAL - "Output of file command on ${CMAKE_COMMAND}.") - endif() - - # Set initial flags to match cmake executable. - if(CMAKE_FILE_SELF MATCHES " 64-bit ") - set(CMAKE_C_FLAGS_INIT "-64") - set(CMAKE_CXX_FLAGS_INIT "-64") - set(CMAKE_Fortran_FLAGS_INIT "-64") - set(CMAKE_EXE_LINKER_FLAGS_INIT "-64") - set(CMAKE_SHARED_LINKER_FLAGS_INIT "-64") - set(CMAKE_MODULE_LINKER_FLAGS_INIT "-64") - endif() - endif() - - # Set remaining defaults. - set(CMAKE_CXX_CREATE_STATIC_LIBRARY - "<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O3 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2") -endif() -include(Platform/UnixPaths) - -if(NOT CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_C_CREATE_ASSEMBLY_SOURCE - "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -if(NOT CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - ) -endif() - -# Initialize C link type selection flags. These flags are used when -# building a shared library, shared module, or executable that links -# to other libraries to select whether to use the static or shared -# versions of the libraries. -foreach(type SHARED_LIBRARY SHARED_MODULE EXE) - set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -endforeach() - -# The IRIX linker needs to find transitive shared library dependencies -# in the -L path. -set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index 05f56d8..e4b4e53 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -12,7 +12,7 @@ Determine the number of processors/cores and save value in ${var} Sets the variable named ${var} to the number of physical cores available on the machine if the information can be determined. Otherwise it is set to 0. Currently this functionality is implemented -for AIX, cygwin, FreeBSD, HPUX, IRIX, Linux, macOS, QNX, Sun and +for AIX, cygwin, FreeBSD, HPUX, Linux, macOS, QNX, Sun and Windows. This function is guaranteed to return a positive integer (>=1) if it @@ -115,22 +115,6 @@ function(ProcessorCount var) endif() if(NOT count) - # IRIX (systems with hinv): - find_program(ProcessorCount_cmd_hinv hinv - PATHS /sbin) - mark_as_advanced(ProcessorCount_cmd_hinv) - if(ProcessorCount_cmd_hinv) - execute_process(COMMAND ${ProcessorCount_cmd_hinv} - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE hinv_output) - string(REGEX MATCHALL "([0-9]+) .* Processors" procs "${hinv_output}") - set(count "${CMAKE_MATCH_1}") - #message("ProcessorCount: trying hinv '${ProcessorCount_cmd_hinv}'") - endif() - endif() - - if(NOT count) # AIX (systems with lsconf): find_program(ProcessorCount_cmd_lsconf lsconf PATHS /usr/sbin) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 220040c..4a4f63f 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 13) -set(CMake_VERSION_PATCH 20190110) +set(CMake_VERSION_PATCH 20190114) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index f026001..8867323 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -6,9 +6,13 @@ #include "cmCTest.h" #include "cmCTestRunTest.h" #include "cmCTestTestHandler.h" +#include "cmDuration.h" +#include "cmListFileCache.h" #include "cmSystemTools.h" #include "cmWorkingDirectory.h" +#include "cm_jsoncpp_value.h" +#include "cm_jsoncpp_writer.h" #include "cm_uv.h" #include "cmUVSignalHackRAII.h" // IWYU pragma: keep @@ -20,13 +24,19 @@ #include <chrono> #include <cstring> #include <iomanip> +#include <iostream> #include <list> #include <math.h> #include <sstream> #include <stack> #include <stdlib.h> +#include <unordered_map> #include <utility> +namespace cmsys { +class RegularExpression; +} + class TestComparator { public: @@ -725,9 +735,330 @@ void cmCTestMultiProcessHandler::MarkFinished() cmSystemTools::RemoveFile(fname); } +static Json::Value DumpToJsonArray(const std::set<std::string>& values) +{ + Json::Value jsonArray = Json::arrayValue; + for (auto& it : values) { + jsonArray.append(it); + } + return jsonArray; +} + +static Json::Value DumpToJsonArray(const std::vector<std::string>& values) +{ + Json::Value jsonArray = Json::arrayValue; + for (auto& it : values) { + jsonArray.append(it); + } + return jsonArray; +} + +static Json::Value DumpRegExToJsonArray( + const std::vector<std::pair<cmsys::RegularExpression, std::string>>& values) +{ + Json::Value jsonArray = Json::arrayValue; + for (auto& it : values) { + jsonArray.append(it.second); + } + return jsonArray; +} + +static Json::Value DumpMeasurementToJsonArray( + const std::map<std::string, std::string>& values) +{ + Json::Value jsonArray = Json::arrayValue; + for (auto& it : values) { + Json::Value measurement = Json::objectValue; + measurement["measurement"] = it.first; + measurement["value"] = it.second; + jsonArray.append(measurement); + } + return jsonArray; +} + +static Json::Value DumpTimeoutAfterMatch( + cmCTestTestHandler::cmCTestTestProperties& testProperties) +{ + Json::Value timeoutAfterMatch = Json::objectValue; + timeoutAfterMatch["timeout"] = testProperties.AlternateTimeout.count(); + timeoutAfterMatch["regex"] = + DumpRegExToJsonArray(testProperties.TimeoutRegularExpressions); + return timeoutAfterMatch; +} + +static Json::Value DumpCTestProperty(std::string const& name, + Json::Value value) +{ + Json::Value property = Json::objectValue; + property["name"] = name; + property["value"] = std::move(value); + return property; +} + +static Json::Value DumpCTestProperties( + cmCTestTestHandler::cmCTestTestProperties& testProperties) +{ + Json::Value properties = Json::arrayValue; + if (!testProperties.AttachOnFail.empty()) { + properties.append(DumpCTestProperty( + "ATTACHED_FILES_ON_FAIL", DumpToJsonArray(testProperties.AttachOnFail))); + } + if (!testProperties.AttachedFiles.empty()) { + properties.append(DumpCTestProperty( + "ATTACHED_FILES", DumpToJsonArray(testProperties.AttachedFiles))); + } + if (testProperties.Cost != 0.0f) { + properties.append( + DumpCTestProperty("COST", static_cast<double>(testProperties.Cost))); + } + if (!testProperties.Depends.empty()) { + properties.append( + DumpCTestProperty("DEPENDS", DumpToJsonArray(testProperties.Depends))); + } + if (testProperties.Disabled) { + properties.append(DumpCTestProperty("DISABLED", testProperties.Disabled)); + } + if (!testProperties.Environment.empty()) { + properties.append(DumpCTestProperty( + "ENVIRONMENT", DumpToJsonArray(testProperties.Environment))); + } + if (!testProperties.ErrorRegularExpressions.empty()) { + properties.append(DumpCTestProperty( + "FAIL_REGULAR_EXPRESSION", + DumpRegExToJsonArray(testProperties.ErrorRegularExpressions))); + } + if (!testProperties.FixturesCleanup.empty()) { + properties.append(DumpCTestProperty( + "FIXTURES_CLEANUP", DumpToJsonArray(testProperties.FixturesCleanup))); + } + if (!testProperties.FixturesRequired.empty()) { + properties.append(DumpCTestProperty( + "FIXTURES_REQUIRED", DumpToJsonArray(testProperties.FixturesRequired))); + } + if (!testProperties.FixturesSetup.empty()) { + properties.append(DumpCTestProperty( + "FIXTURES_SETUP", DumpToJsonArray(testProperties.FixturesSetup))); + } + if (!testProperties.Labels.empty()) { + properties.append( + DumpCTestProperty("LABELS", DumpToJsonArray(testProperties.Labels))); + } + if (!testProperties.Measurements.empty()) { + properties.append(DumpCTestProperty( + "MEASUREMENT", DumpMeasurementToJsonArray(testProperties.Measurements))); + } + if (!testProperties.RequiredRegularExpressions.empty()) { + properties.append(DumpCTestProperty( + "PASS_REGULAR_EXPRESSION", + DumpRegExToJsonArray(testProperties.RequiredRegularExpressions))); + } + if (testProperties.WantAffinity) { + properties.append( + DumpCTestProperty("PROCESSOR_AFFINITY", testProperties.WantAffinity)); + } + if (testProperties.Processors != 1) { + properties.append( + DumpCTestProperty("PROCESSORS", testProperties.Processors)); + } + if (!testProperties.RequiredFiles.empty()) { + properties["REQUIRED_FILES"] = + DumpToJsonArray(testProperties.RequiredFiles); + } + if (!testProperties.LockedResources.empty()) { + properties.append(DumpCTestProperty( + "RESOURCE_LOCK", DumpToJsonArray(testProperties.LockedResources))); + } + if (testProperties.RunSerial) { + properties.append( + DumpCTestProperty("RUN_SERIAL", testProperties.RunSerial)); + } + if (testProperties.SkipReturnCode != -1) { + properties.append( + DumpCTestProperty("SKIP_RETURN_CODE", testProperties.SkipReturnCode)); + } + if (testProperties.ExplicitTimeout) { + properties.append( + DumpCTestProperty("TIMEOUT", testProperties.Timeout.count())); + } + if (!testProperties.TimeoutRegularExpressions.empty()) { + properties.append(DumpCTestProperty( + "TIMEOUT_AFTER_MATCH", DumpTimeoutAfterMatch(testProperties))); + } + if (testProperties.WillFail) { + properties.append(DumpCTestProperty("WILL_FAIL", testProperties.WillFail)); + } + if (!testProperties.Directory.empty()) { + properties.append( + DumpCTestProperty("WORKING_DIRECTORY", testProperties.Directory)); + } + return properties; +} + +class BacktraceData +{ + std::unordered_map<std::string, Json::ArrayIndex> CommandMap; + std::unordered_map<std::string, Json::ArrayIndex> FileMap; + std::unordered_map<cmListFileContext const*, Json::ArrayIndex> NodeMap; + Json::Value Commands = Json::arrayValue; + Json::Value Files = Json::arrayValue; + Json::Value Nodes = Json::arrayValue; + + Json::ArrayIndex AddCommand(std::string const& command) + { + auto i = this->CommandMap.find(command); + if (i == this->CommandMap.end()) { + i = this->CommandMap.emplace(command, this->Commands.size()).first; + this->Commands.append(command); + } + return i->second; + } + + Json::ArrayIndex AddFile(std::string const& file) + { + auto i = this->FileMap.find(file); + if (i == this->FileMap.end()) { + i = this->FileMap.emplace(file, this->Files.size()).first; + this->Files.append(file); + } + return i->second; + } + +public: + bool Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index); + Json::Value Dump(); +}; + +bool BacktraceData::Add(cmListFileBacktrace const& bt, Json::ArrayIndex& index) +{ + if (bt.Empty()) { + return false; + } + cmListFileContext const* top = &bt.Top(); + auto found = this->NodeMap.find(top); + if (found != this->NodeMap.end()) { + index = found->second; + return true; + } + Json::Value entry = Json::objectValue; + entry["file"] = this->AddFile(top->FilePath); + if (top->Line) { + entry["line"] = static_cast<int>(top->Line); + } + if (!top->Name.empty()) { + entry["command"] = this->AddCommand(top->Name); + } + Json::ArrayIndex parent; + if (this->Add(bt.Pop(), parent)) { + entry["parent"] = parent; + } + index = this->NodeMap[top] = this->Nodes.size(); + this->Nodes.append(std::move(entry)); // NOLINT(*) + return true; +} + +Json::Value BacktraceData::Dump() +{ + Json::Value backtraceGraph; + this->CommandMap.clear(); + this->FileMap.clear(); + this->NodeMap.clear(); + backtraceGraph["commands"] = std::move(this->Commands); + backtraceGraph["files"] = std::move(this->Files); + backtraceGraph["nodes"] = std::move(this->Nodes); + return backtraceGraph; +} + +static void AddBacktrace(BacktraceData& backtraceGraph, Json::Value& object, + cmListFileBacktrace const& bt) +{ + Json::ArrayIndex backtrace; + if (backtraceGraph.Add(bt, backtrace)) { + object["backtrace"] = backtrace; + } +} + +static Json::Value DumpCTestInfo( + cmCTestRunTest& testRun, + cmCTestTestHandler::cmCTestTestProperties& testProperties, + BacktraceData& backtraceGraph) +{ + Json::Value testInfo = Json::objectValue; + // test name should always be present + testInfo["name"] = testProperties.Name; + std::string const& config = testRun.GetCTest()->GetConfigType(); + if (!config.empty()) { + testInfo["config"] = config; + } + std::string const& command = testRun.GetActualCommand(); + if (!command.empty()) { + std::vector<std::string> commandAndArgs; + commandAndArgs.push_back(command); + const std::vector<std::string>& args = testRun.GetArguments(); + if (!args.empty()) { + commandAndArgs.reserve(args.size() + 1); + commandAndArgs.insert(commandAndArgs.end(), args.begin(), args.end()); + } + testInfo["command"] = DumpToJsonArray(commandAndArgs); + } + Json::Value properties = DumpCTestProperties(testProperties); + if (!properties.empty()) { + testInfo["properties"] = properties; + } + if (!testProperties.Backtrace.Empty()) { + AddBacktrace(backtraceGraph, testInfo, testProperties.Backtrace); + } + return testInfo; +} + +static Json::Value DumpVersion(int major, int minor) +{ + Json::Value version = Json::objectValue; + version["major"] = major; + version["minor"] = minor; + return version; +} + +void cmCTestMultiProcessHandler::PrintOutputAsJson() +{ + this->TestHandler->SetMaxIndex(this->FindMaxIndex()); + + Json::Value result = Json::objectValue; + result["kind"] = "ctestInfo"; + result["version"] = DumpVersion(1, 0); + + BacktraceData backtraceGraph; + Json::Value tests = Json::arrayValue; + for (auto& it : this->Properties) { + cmCTestTestHandler::cmCTestTestProperties& p = *it.second; + + // Don't worry if this fails, we are only showing the test list, not + // running the tests + cmWorkingDirectory workdir(p.Directory); + cmCTestRunTest testRun(*this); + testRun.SetIndex(p.Index); + testRun.SetTestProperties(&p); + testRun.ComputeArguments(); + + Json::Value testInfo = DumpCTestInfo(testRun, p, backtraceGraph); + tests.append(testInfo); + } + result["backtraceGraph"] = backtraceGraph.Dump(); + result["tests"] = std::move(tests); + + Json::StreamWriterBuilder builder; + builder["indentation"] = " "; + std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter()); + jout->write(result, &std::cout); +} + // For ShowOnly mode void cmCTestMultiProcessHandler::PrintTestList() { + if (this->CTest->GetOutputAsJson()) { + PrintOutputAsJson(); + return; + } + this->TestHandler->SetMaxIndex(this->FindMaxIndex()); int count = 0; diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 3927a8a..93bb880 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -51,6 +51,7 @@ public: void SetParallelLevel(size_t); void SetTestLoad(unsigned long load); virtual void RunTests(); + void PrintOutputAsJson(); void PrintTestList(); void PrintLabels(); diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 10dceca..c786413 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -78,6 +78,10 @@ public: cmCTest* GetCTest() const { return this->CTest; } + std::string& GetActualCommand() { return this->ActualCommand; } + + const std::vector<std::string>& GetArguments() { return this->Arguments; } + void FinalizeTest(); bool TimedOutForStopTime() const { return this->TimeoutIsForStopTime; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 2e1bb0a..9fd2299 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2147,6 +2147,32 @@ bool cmCTestTestHandler::SetTestsProperties( for (std::string const& t : tests) { for (cmCTestTestProperties& rt : this->TestList) { if (t == rt.Name) { + if (key == "_BACKTRACE_TRIPLES") { + std::vector<std::string> triples; + // allow empty args in the triples + cmSystemTools::ExpandListArgument(val, triples, true); + + // Ensure we have complete triples otherwise the data is corrupt. + if (triples.size() % 3 == 0) { + cmState state; + rt.Backtrace = cmListFileBacktrace(state.CreateBaseSnapshot()); + + // the first entry represents the top of the trace so we need to + // reconstruct the backtrace in reverse + for (size_t i = triples.size(); i >= 3; i -= 3) { + cmListFileContext fc; + fc.FilePath = triples[i - 3]; + long line = 0; + if (!cmSystemTools::StringToLong(triples[i - 2].c_str(), + &line)) { + line = 0; + } + fc.Line = line; + fc.Name = triples[i - 1]; + rt.Backtrace = rt.Backtrace.Push(fc); + } + } + } if (key == "WILL_FAIL") { rt.WillFail = cmSystemTools::IsOn(val); } diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index bcacf23..0b557db 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -7,6 +7,7 @@ #include "cmCTestGenericHandler.h" #include "cmDuration.h" +#include "cmListFileCache.h" #include "cmsys/RegularExpression.hxx" #include <chrono> @@ -141,6 +142,8 @@ public: std::set<std::string> FixturesCleanup; std::set<std::string> FixturesRequired; std::set<std::string> RequireSuccessDepends; + // Private test generator properties used to track backtraces + cmListFileBacktrace Backtrace; }; struct cmCTestTestResult diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index bbd3e8e..2f8e675 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -396,6 +396,12 @@ constexpr #endif +template <typename T> +int isize(const T& t) +{ + return static_cast<int>(cm::size(t)); +} + #if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L using std::cbegin; diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 065a184..1d9621c 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -407,7 +407,7 @@ char CCONV* cmExpandVariablesInString(void* arg, const char* source, cmMakefile* mf = static_cast<cmMakefile*>(arg); std::string barf = source; std::string const& result = - mf->ExpandVariablesInString(barf, escapeQuotes, atOnly); + mf->ExpandVariablesInString(barf, escapeQuotes != 0, atOnly != 0); return strdup(result.c_str()); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 7c19864..225c99f 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -278,6 +278,8 @@ cmCTest::cmCTest() this->ExtraVerbose = false; this->ProduceXML = false; this->ShowOnly = false; + this->OutputAsJson = false; + this->OutputAsJsonVersion = 1; this->RunConfigurationScript = false; this->UseHTTP10 = false; this->PrintLabels = false; @@ -1930,6 +1932,20 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, if (this->CheckArgument(arg, "-N", "--show-only")) { this->ShowOnly = true; } + if (cmSystemTools::StringStartsWith(arg.c_str(), "--show-only=")) { + this->ShowOnly = true; + + // Check if a specific format is requested. Defaults to human readable + // text. + std::string argWithFormat = "--show-only="; + std::string format = arg.substr(argWithFormat.length()); + if (format == "json-v1") { + // Force quiet mode so the only output is the json object model. + this->Quiet = true; + this->OutputAsJson = true; + this->OutputAsJsonVersion = 1; + } + } if (this->CheckArgument(arg, "-O", "--output-log") && i < args.size() - 1) { i++; @@ -2630,6 +2646,16 @@ bool cmCTest::GetShowOnly() return this->ShowOnly; } +bool cmCTest::GetOutputAsJson() +{ + return this->OutputAsJson; +} + +int cmCTest::GetOutputAsJsonVersion() +{ + return this->OutputAsJsonVersion; +} + int cmCTest::GetMaxTestNameWidth() const { return this->MaxTestNameWidth; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 480204a..2b40ca3 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -215,6 +215,10 @@ public: /** Should we only show what we would do? */ bool GetShowOnly(); + bool GetOutputAsJson(); + + int GetOutputAsJsonVersion(); + bool ShouldUseHTTP10() { return this->UseHTTP10; } bool ShouldPrintLabels() { return this->PrintLabels; } @@ -507,6 +511,8 @@ private: t_TestingHandlers TestingHandlers; bool ShowOnly; + bool OutputAsJson; + int OutputAsJsonVersion; /** Map of configuration properties */ typedef std::map<std::string, std::string> CTestConfigurationMap; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 27b8599..29483f9 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -30,7 +30,7 @@ Notes about linking on various platforms: ------------------------------------------------------------------------------ -Linux, FreeBSD, macOS, IRIX, Sun, Windows: +Linux, FreeBSD, macOS, Sun, Windows: Linking to libraries using the full path works fine. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 594cb67..fc9c1d2 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -220,7 +220,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, // Set permissions to writable if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) { #if defined(_MSC_VER) || defined(__MINGW32__) - writable = mode & S_IWRITE; + writable = (mode & S_IWRITE) != 0; mode_t newMode = mode | S_IWRITE; #else writable = mode & S_IWUSR; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index c9c6938..a6bec4b 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -90,8 +90,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() } cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio8Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName) { std::string vc10Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( @@ -406,7 +407,7 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) return false; } } else if (this->SystemName == "Android") { - if (this->DefaultPlatformName != "Win32") { + if (this->PlatformInGeneratorName) { std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR " << "specifies a platform too: '" << this->GetName() << "'"; @@ -437,7 +438,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindows(cmMakefile*) bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) { - if (this->DefaultPlatformName != "Win32") { + if (this->PlatformInGeneratorName) { std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR " << "specifies a platform too: '" << this->GetName() << "'"; @@ -488,16 +489,6 @@ std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const return ""; } -void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n"; - if (this->ExpressEdition) { - fout << "# Visual C++ Express 2010\n"; - } else { - fout << "# Visual Studio 2010\n"; - } -} - ///! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator( cmMakefile* mf) @@ -1024,6 +1015,27 @@ std::string cmGlobalVisualStudio10Generator::Encoding() return "utf-8"; } +const char* cmGlobalVisualStudio10Generator::GetToolsVersion() const +{ + switch (this->Version) { + case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VS11: + return "4.0"; + + // in Visual Studio 2013 they detached the MSBuild tools version + // from the .Net Framework version and instead made it have it's own + // version number + case cmGlobalVisualStudioGenerator::VS12: + return "12.0"; + case cmGlobalVisualStudioGenerator::VS14: + return "14.0"; + case cmGlobalVisualStudioGenerator::VS15: + return "15.0"; + } + return ""; +} + bool cmGlobalVisualStudio10Generator::IsNsightTegra() const { return !this->NsightTegraVersion.empty(); diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index dc49ded..7f7c516 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -14,8 +14,6 @@ class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; @@ -43,7 +41,6 @@ public: */ void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*, bool optional) override; - void WriteSLNHeader(std::ostream& fout) override; bool IsCudaEnabled() const { return this->CudaEnabled; } @@ -104,7 +101,7 @@ public: std::string const& sfRel); std::string Encoding() override; - virtual const char* GetToolsVersion() { return "4.0"; } + const char* GetToolsVersion() const; virtual bool IsDefaultToolset(const std::string& version) const; virtual std::string GetAuxiliaryToolset() const; @@ -126,6 +123,9 @@ public: cmIDEFlagTable const* GetNasmFlagTable() const; protected: + cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + void Generate() override; virtual bool InitializeSystem(cmMakefile* mf); virtual bool InitializeWindows(cmMakefile* mf); @@ -140,8 +140,6 @@ protected: virtual bool SelectWindowsPhoneToolset(std::string& toolset) const; virtual bool SelectWindowsStoreToolset(std::string& toolset) const; - const char* GetIDEVersion() const override { return "10.0"; } - std::string const& GetMSBuildCommand(); cmIDEFlagTable const* LoadFlagTable(std::string const& flagTableName, @@ -171,6 +169,8 @@ protected: private: class Factory; + friend class Factory; + struct LongestSourcePath { LongestSourcePath() diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 4cde874..07318cf 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -92,8 +92,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() } cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio10Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio10Generator(cm, name, platformInGeneratorName) { std::string vc11Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( @@ -188,16 +189,6 @@ bool cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset( toolset); } -void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 2012 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 2012\n"; - } -} - bool cmGlobalVisualStudio11Generator::UseFolderProperty() const { // Intentionally skip up to the top-level class implementation. diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 5b089a4..8b4c8b7 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -20,15 +20,14 @@ class cmake; class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator { public: - cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; - void WriteSLNHeader(std::ostream& fout) override; - protected: + cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool InitializeWindowsPhone(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; bool SelectWindowsPhoneToolset(std::string& toolset) const override; @@ -43,7 +42,6 @@ protected: bool IsWindowsPhoneToolsetInstalled() const; bool IsWindowsStoreToolsetInstalled() const; - const char* GetIDEVersion() const override { return "11.0"; } bool UseFolderProperty() const override; static std::set<std::string> GetInstalledWindowsCESDKs(); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 3be7d24..f9da68c 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -75,8 +75,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() } cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio11Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio11Generator(cm, name, platformInGeneratorName) { std::string vc12Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( @@ -186,16 +187,6 @@ bool cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset( toolset); } -void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 2013 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 2013\n"; - } -} - bool cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const { const char desktop81Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index ae78de7..53b7091 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -18,20 +18,14 @@ class cmake; class cmGlobalVisualStudio12Generator : public cmGlobalVisualStudio11Generator { public: - cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; - void WriteSLNHeader(std::ostream& fout) override; - - // in Visual Studio 2013 they detached the MSBuild tools version - // from the .Net Framework version and instead made it have it's own - // version number - const char* GetToolsVersion() override { return "12.0"; } - protected: + cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool ProcessGeneratorToolsetField(std::string const& key, std::string const& value) override; @@ -48,9 +42,9 @@ protected: // of the toolset is installed bool IsWindowsPhoneToolsetInstalled() const; bool IsWindowsStoreToolsetInstalled() const; - const char* GetIDEVersion() const override { return "12.0"; } private: class Factory; + friend class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index ac969e8..8f7dac9 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -75,8 +75,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory() } cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio12Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio12Generator(cm, name, platformInGeneratorName) { std::string vc14Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( @@ -174,17 +175,6 @@ bool cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset( toolset); } -void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout) -{ - // Visual Studio 14 writes .sln format 12.00 - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 14 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 14\n"; - } -} - bool cmGlobalVisualStudio14Generator::IsWindowsDesktopToolsetInstalled() const { const char desktop10Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 4bc430b..32008b0 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -18,17 +18,14 @@ class cmake; class cmGlobalVisualStudio14Generator : public cmGlobalVisualStudio12Generator { public: - cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; - void WriteSLNHeader(std::ostream& fout) override; - - const char* GetToolsVersion() override { return "14.0"; } - protected: + cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool InitializeWindows(cmMakefile* mf) override; bool InitializeWindowsStore(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; @@ -41,7 +38,6 @@ protected: // version of the toolset. virtual std::string GetWindows10SDKMaxVersion() const; - const char* GetIDEVersion() const override { return "14.0"; } virtual bool SelectWindows10SDK(cmMakefile* mf, bool required); // Used to verify that the Desktop toolset for the current generator is @@ -52,5 +48,6 @@ protected: private: class Factory; + friend class Factory; }; #endif diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index 4a08352..eb49e87 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -76,8 +76,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory() } cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio14Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName) { this->ExpressEdition = false; this->DefaultPlatformToolset = "v141"; @@ -97,17 +98,6 @@ bool cmGlobalVisualStudio15Generator::MatchesGeneratorName( return false; } -void cmGlobalVisualStudio15Generator::WriteSLNHeader(std::ostream& fout) -{ - // Visual Studio 15 writes .sln format 12.00 - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 15 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 15\n"; - } -} - bool cmGlobalVisualStudio15Generator::SetGeneratorInstance( std::string const& i, cmMakefile* mf) { diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index 68aa14f..da85d23 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -18,16 +18,10 @@ class cmake; class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator { public: - cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); bool MatchesGeneratorName(const std::string& name) const override; - void WriteSLNHeader(std::ostream& fout) override; - - const char* GetToolsVersion() override { return "15.0"; } - bool SetGeneratorInstance(std::string const& i, cmMakefile* mf) override; bool GetVSInstance(std::string& dir) const; @@ -36,11 +30,12 @@ public: std::string GetAuxiliaryToolset() const override; protected: + cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + bool InitializeWindows(cmMakefile* mf) override; bool SelectWindowsStoreToolset(std::string& toolset) const override; - const char* GetIDEVersion() const override { return "15.0"; } - // Used to verify that the Desktop toolset for the current generator is // installed on the machine. bool IsWindowsDesktopToolsetInstalled() const override; @@ -59,6 +54,7 @@ protected: private: class Factory; + friend class Factory; mutable cmVSSetupAPIHelper vsSetupAPIHelper; }; #endif diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 3be09b0..8694df2 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -217,9 +217,3 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations( } } } - -// output standard header for dsw file -void cmGlobalVisualStudio71Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 8.00\n"; -} diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index b634b95..85755af 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -34,7 +34,6 @@ protected: void WriteExternalProject(std::ostream& fout, const std::string& name, const char* path, const char* typeGuid, const std::set<BT<std::string>>& depends) override; - void WriteSLNHeader(std::ostream& fout) override; // Folders are not supported by VS 7.1. bool UseFolderProperty() const override { return false; } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 3648086..5855177 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -41,19 +41,13 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] = { }; cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( - cmake* cm, const std::string& platformName) - : cmGlobalVisualStudioGenerator(cm) + cmake* cm, std::string const& platformInGeneratorName) + : cmGlobalVisualStudioGenerator(cm, platformInGeneratorName) { this->IntelProjectVersion = 0; this->DevEnvCommandInitialized = false; this->MasmEnabled = false; this->NasmEnabled = false; - - if (platformName.empty()) { - this->DefaultPlatformName = "Win32"; - } else { - this->DefaultPlatformName = platformName; - } this->ExtraFlagTable = cmVS7ExtraFlagTable; } @@ -263,14 +257,6 @@ Json::Value cmGlobalVisualStudio7Generator::GetJson() const } #endif -std::string const& cmGlobalVisualStudio7Generator::GetPlatformName() const -{ - if (!this->GeneratorPlatform.empty()) { - return this->GeneratorPlatform; - } - return this->DefaultPlatformName; -} - bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s, cmMakefile* mf) { @@ -279,18 +265,6 @@ bool cmGlobalVisualStudio7Generator::SetSystemName(std::string const& s, return this->cmGlobalVisualStudioGenerator::SetSystemName(s, mf); } -bool cmGlobalVisualStudio7Generator::SetGeneratorPlatform(std::string const& p, - cmMakefile* mf) -{ - if (this->GetPlatformName() == "x64") { - mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - } else if (this->GetPlatformName() == "Itanium") { - mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); - } - mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); - return this->cmGlobalVisualStudioGenerator::SetGeneratorPlatform(p, mf); -} - void cmGlobalVisualStudio7Generator::Generate() { // first do the superclass method diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 12a86f2..d2a2a38 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -18,13 +18,8 @@ struct cmIDEFlagTable; class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator { public: - cmGlobalVisualStudio7Generator(cmake* cm, - const std::string& platformName = ""); ~cmGlobalVisualStudio7Generator(); - ///! Get the name for the platform. - std::string const& GetPlatformName() const; - ///! Create a local generator appropriate to this Global Generator cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override; @@ -34,8 +29,6 @@ public: bool SetSystemName(std::string const& s, cmMakefile* mf) override; - bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override; - /** * Utilized by the generator factory to determine if this generator * supports toolsets. @@ -110,6 +103,9 @@ public: cmIDEFlagTable const* ExtraFlagTable; protected: + cmGlobalVisualStudio7Generator(cmake* cm, + std::string const& platformInGeneratorName); + void Generate() override; std::string const& GetDevEnvCommand(); @@ -134,7 +130,6 @@ protected: virtual void WriteSLNGlobalSections(std::ostream& fout, cmLocalGenerator* root); virtual void WriteSLNFooter(std::ostream& fout); - virtual void WriteSLNHeader(std::ostream& fout) = 0; std::string WriteUtilityDepend(const cmGeneratorTarget* target) override; virtual void WriteTargetsToSolution( @@ -167,8 +162,6 @@ protected: // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; - std::string GeneratorPlatform; - std::string DefaultPlatformName; bool MasmEnabled; bool NasmEnabled; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ee118f1..55284c9 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -12,8 +12,9 @@ #include "cmake.h" cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio71Generator(cm, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio71Generator(cm, platformInGeneratorName) { this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->Name = name; @@ -60,7 +61,7 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p, cmMakefile* mf) { - if (this->DefaultPlatformName == "Win32") { + if (!this->PlatformInGeneratorName) { this->GeneratorPlatform = p; return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform("", mf); } else { diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index a21c53d..8719bf3 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -13,9 +13,6 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: - cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name, - const std::string& platformName); - ///! Get the name for the generator. std::string GetName() const override { return this->Name; } @@ -44,12 +41,11 @@ public: return !this->WindowsCEVersion.empty(); } - /** Is the installed VS an Express edition? */ - bool IsExpressEdition() const { return this->ExpressEdition; } - protected: + cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); + void AddExtraIDETargets() override; - const char* GetIDEVersion() const override { return "8.0"; } std::string FindDevEnvCommand() override; @@ -77,6 +73,5 @@ protected: std::string Name; std::string WindowsCEVersion; - bool ExpressEdition; }; #endif diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 7ac3a6f..e784595 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -83,8 +83,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() } cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( - cmake* cm, const std::string& name, const std::string& platformName) - : cmGlobalVisualStudio8Generator(cm, name, platformName) + cmake* cm, const std::string& name, + std::string const& platformInGeneratorName) + : cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName) { this->Version = VS9; std::string vc9Express; @@ -94,12 +95,6 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( vc9Express, cmSystemTools::KeyWOW64_32); } -void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout) -{ - fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; - fout << "# Visual Studio 2008\n"; -} - std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory() { std::string base; diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index ee17c37..7bebfd6 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -13,17 +13,9 @@ class cmGlobalVisualStudio9Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name, - const std::string& platformName); static cmGlobalGeneratorFactory* NewFactory(); /** - * Try to determine system information such as shared library - * extension, pthreads, byte order etc. - */ - void WriteSLNHeader(std::ostream& fout) override; - - /** * Where does this version of Visual Studio look for macros for the * current user? Returns the empty string if this version of Visual * Studio does not implement support for VB macros. @@ -37,7 +29,8 @@ public: std::string GetUserMacrosRegKeyBase() override; protected: - const char* GetIDEVersion() const override { return "9.0"; } + cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name, + std::string const& platformInGeneratorName); private: class Factory; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index da3daf8..dc8de03 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -20,12 +20,20 @@ #include "cmState.h" #include "cmTarget.h" -cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm) +cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator( + cmake* cm, std::string const& platformInGeneratorName) : cmGlobalGenerator(cm) { cm->GetState()->SetIsGeneratorMultiConfig(true); cm->GetState()->SetWindowsShell(true); cm->GetState()->SetWindowsVSIDE(true); + + if (platformInGeneratorName.empty()) { + this->DefaultPlatformName = "Win32"; + } else { + this->DefaultPlatformName = platformInGeneratorName; + this->PlatformInGeneratorName = true; + } } cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() @@ -43,6 +51,97 @@ void cmGlobalVisualStudioGenerator::SetVersion(VSVersion v) this->Version = v; } +bool cmGlobalVisualStudioGenerator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) +{ + if (this->GetPlatformName() == "x64") { + mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); + } else if (this->GetPlatformName() == "Itanium") { + mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); + } + mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); + return this->cmGlobalGenerator::SetGeneratorPlatform(p, mf); +} + +std::string const& cmGlobalVisualStudioGenerator::GetPlatformName() const +{ + if (!this->GeneratorPlatform.empty()) { + return this->GeneratorPlatform; + } + return this->DefaultPlatformName; +} + +const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const +{ + switch (this->Version) { + case cmGlobalVisualStudioGenerator::VS9: + return "9.0"; + case cmGlobalVisualStudioGenerator::VS10: + return "10.0"; + case cmGlobalVisualStudioGenerator::VS11: + return "11.0"; + case cmGlobalVisualStudioGenerator::VS12: + return "12.0"; + case cmGlobalVisualStudioGenerator::VS14: + return "14.0"; + case cmGlobalVisualStudioGenerator::VS15: + return "15.0"; + } + return ""; +} + +void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) +{ + switch (this->Version) { + case cmGlobalVisualStudioGenerator::VS9: + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; + break; + case cmGlobalVisualStudioGenerator::VS10: + fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n"; + if (this->ExpressEdition) { + fout << "# Visual C++ Express 2010\n"; + } else { + fout << "# Visual Studio 2010\n"; + } + break; + case cmGlobalVisualStudioGenerator::VS11: + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 2012 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 2012\n"; + } + break; + case cmGlobalVisualStudioGenerator::VS12: + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 2013 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 2013\n"; + } + break; + case cmGlobalVisualStudioGenerator::VS14: + // Visual Studio 14 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 14 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 14\n"; + } + break; + case cmGlobalVisualStudioGenerator::VS15: + // Visual Studio 15 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 15 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 15\n"; + } + break; + } +} + std::string cmGlobalVisualStudioGenerator::GetRegistryBase() { return cmGlobalVisualStudioGenerator::GetRegistryBase(this->GetIDEVersion()); diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index c891160..d44f5a5 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -41,12 +41,22 @@ public: VS15 = 150 }; - cmGlobalVisualStudioGenerator(cmake* cm); virtual ~cmGlobalVisualStudioGenerator(); VSVersion GetVersion() const; void SetVersion(VSVersion v); + /** Is the installed VS an Express edition? */ + bool IsExpressEdition() const { return this->ExpressEdition; } + + bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override; + + /** + * Get the name of the target platform (architecture) for which we generate. + * The names are as defined by VS, e.g. "Win32", "x64", "Itanium", "ARM". + */ + std::string const& GetPlatformName() const; + /** * Configure CMake's Visual Studio macros file into the user's Visual * Studio macros directory. @@ -130,6 +140,9 @@ public: bool dryRun) override; protected: + cmGlobalVisualStudioGenerator(cmake* cm, + std::string const& platformInGeneratorName); + void AddExtraIDETargets() override; // Does this VS version link targets to each other if there are @@ -137,7 +150,9 @@ protected: // below 8. virtual bool VSLinksDependencies() const { return true; } - virtual const char* GetIDEVersion() const = 0; + const char* GetIDEVersion() const; + + void WriteSLNHeader(std::ostream& fout); bool ComputeTargetDepends() override; class VSDependSet : public std::set<std::string> @@ -159,6 +174,11 @@ protected: protected: VSVersion Version; + bool ExpressEdition; + + std::string GeneratorPlatform; + std::string DefaultPlatformName; + bool PlatformInGeneratorName = false; private: virtual std::string GetVSMakeProgram() = 0; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 206dd3d..314f27d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -258,6 +258,9 @@ class cmMakefile; SELECT(POLICY, CMP0087, \ "Install CODE|SCRIPT allow the use of generator " \ "expressions.", \ + 3, 14, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0088, \ + "FindBISON runs bison in CMAKE_CURRENT_BINARY_DIR when executing.", \ 3, 14, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 5470ec3..f4cf3e0 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -13,6 +13,7 @@ #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmake.h" #include <memory> #include <utility> @@ -75,13 +76,59 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( bool const uic = target->GetPropertyAsBool("AUTOUIC"); bool const rcc = target->GetPropertyAsBool("AUTORCC"); if (moc || uic || rcc) { - // We support Qt4 and Qt5 + std::string const mocExec = + target->GetSafeProperty("AUTOMOC_EXECUTABLE"); + std::string const uicExec = + target->GetSafeProperty("AUTOUIC_EXECUTABLE"); + std::string const rccExec = + target->GetSafeProperty("AUTORCC_EXECUTABLE"); + + // We support Qt4, Qt5 and Qt6 auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target); - if ((qtVersion.Major == 4) || (qtVersion.Major == 5)) { + bool const validQt = (qtVersion.Major == 4) || + (qtVersion.Major == 5) || (qtVersion.Major == 6); + + bool const mocAvailable = (validQt || !mocExec.empty()); + bool const uicAvailable = (validQt || !uicExec.empty()); + bool const rccAvailable = (validQt || !rccExec.empty()); + bool const mocIsValid = (moc && mocAvailable); + bool const uicIsValid = (uic && uicAvailable); + bool const rccIsValid = (rcc && uicAvailable); + // Disabled AUTOMOC/UIC/RCC warning + bool const mocDisabled = (moc && !mocAvailable); + bool const uicDisabled = (uic && !uicAvailable); + bool const rccDisabled = (rcc && !rccAvailable); + if (mocDisabled || uicDisabled || rccDisabled) { + std::string msg = "AUTOGEN: No valid Qt version found for target "; + msg += target->GetName(); + msg += ". "; + { + std::vector<std::string> lst; + if (mocDisabled) { + lst.emplace_back("AUTOMOC"); + } + if (uicDisabled) { + lst.emplace_back("AUTOUIC"); + } + if (rccDisabled) { + lst.emplace_back("AUTORCC"); + } + msg += cmJoin(lst, ", "); + } + msg += " disabled. Consider adding:\n"; + if (uicDisabled) { + msg += " find_package(Qt5 COMPONENTS Widgets)\n"; + } else { + msg += " find_package(Qt5 COMPONENTS Core)\n"; + } + msg += "to your CMakeLists.txt file."; + target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); + } + if (mocIsValid || uicIsValid || rccIsValid) { // Create autogen target initializer Initializers_.emplace_back(cm::make_unique<cmQtAutoGenInitializer>( - this, target, qtVersion, moc, uic, rcc, globalAutoGenTarget, - globalAutoRccTarget)); + this, target, qtVersion, mocIsValid, uicIsValid, rccIsValid, + globalAutoGenTarget, globalAutoRccTarget)); } } } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 6a2a951..e4d2c82 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -9,6 +9,7 @@ #include "cmCustomCommandLines.h" #include "cmDuration.h" #include "cmFilePathChecksum.h" +#include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmLinkItem.h" @@ -42,6 +43,9 @@ std::string GetQtExecutableTargetName( const cmQtAutoGen::IntegerVersion& qtVersion, std::string const& executable) { + if (qtVersion.Major == 6) { + return ("Qt6::" + executable); + } if (qtVersion.Major == 5) { return ("Qt5::" + executable); } @@ -395,8 +399,16 @@ bool cmQtAutoGenInitializer::InitCustomTargets() } // Init uic specific settings - if (this->Uic.Enabled && !InitUic()) { - return false; + if (this->Uic.Enabled) { + if (InitUic()) { + auto* uicTarget = makefile->FindTargetToUse( + GetQtExecutableTargetName(this->QtVersion, "uic")); + if (uicTarget != nullptr) { + this->AutogenTarget.DependTargets.insert(uicTarget); + } + } else { + return false; + } } // Autogen target name @@ -437,6 +449,12 @@ bool cmQtAutoGenInitializer::InitCustomTargets() this->AutogenTarget.DependOrigin = this->Target->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS"); + auto* mocTarget = makefile->FindTargetToUse( + GetQtExecutableTargetName(this->QtVersion, "moc")); + if (mocTarget != nullptr) { + this->AutogenTarget.DependTargets.insert(mocTarget); + } + std::string const deps = this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); if (!deps.empty()) { @@ -504,7 +522,7 @@ bool cmQtAutoGenInitializer::InitMoc() { // We need to disable this until we have all implicit includes available. // See issue #18669. - // bool const appendImplicit = (this->QtVersion.Major == 5); + // bool const appendImplicit = (this->QtVersion.Major >= 5); auto GetIncludeDirs = [this, localGen](std::string const& cfg) -> std::vector<std::string> { @@ -839,7 +857,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() // Process qrc files if (!this->Rcc.Qrcs.empty()) { - const bool QtV5 = (this->QtVersion.Major == 5); + const bool modernQt = (this->QtVersion.Major >= 5); // Target rcc options std::vector<std::string> optionsTarget; cmSystemTools::ExpandListArgument( @@ -911,10 +929,10 @@ bool cmQtAutoGenInitializer::InitScanFiles() std::vector<std::string> nameOpts; nameOpts.emplace_back("-name"); nameOpts.emplace_back(std::move(name)); - RccMergeOptions(opts, nameOpts, QtV5); + RccMergeOptions(opts, nameOpts, modernQt); } // Merge file option - RccMergeOptions(opts, qrc.Options, QtV5); + RccMergeOptions(opts, qrc.Options, modernQt); qrc.Options = std::move(opts); } // RCC resources @@ -1092,6 +1110,7 @@ bool cmQtAutoGenInitializer::InitRccTargets() { cmMakefile* makefile = this->Target->Target->GetMakefile(); cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + auto rccTargetName = GetQtExecutableTargetName(this->QtVersion, "rcc"); for (Qrc const& qrc : this->Rcc.Qrcs) { // Register info file as generated by CMake @@ -1102,6 +1121,11 @@ bool cmQtAutoGenInitializer::InitRccTargets() std::vector<std::string> ccOutput; ccOutput.push_back(qrc.RccFile); + std::vector<std::string> ccDepends; + // Add the .qrc and info file to the custom command dependencies + ccDepends.push_back(qrc.QrcFile); + ccDepends.push_back(qrc.InfoFile); + cmCustomCommandLines commandLines; if (this->MultiConfig) { // Build for all configurations @@ -1137,15 +1161,12 @@ bool cmQtAutoGenInitializer::InitRccTargets() ccName += "_"; ccName += qrc.PathChecksum; } - std::vector<std::string> ccDepends; - // Add the .qrc and info file to the custom target dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); cmTarget* autoRccTarget = makefile->AddUtilityCommand( ccName, cmMakefile::TargetOrigin::Generator, true, this->Dir.Work.c_str(), ccOutput, ccDepends, commandLines, false, ccComment.c_str()); + // Create autogen generator target localGen->AddGeneratorTarget( new cmGeneratorTarget(autoRccTarget, localGen)); @@ -1154,6 +1175,9 @@ bool cmQtAutoGenInitializer::InitRccTargets() if (!this->TargetsFolder.empty()) { autoRccTarget->SetProperty("FOLDER", this->TargetsFolder.c_str()); } + if (!rccTargetName.empty()) { + autoRccTarget->AddUtility(rccTargetName, makefile); + } } // Add autogen target to the origin target dependencies this->Target->Target->AddUtility(ccName, makefile); @@ -1166,16 +1190,15 @@ bool cmQtAutoGenInitializer::InitRccTargets() // Create custom rcc command { std::vector<std::string> ccByproducts; - std::vector<std::string> ccDepends; - // Add the .qrc and info file to the custom command dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); // Add the resource files to the dependencies for (std::string const& fileName : qrc.Resources) { // Add resource file to the custom command dependencies ccDepends.push_back(fileName); } + if (!rccTargetName.empty()) { + ccDepends.push_back(rccTargetName); + } makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends, /*main_dependency*/ std::string(), commandLines, ccComment.c_str(), @@ -1374,7 +1397,7 @@ static std::vector<cmQtAutoGenInitializer::IntegerVersion> GetKnownQtVersions( std::vector<cmQtAutoGenInitializer::IntegerVersion> result; for (const std::string& prefix : - std::vector<std::string>({ "Qt5Core", "QT" })) { + std::vector<std::string>({ "Qt6Core", "Qt5Core", "QT" })) { auto tmp = cmQtAutoGenInitializer::IntegerVersion( StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MAJOR")), StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MINOR"))); @@ -1418,21 +1441,36 @@ std::pair<bool, std::string> GetQtExecutable( const cmQtAutoGen::IntegerVersion& qtVersion, cmGeneratorTarget* target, const std::string& executable, bool ignoreMissingTarget, std::string* output) { + const std::string upperExecutable = cmSystemTools::UpperCase(executable); + std::string result = + target->Target->GetSafeProperty("AUTO" + upperExecutable + "_EXECUTABLE"); + if (!result.empty()) { + cmListFileBacktrace lfbt = target->Target->GetMakefile()->GetBacktrace(); + cmGeneratorExpression ge(lfbt); + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(result); + result = cge->Evaluate(target->GetLocalGenerator(), ""); + + return std::make_pair(true, result); + } + std::string err; - std::string result; // Find executable { const std::string targetName = GetQtExecutableTargetName(qtVersion, executable); if (targetName.empty()) { - err = "The AUTOMOC, AUTOUIC and AUTORCC feature "; - err += "supports only Qt 4 and Qt 5"; + err = "The AUTO" + upperExecutable + " feature "; + err += "supports only Qt 4, Qt 5 and Qt 6."; } else { cmLocalGenerator* localGen = target->GetLocalGenerator(); cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); if (tgt != nullptr) { - result = tgt->ImportedGetLocation(""); + if (tgt->IsImported()) { + result = tgt->ImportedGetLocation(""); + } else { + result = tgt->GetLocation(""); + } } else { if (ignoreMissingTarget) { return std::make_pair(true, ""); @@ -1510,7 +1548,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable() return false; } - if (this->QtVersion.Major == 5) { + if (this->QtVersion.Major == 5 || this->QtVersion.Major == 6) { if (stdOut.find("--list") != std::string::npos) { this->Rcc.ListOptions.push_back("--list"); } else { diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 796d2df..e4ced6e 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -7,14 +7,16 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" +#include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmOutputConverter.h" #include "cmProperty.h" -#include "cmPropertyMap.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTest.h" +class cmPropertyMap; + cmTestGenerator::cmTestGenerator( cmTest* test, std::vector<std::string> const& configurations) : cmScriptGenerator("CTEST_CONFIGURATION_TYPE", configurations) @@ -121,16 +123,15 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Output properties for the test. cmPropertyMap& pm = this->Test->GetProperties(); - if (!pm.empty()) { - os << indent << "set_tests_properties(" << this->Test->GetName() - << " PROPERTIES "; - for (auto const& i : pm) { - os << " " << i.first << " " - << cmOutputConverter::EscapeForCMake( - ge.Parse(i.second.GetValue())->Evaluate(this->LG, config)); - } - os << ")" << std::endl; + os << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + for (auto const& i : pm) { + os << " " << i.first << " " + << cmOutputConverter::EscapeForCMake( + ge.Parse(i.second.GetValue())->Evaluate(this->LG, config)); } + this->GenerateInternalProperties(os); + os << ")" << std::endl; } void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent) @@ -179,13 +180,37 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent) // Output properties for the test. cmPropertyMap& pm = this->Test->GetProperties(); - if (!pm.empty()) { - fout << indent << "set_tests_properties(" << this->Test->GetName() - << " PROPERTIES "; - for (auto const& i : pm) { - fout << " " << i.first << " " - << cmOutputConverter::EscapeForCMake(i.second.GetValue()); + fout << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + for (auto const& i : pm) { + fout << " " << i.first << " " + << cmOutputConverter::EscapeForCMake(i.second.GetValue()); + } + this->GenerateInternalProperties(fout); + fout << ")" << std::endl; +} + +void cmTestGenerator::GenerateInternalProperties(std::ostream& os) +{ + cmListFileBacktrace bt = this->Test->GetBacktrace(); + if (bt.Empty()) { + return; + } + + os << " " + << "_BACKTRACE_TRIPLES" + << " \""; + + bool prependTripleSeparator = false; + while (!bt.Empty()) { + const auto& entry = bt.Top(); + if (prependTripleSeparator) { + os << ";"; } - fout << ")" << std::endl; + os << entry.FilePath << ";" << entry.Line << ";" << entry.Name; + bt = bt.Pop(); + prependTripleSeparator = true; } + + os << "\""; } diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index 73d05a3..f26d2ff 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -35,6 +35,9 @@ public: cmTest* GetTest() const; +private: + void GenerateInternalProperties(std::ostream& os); + protected: void GenerateScriptConfigs(std::ostream& os, Indent indent) override; void GenerateScriptActions(std::ostream& os, Indent indent) override; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6d54c12..b0e70ff 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -623,6 +623,7 @@ void cmVisualStudio10TargetGenerator::Generate() Elem(e0, "PropertyGroup").Attribute("Label", "UserMacros"); this->WriteWinRTPackageCertificateKeyFile(e0); this->WritePathAndIncrementalLinkOptions(e0); + this->WriteCEDebugProjectConfigurationValues(e0); this->WriteItemDefinitionGroups(e0); this->WriteCustomCommands(e0); this->WriteAllSources(e0); @@ -1071,6 +1072,32 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0) } } +void cmVisualStudio10TargetGenerator::WriteCEDebugProjectConfigurationValues( + Elem& e0) +{ + if (!this->GlobalGenerator->TargetsWindowsCE()) { + return; + } + const char* additionalFiles = + this->GeneratorTarget->GetProperty("DEPLOYMENT_ADDITIONAL_FILES"); + const char* remoteDirectory = + this->GeneratorTarget->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY"); + if (!(additionalFiles || remoteDirectory)) { + return; + } + for (std::string const& c : this->Configurations) { + Elem e1(e0, "PropertyGroup"); + e1.Attribute("Condition", this->CalcCondition(c)); + + if (remoteDirectory) { + e1.Element("RemoteDirectory", remoteDirectory); + } + if (additionalFiles) { + e1.Element("CEAdditionalFiles", additionalFiles); + } + } +} + void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( Elem& e1, std::string const& config) { diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index b17b5f8..7d24e88 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -57,6 +57,7 @@ private: void WriteProjectConfigurations(Elem& e0); void WriteProjectConfigurationValues(Elem& e0); void WriteMSToolConfigurationValues(Elem& e1, std::string const& config); + void WriteCEDebugProjectConfigurationValues(Elem& e0); void WriteMSToolConfigurationValuesManaged(Elem& e1, std::string const& config); void WriteHeaderSource(Elem& e1, cmSourceFile const* sf); diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 5d67dcf..afe9230 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -269,7 +269,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() if (keyValue[1].front() == '\'' && keyValue[1].back() == '\'') { keyValue[1] = - keyValue[1].substr(1, std::max<int>(0, keyValue[1].size() - 2)); + keyValue[1].substr(1, std::max(0, cm::isize(keyValue[1]) - 2)); } if (keyValue[0] == "level") { diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index c504ef4..49dbf1a 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -50,7 +50,7 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args, // Set permissions to writable if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) { #if defined(_MSC_VER) || defined(__MINGW32__) - writable = mode & S_IWRITE; + writable = (mode & S_IWRITE) != 0; mode_t newMode = mode | S_IWRITE; #else writable = mode & S_IWUSR; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1bc36cc..bfb066d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -610,16 +610,13 @@ bool cmake::FindPackage(const std::vector<std::string>& args) } // Parse the args -void cmake::SetArgs(const std::vector<std::string>& args, - bool directoriesSetBefore) +void cmake::SetArgs(const std::vector<std::string>& args) { - bool directoriesSet = directoriesSetBefore; bool haveToolset = false; bool havePlatform = false; for (unsigned int i = 1; i < args.size(); ++i) { std::string const& arg = args[i]; if (arg.find("-H", 0) == 0 || arg.find("-S", 0) == 0) { - directoriesSet = true; std::string path = arg.substr(2); if (path.empty()) { ++i; @@ -640,7 +637,6 @@ void cmake::SetArgs(const std::vector<std::string>& args, } else if (arg.find("-O", 0) == 0) { // There is no local generate anymore. Ignore -O option. } else if (arg.find("-B", 0) == 0) { - directoriesSet = true; std::string path = arg.substr(2); if (path.empty()) { ++i; @@ -802,16 +798,27 @@ void cmake::SetArgs(const std::vector<std::string>& args, this->SetGlobalGenerator(gen); } } - // no option assume it is the path to the source + // no option assume it is the path to the source or an existing build else { - directoriesSet = true; this->SetDirectoriesFromFile(arg.c_str()); } } - if (!directoriesSet) { - this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + + const bool haveSourceDir = !this->GetHomeDirectory().empty(); + const bool haveBinaryDir = !this->GetHomeOutputDirectory().empty(); + + if (this->CurrentWorkingMode == cmake::NORMAL_MODE && !haveSourceDir && + !haveBinaryDir) { + cmSystemTools::Error("No source or binary directory provided"); + return; + } + + if (!haveSourceDir) { this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); } + if (!haveBinaryDir) { + this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + } } void cmake::SetDirectoriesFromFile(const char* arg) @@ -1528,7 +1535,6 @@ void cmake::CreateDefaultGlobalGenerator() const char* GeneratorName; }; static VSVersionedGenerator const vsGenerators[] = { - { "15.0", "Visual Studio 15 2017" }, // { "14.0", "Visual Studio 14 2015" }, // { "12.0", "Visual Studio 12 2013" }, // { "11.0", "Visual Studio 11 2012" }, // diff --git a/Source/cmake.h b/Source/cmake.h index d00acc7..3c06c56 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -277,8 +277,7 @@ public: int GetSystemInformation(std::vector<std::string>&); ///! Parse command line arguments - void SetArgs(const std::vector<std::string>&, - bool directoriesSetBefore = false); + void SetArgs(const std::vector<std::string>& args); ///! Is this cmake running as a result of a TRY_COMPILE command bool GetIsInTryCompile() const; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 75dabde..e52f2b3 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -285,12 +285,12 @@ int do_cmake(int ac, char const* const* av) } else if (cmHasLiteralPrefix(av[i], "-P")) { if (i == ac - 1) { cmSystemTools::Error("No script specified for argument -P"); - } else { - workingMode = cmake::SCRIPT_MODE; - args.push_back(av[i]); - i++; - args.push_back(av[i]); + return 1; } + workingMode = cmake::SCRIPT_MODE; + args.push_back(av[i]); + i++; + args.push_back(av[i]); } else if (cmHasLiteralPrefix(av[i], "--find-package")) { workingMode = cmake::FIND_PACKAGE_MODE; args.push_back(av[i]); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 930ced9..7287594 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -270,9 +270,12 @@ static int HandleCppLint(const std::string& runCmd, << "\n"; return 1; } - std::cerr << "Warning: cpplint diagnostics:\n"; - // Output the output from cpplint to stderr - std::cerr << stdOut; + if (!stdOut.empty()) { + std::cerr << "Warning: cpplint diagnostics:\n"; + // Output the output from cpplint to stderr + std::cerr << stdOut; + } + // always return 0 so the build can continue as cpplint returns non-zero // for any warning return 0; diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py deleted file mode 100755 index 1b38d15..0000000 --- a/Source/cmparseMSBuildXML.py +++ /dev/null @@ -1,341 +0,0 @@ -# This python script parses the spec files from MSBuild to create -# mappings from compiler options to IDE XML specifications. For -# more information see here: - -# http://blogs.msdn.com/vcblog/archive/2008/12/16/msbuild-task.aspx -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/cl.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/lib.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/link.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/cl.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/lib.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/link.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/cl.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/lib.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/v120/1033/link.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/cl.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/lib.xml" -# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/link.xml" -# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/cl.xml" -# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/lib.xml" -# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/link.xml" -# -# BoolProperty <Name>true|false</Name> -# simple example: -# <BoolProperty ReverseSwitch="Oy-" Name="OmitFramePointers" -# Category="Optimization" Switch="Oy"> -# <BoolProperty.DisplayName> <BoolProperty.Description> -# <CLCompile> -# <OmitFramePointers>true</OmitFramePointers> -# </ClCompile> -# -# argument means it might be this: /MP3 -# example with argument: -# <BoolProperty Name="MultiProcessorCompilation" Category="General" Switch="MP"> -# <BoolProperty.DisplayName> -# <sys:String>Multi-processor Compilation</sys:String> -# </BoolProperty.DisplayName> -# <BoolProperty.Description> -# <sys:String>Multi-processor Compilation</sys:String> -# </BoolProperty.Description> -# <Argument Property="ProcessorNumber" IsRequired="false" /> -# </BoolProperty> -# <CLCompile> -# <MultiProcessorCompilation>true</MultiProcessorCompilation> -# <ProcessorNumber>4</ProcessorNumber> -# </ClCompile> -# IntProperty -# not used AFIT -# <IntProperty Name="ProcessorNumber" Category="General" Visible="false"> - - -# per config options example -# <EnableFiberSafeOptimizations Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EnableFiberSafeOptimizations> -# -# EnumProperty -# <EnumProperty Name="Optimization" Category="Optimization"> -# <EnumProperty.DisplayName> -# <sys:String>Optimization</sys:String> -# </EnumProperty.DisplayName> -# <EnumProperty.Description> -# <sys:String>Select option for code optimization; choose Custom to use specific optimization options. (/Od, /O1, /O2, /Ox)</sys:String> -# </EnumProperty.Description> -# <EnumValue Name="MaxSpeed" Switch="O2"> -# <EnumValue.DisplayName> -# <sys:String>Maximize Speed</sys:String> -# </EnumValue.DisplayName> -# <EnumValue.Description> -# <sys:String>Equivalent to /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy</sys:String> -# </EnumValue.Description> -# </EnumValue> -# <EnumValue Name="MinSpace" Switch="O1"> -# <EnumValue.DisplayName> -# <sys:String>Minimize Size</sys:String> -# </EnumValue.DisplayName> -# <EnumValue.Description> -# <sys:String>Equivalent to /Og /Os /Oy /Ob2 /Gs /GF /Gy</sys:String> -# </EnumValue.Description> -# </EnumValue> -# example for O2 would be this: -# <Optimization>MaxSpeed</Optimization> -# example for O1 would be this: -# <Optimization>MinSpace</Optimization> -# -# StringListProperty -# <StringListProperty Name="PreprocessorDefinitions" Category="Preprocessor" Switch="D "> -# <StringListProperty.DisplayName> -# <sys:String>Preprocessor Definitions</sys:String> -# </StringListProperty.DisplayName> -# <StringListProperty.Description> -# <sys:String>Defines a preprocessing symbols for your source file.</sys:String> -# </StringListProperty.Description> -# </StringListProperty> - -# <StringListProperty Subtype="folder" Name="AdditionalIncludeDirectories" Category="General" Switch="I"> -# <StringListProperty.DisplayName> -# <sys:String>Additional Include Directories</sys:String> -# </StringListProperty.DisplayName> -# <StringListProperty.Description> -# <sys:String>Specifies one or more directories to add to the include path; separate with semi-colons if more than one. (/I[path])</sys:String> -# </StringListProperty.Description> -# </StringListProperty> -# StringProperty - -# Example add bill include: - -# <AdditionalIncludeDirectories>..\..\..\..\..\..\bill;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - - -import sys -from xml.dom.minidom import parse, parseString - -def getText(node): - nodelist = node.childNodes - rc = "" - for child in nodelist: - if child.nodeType == child.TEXT_NODE: - rc = rc + child.data - return rc - -def print_tree(document, spaces=""): - for i in range(len(document.childNodes)): - if document.childNodes[i].nodeType == document.childNodes[i].ELEMENT_NODE: - print spaces+str(document.childNodes[i].nodeName ) - print_tree(document.childNodes[i],spaces+"----") - pass - -########################################################################################### -#Data structure that stores a property of MSBuild -class Property: - #type = type of MSBuild property (ex. if the property is EnumProperty type should be "Enum") - #attributeNames = a list of any attributes that this property could have (ex. if this was a EnumProperty it should be ["Name","Category"]) - #document = the dom file that's root node is the Property node (ex. if you were parsing a BoolProperty the root node should be something like <BoolProperty Name="RegisterOutput" Category="General" IncludeInCommandLine="false"> - def __init__(self,type,attributeNames,document=None): - self.suffix_type = "Property" - self.prefix_type = type - self.attributeNames = attributeNames - self.attributes = {} - self.DisplayName = "" - self.Description = "" - self.argumentProperty = "" - self.argumentIsRequired = "" - self.values = [] - if document is not None: - self.populate(document) - pass - - #document = the dom file that's root node is the Property node (ex. if you were parsing a BoolProperty the root node should be something like <BoolProperty Name="RegisterOutput" Category="General" IncludeInCommandLine="false"> - #spaces = do not use - def populate(self,document, spaces = ""): - if document.nodeName == self.prefix_type+self.suffix_type: - for i in self.attributeNames: - self.attributes[i] = document.getAttribute(i) - for i in range(len(document.childNodes)): - child = document.childNodes[i] - if child.nodeType == child.ELEMENT_NODE: - if child.nodeName == self.prefix_type+self.suffix_type+".DisplayName": - self.DisplayName = getText(child.childNodes[1]) - if child.nodeName == self.prefix_type+self.suffix_type+".Description": - self.Description = getText(child.childNodes[1]) - if child.nodeName == "Argument": - self.argumentProperty = child.getAttribute("Property") - self.argumentIsRequired = child.getAttribute("IsRequired") - if child.nodeName == self.prefix_type+"Value": - va = Property(self.prefix_type,["Name","DisplayName","Switch"]) - va.suffix_type = "Value" - va.populate(child) - self.values.append(va) - self.populate(child,spaces+"----") - pass - - #toString function - def __str__(self): - toReturn = self.prefix_type+self.suffix_type+":" - for i in self.attributeNames: - toReturn += "\n "+i+": "+self.attributes[i] - if self.argumentProperty != "": - toReturn += "\n Argument:\n Property: "+self.argumentProperty+"\n IsRequired: "+self.argumentIsRequired - for i in self.values: - toReturn+="\n "+str(i).replace("\n","\n ") - return toReturn -########################################################################################### - -########################################################################################### -#Class that populates itself from an MSBuild file and outputs it in CMake -#format - -class MSBuildToCMake: - #document = the entire MSBuild xml file - def __init__(self,document=None): - self.enumProperties = [] - self.stringProperties = [] - self.stringListProperties = [] - self.boolProperties = [] - self.intProperties = [] - if document!=None : - self.populate(document) - pass - - #document = the entire MSBuild xml file - #spaces = don't use - #To add a new property (if they exist) copy and paste this code and fill in appropriate places - # - #if child.nodeName == "<Name>Property": - # self.<Name>Properties.append(Property("<Name>",[<List of attributes>],child)) - # - #Replace <Name> with the name of the new property (ex. if property is StringProperty replace <Name> with String) - #Replace <List of attributes> with a list of attributes in your property's root node - #in the __init__ function add the line self.<Name>Properties = [] - # - #That is all that is required to add new properties - # - def populate(self,document, spaces=""): - for i in range(len(document.childNodes)): - child = document.childNodes[i] - if child.nodeType == child.ELEMENT_NODE: - if child.nodeName == "EnumProperty": - self.enumProperties.append(Property("Enum",["Name","Category"],child)) - if child.nodeName == "StringProperty": - self.stringProperties.append(Property("String",["Name","Subtype","Separator","Category","Visible","IncludeInCommandLine","Switch","DisplayName","ReadOnly"],child)) - if child.nodeName == "StringListProperty": - self.stringListProperties.append(Property("StringList",["Name","Category","Switch","DisplayName","Subtype"],child)) - if child.nodeName == "BoolProperty": - self.boolProperties.append(Property("Bool",["ReverseSwitch","Name","Category","Switch","DisplayName","SwitchPrefix","IncludeInCommandLine"],child)) - if child.nodeName == "IntProperty": - self.intProperties.append(Property("Int",["Name","Category","Visible"],child)) - self.populate(child,spaces+"----") - pass - - #outputs information that CMake needs to know about MSBuild xml files - def toCMake(self): - toReturn = "static cmVS7FlagTable cmVS10CxxTable[] =\n{\n" - toReturn += "\n //Enum Properties\n" - lastProp = {} - for i in self.enumProperties: - if i.attributes["Name"] == "CompileAsManaged": - #write these out after the rest of the enumProperties - lastProp = i - continue - for j in i.values: - #hardcore Brad King's manual fixes for cmVS10CLFlagTable.h - if i.attributes["Name"] == "PrecompiledHeader" and j.attributes["Switch"] != "": - toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - else: - #default (normal, non-hardcoded) case - toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\", 0},\n" - toReturn += "\n" - - if lastProp != {}: - for j in lastProp.values: - toReturn+=" {\""+lastProp.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\", 0},\n" - toReturn += "\n" - - toReturn += "\n //Bool Properties\n" - for i in self.boolProperties: - if i.argumentProperty == "": - if i.attributes["ReverseSwitch"] != "": - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\", 0},\n" - if i.attributes["Switch"] != "": - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\", 0},\n" - - toReturn += "\n //Bool Properties With Argument\n" - for i in self.boolProperties: - if i.argumentProperty != "": - if i.attributes["ReverseSwitch"] != "": - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.attributes["DisplayName"]+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" - if i.attributes["Switch"] != "": - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - toReturn += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.attributes["DisplayName"]+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" - - toReturn += "\n //String List Properties\n" - for i in self.stringListProperties: - if i.attributes["Switch"] == "": - toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n"; - else: - toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\",\n \""+i.attributes["DisplayName"]+"\",\n \"\", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},\n" - - toReturn += "\n //String Properties\n" - for i in self.stringProperties: - if i.attributes["Switch"] == "": - if i.attributes["Name"] == "PrecompiledHeaderFile": - #more hardcoding - toReturn += " {\"PrecompiledHeaderFile\", \"Yc\",\n" - toReturn += " \"Precompiled Header Name\",\n" - toReturn += " \"\", cmVS7FlagTable::UserValueRequired},\n" - toReturn += " {\"PrecompiledHeaderFile\", \"Yu\",\n" - toReturn += " \"Precompiled Header Name\",\n" - toReturn += " \"\", cmVS7FlagTable::UserValueRequired},\n" - else: - toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n"; - else: - toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+i.attributes["Separator"]+"\",\n \""+i.attributes["DisplayName"]+"\",\n \"\", cmVS7FlagTable::UserValue},\n" - - toReturn += " {0,0,0,0,0}\n};" - return toReturn - pass - - #toString function - def __str__(self): - toReturn = "" - allList = [self.enumProperties,self.stringProperties,self.stringListProperties,self.boolProperties,self.intProperties] - for p in allList: - for i in p: - toReturn += "==================================================\n"+str(i).replace("\n","\n ")+"\n==================================================\n" - - return toReturn -########################################################################################### - -########################################################################################### -# main function -def main(argv): - xml_file = None - help = """ - Please specify an input xml file with -x - - Exiting... - Have a nice day :)""" - for i in range(0,len(argv)): - if argv[i] == "-x": - xml_file = argv[i+1] - if argv[i] == "-h": - print help - sys.exit(0) - pass - if xml_file == None: - print help - sys.exit(1) - - f = open(xml_file,"r") - xml_str = f.read() - xml_dom = parseString(xml_str) - - convertor = MSBuildToCMake(xml_dom) - print convertor.toCMake() - - xml_dom.unlink() -########################################################################################### -# main entry point -if __name__ == "__main__": - main(sys.argv) - -sys.exit(0) diff --git a/Source/ctest.cxx b/Source/ctest.cxx index ca412ae..8ba126f 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -46,7 +46,10 @@ static const char* cmDocumentationOptions[][2] = { "given number of jobs." }, { "-Q,--quiet", "Make ctest quiet." }, { "-O <file>, --output-log <file>", "Output to log file" }, - { "-N,--show-only", "Disable actual execution of tests." }, + { "-N,--show-only[=format]", + "Disable actual execution of tests. The optional 'format' defines the " + "format of the test information and can be 'human' for the current text " + "format or 'json-v1' for json format. Defaults to 'human'." }, { "-L <regex>, --label-regex <regex>", "Run tests with labels matching " "regular expression." }, diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 2a8d3e6..6b166d6 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -163,6 +163,49 @@ if(BUILD_TESTING) set(CPACK_BINARY_NUGET OFF) endif() + if(WIN32) + # Macro to search for available Windows CE SDKs in the windows Registry + macro(select_wince_sdk selected_reg selected_sdk) + if(CMAKE_HOST_WIN32) + execute_process(COMMAND reg QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs" + OUTPUT_VARIABLE sdk_reg + ERROR_VARIABLE my_err) + string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}") + list(LENGTH sdk_list sdk_list_len) + if (${sdk_list_len} GREATER 1) + list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above + string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name + endif() + # Build a key to be used by get_filename_component that is pointing to the SDK directory + set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]") + # Set return values + set(${selected_reg} ${_reg}) + set(${selected_sdk} ${_sdk}) + endif(CMAKE_HOST_WIN32) + endmacro(select_wince_sdk) + + set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]") + set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]") + set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]") + set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]") + set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]") + set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]") + set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]") + set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]") + set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]") + select_wince_sdk(reg_wince wince_sdk) + set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") + set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]") + foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm) + get_filename_component(r "${reg_${reg}}" ABSOLUTE) + if(IS_DIRECTORY "${r}" AND NOT "${r}" STREQUAL "/registry") + set(${reg} 1) + else() + set(${reg} 0) + endif() + endforeach() + endif() + #--------------------------------------------------------------------------- # Add tests below here. @@ -554,7 +597,6 @@ if(BUILD_TESTING) else() if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" - OR CMAKE_SYSTEM_NAME MATCHES "IRIX64" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(run_pic_test 0) else() @@ -2125,50 +2167,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() - if(WIN32) - # Macro to search for available Windows CE SDKs in the windows Registry - macro(select_wince_sdk selected_reg selected_sdk) - if(CMAKE_HOST_WIN32) - execute_process(COMMAND reg QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs" - OUTPUT_VARIABLE sdk_reg - ERROR_VARIABLE my_err) - string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}") - list(LENGTH sdk_list sdk_list_len) - if (${sdk_list_len} GREATER 1) - list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above - string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name - endif() - # Build a key to be used by get_filename_component that is pointing to the SDK directory - set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]") - - # Set return values - set(${selected_reg} ${_reg}) - set(${selected_sdk} ${_sdk}) - endif(CMAKE_HOST_WIN32) - endmacro(select_wince_sdk) - - set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]") - set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]") - set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]") - set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]") - set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]") - set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]") - set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]") - set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]") - set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]") - select_wince_sdk(reg_wince wince_sdk) - set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") - set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]") - foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm) - get_filename_component(r "${reg_${reg}}" ABSOLUTE) - if(IS_DIRECTORY "${r}" AND NOT "${r}" STREQUAL "/registry") - set(${reg} 1) - else() - set(${reg} 0) - endif() - endforeach() - endif() - get_filename_component(ntver "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion;CurrentVersion]" NAME) if(WIN32 AND ntver VERSION_GREATER 6.1) # Windows >= 8.0 macro(add_test_VSWinStorePhone name generator systemName systemVersion architecture) diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index 9157c76..f01e616 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -415,78 +415,6 @@ set(hp_f90_64_dirs "/usr/lib/hpux64;/opt/langtools/lib/hpux64") list(APPEND platforms hp_f90_64) #----------------------------------------------------------------------------- -# IRIX - -# cc -o32 dummy.c -v -set(irix64_cc_o32_text "/usr/lib/ld -elf -_SYSTYPE_SVR4 -require_dynamic_link _rld_new_interface -no_unresolved -Wx,-G 0 -o32 -mips2 -call_shared -g0 -KPIC -L/usr/lib/ -nocount /usr/lib/crt1.o -count dummy.o -nocount -lc /usr/lib/crtn.o") -set(irix64_cc_o32_libs "c") -set(irix64_cc_o32_dirs "/usr/lib") -list(APPEND platforms irix64_cc_o32) - -# cc -n32 dummy.c -v -set(irix64_cc_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 /usr/lib32/mips4/crt1.o dummy.o -dont_warn_unused -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_cc_n32_libs "c") -set(irix64_cc_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_cc_n32) - -# cc -64 dummy.c -v -set(irix64_cc_64_text "/usr/lib32/cmplrs/ld64 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 /usr/lib64/mips4/crt1.o dummy.o -dont_warn_unused -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_cc_64_libs "c") -set(irix64_cc_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_cc_64) - -# CC -o32 dummy.cxx -v -set(irix64_CC_o32_text "/usr/lib/ld -elf -cxx -woff 134 -_SYSTYPE_SVR4 -require_dynamic_link _rld_new_interface -no_unresolved -Wx,-G 0 -o32 -mips2 -call_shared -g0 -KPIC -L/usr/lib/ -nocount /usr/lib/crt1.o /usr/lib/c++init.o -count dummy.o -nocount -dont_warn_unused -lC -warn_unused -lc /usr/lib/crtn.o") -set(irix64_CC_o32_libs "C;c") -set(irix64_CC_o32_dirs "/usr/lib") -list(APPEND platforms irix64_CC_o32) - -# CC -n32 dummy.cxx -v -set(irix64_CC_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -init _main -fini _fini -no_unresolved -transitive_link -demangle -elf -_SYSTYPE_SVR4 -LANG:std -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 -cxx -woff 134 /usr/lib32/mips4/crt1.o /usr/lib32/c++init.o dummy.o -dont_warn_unused -lCsup -lC -lCio -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_CC_n32_libs "Csup;C;Cio;c") -set(irix64_CC_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_CC_n32) - -# CC -64 dummy.cxx -v -set(irix64_CC_64_text "/usr/lib32/cmplrs/ld64 -call_shared -init _main -fini _fini -no_unresolved -transitive_link -demangle -elf -_SYSTYPE_SVR4 -LANG:std -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 -cxx -woff 134 /usr/lib64/mips4/crt1.o /usr/lib64/c++init.o dummy.o -dont_warn_unused -lCsup -lC -lCio -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_CC_64_libs "Csup;C;Cio;c") -set(irix64_CC_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_CC_64) - -# f77 -o32 dummy.f -v -set(irix64_f77_o32_text "/usr/lib/ld -elf -_SYSTYPE_SVR4 -require_dynamic_link _rld_new_interface -no_unresolved -Wx,-G 0 -o32 -mips2 -call_shared -g0 -KPIC -L/usr/lib/ -nocount /usr/lib/crt1.o -count dummy.o -nocount -lftn -lm -lc /usr/lib/crtn.o") -set(irix64_f77_o32_libs "ftn;m;c") -set(irix64_f77_o32_dirs "/usr/lib") -list(APPEND platforms irix64_f77_o32) - -# f77 -n32 dummy.f -v -set(irix64_f77_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 /usr/lib32/mips4/crt1.o dummy.o -dont_warn_unused -lftn -lm -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_f77_n32_libs "ftn;m;c") -set(irix64_f77_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_f77_n32) - -# f77 -64 dummy.f -v -set(irix64_f77_64_text "/usr/lib32/cmplrs/ld64 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 /usr/lib64/mips4/crt1.o dummy.o -dont_warn_unused -lftn -lm -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_f77_64_libs "ftn;m;c") -set(irix64_f77_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_f77_64) - -# f90 -o32 dummy.f -v -#f90 ERROR: specified abi -o32 not supported. - -# f90 -n32 dummy.f -v -set(irix64_f90_n32_text "/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -n32 -L/usr/lib32/mips4/r10000 -L/usr/lib32/mips4 -L/usr/lib32 /usr/lib32/mips4/crt1.o dummy.o -dont_warn_unused -lfortran -lffio -lftn -lm -Bdynamic -lc /usr/lib32/mips4/crtn.o -warn_unused") -set(irix64_f90_n32_libs "fortran;ffio;ftn;m;c") -set(irix64_f90_n32_dirs "/usr/lib32/mips4/r10000;/usr/lib32/mips4;/usr/lib32") -list(APPEND platforms irix64_f90_n32) - -# f90 -64 dummy.f -v -set(irix64_f90_64_text "/usr/lib32/cmplrs/ld64 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -show -mips4 -64 -L/usr/lib64/mips4/r10000 -L/usr/lib64/mips4 -L/usr/lib64 /usr/lib64/mips4/crt1.o dummy.o -dont_warn_unused -lfortran -lffio -lftn -lm -Bdynamic -lc /usr/lib64/mips4/crtn.o -warn_unused") -set(irix64_f90_64_libs "fortran;ffio;ftn;m;c") -set(irix64_f90_64_dirs "/usr/lib64/mips4/r10000;/usr/lib64/mips4;/usr/lib64") -list(APPEND platforms irix64_f90_64) - -#----------------------------------------------------------------------------- # Cygwin # gcc dummy.c -v diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 67fcc02..811fff3 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -332,7 +332,6 @@ if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") else() if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" - OR CMAKE_SYSTEM_NAME MATCHES "IRIX64" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(run_pic_test 0) else() diff --git a/Tests/RunCMake/Autogen/CMakeLists.txt b/Tests/RunCMake/Autogen/CMakeLists.txt new file mode 100644 index 0000000..9a66cde --- /dev/null +++ b/Tests/RunCMake/Autogen/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.13) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Autogen/NoQt-stderr.txt b/Tests/RunCMake/Autogen/NoQt-stderr.txt new file mode 100644 index 0000000..6b4a933 --- /dev/null +++ b/Tests/RunCMake/Autogen/NoQt-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) in CMakeLists.txt: + AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC, + AUTORCC disabled. Consider adding: + + find_package\(Qt5 COMPONENTS Widgets\) + + to your CMakeLists.txt file. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Autogen/NoQt.cmake b/Tests/RunCMake/Autogen/NoQt.cmake new file mode 100644 index 0000000..b2d375a --- /dev/null +++ b/Tests/RunCMake/Autogen/NoQt.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) + +add_executable(main empty.cpp) +set_property(TARGET main PROPERTY AUTOMOC 1) +set_property(TARGET main PROPERTY AUTORCC 1) +set_property(TARGET main PROPERTY AUTOUIC 1) diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake new file mode 100644 index 0000000..e52f28d --- /dev/null +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(NoQt) diff --git a/Tests/RunCMake/Autogen/empty.cpp b/Tests/RunCMake/Autogen/empty.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Autogen/empty.cpp diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 67fd65a..54b3ac7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -42,7 +42,12 @@ function(add_RunCMake_test_group test types) # much system information so it is easier to set programs and environment # values here unset(${test}_${type}_FOUND_PREREQUIREMENTS) - include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + else() + string(REGEX MATCH "^[^.]*" main_type "${type}") + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${main_type}/Prerequirements.cmake") + endif() get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS" "${TEST_CONFIG_DIR}/${type}_config.cmake") @@ -145,6 +150,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() add_RunCMake_test(AndroidTestUtilities) +add_RunCMake_test(Autogen) add_RunCMake_test(BuildDepends) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) @@ -338,6 +344,9 @@ endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^9]|9[0-9])") add_RunCMake_test(VS10Project) + if( vs12 AND wince ) + add_RunCMake_test( VS10ProjectWinCE "-DRunCMake_GENERATOR_PLATFORM=${wince_sdk}") + endif() endif() if(XCODE_VERSION) @@ -385,8 +394,9 @@ add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) add_RunCMake_test(FetchContent) +set(CTestCommandLine_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) if(NOT CMake_TEST_EXTERNAL_CMAKE) - set(CTestCommandLine_ARGS -DTEST_AFFINITY=$<TARGET_FILE:testAffinity>) + list(APPEND CTestCommandLine_ARGS -DTEST_AFFINITY=$<TARGET_FILE:testAffinity>) endif() add_executable(print_stdin print_stdin.c) add_RunCMake_test(CTestCommandLine -DTEST_PRINT_STDIN=$<TARGET_FILE:print_stdin>) @@ -455,7 +465,53 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(ctest_labels_for_subprojects) endif() -add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External") +set(cpack_tests + DEB.CUSTOM_NAMES + DEB.DEBUGINFO + DEB.DEFAULT_PERMISSIONS + DEB.DEPENDENCIES + DEB.EMPTY_DIR + DEB.VERSION + DEB.EXTRA + DEB.GENERATE_SHLIBS + DEB.GENERATE_SHLIBS_LDCONFIG + DEB.LONG_FILENAMES + DEB.MINIMAL + DEB.PER_COMPONENT_FIELDS + DEB.TIMESTAMPS + DEB.MD5SUMS + DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY + + RPM.CUSTOM_BINARY_SPEC_FILE + RPM.CUSTOM_NAMES + RPM.DEBUGINFO + RPM.DEFAULT_PERMISSIONS + RPM.DEPENDENCIES + RPM.DIST + RPM.EMPTY_DIR + RPM.VERSION + RPM.INSTALL_SCRIPTS + RPM.MAIN_COMPONENT + RPM.MINIMAL + RPM.PARTIALLY_RELOCATABLE_WARNING + RPM.PER_COMPONENT_FIELDS + RPM.SINGLE_DEBUGINFO + RPM.EXTRA_SLASH_IN_PATH + RPM.SOURCE_PACKAGE + RPM.SUGGESTS + RPM.SYMLINKS + RPM.USER_FILELIST + + 7Z + TBZ2 + TGZ + TXZ + TZ + ZIP + STGZ + External + ) +add_RunCMake_test_group(CPack "${cpack_tests}") # 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/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index d00ef3b..f65cb9d 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -2,6 +2,7 @@ cmake_policy(SET CMP0057 NEW) function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target) if(TEST_TYPE IN_LIST types) + string(REGEX MATCH "^[^.]*" GENERATOR_TYPE "${TEST_TYPE}") set(RunCMake_TEST_NO_CLEAN TRUE) if(package_target) set(full_test_name_ "${TEST_NAME}-package-target") @@ -21,8 +22,8 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - if(EXISTS "${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-Prerequirements.cmake") - include("${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-Prerequirements.cmake") + if(EXISTS "${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-Prerequirements.cmake") + include("${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-Prerequirements.cmake") set(FOUND_PREREQUIREMENTS false) get_test_prerequirements("FOUND_PREREQUIREMENTS" "${config_file}") @@ -35,7 +36,7 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK endif() # execute cmake - set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}" + set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${GENERATOR_TYPE}" "-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}" "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}" "-DPACKAGING_TYPE=${PACKAGING_TYPE}") @@ -64,9 +65,9 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK endif() if(source) - set(pack_params_ -G ${TEST_TYPE} --config ./CPackSourceConfig.cmake) + set(pack_params_ -G ${GENERATOR_TYPE} --config ./CPackSourceConfig.cmake) FILE(APPEND ${RunCMake_TEST_BINARY_DIR}/CPackSourceConfig.cmake - "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME} -DGENERATOR_TYPE:STRING=${TEST_TYPE}\")") + "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME} -DGENERATOR_TYPE:STRING=${GENERATOR_TYPE}\")") else() unset(pack_params_) endif() @@ -91,18 +92,18 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK ) foreach(o out err) - if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") - elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${PACKAGING_TYPE}-std${o}.txt") - elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") - elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt) - set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt") + if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-${PACKAGING_TYPE}-std${o}.txt") + elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-std${o}.txt) + set(RunCMake-std${o}-file "tests/${TEST_NAME}/${GENERATOR_TYPE}-std${o}.txt") elseif(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt) set(RunCMake-std${o}-file "tests/${TEST_NAME}/${SUBTEST_SUFFIX}-std${o}.txt") - elseif(EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/default_expected_std${o}.txt) - set(RunCMake-std${o}-file "${TEST_TYPE}/default_expected_std${o}.txt") + elseif(EXISTS ${RunCMake_SOURCE_DIR}/${GENERATOR_TYPE}/default_expected_std${o}.txt) + set(RunCMake-std${o}-file "${GENERATOR_TYPE}/default_expected_std${o}.txt") else() unset(RunCMake-std${o}-file) endif() @@ -110,12 +111,12 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK # verify result run_cmake_command( - ${TEST_TYPE}/${full_test_name_} + ${GENERATOR_TYPE}/${full_test_name_} "${CMAKE_COMMAND}" -DRunCMake_TEST=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX=${TEST_NAME} -DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX} - -DGENERATOR_TYPE=${TEST_TYPE} + -DGENERATOR_TYPE=${GENERATOR_TYPE} -DPACKAGING_TYPE=${PACKAGING_TYPE} "-Dsrc_dir=${RunCMake_SOURCE_DIR}" "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}" diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt index f02f9d6..6c87ca0 100644 --- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt +++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt @@ -1 +1 @@ -^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ +^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.[^/]*/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 33ddb72..37df57c 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -4,35 +4,35 @@ include(RunCMake) include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake") # run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES" -run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM" false "MONOLITHIC;COMPONENT") -run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT") -run_cpack_test(DEBUGINFO "RPM;DEB" true "COMPONENT") -run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM;DEB" false "MONOLITHIC;COMPONENT") -run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT") -run_cpack_test(DIST "RPM" false "MONOLITHIC") -run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT") -run_cpack_test(VERSION "RPM;DEB" false "MONOLITHIC;COMPONENT") -run_cpack_test(EXTRA "DEB" false "COMPONENT") -run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB" true "COMPONENT") -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;STGZ;External" false "MONOLITHIC;COMPONENT") -run_cpack_test_package_target(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") +run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT") +run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ" true "COMPONENT") +run_cpack_test(DEBUGINFO "RPM.DEBUGINFO;DEB.DEBUGINFO" true "COMPONENT") +run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM.DEFAULT_PERMISSIONS;DEB.DEFAULT_PERMISSIONS" false "MONOLITHIC;COMPONENT") +run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES;DEB.DEPENDENCIES" true "COMPONENT") +run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC") +run_cpack_test(EMPTY_DIR "RPM.EMPTY_DIR;DEB.EMPTY_DIR;TGZ" true "MONOLITHIC;COMPONENT") +run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT") +run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT") +run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB.GENERATE_SHLIBS" true "COMPONENT") +run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB.GENERATE_SHLIBS_LDCONFIG" true "COMPONENT") +run_cpack_test(INSTALL_SCRIPTS "RPM.INSTALL_SCRIPTS" false "COMPONENT") +run_cpack_test(LONG_FILENAMES "DEB.LONG_FILENAMES" false "MONOLITHIC") +run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM.MAIN_COMPONENT" false "COMPONENT") +run_cpack_test(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(MINIMAL "RPM.MINIMAL;DEB.MINIMAL;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" 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") -run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true "CUSTOM") -run_cpack_test(EXTRA_SLASH_IN_PATH "RPM" true "COMPONENT") -run_cpack_source_test(SOURCE_PACKAGE "RPM") -run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC") -run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT") +run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM.PARTIALLY_RELOCATABLE_WARNING" false "COMPONENT") +run_cpack_test(PER_COMPONENT_FIELDS "RPM.PER_COMPONENT_FIELDS;DEB.PER_COMPONENT_FIELDS" false "COMPONENT") +run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM.SINGLE_DEBUGINFO" true "CUSTOM") +run_cpack_test(EXTRA_SLASH_IN_PATH "RPM.EXTRA_SLASH_IN_PATH" true "COMPONENT") +run_cpack_source_test(SOURCE_PACKAGE "RPM.SOURCE_PACKAGE") +run_cpack_test(SUGGESTS "RPM.SUGGESTS" false "MONOLITHIC") +run_cpack_test(SYMLINKS "RPM.SYMLINKS;TGZ" false "MONOLITHIC;COMPONENT") set(ENVIRONMENT "SOURCE_DATE_EPOCH=123456789") -run_cpack_test(TIMESTAMPS "DEB;TGZ" false "COMPONENT") +run_cpack_test(TIMESTAMPS "DEB.TIMESTAMPS;TGZ" false "COMPONENT") unset(ENVIRONMENT) -run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") -run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test(USER_FILELIST "RPM.USER_FILELIST" false "MONOLITHIC") +run_cpack_test(MD5SUMS "DEB.MD5SUMS" false "MONOLITHIC;COMPONENT") run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") -run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt index e6d86d0..b050262 100644 --- a/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt +++ b/Tests/RunCMake/CPack/tests/CUSTOM_BINARY_SPEC_FILE/RPM-COMPONENT-stderr.txt @@ -1,2 +1,2 @@ ^CPackRPM: Will use USER specified spec file: (/[^/]*)*/CUSTOM_BINARY_SPEC_FILE/custom\.spec\.in -CPackRPM: Will use GENERATED spec file:.*/Tests/RunCMake/RPM/CPack/CUSTOM_BINARY_SPEC_FILE-build/_CPack_Packages/.*/RPM/SPECS/custom_binary_spec_file-test2\.spec$ +CPackRPM: Will use GENERATED spec file:.*/Tests/RunCMake/RPM\.CUSTOM_BINARY_SPEC_FILE/CPack/CUSTOM_BINARY_SPEC_FILE-build/_CPack_Packages/.*/RPM/SPECS/custom_binary_spec_file-test2\.spec$ diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt index feb296c..53d71d9 100644 --- a/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt +++ b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt @@ -1 +1 @@ -^(.*CPackRPM:Warning: SUGGESTS not supported in provided rpmbuild.*)?CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build/_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec$ +^(.*CPackRPM:Warning: SUGGESTS not supported in provided rpmbuild.*)?CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.SUGGESTS/CPack/[^-]*-build/_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec$ diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 750ae50..cae14b1 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -173,3 +173,32 @@ function(run_TestStdin) run_cmake_command(TestStdin ${CMAKE_CTEST_COMMAND} -V) endfunction() run_TestStdin() + +function(ShowAsJson_check_python v) + set(json_file "${RunCMake_TEST_BINARY_DIR}/ctest.json") + file(WRITE "${json_file}" "${actual_stdout}") + set(actual_stdout "" PARENT_SCOPE) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} "${RunCMake_SOURCE_DIR}/ShowAsJson${v}-check.py" "${json_file}" + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + ) + if(NOT result EQUAL 0) + string(REPLACE "\n" "\n " output " ${output}") + set(RunCMake_TEST_FAILED "Unexpected output:\n${output}" PARENT_SCOPE) + endif() +endfunction() + +function(run_ShowAsJson) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ShowAsJson) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(ShowAsJson \"${CMAKE_COMMAND}\" -E echo) + set_tests_properties(ShowAsJson PROPERTIES WILL_FAIL true _BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\") +") + run_cmake_command(ShowAsJsonVersionOne ${CMAKE_CTEST_COMMAND} --show-only=json-v1) +endfunction() +run_ShowAsJson() diff --git a/Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py b/Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py new file mode 100644 index 0000000..d794e7d --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/ShowAsJson1-check.py @@ -0,0 +1,106 @@ +from ShowAsJson_check import * + +def check_kind(k): + assert is_string(k) + assert k == "ctestInfo" + +def check_version(v): + assert is_dict(v) + assert sorted(v.keys()) == ["major", "minor"] + assert is_int(v["major"]) + assert is_int(v["minor"]) + assert v["major"] == 1 + assert v["minor"] == 0 + +def check_backtracegraph(b): + assert is_dict(b) + assert sorted(b.keys()) == ["commands", "files", "nodes"] + check_backtracegraph_commands(b["commands"]) + check_backtracegraph_files(b["files"]) + check_backtracegraph_nodes(b["nodes"]) + +def check_backtracegraph_commands(c): + assert is_list(c) + assert len(c) == 1 + assert is_string(c[0]) + assert c[0] == "add_test" + +def check_backtracegraph_files(f): + assert is_list(f) + assert len(f) == 2 + assert is_string(f[0]) + assert is_string(f[1]) + assert f[0] == "file1" + assert f[1] == "file0" + +def check_backtracegraph_nodes(n): + assert is_list(n) + assert len(n) == 2 + node = n[0] + assert is_dict(node) + assert sorted(node.keys()) == ["file"] + assert is_int(node["file"]) + assert node["file"] == 1 + node = n[1] + assert is_dict(node) + assert sorted(node.keys()) == ["command", "file", "line", "parent"] + assert is_int(node["command"]) + assert is_int(node["file"]) + assert is_int(node["line"]) + assert is_int(node["parent"]) + assert node["command"] == 0 + assert node["file"] == 0 + assert node["line"] == 1 + assert node["parent"] == 0 + +def check_command(c): + assert is_list(c) + assert len(c) == 3 + assert is_string(c[0]) + check_re(c[0], "/cmake(\.exe)?$") + assert is_string(c[1]) + assert c[1] == "-E" + assert is_string(c[2]) + assert c[2] == "echo" + +def check_willfail_property(p): + assert is_dict(p) + assert sorted(p.keys()) == ["name", "value"] + assert is_string(p["name"]) + assert is_bool(p["value"]) + assert p["name"] == "WILL_FAIL" + assert p["value"] == True + +def check_workingdir_property(p): + assert is_dict(p) + assert sorted(p.keys()) == ["name", "value"] + assert is_string(p["name"]) + assert is_string(p["value"]) + assert p["name"] == "WORKING_DIRECTORY" + assert p["value"].endswith("Tests/RunCMake/CTestCommandLine/ShowAsJson") + +def check_properties(p): + assert is_list(p) + assert len(p) == 2 + check_willfail_property(p[0]) + check_workingdir_property(p[1]) + +def check_tests(t): + assert is_list(t) + assert len(t) == 1 + test = t[0] + assert is_dict(test) + assert sorted(test.keys()) == ["backtrace", "command", "name", "properties"] + assert is_int(test["backtrace"]) + assert test["backtrace"] == 1 + check_command(test["command"]) + assert is_string(test["name"]) + assert test["name"] == "ShowAsJson" + check_properties(test["properties"]) + +assert is_dict(ctest_json) +assert sorted(ctest_json.keys()) == ["backtraceGraph", "kind", "tests", "version"] +check_backtracegraph(ctest_json["backtraceGraph"]) +check_kind(ctest_json["kind"]) +check_version(ctest_json["version"]) +check_tests(ctest_json["tests"]) diff --git a/Tests/RunCMake/CTestCommandLine/ShowAsJson_check.py b/Tests/RunCMake/CTestCommandLine/ShowAsJson_check.py new file mode 100644 index 0000000..493c9e5 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/ShowAsJson_check.py @@ -0,0 +1,24 @@ +import sys +import json +import re + +def is_bool(x): + return isinstance(x, bool) + +def is_dict(x): + return isinstance(x, dict) + +def is_list(x): + return isinstance(x, list) + +def is_int(x): + return isinstance(x, int) or isinstance(x, long) + +def is_string(x): + return isinstance(x, str) or isinstance(x, unicode) + +def check_re(x, regex): + assert re.search(regex, x) + +with open(sys.argv[1]) as f: + ctest_json = json.load(f) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 4cd34de..0e04ad1 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -4,17 +4,17 @@ include(RunCMake) run_cmake_command(NoArgs ${CMAKE_COMMAND}) run_cmake_command(Wizard ${CMAKE_COMMAND} -i) -run_cmake_command(C-no-arg ${CMAKE_COMMAND} -C) -run_cmake_command(C-no-file ${CMAKE_COMMAND} -C nosuchcachefile.txt) -run_cmake_command(Cno-file ${CMAKE_COMMAND} -Cnosuchcachefile.txt) +run_cmake_command(C-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -C) +run_cmake_command(C-no-file ${CMAKE_COMMAND} -B DummyBuildDir -C nosuchcachefile.txt) +run_cmake_command(Cno-file ${CMAKE_COMMAND} -B DummyBuildDir -Cnosuchcachefile.txt) run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt) run_cmake_command(lists-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeLists.txt) -run_cmake_command(D-no-arg ${CMAKE_COMMAND} -D) -run_cmake_command(D-no-src ${CMAKE_COMMAND} -D VAR=VALUE) -run_cmake_command(Dno-src ${CMAKE_COMMAND} -DVAR=VALUE) -run_cmake_command(U-no-arg ${CMAKE_COMMAND} -U) -run_cmake_command(U-no-src ${CMAKE_COMMAND} -U VAR) -run_cmake_command(Uno-src ${CMAKE_COMMAND} -UVAR) +run_cmake_command(D-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -D) +run_cmake_command(D-no-src ${CMAKE_COMMAND} -B DummyBuildDir -D VAR=VALUE) +run_cmake_command(Dno-src ${CMAKE_COMMAND} -B DummyBuildDir -DVAR=VALUE) +run_cmake_command(U-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -U) +run_cmake_command(U-no-src ${CMAKE_COMMAND} -B DummyBuildDir -U VAR) +run_cmake_command(Uno-src ${CMAKE_COMMAND} -B DummyBuildDir -UVAR) run_cmake_command(E-no-arg ${CMAKE_COMMAND} -E) run_cmake_command(E_capabilities ${CMAKE_COMMAND} -E capabilities) run_cmake_command(E_capabilities-arg ${CMAKE_COMMAND} -E capabilities --extra-arg) @@ -34,8 +34,8 @@ run_cmake_command(E___run_co_compile-bad-iwyu ${CMAKE_COMMAND} -E __run_co_compi run_cmake_command(E___run_co_compile-no--- ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist command-does-not-exist) run_cmake_command(E___run_co_compile-no-cc ${CMAKE_COMMAND} -E __run_co_compile --iwyu=iwyu-does-not-exist --) -run_cmake_command(G_no-arg ${CMAKE_COMMAND} -G) -run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator) +run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G) +run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) @@ -61,6 +61,7 @@ function(run_ExplicitDirs) file(REMOVE_RECURSE "${binary_dir}") file(MAKE_DIRECTORY "${binary_dir}") + run_cmake_command(no-S-B ${CMAKE_COMMAND} -DFOO=BAR) run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir}) run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} ) run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S ) @@ -330,9 +331,9 @@ set(RunCMake_TEST_OPTIONS -Wdev -Wno-dev) run_cmake(Wno-dev) unset(RunCMake_TEST_OPTIONS) -run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -W) -run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -Wno-) -run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -Werror=) +run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -B DummyBuildDir -W) +run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -B DummyBuildDir -Wno-) +run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -B DummyBuildDir -Werror=) set(RunCMake_TEST_OPTIONS --debug-output) run_cmake(debug-output) diff --git a/Tests/RunCMake/CommandLine/no-S-B-result.txt b/Tests/RunCMake/CommandLine/no-S-B-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/no-S-B-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/no-S-B-stderr.txt b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt new file mode 100644 index 0000000..7a94307 --- /dev/null +++ b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt @@ -0,0 +1 @@ +CMake Error: No source or binary directory provided diff --git a/Tests/RunCMake/VS10ProjectWinCE/CMakeLists.txt b/Tests/RunCMake/VS10ProjectWinCE/CMakeLists.txt new file mode 100644 index 0000000..91baae7 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake b/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake new file mode 100644 index 0000000..b35ee90 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +set(RunCMake_GENERATOR "Visual Studio 12 2013") +set(RunCMake_GENERATOR_TOOLSET CE800) +set(RunCMake_GENERATOR_INSTANCE "") +set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=WindowsCE ) + +run_cmake(VsCEDebuggerDeploy) diff --git a/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake new file mode 100644 index 0000000..c66676f --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake @@ -0,0 +1,34 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + + +if( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsCE" ) + set(RunCMake_TEST_FAILED "Test only valid for WindowsCE") + return() +endif() + + +set(FoundCEAdditionalFiles FALSE) +set(FoundRemoteDirectory FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<CEAdditionalFiles> *foo\\.dll\\|\\\\foo\\\\src\\\\dir\\\\on\\\\host\\|\\$\\(RemoteDirectory\\)\\|0;bar\\.dll\\|\\\\bar\\\\src\\\\dir\\|\\$\\(RemoteDirectory\\)bardir\\|0.*</CEAdditionalFiles> *$") + set(FoundCEAdditionalFiles TRUE) + elseif(line MATCHES " *<RemoteDirectory>[A-Za-z0-9\\]+</RemoteDirectory> *$") + set(FoundRemoteDirectory TRUE) + endif() +endforeach() + +if(NOT FoundCEAdditionalFiles) + set(RunCMake_TEST_FAILED "CEAddionalFiles not found or not set correctly.") + return() +endif() + +if(NOT FoundRemoteDirectory) + set(RunCMake_TEST_FAILED "RemoteDirectory not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy.cmake b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy.cmake new file mode 100644 index 0000000..948f14c --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy.cmake @@ -0,0 +1,13 @@ +enable_language(CXX) + +set(DEPLOY_DIR + "temp\\foodir" +) + +add_library(foo foo.cpp) + +set_target_properties(foo + PROPERTIES + DEPLOYMENT_ADDITIONAL_FILES "foo.dll|\\foo\\src\\dir\\on\\host|$(RemoteDirectory)|0;bar.dll|\\bar\\src\\dir|$(RemoteDirectory)bardir|0" + DEPLOYMENT_REMOTE_DIRECTORY ${DEPLOY_DIR} +) diff --git a/Tests/RunCMake/VS10ProjectWinCE/foo.cpp b/Tests/RunCMake/VS10ProjectWinCE/foo.cpp new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/foo.cpp @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/VS10ProjectWinCE/foo.cs b/Tests/RunCMake/VS10ProjectWinCE/foo.cs new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectWinCE/foo.cs @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/SubDirSpaces/CMakeLists.txt b/Tests/SubDirSpaces/CMakeLists.txt index 40c265e..0d45db8 100644 --- a/Tests/SubDirSpaces/CMakeLists.txt +++ b/Tests/SubDirSpaces/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project(SUBDIR) # Some systems do not seem to support rpath with spaces. -if(CMAKE_SYSTEM_NAME MATCHES "IRIX|QNX") +if(CMAKE_SYSTEM_NAME MATCHES "QNX") set(CMAKE_SKIP_BUILD_RPATH 1) endif() diff --git a/Utilities/Sphinx/colors.py b/Utilities/Sphinx/colors.py index f98a483..dae0063 100644 --- a/Utilities/Sphinx/colors.py +++ b/Utilities/Sphinx/colors.py @@ -14,14 +14,14 @@ class CMakeTemplateStyle(Style): styles = { Whitespace: "#bbbbbb", Comment: "italic #408080", - Operator: "bold #000000", + Operator: "#555555", String: "#217A21", Number: "#105030", - Name.Builtin: "#400080", # anything lowercase - Name.Function: "bold #1010A0", # function + Name.Builtin: "#333333", # anything lowercase + Name.Function: "#007020", # function Name.Variable: "#1080B0", # <..> - Name.Tag: "#19177C", # ${..} - Name.Constant: "#6020E0", # uppercase only + Name.Tag: "#bb60d5", # ${..} + Name.Constant: "#4070a0", # uppercase only Name.Entity: "italic #70A020", # @..@ Name.Attribute: "#906060", # paths, URLs Name.Label: "#A0A000", # anything left over |