diff options
136 files changed, 1347 insertions, 387 deletions
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index e8b7cc8..9fbad4b 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -15,10 +15,12 @@ The first signature is for adding a custom command to produce an output:: [COMMAND command2 [ARGS] [args2...] ...] [MAIN_DEPENDENCY depend] [DEPENDS [depends...]] + [BYPRODUCTS [files...]] [IMPLICIT_DEPENDS <lang1> depend1 [<lang2> depend2] ...] [WORKING_DIRECTORY dir] - [COMMENT comment] [VERBATIM] [APPEND]) + [COMMENT comment] + [VERBATIM] [APPEND] [USES_TERMINAL]) This defines a command to generate specified ``OUTPUT`` file(s). A target created in the same directory (``CMakeLists.txt`` file) @@ -43,6 +45,27 @@ The options are: options are currently ignored when APPEND is given, but may be used in the future. +``BYPRODUCTS`` + Specify the files the command is expected to produce but whose + modification time may or may not be newer than the dependencies. + If a byproduct name is a relative path it will be interpreted + relative to the build tree directory corresponding to the + current source directory. + Each byproduct file will be marked with the :prop_sf:`GENERATED` + source file property automatically. + + Explicit specification of byproducts is supported by the + :generator:`Ninja` generator to tell the ``ninja`` build tool + how to regenerate byproducts when they are missing. It is + also useful when other build rules (e.g. custom commands) + depend on the byproducts. Ninja requires a build rule for any + generated file on which another rule depends even if there are + order-only dependencies to ensure the byproducts will be + available before their dependents build. + + The ``BYPRODUCTS`` option is ignored on non-Ninja generators + except to mark byproducts ``GENERATED``. + ``COMMAND`` Specify the command-line(s) to execute at build time. If more than one ``COMMAND`` is specified they will be executed in order, @@ -114,10 +137,17 @@ The options are: If an output name is a relative path it will be interpreted relative to the build tree directory corresponding to the current source directory. + Each output file will be marked with the :prop_sf:`GENERATED` + source file property automatically. If the output of the custom command is not actually created as a file on disk it should be marked with the :prop_sf:`SYMBOLIC` source file property. +``USES_TERMINAL`` + The command will be given direct access to the terminal if possible. + With the :generator:`Ninja` generator, this places the command in + the ``console`` pool. + ``VERBATIM`` All arguments to the commands will be escaped properly for the build tool so that the invoked command receives each argument @@ -148,8 +178,10 @@ target is already built, the command will not execute. PRE_BUILD | PRE_LINK | POST_BUILD COMMAND command1 [ARGS] [args1...] [COMMAND command2 [ARGS] [args2...] ...] + [BYPRODUCTS [files...]] [WORKING_DIRECTORY dir] - [COMMENT comment] [VERBATIM]) + [COMMENT comment] + [VERBATIM] [USES_TERMINAL]) This defines a new command that will be associated with building the specified target. When the command will happen is determined by which diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst index 1bf70bf..996d08e 100644 --- a/Help/command/add_custom_target.rst +++ b/Help/command/add_custom_target.rst @@ -8,38 +8,101 @@ Add a target with no output so it will always be built. add_custom_target(Name [ALL] [command1 [args1...]] [COMMAND command2 [args2...] ...] [DEPENDS depend depend depend ... ] + [BYPRODUCTS [files...]] [WORKING_DIRECTORY dir] - [COMMENT comment] [VERBATIM] + [COMMENT comment] + [VERBATIM] [USES_TERMINAL] [SOURCES src1 [src2...]]) Adds a target with the given name that executes the given commands. -The target has no output file and is ALWAYS CONSIDERED OUT OF DATE +The target has no output file and is *always considered out of date* even if the commands try to create a file with the name of the target. -Use ADD_CUSTOM_COMMAND to generate a file with dependencies. By -default nothing depends on the custom target. Use ADD_DEPENDENCIES to -add dependencies to or from other targets. If the ALL option is -specified it indicates that this target should be added to the default -build target so that it will be run every time (the command cannot be -called ALL). The command and arguments are optional and if not -specified an empty target will be created. If WORKING_DIRECTORY is -set, then the command will be run in that directory. If it is a -relative path it will be interpreted relative to the build tree -directory corresponding to the current source directory. If COMMENT -is set, the value will be displayed as a message before the commands -are executed at build time. Dependencies listed with the DEPENDS -argument may reference files and outputs of custom commands created -with add_custom_command() in the same directory (CMakeLists.txt file). - -If VERBATIM is given then all arguments to the commands will be -escaped properly for the build tool so that the invoked command -receives each argument unchanged. Note that one level of escapes is -still used by the CMake language processor before add_custom_target -even sees the arguments. Use of VERBATIM is recommended as it enables -correct behavior. When VERBATIM is not given the behavior is platform -specific because there is no protection of tool-specific special -characters. - -The SOURCES option specifies additional source files to be included in -the custom target. Specified source files will be added to IDE -project files for convenience in editing even if they have not build -rules. +Use the :command:`add_custom_command` command to generate a file with +dependencies. By default nothing depends on the custom target. Use +the :command:`add_dependencies` command to add dependencies to or +from other targets. + +The options are: + +``ALL`` + Indicate that this target should be added to the default build + target so that it will be run every time (the command cannot be + called ``ALL``). + +``BYPRODUCTS`` + Specify the files the command is expected to produce but whose + modification time may or may not be updated on subsequent builds. + If a byproduct name is a relative path it will be interpreted + relative to the build tree directory corresponding to the + current source directory. + Each byproduct file will be marked with the :prop_sf:`GENERATED` + source file property automatically. + + Explicit specification of byproducts is supported by the + :generator:`Ninja` generator to tell the ``ninja`` build tool + how to regenerate byproducts when they are missing. It is + also useful when other build rules (e.g. custom commands) + depend on the byproducts. Ninja requires a build rule for any + generated file on which another rule depends even if there are + order-only dependencies to ensure the byproducts will be + available before their dependents build. + + The ``BYPRODUCTS`` option is ignored on non-Ninja generators + except to mark byproducts ``GENERATED``. + +``COMMAND`` + Specify the command-line(s) to execute at build time. + If more than one ``COMMAND`` is specified they will be executed in order, + but *not* necessarily composed into a stateful shell or batch script. + (To run a full script, use the :command:`configure_file` command or the + :command:`file(GENERATE)` command to create it, and then specify + a ``COMMAND`` to launch it.) + + If ``COMMAND`` specifies an executable target (created by the + :command:`add_executable` command) it will automatically be replaced + by the location of the executable created at build time. + Additionally a target-level dependency will be added so that the + executable target will be built before this custom target. + + Arguments to ``COMMAND`` may use + :manual:`generator expressions <cmake-generator-expressions(7)>`. + References to target names in generator expressions imply target-level + dependencies. + + The command and arguments are optional and if not specified an empty + target will be created. + +``COMMENT`` + Display the given message before the commands are executed at + build time. + +``DEPENDS`` + Reference files and outputs of custom commands created with + :command:`add_custom_command` command calls in the same directory + (``CMakeLists.txt`` file). They will be brought up to date when + the target is built. + +``SOURCES`` + Specify additional source files to be included in the custom target. + Specified source files will be added to IDE project files for + convenience in editing even if they have no build rules. + +``VERBATIM`` + All arguments to the commands will be escaped properly for the + build tool so that the invoked command receives each argument + unchanged. Note that one level of escapes is still used by the + CMake language processor before ``add_custom_target`` even sees + the arguments. Use of ``VERBATIM`` is recommended as it enables + correct behavior. When ``VERBATIM`` is not given the behavior + is platform specific because there is no protection of + tool-specific special characters. + +``USES_TERMINAL`` + The command will be given direct access to the terminal if possible. + With the :generator:`Ninja` generator, this places the command in + the ``console`` pool. + +``WORKING_DIRECTORY`` + Execute the command with the given current working directory. + If it is a relative path it will be interpreted relative to the + build tree directory corresponding to the current source directory. diff --git a/Help/command/string.rst b/Help/command/string.rst index 07d0ff3..351385b 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -73,8 +73,13 @@ TOUPPER/TOLOWER will convert string to upper/lower characters. LENGTH will return a given string's length. -SUBSTRING will return a substring of a given string. If length is -1 +SUBSTRING will return a substring of a given string. If length is -1 the remainder of the string starting at begin will be returned. +If string is shorter than length then end of string is used instead. + +.. note:: + CMake 3.1 and below reported an error if length pointed past + the end of string. STRIP will return a substring of a given string with leading and trailing spaces removed. diff --git a/Help/command/target_include_directories.rst b/Help/command/target_include_directories.rst index 581bace..fd433a8 100644 --- a/Help/command/target_include_directories.rst +++ b/Help/command/target_include_directories.rst @@ -9,8 +9,8 @@ Add include directories to a target. <INTERFACE|PUBLIC|PRIVATE> [items1...] [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...]) -Specify include directories or targets to use when compiling a given -target. The named ``<target>`` must have been created by a command such +Specify include directories to use when compiling a given target. +The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an :prop_tgt:`IMPORTED` target. diff --git a/Help/generator/Visual Studio 14.rst b/Help/generator/Visual Studio 14 2015.rst index d621b7e..b35997a 100644 --- a/Help/generator/Visual Studio 14.rst +++ b/Help/generator/Visual Studio 14 2015.rst @@ -1,7 +1,7 @@ -Visual Studio 14 ----------------- +Visual Studio 14 2015 +--------------------- -Generates Visual Studio 14 project files. +Generates Visual Studio 14 (VS 2015) project files. The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set to specify a target platform name. @@ -9,8 +9,8 @@ to specify a target platform name. For compatibility with CMake versions prior to 3.1, one may specify a target platform name optionally at the end of this generator name: -``Visual Studio 14 Win64`` +``Visual Studio 14 2015 Win64`` Specify target platform ``x64``. -``Visual Studio 14 ARM`` +``Visual Studio 14 2015 ARM`` Specify target platform ``ARM``. diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 4bc8c5f..bda7eef 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -64,7 +64,7 @@ one may launch CMake from any environment. /generator/Visual Studio 10 2010 /generator/Visual Studio 11 2012 /generator/Visual Studio 12 2013 - /generator/Visual Studio 14 + /generator/Visual Studio 14 2015 /generator/Xcode Extra Generators diff --git a/Help/release/3.1.0.rst b/Help/release/3.1.0.rst index 65aae00..101c29d 100644 --- a/Help/release/3.1.0.rst +++ b/Help/release/3.1.0.rst @@ -18,7 +18,7 @@ New Features Generators ---------- -* A :generator:`Visual Studio 14` generator was added. +* The :generator:`Visual Studio 14 2015` generator was added. Windows Phone and Windows Store ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/release/dev/console-pool.rst b/Help/release/dev/console-pool.rst new file mode 100644 index 0000000..19c2f19 --- /dev/null +++ b/Help/release/dev/console-pool.rst @@ -0,0 +1,8 @@ +console-pool +------------ + +* The :command:`add_custom_command` and :command:`add_custom_target` + commands learned a new ``USES_TERMINAL`` option to request that + the command be given direct access to the terminal if possible. + The :generator:`Ninja` generator will places such commands in the + ``console`` pool. diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 50cb972..376a6dc 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -30,11 +30,11 @@ # License text for the above reference.) # if it's the MS C/CXX compiler, search for link -if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC" - OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC" - OR CMAKE_Fortran_SIMULATE_ID STREQUAL "MSVC" - OR CMAKE_C_COMPILER_ID STREQUAL "MSVC" - OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" +if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" OR (CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 56d9b66..d2cb2ee 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -678,14 +678,14 @@ foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLIC endif() endif() + # Do not forget to unset previously set header (from previous component) + unset(TMP_RPM_${_RPM_SPEC_HEADER}) # Treat the RPM Spec keyword iff it has been properly defined if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) # Transform NAME --> Name e.g. PROVIDES --> Provides # The Upper-case first letter and lowercase tail is the # appropriate value required in the final RPM spec file. - string(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH) - math(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1") - string(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL) + string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL) string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") @@ -700,9 +700,7 @@ foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLIC message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") endif() set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") - else() - # Do not forget to unset previously set header (from previous component) - unset(TMP_RPM_${_RPM_SPEC_HEADER}) + unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) endif() endforeach() diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 0372e18..c1acae6 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -1,6 +1,6 @@ include(Compiler/Clang) __compiler_clang(CXX) -if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") +if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index 92119ba..ebd5c43 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -6,7 +6,7 @@ if(WIN32 OR (APPLE AND NOT appleClangPolicy STREQUAL NEW)) return() endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") @@ -17,14 +17,18 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") endif() -set(CMAKE_C_STANDARD_DEFAULT 90) +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6) + set(CMAKE_C_STANDARD_DEFAULT 11) +elseif(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) + set(CMAKE_C_STANDARD_DEFAULT 99) +endif() macro(cmake_record_c_compile_features) macro(_get_clang_features std_version list) record_compiler_features(C "${std_version}" ${list}) endmacro() - if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) + if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) _get_clang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES) if (_result EQUAL 0) _get_clang_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 780a072..6fe0b56 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -1,7 +1,7 @@ include(Compiler/Clang) __compiler_clang(CXX) -if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") +if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index eeba119..701089c 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -18,8 +18,8 @@ if(__COMPILER_CLANG) endif() set(__COMPILER_CLANG 1) -if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC" - OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") +if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") macro(__compiler_clang lang) endmacro() else() diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index c4a2ed6..9018450 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -12,8 +12,11 @@ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") endif() -# This may change in a future GNU version. -set(CMAKE_C_STANDARD_DEFAULT 90) +if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + set(CMAKE_C_STANDARD_DEFAULT 11) +else(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + set(CMAKE_C_STANDARD_DEFAULT 90) +endif() macro(cmake_record_c_compile_features) macro(_get_gcc_features std_version list) diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 422bacd..a91c901 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -11,7 +11,8 @@ else() endif() endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3) +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) + # Supported since 4.3 set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") endif() @@ -19,9 +20,7 @@ endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") -elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") + # 4.3 supports 0x variants endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 32f6d2c..e5616b1 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -132,6 +132,9 @@ Create custom targets to build projects in external trees Use source dir for build dir ``BUILD_ALWAYS 1`` No stamp file, build step always runs + ``BUILD_BYPRODUCTS <file>...`` + Files that will be generated by the build command but may or may + not have their modification time updated by subsequent builds. Install step options are: @@ -234,6 +237,9 @@ Create custom targets to build projects in external trees Steps that depend on this step ``DEPENDS <file>...`` Files on which this step depends + ``BYPRODUCTS <file>...`` + Files that will be generated by this step but may or may not + have their modification time updated by subsequent builds. ``ALWAYS 1`` No stamp file, step always runs ``EXCLUDE_FROM_MAIN 1`` @@ -1409,6 +1415,9 @@ function(ExternalProject_Add_Step name step) # Dependencies on files. get_property(depends TARGET ${name} PROPERTY _EP_${step}_DEPENDS) + # Byproducts of the step. + get_property(byproducts TARGET ${name} PROPERTY _EP_${step}_BYPRODUCTS) + # Dependencies on steps. get_property(dependees TARGET ${name} PROPERTY _EP_${step}_DEPENDEES) foreach(dependee IN LISTS dependees) @@ -1466,6 +1475,7 @@ function(ExternalProject_Add_Step name step) add_custom_command( OUTPUT ${stamp_file} + BYPRODUCTS ${byproducts} COMMENT ${comment} COMMAND ${command} COMMAND ${touch} @@ -2139,8 +2149,11 @@ function(_ep_add_build_command name) set(always 0) endif() + get_property(build_byproducts TARGET ${name} PROPERTY _EP_BUILD_BYPRODUCTS) + ExternalProject_Add_Step(${name} build COMMAND ${cmd} + BYPRODUCTS ${build_byproducts} WORKING_DIRECTORY ${binary_dir} DEPENDEES configure ALWAYS ${always} diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index a21ca89..f94bd09 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -179,11 +179,6 @@ if(NOT DEFINED CURSES_HAVE_CURSES_H) endif() endif() -if (NOT CURSES_TINFO_HAS_CBREAK) - find_library(CURSES_EXTRA_LIBRARY cur_colr HINTS "${_cursesLibDir}") - find_library(CURSES_EXTRA_LIBRARY cur_colr ) -endif() - find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") find_library(CURSES_FORM_LIBRARY form ) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 79be34e..bb73853 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -115,7 +115,10 @@ if(Java_JAVA_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) if( res ) - if(${Java_FIND_REQUIRED}) + if(var MATCHES "No Java runtime present, requesting install") + set_property(CACHE Java_JAVA_EXECUTABLE + PROPERTY VALUE "Java_JAVA_EXECUTABLE-NOTFOUND") + elseif(${Java_FIND_REQUIRED}) message( FATAL_ERROR "Error executing java -version" ) else() message( STATUS "Warning, could not run java -version") diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 801b4f8..a102c66 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -111,11 +111,11 @@ int main() { # same in Fortran set(OpenMP_Fortran_TEST_SOURCE " -program test -use omp_lib -integer :: n -n = omp_get_num_threads() -end program test + program test + use omp_lib + integer :: n + n = omp_get_num_threads() + end program test " ) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 4c936fe..da19a3d 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -18,8 +18,8 @@ if(__WINDOWS_CLANG) endif() set(__WINDOWS_CLANG 1) -if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC" - OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") +if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" + OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") include(Platform/Windows-MSVC) macro(__windows_compiler_clang lang) __windows_compiler_msvc(${lang}) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 730f068..2350bfe 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 1) -set(CMake_VERSION_PATCH 20141114) +set(CMake_VERSION_PATCH 20141125) #set(CMake_VERSION_RC 1) diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h index b157a28..791ac9b 100644 --- a/Source/CursesDialog/cmCursesStandardIncludes.h +++ b/Source/CursesDialog/cmCursesStandardIncludes.h @@ -15,30 +15,13 @@ #define _MSE_INT_H #endif -#include <cmFormConfigure.h> - #if defined(__hpux) # define _BOOL_DEFINED # include <sys/time.h> -# define _XOPEN_SOURCE_EXTENDED -# include <curses.h> -# include <form.h> -# undef _XOPEN_SOURCE_EXTENDED -#else -/* figure out which curses.h to include */ -# if defined(CURSES_HAVE_NCURSES_H) -# include <ncurses.h> -# elif defined(CURSES_HAVE_NCURSES_NCURSES_H) -# include <ncurses/ncurses.h> -# elif defined(CURSES_HAVE_NCURSES_CURSES_H) -# include <ncurses/curses.h> -# else -# include <curses.h> -# endif - -# include <form.h> #endif +#include <form.h> + // This is a hack to prevent warnings about these functions being // declared but not referenced. #if defined(__sgi) && !defined(__GNUC__) @@ -57,10 +40,6 @@ public: }; #endif -#ifndef getmaxyx - #define getmaxyx(w,y,x) ((y) = getmaxy(w), (x) = getmaxx(w)) -#endif - // on some machines move erase and clear conflict with stl // so remove them from the namespace diff --git a/Source/CursesDialog/form/fld_attr.c b/Source/CursesDialog/form/fld_attr.c index 8619588..35ea903 100644 --- a/Source/CursesDialog/form/fld_attr.c +++ b/Source/CursesDialog/form/fld_attr.c @@ -29,13 +29,7 @@ /**************************************************************************** * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * ****************************************************************************/ -#if defined(__hpux) - #define _XOPEN_SOURCE_EXTENDED -#endif - #include "form.priv.h" -#if defined(__hpux) - #undef _XOPEN_SOURCE_EXTENDED -#endif +#include "form.priv.h" MODULE_ID("$Id$") /*---------------------------------------------------------------------------- diff --git a/Source/CursesDialog/form/form.h b/Source/CursesDialog/form/form.h index 94f05af..1219cb5 100644 --- a/Source/CursesDialog/form/form.h +++ b/Source/CursesDialog/form/form.h @@ -47,7 +47,17 @@ # elif defined(CURSES_HAVE_NCURSES_CURSES_H) # include <ncurses/curses.h> # else +# if defined(__hpux) +# if defined(_XOPEN_SOURCE_EXTENDED) +# define HAVE__XOPEN_SOURCE_EXTENDED +# else +# define _XOPEN_SOURCE_EXTENDED +# endif +# endif # include <curses.h> +# if defined(__hpux) && !defined(HAVE__XOPEN_SOURCE_EXTENDED) +# undef _XOPEN_SOURCE_EXTENDED +# endif # endif #include <eti.h> diff --git a/Source/CursesDialog/form/form.priv.h b/Source/CursesDialog/form/form.priv.h index 3691f2f..8516a6f 100644 --- a/Source/CursesDialog/form/form.priv.h +++ b/Source/CursesDialog/form/form.priv.h @@ -33,12 +33,6 @@ #include "mf_common.h" #include "form.h" -/* get around odd bug on aCC and itanium */ -#if defined(__hpux) && defined(__ia64) -#define getmaxx __getmaxx -#define getmaxy __getmaxy -#endif - /* form status values */ #define _OVLMODE (0x04) /* Form is in overlay mode */ #define _WINDOW_MODIFIED (0x10) /* Current field window has been modified */ diff --git a/Source/CursesDialog/form/frm_driver.c b/Source/CursesDialog/form/frm_driver.c index b9611bf..26f580e 100644 --- a/Source/CursesDialog/form/frm_driver.c +++ b/Source/CursesDialog/form/frm_driver.c @@ -29,13 +29,7 @@ /**************************************************************************** * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * ****************************************************************************/ -#if defined(__hpux) - #define _XOPEN_SOURCE_EXTENDED -#endif #include "form.priv.h" -#if defined(__hpux) - #undef _XOPEN_SOURCE_EXTENDED -#endif /* AIX seems to define this */ #undef lines @@ -357,12 +351,7 @@ static void Buffer_To_Window(const FIELD * field, WINDOW * win) assert(win && field); -#if defined(__LSB_VERSION__) getmaxyx(win, height, width); -#else - width = getmaxx(win); - height = getmaxy(win); -#endif for(row=0, pBuffer=field->buf; row < height; @@ -394,17 +383,13 @@ static void Window_To_Buffer(WINDOW * win, FIELD * field) int pad; int len = 0; char *p; - int row, height; + int row, height, width; assert(win && field && field->buf ); pad = field->pad; p = field->buf; -#if defined(__LSB_VERSION__) - { int width; getmaxyx(win, height, width); } -#else - height = getmaxy(win); -#endif + getmaxyx(win, height, width); for(row=0; (row < height) && (row < field->drows); row++ ) { diff --git a/Source/CursesDialog/form/frm_post.c b/Source/CursesDialog/form/frm_post.c index 3c63de7..924fe6a 100644 --- a/Source/CursesDialog/form/frm_post.c +++ b/Source/CursesDialog/form/frm_post.c @@ -63,12 +63,7 @@ int post_form(FORM * form) RETURN(E_NOT_CONNECTED); formwin = Get_Form_Window(form); -#if defined(__LSB_VERSION__) getmaxyx(formwin, height, width); -#else - width = getmaxx(formwin); - height = getmaxy(formwin); -#endif if ((form->cols > width) || (form->rows > height)) RETURN(E_NO_ROOM); diff --git a/Source/CursesDialog/form/frm_req_name.c b/Source/CursesDialog/form/frm_req_name.c index b108dab..6fb9183 100644 --- a/Source/CursesDialog/form/frm_req_name.c +++ b/Source/CursesDialog/form/frm_req_name.c @@ -35,13 +35,7 @@ * Routines to handle external names of menu requests * ***************************************************************************/ -#if defined(__hpux) - #define _XOPEN_SOURCE_EXTENDED -#endif #include "form.priv.h" -#if defined(__hpux) - #undef _XOPEN_SOURCE_EXTENDED -#endif MODULE_ID("$Id$") diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 2d19610..818b910 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -32,9 +32,10 @@ bool cmAddCustomCommandCommand std::string source, target, main_dependency, working; std::string comment_buffer; const char* comment = 0; - std::vector<std::string> depends, outputs, output; + std::vector<std::string> depends, outputs, output, byproducts; bool verbatim = false; bool append = false; + bool uses_terminal = false; std::string implicit_depends_lang; cmCustomCommand::ImplicitDependsList implicit_depends; @@ -56,6 +57,7 @@ bool cmAddCustomCommandCommand doing_main_dependency, doing_output, doing_outputs, + doing_byproducts, doing_comment, doing_working_directory, doing_nothing @@ -102,6 +104,10 @@ bool cmAddCustomCommandCommand { append = true; } + else if(copy == "USES_TERMINAL") + { + uses_terminal = true; + } else if(copy == "TARGET") { doing = doing_target; @@ -122,6 +128,10 @@ bool cmAddCustomCommandCommand { doing = doing_output; } + else if (copy == "BYPRODUCTS") + { + doing = doing_byproducts; + } else if (copy == "WORKING_DIRECTORY") { doing = doing_working_directory; @@ -145,6 +155,7 @@ bool cmAddCustomCommandCommand { case doing_output: case doing_outputs: + case doing_byproducts: if (!cmSystemTools::FileIsFullPath(copy.c_str())) { // This is an output to be generated, so it should be @@ -228,6 +239,9 @@ bool cmAddCustomCommandCommand case doing_outputs: outputs.push_back(filename); break; + case doing_byproducts: + byproducts.push_back(filename); + break; case doing_comment: comment_buffer = copy; comment = comment_buffer.c_str(); @@ -267,7 +281,9 @@ bool cmAddCustomCommandCommand } // Make sure the output names and locations are safe. - if(!this->CheckOutputs(output) || !this->CheckOutputs(outputs)) + if(!this->CheckOutputs(output) || + !this->CheckOutputs(outputs) || + !this->CheckOutputs(byproducts)) { return false; } @@ -309,19 +325,19 @@ bool cmAddCustomCommandCommand { // Source is empty, use the target. std::vector<std::string> no_depends; - this->Makefile->AddCustomCommandToTarget(target, no_depends, + this->Makefile->AddCustomCommandToTarget(target, byproducts, no_depends, commandLines, cctype, comment, working.c_str(), - escapeOldStyle); + escapeOldStyle, uses_terminal); } else if(target.empty()) { // Target is empty, use the output. - this->Makefile->AddCustomCommandToOutput(output, depends, - main_dependency, + this->Makefile->AddCustomCommandToOutput(output, byproducts, + depends, main_dependency, commandLines, comment, working.c_str(), false, - escapeOldStyle); + escapeOldStyle, uses_terminal); // Add implicit dependency scanning requests if any were given. if(!implicit_depends.empty()) @@ -346,6 +362,16 @@ bool cmAddCustomCommandCommand } } } + else if (!byproducts.empty()) + { + this->SetError("BYPRODUCTS may not be specified with SOURCE signatures"); + return false; + } + else if (uses_terminal) + { + this->SetError("USES_TERMINAL may not be used with SOURCE signatures"); + return false; + } else { bool issueMessage = true; diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 3235502..09c8af5 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -45,9 +45,10 @@ bool cmAddCustomTargetCommand cmCustomCommandLines commandLines; // Accumulate dependencies. - std::vector<std::string> depends; + std::vector<std::string> depends, byproducts; std::string working_directory; bool verbatim = false; + bool uses_terminal = false; std::string comment_buffer; const char* comment = 0; std::vector<std::string> sources; @@ -56,10 +57,11 @@ bool cmAddCustomTargetCommand enum tdoing { doing_command, doing_depends, + doing_byproducts, doing_working_directory, doing_comment, doing_source, - doing_verbatim + doing_nothing }; tdoing doing = doing_command; @@ -84,15 +86,24 @@ bool cmAddCustomTargetCommand { doing = doing_depends; } + else if(copy == "BYPRODUCTS") + { + doing = doing_byproducts; + } else if(copy == "WORKING_DIRECTORY") { doing = doing_working_directory; } else if(copy == "VERBATIM") { - doing = doing_verbatim; + doing = doing_nothing; verbatim = true; } + else if(copy == "USES_TERMINAL") + { + doing = doing_nothing; + uses_terminal = true; + } else if (copy == "COMMENT") { doing = doing_comment; @@ -122,6 +133,19 @@ bool cmAddCustomTargetCommand case doing_command: currentLine.push_back(copy); break; + case doing_byproducts: + { + std::string filename; + if (!cmSystemTools::FileIsFullPath(copy.c_str())) + { + filename = this->Makefile->GetCurrentOutputDirectory(); + filename += "/"; + } + filename += copy; + cmSystemTools::ConvertToUnixSlashes(filename); + byproducts.push_back(filename); + } + break; case doing_depends: { std::string dep = copy; @@ -221,12 +245,27 @@ bool cmAddCustomTargetCommand cmSystemTools::CollapseFullPath(working_directory, build_dir); } + if (commandLines.empty() && !byproducts.empty()) + { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "BYPRODUCTS may not be specified without any COMMAND"); + return true; + } + if (commandLines.empty() && uses_terminal) + { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "USES_TERMINAL may not be specified without any COMMAND"); + return true; + } + // Add the utility target to the makefile. bool escapeOldStyle = !verbatim; cmTarget* target = this->Makefile->AddUtilityCommand(targetName, excludeFromAll, - working_directory.c_str(), depends, - commandLines, escapeOldStyle, comment); + working_directory.c_str(), + byproducts, depends, + commandLines, escapeOldStyle, comment, + uses_terminal); // Add additional user-specified source files to the target. target->AddSources(sources); diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index dd2a1b8..b304f28 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -353,10 +353,11 @@ void CCONV cmAddCustomCommandToTarget(void *arg, const char* target, } // Pass the call to the makefile instance. + std::vector<std::string> no_byproducts; std::vector<std::string> no_depends; const char* no_comment = 0; const char* no_working_dir = 0; - mf->AddCustomCommandToTarget(target, no_depends, commandLines, + mf->AddCustomCommandToTarget(target, no_byproducts, no_depends, commandLines, cctype, no_comment, no_working_dir); } diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index 0c15477..8f22f80 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -63,12 +63,13 @@ static bool LogErrorsAsMessages; { \ if (LogErrorsAsMessages) \ { \ - std::ostringstream oss; \ - oss.flags(std::ios::hex); \ - oss << context << " failed HRESULT, hr = 0x" << hr << std::endl; \ - oss.flags(std::ios::dec); \ - oss << __FILE__ << "(" << __LINE__ << ")"; \ - cmSystemTools::Message(oss.str().c_str()); \ + std::ostringstream _hresult_oss; \ + _hresult_oss.flags(std::ios::hex); \ + _hresult_oss << context << " failed HRESULT, hr = 0x" \ + << hr << std::endl; \ + _hresult_oss.flags(std::ios::dec); \ + _hresult_oss << __FILE__ << "(" << __LINE__ << ")"; \ + cmSystemTools::Message(_hresult_oss.str().c_str()); \ } \ } diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index c161eb6..2afb029 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -22,11 +22,13 @@ cmCustomCommand::cmCustomCommand() this->HaveComment = false; this->EscapeOldStyle = true; this->EscapeAllowMakeVars = false; + this->UsesTerminal = false; } //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): Outputs(r.Outputs), + Byproducts(r.Byproducts), Depends(r.Depends), CommandLines(r.CommandLines), HaveComment(r.HaveComment), @@ -34,7 +36,8 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): WorkingDirectory(r.WorkingDirectory), EscapeAllowMakeVars(r.EscapeAllowMakeVars), EscapeOldStyle(r.EscapeOldStyle), - Backtrace(r.Backtrace) + Backtrace(r.Backtrace), + UsesTerminal(r.UsesTerminal) { } @@ -47,6 +50,7 @@ cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r) } this->Outputs = r.Outputs; + this->Byproducts= r.Byproducts; this->Depends = r.Depends; this->CommandLines = r.CommandLines; this->HaveComment = r.HaveComment; @@ -56,6 +60,7 @@ cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r) this->EscapeOldStyle = r.EscapeOldStyle; this->ImplicitDepends = r.ImplicitDepends; this->Backtrace = r.Backtrace; + this->UsesTerminal = r.UsesTerminal; return *this; } @@ -63,11 +68,13 @@ cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r) //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand(cmMakefile const* mf, const std::vector<std::string>& outputs, + const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDirectory): Outputs(outputs), + Byproducts(byproducts), Depends(depends), CommandLines(commandLines), HaveComment(comment?true:false), @@ -97,6 +104,12 @@ const std::vector<std::string>& cmCustomCommand::GetOutputs() const } //---------------------------------------------------------------------------- +const std::vector<std::string>& cmCustomCommand::GetByproducts() const +{ + return this->Byproducts; +} + +//---------------------------------------------------------------------------- const std::vector<std::string>& cmCustomCommand::GetDepends() const { return this->Depends; @@ -184,3 +197,15 @@ void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList const& l) this->ImplicitDepends.insert(this->ImplicitDepends.end(), l.begin(), l.end()); } + +//---------------------------------------------------------------------------- +bool cmCustomCommand::GetUsesTerminal() const +{ + return this->UsesTerminal; +} + +//---------------------------------------------------------------------------- +void cmCustomCommand::SetUsesTerminal(bool b) +{ + this->UsesTerminal = b; +} diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 21dbefb..0bfaef2 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -32,6 +32,7 @@ public: /** Main constructor specifies all information for the command. */ cmCustomCommand(cmMakefile const* mf, const std::vector<std::string>& outputs, + const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, const char* comment, @@ -42,6 +43,9 @@ public: /** Get the output file produced by the command. */ const std::vector<std::string>& GetOutputs() const; + /** Get the extra files produced by the command. */ + const std::vector<std::string>& GetByproducts() const; + /** Get the vector that holds the list of dependencies. */ const std::vector<std::string>& GetDepends() const; @@ -79,8 +83,14 @@ public: void AppendImplicitDepends(ImplicitDependsList const&); ImplicitDependsList const& GetImplicitDepends() const; + /** Set/Get whether this custom command should be given access to the + real console (if possible). */ + bool GetUsesTerminal() const; + void SetUsesTerminal(bool b); + private: std::vector<std::string> Outputs; + std::vector<std::string> Byproducts; std::vector<std::string> Depends; cmCustomCommandLines CommandLines; bool HaveComment; @@ -90,6 +100,7 @@ private: bool EscapeOldStyle; cmListFileBacktrace Backtrace; ImplicitDependsList ImplicitDepends; + bool UsesTerminal; }; #endif diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 1bca6e6..162d7a1 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -91,6 +91,12 @@ std::vector<std::string> const& cmCustomCommandGenerator::GetOutputs() const } //---------------------------------------------------------------------------- +std::vector<std::string> const& cmCustomCommandGenerator::GetByproducts() const +{ + return this->CC.GetByproducts(); +} + +//---------------------------------------------------------------------------- std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const { if (!this->DependsDone) diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 0d8a0a4..b4ae014 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -42,6 +42,7 @@ public: const char* GetComment() const; std::string GetWorkingDirectory() const; std::vector<std::string> const& GetOutputs() const; + std::vector<std::string> const& GetByproducts() const; std::vector<std::string> const& GetDepends() const; }; diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 1a101dd..03d0bc6 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -80,6 +80,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, return; } + this->Makefile->AddCMakeOutputFile(outputFileName.c_str()); this->Files.push_back(outputFileName); outputFiles[outputFileName] = outputContent; @@ -117,6 +118,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() } else { + this->Makefile->AddCMakeDependFile(this->Input.c_str()); cmSystemTools::GetPermissions(this->Input.c_str(), perm); cmsys::ifstream fin(this->Input.c_str()); if(!fin) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ab9dc88..b9c9b3b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2207,7 +2207,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) = this->CreateGlobalTarget(this->GetPackageTargetName(), "Run CPack packaging tool...", &cpackCommandLines, depends, - workingDir.c_str()); + workingDir.c_str(), /*uses_terminal*/false); } // CPack source const char* packageSourceTargetName = this->GetPackageSourceTargetName(); @@ -2231,8 +2231,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) = this->CreateGlobalTarget(packageSourceTargetName, "Run CPack packaging tool for source...", &cpackCommandLines, depends, - workingDir.c_str() - ); + workingDir.c_str(), /*uses_terminal*/false); } } @@ -2257,7 +2256,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) cpackCommandLines.push_back(singleLine); (*targets)[this->GetTestTargetName()] = this->CreateGlobalTarget(this->GetTestTargetName(), - "Running tests...", &cpackCommandLines, depends, 0); + "Running tests...", &cpackCommandLines, depends, 0, + /*uses_terminal*/false); } //Edit Cache @@ -2280,7 +2280,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[editCacheTargetName] = this->CreateGlobalTarget( editCacheTargetName, "Running CMake cache editor...", - &cpackCommandLines, depends, 0); + &cpackCommandLines, depends, 0, /*uses_terminal*/true); } else { @@ -2293,7 +2293,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) this->CreateGlobalTarget( editCacheTargetName, "No interactive CMake dialog available...", - &cpackCommandLines, depends, 0); + &cpackCommandLines, depends, 0, /*uses_terminal*/false); } } @@ -2312,7 +2312,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[rebuildCacheTargetName] = this->CreateGlobalTarget( rebuildCacheTargetName, "Running CMake to regenerate build system...", - &cpackCommandLines, depends, 0); + &cpackCommandLines, depends, 0, /*uses_terminal*/false); } //Install @@ -2352,7 +2352,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)["list_install_components"] = this->CreateGlobalTarget("list_install_components", ostr.str().c_str(), - &cpackCommandLines, depends, 0); + &cpackCommandLines, depends, 0, /*uses_terminal*/false); } std::string cmd = cmakeCommand; cpackCommandLines.erase(cpackCommandLines.begin(), @@ -2372,7 +2372,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) depends.push_back(this->GetAllTargetName()); } } - if(mf->GetDefinition("CMake_BINARY_DIR")) + if(mf->GetDefinition("CMake_BINARY_DIR") && + !mf->IsOn("CMAKE_CROSSCOMPILING")) { // We are building CMake itself. We cannot use the original // executable to install over itself. The generator will @@ -2392,7 +2393,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[this->GetInstallTargetName()] = this->CreateGlobalTarget( this->GetInstallTargetName(), "Install the project...", - &cpackCommandLines, depends, 0); + &cpackCommandLines, depends, 0, /*uses_terminal*/false); // install_local if(const char* install_local = this->GetInstallLocalTargetName()) @@ -2408,7 +2409,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[install_local] = this->CreateGlobalTarget( install_local, "Installing only the local directory...", - &cpackCommandLines, depends, 0); + &cpackCommandLines, depends, 0, /*uses_terminal*/false); } // install_strip @@ -2425,7 +2426,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[install_strip] = this->CreateGlobalTarget( install_strip, "Installing the project stripped...", - &cpackCommandLines, depends, 0); + &cpackCommandLines, depends, 0, /*uses_terminal*/false); } } } @@ -2499,7 +2500,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( const std::string& name, const char* message, const cmCustomCommandLines* commandLines, std::vector<std::string> depends, - const char* workingDirectory) + const char* workingDirectory, + bool uses_terminal) { // Package cmTarget target; @@ -2508,10 +2510,12 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( target.SetProperty("EXCLUDE_FROM_ALL","TRUE"); std::vector<std::string> no_outputs; + std::vector<std::string> no_byproducts; std::vector<std::string> no_depends; // Store the custom command in the target. - cmCustomCommand cc(0, no_outputs, no_depends, *commandLines, 0, - workingDirectory); + cmCustomCommand cc(0, no_outputs, no_byproducts, no_depends, + *commandLines, 0, workingDirectory); + cc.SetUsesTerminal(uses_terminal); target.AddPostBuildCommand(cc); target.SetProperty("EchoString", message); std::vector<std::string>::iterator dit; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 8a10d38..926efe7 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -385,7 +385,8 @@ protected: void CreateDefaultGlobalTargets(cmTargets* targets); cmTarget CreateGlobalTarget(const std::string& name, const char* message, const cmCustomCommandLines* commandLines, - std::vector<std::string> depends, const char* workingDir); + std::vector<std::string> depends, const char* workingDir, + bool uses_terminal); bool NeedSymbolicMark; bool UseLinkScript; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 498ae9a..6f0586b 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -242,7 +242,7 @@ void cmGlobalNinjaGenerator::AddCustomCommandRule() /*deptype*/ "", /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ true, + /*restat*/ "1", /*generator*/ false); } @@ -250,6 +250,7 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command, const std::string& description, const std::string& comment, + bool uses_terminal, const cmNinjaDeps& outputs, const cmNinjaDeps& deps, const cmNinjaDeps& orderOnly) @@ -266,6 +267,10 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command, cmNinjaVars vars; vars["COMMAND"] = cmd; vars["DESC"] = EncodeLiteral(description); + if (uses_terminal && SupportsConsolePool()) + { + vars["pool"] = "console"; + } this->WriteBuild(*this->BuildFileStream, comment, @@ -304,7 +309,7 @@ cmGlobalNinjaGenerator::AddMacOSXContentRule() /*deptype*/ "", /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ false, + /*restat*/ "", /*generator*/ false); } @@ -339,7 +344,7 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os, const std::string& deptype, const std::string& rspfile, const std::string& rspcontent, - bool restat, + const std::string& restat, bool generator) { // Make sure the rule has a name. @@ -403,10 +408,10 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os, os << "rspfile_content = " << rspcontent << "\n"; } - if(restat) + if(!restat.empty()) { cmGlobalNinjaGenerator::Indent(os, 1); - os << "restat = 1\n"; + os << "restat = " << restat << "\n"; } if(generator) @@ -602,7 +607,7 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name, const std::string& deptype, const std::string& rspfile, const std::string& rspcontent, - bool restat, + const std::string& restat, bool generator) { // Do not add the same rule twice. @@ -826,6 +831,7 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies() std::copy(i->second.begin(), i->second.end(), std::back_inserter(deps)); WriteCustomCommandBuild(/*command=*/"", /*description=*/"", "Assume dependencies for generated source file.", + /*uses_terminal*/false, cmNinjaDeps(1, i->first), deps); } } @@ -1116,7 +1122,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) /*deptype=*/ "", /*rspfile=*/ "", /*rspcontent*/ "", - /*restat=*/ false, + /*restat=*/ "", /*generator=*/ true); cmLocalNinjaGenerator *ng = static_cast<cmLocalNinjaGenerator *>(lg); @@ -1141,9 +1147,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) cmNinjaVars variables; // Use 'console' pool to get non buffered output of the CMake re-run call // Available since Ninja 1.5 - if(cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - ninjaVersion().c_str(), - "1.5") == false) + if(SupportsConsolePool()) { variables["pool"] = "console"; } @@ -1185,6 +1189,12 @@ std::string cmGlobalNinjaGenerator::ninjaVersion() const return version; } +bool cmGlobalNinjaGenerator::SupportsConsolePool() const +{ + return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, + ninjaVersion().c_str(), "1.5") == false; +} + void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) { WriteRule(*this->RulesFileStream, @@ -1196,7 +1206,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) /*deptype=*/ "", /*rspfile=*/ "", /*rspcontent*/ "", - /*restat=*/ false, + /*restat=*/ "", /*generator=*/ false); WriteBuild(os, "Clean all the built files.", @@ -1219,7 +1229,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) /*deptype=*/ "", /*rspfile=*/ "", /*rspcontent*/ "", - /*restat=*/ false, + /*restat=*/ "", /*generator=*/ false); WriteBuild(os, "Print all primary targets available.", diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index f666ee3..3d443d8 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -103,6 +103,7 @@ public: void WriteCustomCommandBuild(const std::string& command, const std::string& description, const std::string& comment, + bool uses_terminal, const cmNinjaDeps& outputs, const cmNinjaDeps& deps = cmNinjaDeps(), const cmNinjaDeps& orderOnly = cmNinjaDeps()); @@ -124,7 +125,7 @@ public: const std::string& deptype, const std::string& rspfile, const std::string& rspcontent, - bool restat, + const std::string& restat, bool generator); /** @@ -244,7 +245,7 @@ public: const std::string& deptype, const std::string& rspfile, const std::string& rspcontent, - bool restat, + const std::string& restat, bool generator); bool HasRule(const std::string& name); @@ -299,6 +300,9 @@ public: virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; std::string ninjaVersion() const; + + bool SupportsConsolePool() const; + protected: /// Overloaded methods. @see cmGlobalGenerator::Generate() diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index d70d2af..499ac56 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -262,6 +262,24 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf) } //---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset( + std::string& toolset) const +{ + toolset = ""; + return false; +} + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset( + std::string& toolset) const +{ + toolset = ""; + return false; +} + +//---------------------------------------------------------------------------- std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const { if (this->SystemVersion == "8.0") diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 686dcdf..3b0a5cf 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -118,9 +118,10 @@ protected: virtual bool InitializeWindowsCE(cmMakefile* mf); virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); + virtual std::string SelectWindowsCEToolset() const; - virtual std::string SelectWindowsPhoneToolset() const { return ""; } - virtual std::string SelectWindowsStoreToolset() const { return ""; } + virtual bool SelectWindowsPhoneToolset(std::string& toolset) const; + virtual bool SelectWindowsStoreToolset(std::string& toolset) const; virtual const char* GetIDEVersion() { return "10.0"; } diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 39bbdc0..2b69222 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -131,12 +131,20 @@ cmGlobalVisualStudio11Generator::MatchesGeneratorName( //---------------------------------------------------------------------------- bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf) { - this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset(); - if(this->DefaultPlatformToolset.empty()) + if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset)) { cmOStringStream e; - e << this->GetName() << " supports Windows Phone '8.0', but not '" - << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + if(this->DefaultPlatformToolset.empty()) + { + e << this->GetName() << " supports Windows Phone '8.0', but not '" + << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + } + else + { + e << "A Windows Phone component with CMake requires both the Windows " + << "Desktop SDK as well as the Windows Phone '" << this->SystemVersion + << "' SDK. Please make sure that you have both installed"; + } mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -146,12 +154,20 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf) //---------------------------------------------------------------------------- bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf) { - this->DefaultPlatformToolset = this->SelectWindowsStoreToolset(); - if(this->DefaultPlatformToolset.empty()) + if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset)) { cmOStringStream e; - e << this->GetName() << " supports Windows Store '8.0', but not '" - << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + if(this->DefaultPlatformToolset.empty()) + { + e << this->GetName() << " supports Windows Store '8.0', but not '" + << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + } + else + { + e << "A Windows Store component with CMake requires both the Windows " + << "Desktop SDK as well as the Windows Store '" << this->SystemVersion + << "' SDK. Please make sure that you have both installed"; + } mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -159,23 +175,47 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf) } //---------------------------------------------------------------------------- -std::string cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset() const +bool +cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset( + std::string& toolset) const { if(this->SystemVersion == "8.0") { - return "v110_wp80"; + if (this->IsWindowsPhoneToolsetInstalled() && + this->IsWindowsDesktopToolsetInstalled()) + { + toolset = "v110_wp80"; + return true; + } + else + { + return false; + } } - return this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(); + return + this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(toolset); } //---------------------------------------------------------------------------- -std::string cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset() const +bool +cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset( + std::string& toolset) const { if(this->SystemVersion == "8.0") { - return "v110"; + if(this->IsWindowsStoreToolsetInstalled() && + this->IsWindowsDesktopToolsetInstalled()) + { + toolset = "v110"; + return true; + } + else + { + return false; + } } - return this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(); + return + this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(toolset); } //---------------------------------------------------------------------------- @@ -256,3 +296,54 @@ cmGlobalVisualStudio11Generator::NeedsDeploy(cmTarget::TargetType type) const } return cmGlobalVisualStudio10Generator::NeedsDeploy(type); } + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio11Generator::IsWindowsDesktopToolsetInstalled() const +{ + const char desktop80Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\11.0\\VC\\Libraries\\Extended"; + const char VS2012DesktopExpressKey[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "WDExpress\\11.0;InstallDir"; + + std::vector<std::string> subkeys; + std::string path; + return cmSystemTools::ReadRegistryValue(VS2012DesktopExpressKey, + path, + cmSystemTools::KeyWOW64_32) || + cmSystemTools::GetRegistrySubKeys(desktop80Key, + subkeys, + cmSystemTools::KeyWOW64_32); +} + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio11Generator::IsWindowsPhoneToolsetInstalled() const +{ + const char wp80Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "Microsoft SDKs\\WindowsPhone\\v8.0\\" + "Install Path;Install Path"; + + std::string path; + cmSystemTools::ReadRegistryValue(wp80Key, + path, + cmSystemTools::KeyWOW64_32); + return !path.empty(); +} + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio11Generator::IsWindowsStoreToolsetInstalled() const +{ + const char win80Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\11.0\\VC\\Libraries\\Core\\Arm"; + + std::vector<std::string> subkeys; + return cmSystemTools::GetRegistrySubKeys(win80Key, + subkeys, + cmSystemTools::KeyWOW64_32); +} diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index bbd935c..c79dc97 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -36,8 +36,15 @@ public: protected: virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); - virtual std::string SelectWindowsPhoneToolset() const; - virtual std::string SelectWindowsStoreToolset() const; + virtual bool SelectWindowsPhoneToolset(std::string& toolset) const; + virtual bool SelectWindowsStoreToolset(std::string& toolset) const; + + // These aren't virtual because we need to check if the selected version + // of the toolset is installed + bool IsWindowsDesktopToolsetInstalled() const; + bool IsWindowsPhoneToolsetInstalled() const; + bool IsWindowsStoreToolsetInstalled() const; + virtual const char* GetIDEVersion() { return "11.0"; } bool UseFolderProperty(); static std::set<std::string> GetInstalledWindowsCESDKs(); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 29ecfe0..047f2ad 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -111,12 +111,20 @@ cmGlobalVisualStudio12Generator::MatchesGeneratorName( //---------------------------------------------------------------------------- bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf) { - this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset(); - if(this->DefaultPlatformToolset.empty()) + if(!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset)) { cmOStringStream e; - e << this->GetName() << " supports Windows Phone '8.0' and '8.1', " - "but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + if(this->DefaultPlatformToolset.empty()) + { + e << this->GetName() << " supports Windows Phone '8.0' and '8.1', but " + "not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + } + else + { + e << "A Windows Phone component with CMake requires both the Windows " + << "Desktop SDK as well as the Windows Phone '" << this->SystemVersion + << "' SDK. Please make sure that you have both installed"; + } mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -126,12 +134,20 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf) //---------------------------------------------------------------------------- bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf) { - this->DefaultPlatformToolset = this->SelectWindowsStoreToolset(); - if(this->DefaultPlatformToolset.empty()) + if(!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset)) { cmOStringStream e; - e << this->GetName() << " supports Windows Store '8.0' and '8.1', " - "but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + if(this->DefaultPlatformToolset.empty()) + { + e << this->GetName() << " supports Windows Store '8.0' and '8.1', but " + "not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + } + else + { + e << "A Windows Store component with CMake requires both the Windows " + << "Desktop SDK as well as the Windows Store '" << this->SystemVersion + << "' SDK. Please make sure that you have both installed"; + } mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -139,23 +155,47 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf) } //---------------------------------------------------------------------------- -std::string cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset() const +bool +cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset( + std::string& toolset) const { if(this->SystemVersion == "8.1") { - return "v120_wp81"; + if (this->IsWindowsPhoneToolsetInstalled() && + this->IsWindowsDesktopToolsetInstalled()) + { + toolset = "v120_wp81"; + return true; + } + else + { + return false; + } } - return this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(); + return + this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(toolset); } //---------------------------------------------------------------------------- -std::string cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset() const +bool +cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset( + std::string& toolset) const { if(this->SystemVersion == "8.1") { - return "v120"; + if(this->IsWindowsStoreToolsetInstalled() && + this->IsWindowsDesktopToolsetInstalled()) + { + toolset = "v120"; + return true; + } + else + { + return false; + } } - return this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(); + return + this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(toolset); } //---------------------------------------------------------------------------- @@ -180,3 +220,46 @@ cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator() lg->SetGlobalGenerator(this); return lg; } + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio12Generator::IsWindowsDesktopToolsetInstalled() const +{ + const char desktop81Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\12.0\\VC\\LibraryDesktop"; + + std::vector<std::string> subkeys; + return cmSystemTools::GetRegistrySubKeys(desktop81Key, + subkeys, + cmSystemTools::KeyWOW64_32); +} + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio12Generator::IsWindowsPhoneToolsetInstalled() const +{ + const char wp81Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "Microsoft SDKs\\WindowsPhone\\v8.1\\Install Path;Install Path"; + + std::string path; + cmSystemTools::ReadRegistryValue(wp81Key, + path, + cmSystemTools::KeyWOW64_32); + return !path.empty(); +} + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio12Generator::IsWindowsStoreToolsetInstalled() const +{ + const char win81Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\12.0\\VC\\Libraries\\Core\\Arm"; + + std::vector<std::string> subkeys; + return cmSystemTools::GetRegistrySubKeys(win81Key, + subkeys, + cmSystemTools::KeyWOW64_32); +} diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index ec85f10..a81516f 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -41,8 +41,14 @@ public: protected: virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); - virtual std::string SelectWindowsPhoneToolset() const; - virtual std::string SelectWindowsStoreToolset() const; + virtual bool SelectWindowsPhoneToolset(std::string& toolset) const; + virtual bool SelectWindowsStoreToolset(std::string& toolset) const; + + // These aren't virtual because we need to check if the selected version + // of the toolset is installed + bool IsWindowsDesktopToolsetInstalled() const; + bool IsWindowsPhoneToolsetInstalled() const; + bool IsWindowsStoreToolsetInstalled() const; virtual const char* GetIDEVersion() { return "12.0"; } private: class Factory; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index d001f93..fe702c0 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -13,21 +13,36 @@ #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" -static const char vs14generatorName[] = "Visual Studio 14"; +static const char vs14generatorName[] = "Visual Studio 14 2015"; + +// Map generator name without year to name with year. +static const char* cmVS14GenName(const std::string& name, std::string& genName) +{ + if(strncmp(name.c_str(), vs14generatorName, + sizeof(vs14generatorName)-6) != 0) + { + return 0; + } + const char* p = name.c_str() + sizeof(vs14generatorName) - 6; + if(cmHasLiteralPrefix(p, " 2015")) + { + p += 5; + } + genName = std::string(vs14generatorName) + p; + return p; +} class cmGlobalVisualStudio14Generator::Factory : public cmGlobalGeneratorFactory { public: virtual cmGlobalGenerator* CreateGlobalGenerator( - const std::string& genName) const + const std::string& name) const { - if(strncmp(genName.c_str(), vs14generatorName, - sizeof(vs14generatorName) - 1) != 0) - { - return 0; - } - const char* p = genName.c_str() + sizeof(vs14generatorName) - 1; + std::string genName; + const char* p = cmVS14GenName(name, genName); + if(!p) + { return 0; } if(!*p) { return new cmGlobalVisualStudio14Generator( @@ -51,7 +66,7 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const { entry.Name = vs14generatorName; - entry.Brief = "Generates Visual Studio 14 project files."; + entry.Brief = "Generates Visual Studio 14 (VS 2015) project files."; } virtual void GetGenerators(std::vector<std::string>& names) const @@ -85,7 +100,12 @@ bool cmGlobalVisualStudio14Generator::MatchesGeneratorName( const std::string& name) const { - return name == this->GetName(); + std::string genName; + if(cmVS14GenName(name, genName)) + { + return genName == this->GetName(); + } + return false; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 745515b..e6ce45d 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -341,9 +341,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() // overwritten by the CreateVCProjBuildRule. // (this could be avoided with per-target source files) std::string no_main_dependency = ""; + std::vector<std::string> no_byproducts; if(cmSourceFile* file = mf->AddCustomCommandToOutput( - stamps, listFiles, + stamps, no_byproducts, listFiles, no_main_dependency, commandLines, "Checking Build System", no_working_directory, true)) { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 5e7a898..b9f64e2 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -477,7 +477,9 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, this->PostBuildMakeTarget(target.GetName(), "$(CONFIGURATION)"); cmCustomCommandLines commandLines; commandLines.push_back(makeHelper); + std::vector<std::string> no_byproducts; lg->GetMakefile()->AddCustomCommandToTarget(target.GetName(), + no_byproducts, no_depends, commandLines, cmTarget::POST_BUILD, @@ -1368,6 +1370,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases, cmCustomCommand command(this->CurrentMakefile, std::vector<std::string>(), std::vector<std::string>(), + std::vector<std::string>(), cmd, "Creating symlinks", ""); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 9225f64..0b0d971 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -440,10 +440,18 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->Makefile); const std::vector<std::string> &outputs = ccg.GetOutputs(); - cmNinjaDeps ninjaOutputs(outputs.size()), ninjaDeps; + const std::vector<std::string> &byproducts = ccg.GetByproducts(); + cmNinjaDeps ninjaOutputs(outputs.size()+byproducts.size()), ninjaDeps; +#if 0 +#error TODO: Once CC in an ExternalProject target must provide the \ + file of each imported target that has an add_dependencies pointing \ + at us. How to know which ExternalProject step actually provides it? +#endif std::transform(outputs.begin(), outputs.end(), ninjaOutputs.begin(), MapToNinjaPath()); + std::transform(byproducts.begin(), byproducts.end(), + ninjaOutputs.begin() + outputs.size(), MapToNinjaPath()); this->AppendCustomCommandDeps(ccg, ninjaDeps); for (cmNinjaDeps::iterator i = ninjaOutputs.begin(); i != ninjaOutputs.end(); @@ -468,6 +476,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( this->BuildCommandLine(cmdLines), this->ConstructComment(ccg), "Custom command for " + ninjaOutputs[0], + cc->GetUsesTerminal(), ninjaOutputs, ninjaDeps, orderOnlyDeps); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index c14fb2b..b9a5074 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -821,10 +821,12 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, command.push_back("make_directory"); command.push_back(outDir); std::vector<std::string> no_output; + std::vector<std::string> no_byproducts; std::vector<std::string> no_depends; cmCustomCommandLines commands; commands.push_back(command); - pcc.reset(new cmCustomCommand(0, no_output, no_depends, commands, 0, 0)); + pcc.reset(new cmCustomCommand(0, no_output, no_byproducts, + no_depends, commands, 0, 0)); pcc->SetEscapeOldStyle(false); pcc->SetEscapeAllowMakeVars(true); return pcc; diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 9680d43..f01aa6b 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -95,10 +95,12 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target, command.push_back("make_directory"); command.push_back(impDir); std::vector<std::string> no_output; + std::vector<std::string> no_byproducts; std::vector<std::string> no_depends; cmCustomCommandLines commands; commands.push_back(command); - pcc.reset(new cmCustomCommand(0, no_output, no_depends, commands, 0, 0)); + pcc.reset(new cmCustomCommand(0, no_output, no_byproducts, + no_depends, commands, 0, 0)); pcc->SetEscapeOldStyle(false); pcc->SetEscapeAllowMakeVars(true); return pcc; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8a8aadc..61807b2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -880,12 +880,14 @@ void cmMakefile::ConfigureFinalPass() //---------------------------------------------------------------------------- void cmMakefile::AddCustomCommandToTarget(const std::string& target, + const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type, const char* comment, const char* workingDir, - bool escapeOldStyle) const + bool escapeOldStyle, + bool uses_terminal) { // Find the target to which to add the custom command. cmTargets::iterator ti = this->Targets.find(target); @@ -935,12 +937,24 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, this->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } + + // Always create the byproduct sources and mark them generated. + for(std::vector<std::string>::const_iterator o = byproducts.begin(); + o != byproducts.end(); ++o) + { + if(cmSourceFile* out = this->GetOrCreateSource(*o, true)) + { + out->SetProperty("GENERATED", "1"); + } + } + // Add the command to the appropriate build step for the target. std::vector<std::string> no_output; - cmCustomCommand cc(this, no_output, depends, + cmCustomCommand cc(this, no_output, byproducts, depends, commandLines, comment, workingDir); cc.SetEscapeOldStyle(escapeOldStyle); cc.SetEscapeAllowMakeVars(true); + cc.SetUsesTerminal(uses_terminal); switch(type) { case cmTarget::PRE_BUILD: @@ -958,13 +972,15 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, //---------------------------------------------------------------------------- cmSourceFile* cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, + const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace, - bool escapeOldStyle) + bool escapeOldStyle, + bool uses_terminal) { // Make sure there is at least one output. if(outputs.empty()) @@ -1055,6 +1071,14 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, out->SetProperty("GENERATED", "1"); } } + for(std::vector<std::string>::const_iterator o = byproducts.begin(); + o != byproducts.end(); ++o) + { + if(cmSourceFile* out = this->GetOrCreateSource(*o, true)) + { + out->SetProperty("GENERATED", "1"); + } + } // Attach the custom command to the file. if(file) @@ -1067,10 +1091,11 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, } cmCustomCommand* cc = - new cmCustomCommand(this, outputs, depends2, commandLines, - comment, workingDir); + new cmCustomCommand(this, outputs, byproducts, depends2, + commandLines, comment, workingDir); cc->SetEscapeOldStyle(escapeOldStyle); cc->SetEscapeAllowMakeVars(true); + cc->SetUsesTerminal(uses_terminal); file->SetCustomCommand(cc); this->UpdateOutputToSourceMap(outputs, file); } @@ -1119,13 +1144,17 @@ cmMakefile::AddCustomCommandToOutput(const std::string& output, const char* comment, const char* workingDir, bool replace, - bool escapeOldStyle) + bool escapeOldStyle, + bool uses_terminal) { std::vector<std::string> outputs; outputs.push_back(output); - return this->AddCustomCommandToOutput(outputs, depends, main_dependency, + std::vector<std::string> no_byproducts; + return this->AddCustomCommandToOutput(outputs, no_byproducts, + depends, main_dependency, commandLines, comment, workingDir, - replace, escapeOldStyle); + replace, escapeOldStyle, + uses_terminal); } //---------------------------------------------------------------------------- @@ -1144,7 +1173,9 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target, // In the old-style signature if the source and target were the // same then it added a post-build rule to the target. Preserve // this behavior. - this->AddCustomCommandToTarget(target, depends, commandLines, + std::vector<std::string> no_byproducts; + this->AddCustomCommandToTarget(target, no_byproducts, + depends, commandLines, cmTarget::POST_BUILD, comment, 0); return; } @@ -1242,7 +1273,25 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, const char* workingDirectory, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, - bool escapeOldStyle, const char* comment) + bool escapeOldStyle, const char* comment, + bool uses_terminal) +{ + std::vector<std::string> no_byproducts; + return this->AddUtilityCommand(utilityName, excludeFromAll, workingDirectory, + no_byproducts, depends, commandLines, + escapeOldStyle, comment, uses_terminal); +} + +//---------------------------------------------------------------------------- +cmTarget* +cmMakefile::AddUtilityCommand(const std::string& utilityName, + bool excludeFromAll, + const char* workingDirectory, + const std::vector<std::string>& byproducts, + const std::vector<std::string>& depends, + const cmCustomCommandLines& commandLines, + bool escapeOldStyle, const char* comment, + bool uses_terminal) { // Create a target instance for this utility. cmTarget* target = this->AddNewTarget(cmTarget::UTILITY, utilityName); @@ -1263,13 +1312,15 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, force += cmake::GetCMakeFilesDirectory(); force += "/"; force += utilityName; + std::vector<std::string> forced; + forced.push_back(force); std::string no_main_dependency = ""; bool no_replace = false; - this->AddCustomCommandToOutput(force, depends, - no_main_dependency, + this->AddCustomCommandToOutput(forced, byproducts, + depends, no_main_dependency, commandLines, comment, workingDirectory, no_replace, - escapeOldStyle); + escapeOldStyle, uses_terminal); cmSourceFile* sf = target->AddSourceCMP0049(force); // The output is not actually created so mark it symbolic. @@ -1282,6 +1333,16 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, cmSystemTools::Error("Could not get source file entry for ", force.c_str()); } + + // Always create the byproduct sources and mark them generated. + for(std::vector<std::string>::const_iterator o = byproducts.begin(); + o != byproducts.end(); ++o) + { + if(cmSourceFile* out = this->GetOrCreateSource(*o, true)) + { + out->SetProperty("GENERATED", "1"); + } + } } return target; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 824513b..0458d54 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -170,19 +170,23 @@ public: /** Add a custom command to the build. */ void AddCustomCommandToTarget(const std::string& target, + const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type, const char* comment, const char* workingDir, - bool escapeOldStyle = true) const; + bool escapeOldStyle = true, + bool uses_terminal = false); cmSourceFile* AddCustomCommandToOutput( const std::vector<std::string>& outputs, + const std::vector<std::string>& byproducts, const std::vector<std::string>& depends, const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, - bool escapeOldStyle = true); + bool escapeOldStyle = true, + bool uses_terminal = false); cmSourceFile* AddCustomCommandToOutput( const std::string& output, const std::vector<std::string>& depends, @@ -190,7 +194,8 @@ public: const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, - bool escapeOldStyle = true); + bool escapeOldStyle = true, + bool uses_terminal = false); void AddCustomCommandOldStyle(const std::string& target, const std::vector<std::string>& outputs, const std::vector<std::string>& depends, @@ -237,7 +242,17 @@ public: const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, bool escapeOldStyle = true, - const char* comment = 0); + const char* comment = 0, + bool uses_terminal = false); + cmTarget* AddUtilityCommand(const std::string& utilityName, + bool excludeFromAll, + const char* workingDirectory, + const std::vector<std::string>& byproducts, + const std::vector<std::string>& depends, + const cmCustomCommandLines& commandLines, + bool escapeOldStyle = true, + const char* comment = 0, + bool uses_terminal = false); /** * Add a link library to the build. diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 0cc3e3b..25931f3 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -194,12 +194,7 @@ cmNinjaNormalTargetGenerator vars.ObjectDir = "$OBJECT_DIR"; - // TODO: - // Makefile generator expands <TARGET> to the plain target name - // with suffix. $out expands to a relative path. This difference - // could make trouble when switching to Ninja generator. Maybe - // using TARGET_NAME and RuleVariables::TargetName is a fix. - vars.Target = "$out"; + vars.Target = "$TARGET_FILE"; vars.SONameFlag = "$SONAME_FLAG"; vars.TargetSOName = "$SONAME"; @@ -252,7 +247,7 @@ cmNinjaNormalTargetGenerator << this->GetVisibleTypeName() << "."; cmOStringStream description; description << "Linking " << this->TargetLinkLanguage << " " - << this->GetVisibleTypeName() << " $out"; + << this->GetVisibleTypeName() << " $TARGET_FILE"; this->GetGlobalGenerator()->AddRule(ruleName, linkCmd, description.str(), @@ -261,7 +256,7 @@ cmNinjaNormalTargetGenerator /*deptype*/ "", rspfile, rspcontent, - /*restat*/ false, + /*restat*/ "$RESTAT", /*generator*/ false); } @@ -283,7 +278,7 @@ cmNinjaNormalTargetGenerator /*deptype*/ "", /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ false, + /*restat*/ "", /*generator*/ false); else this->GetGlobalGenerator()->AddRule("CMAKE_SYMLINK_LIBRARY", @@ -297,7 +292,7 @@ cmNinjaNormalTargetGenerator /*deptype*/ "", /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ false, + /*restat*/ "", /*generator*/ false); } } @@ -326,7 +321,7 @@ cmNinjaNormalTargetGenerator this->GetLocalGenerator()->ConvertToOutputFormat( mf->GetRequiredDefinition("CMAKE_COMMAND"), cmLocalGenerator::SHELL); - linkCmds.push_back(cmakeCommand + " -E remove $out"); + linkCmds.push_back(cmakeCommand + " -E remove $TARGET_FILE"); } // TODO: Use ARCHIVE_APPEND for archives over a certain size. { @@ -450,6 +445,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->GetConfigName()); bool useWatcomQuote = mf->IsOn(createRule+"_USE_WATCOM_QUOTE"); cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator(); + + vars["TARGET_FILE"] = + localGen.ConvertToOutputFormat(targetOutputReal, cmLocalGenerator::SHELL); + localGen.GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], @@ -509,6 +508,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmLocalGenerator::SHELL); vars["TARGET_IMPLIB"] = impLibPath; EnsureParentDirectoryExists(impLibPath); + if(target.HasImportLibrary()) + { + outputs.push_back(targetOutputImplib); + } } if (!this->SetMsvcTargetPdbVariable(vars)) @@ -553,6 +556,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() &postBuildCmdLines }; + cmNinjaDeps byproducts; for (unsigned i = 0; i != 3; ++i) { for (std::vector<cmCustomCommand>::const_iterator @@ -561,6 +565,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() { cmCustomCommandGenerator ccg(*ci, cfgName, mf); localGen.AppendCustomCommandLines(ccg, *cmdLineLists[i]); + std::vector<std::string> const& ccByproducts = ccg.GetByproducts(); + std::transform(ccByproducts.begin(), ccByproducts.end(), + std::back_inserter(byproducts), MapToNinjaPath()); } } @@ -608,6 +615,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->GetLocalGenerator()->AppendTargetDepends(this->GetTarget(), orderOnlyDeps); + // Ninja should restat after linking if and only if there are byproducts. + vars["RESTAT"] = byproducts.empty()? "" : "1"; + + for (cmNinjaDeps::const_iterator oi = byproducts.begin(), + oe = byproducts.end(); + oi != oe; ++oi) + { + this->GetGlobalGenerator()->SeenCustomCommandOutput(*oi); + outputs.push_back(*oi); + } + // Write the build statement for this target. globalGen.WriteBuild(this->GetBuildFileStream(), comment.str(), @@ -659,16 +677,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } } - if (!this->TargetNameImport.empty()) - { - // Since using multiple outputs would mess up the $out variable, use an - // alias for the import library. - globalGen.WritePhonyBuild(this->GetBuildFileStream(), - "Alias for import library.", - cmNinjaDeps(1, targetOutputImplib), - cmNinjaDeps(1, targetOutputReal)); - } - // Add aliases for the file name and the target name. globalGen.AddTargetAlias(this->TargetNameOut, &target); globalGen.AddTargetAlias(this->GetTargetName(), &target); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 80213d8..7967762 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -477,7 +477,7 @@ cmNinjaTargetGenerator deptype, /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ false, + /*restat*/ "", /*generator*/ false); } @@ -538,8 +538,11 @@ cmNinjaTargetGenerator cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->GetMakefile()); const std::vector<std::string>& ccoutputs = ccg.GetOutputs(); + const std::vector<std::string>& ccbyproducts= ccg.GetByproducts(); std::transform(ccoutputs.begin(), ccoutputs.end(), std::back_inserter(orderOnlyDeps), MapToNinjaPath()); + std::transform(ccbyproducts.begin(), ccbyproducts.end(), + std::back_inserter(orderOnlyDeps), MapToNinjaPath()); } if (!orderOnlyDeps.empty()) diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 40a15a3..17cf517 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -116,7 +116,6 @@ protected: void WriteObjectBuildStatements(); void WriteObjectBuildStatement(cmSourceFile const* source, bool writeOrderDependsTargetForTarget); - void WriteCustomCommandBuildStatement(cmCustomCommand *cc); cmNinjaDeps GetObjects() const { return this->Objects; } diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index f5d18dc..42d6b46 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -27,14 +27,19 @@ cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() {} void cmNinjaUtilityTargetGenerator::Generate() { + std::string utilCommandName = cmake::GetCMakeFilesDirectoryPostSlash(); + utilCommandName += this->GetTargetName() + ".util"; + std::vector<std::string> commands; - cmNinjaDeps deps, outputs; + cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName); const std::vector<cmCustomCommand> *cmdLists[2] = { &this->GetTarget()->GetPreBuildCommands(), &this->GetTarget()->GetPostBuildCommands() }; + bool uses_terminal = false; + for (unsigned i = 0; i != 2; ++i) { for (std::vector<cmCustomCommand>::const_iterator ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) { @@ -42,6 +47,11 @@ void cmNinjaUtilityTargetGenerator::Generate() this->GetMakefile()); this->GetLocalGenerator()->AppendCustomCommandDeps(ccg, deps); this->GetLocalGenerator()->AppendCustomCommandLines(ccg, commands); + std::vector<std::string> const& ccByproducts = ccg.GetByproducts(); + std::transform(ccByproducts.begin(), ccByproducts.end(), + std::back_inserter(util_outputs), MapToNinjaPath()); + if (ci->GetUsesTerminal()) + uses_terminal = true; } } @@ -60,8 +70,11 @@ void cmNinjaUtilityTargetGenerator::Generate() // Depend on all custom command outputs. const std::vector<std::string>& ccOutputs = ccg.GetOutputs(); + const std::vector<std::string>& ccByproducts = ccg.GetByproducts(); std::transform(ccOutputs.begin(), ccOutputs.end(), std::back_inserter(deps), MapToNinjaPath()); + std::transform(ccByproducts.begin(), ccByproducts.end(), + std::back_inserter(deps), MapToNinjaPath()); } } @@ -103,14 +116,19 @@ void cmNinjaUtilityTargetGenerator::Generate() if (command.find('$') != std::string::npos) return; - std::string utilCommandName = cmake::GetCMakeFilesDirectoryPostSlash(); - utilCommandName += this->GetTargetName() + ".util"; + for (cmNinjaDeps::const_iterator + oi = util_outputs.begin(), oe = util_outputs.end(); + oi != oe; ++oi) + { + this->GetGlobalGenerator()->SeenCustomCommandOutput(*oi); + } this->GetGlobalGenerator()->WriteCustomCommandBuild( command, desc, "Utility command for " + this->GetTargetName(), - cmNinjaDeps(1, utilCommandName), + uses_terminal, + util_outputs, deps); this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(), diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 929cbc0..c71e739 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -438,7 +438,8 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) // rejection in cmMakefile::AddCustomCommandToTarget because we know // PRE_BUILD will work for an OBJECT_LIBRARY in this specific case. std::vector<std::string> no_output; - cmCustomCommand cc(makefile, no_output, depends, + std::vector<std::string> no_byproducts; + cmCustomCommand cc(makefile, no_output, no_byproducts, depends, commandLines, autogenComment.c_str(), workingDirectory.c_str()); cc.SetEscapeOldStyle(false); @@ -451,7 +452,9 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) cmTarget* autogenTarget = 0; if (!rcc_output.empty()) { - makefile->AddCustomCommandToOutput(rcc_output, depends, "", + std::vector<std::string> no_byproducts; + makefile->AddCustomCommandToOutput(rcc_output, no_byproducts, + depends, "", commandLines, 0, workingDirectory.c_str(), false, false); @@ -1479,7 +1482,7 @@ void cmQtAutoGenerators::Init() { const std::string &path = *it; this->MocIncludes.push_back("-I" + path); - if (this->EndsWith(path, ".framework/Headers")) + if (cmHasLiteralSuffix(path, ".framework/Headers")) { // Go up twice to get to the framework root std::vector<std::string> pathComponents; @@ -1500,7 +1503,7 @@ void cmQtAutoGenerators::Init() if (this->IncludeProjectDirsBefore) { - const std::string &binDir = "-I" + this->ProjectBinaryDir; + const std::string binDir = "-I" + this->ProjectBinaryDir; const std::string srcDir = "-I" + this->ProjectSourceDir; @@ -1771,7 +1774,7 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, std::string basename = cmsys::SystemTools:: GetFilenameWithoutLastExtension(currentMoc); - const bool moc_style = this->StartsWith(basename, "moc_"); + const bool moc_style = cmHasLiteralPrefix(basename, "moc_"); // If the moc include is of the moc_foo.cpp style we expect // the Q_OBJECT class declaration in a header file. @@ -1953,7 +1956,7 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, std::string basename = cmsys::SystemTools:: GetFilenameWithoutLastExtension(currentMoc); - const bool mocUnderscoreStyle = this->StartsWith(basename, "moc_"); + const bool mocUnderscoreStyle = cmHasLiteralPrefix(basename, "moc_"); // If the moc include is of the moc_foo.cpp style we expect // the Q_OBJECT class declaration in a header file. diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 90a8f85..ce7c854 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -711,12 +711,10 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const& this->SetError(ostr.str()); return false; } - int leftOverLength = intStringLength - begin; - if ( end < -1 || end > leftOverLength ) + if ( end < -1 ) { cmOStringStream ostr; - ostr << "end index: " << end << " is out of range -1 - " - << leftOverLength; + ostr << "end index: " << end << " should be -1 or greater"; this->SetError(ostr.str()); return false; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ee62f06..4a5cc64 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4798,11 +4798,7 @@ std::pair<bool, const char*> consistentNumberProperty(const char *lhs, { char *pEnd; -#if defined(_MSC_VER) - static const char* const null_ptr = 0; -#else -# define null_ptr 0 -#endif + const char* const null_ptr = 0; long lnum = strtol(lhs, &pEnd, 0); if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) @@ -4816,10 +4812,6 @@ std::pair<bool, const char*> consistentNumberProperty(const char *lhs, return std::pair<bool, const char*>(false, null_ptr); } -#if !defined(_MSC_VER) -#undef null_ptr -#endif - if (t == NumberMaxType) { return std::make_pair(true, cmMaximum(lnum, rnum) == lnum ? lhs : rhs); @@ -4849,11 +4841,7 @@ std::pair<bool, const char*> consistentProperty(const char *lhs, return std::make_pair(true, lhs); } -#if defined(_MSC_VER) - static const char* const null_ptr = 0; -#else -# define null_ptr 0 -#endif + const char* const null_ptr = 0; switch(t) { @@ -4868,11 +4856,6 @@ std::pair<bool, const char*> consistentProperty(const char *lhs, } assert(!"Unreachable!"); return std::pair<bool, const char*>(false, null_ptr); - -#if !defined(_MSC_VER) -#undef null_ptr -#endif - } template<typename PropertyType> diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 26fc317..f591fc8 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -307,7 +307,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->BuildFileStream->SetCopyIfDifferent(true); // Write the encoding header into the file - char magic[] = {0xEF,0xBB, 0xBF}; + char magic[] = {char(0xEF), char(0xBB), char(0xBF)}; this->BuildFileStream->write(magic, 3); //get the tools version to use @@ -326,9 +326,9 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteString("<PropertyGroup Label=\"NsightTegraProject\">\n", 1); if(this->NsightTegraVersion[0] >= 2) { - // Nsight Tegra 2.0 uses project revision 8. + // Nsight Tegra 2.0 uses project revision 9. this->WriteString("<NsightTegraProjectRevisionNumber>" - "8" + "9" "</NsightTegraProjectRevisionNumber>\n", 2); // Tell newer versions to upgrade silently when loading. this->WriteString("<NsightTegraUpgradeOnceWithoutPrompt>" @@ -937,7 +937,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() path += ".vcxproj.filters"; cmGeneratedFileStream fout(path.c_str()); fout.SetCopyIfDifferent(true); - char magic[] = {0xEF,0xBB, 0xBF}; + char magic[] = {char(0xEF), char(0xBB), char(0xBF)}; fout.write(magic, 3); cmGeneratedFileStream* save = this->BuildFileStream; this->BuildFileStream = & fout; @@ -2036,7 +2036,8 @@ WriteMasmOptions(std::string const& configName, void cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) { - if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) + if(this->Target->GetType() != cmTarget::STATIC_LIBRARY && + this->Target->GetType() != cmTarget::OBJECT_LIBRARY) { return; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index dc1b113..fb04376 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1401,7 +1401,7 @@ int cmake::ActualConfigure() {"10.0", "Visual Studio 10 2010"}, {"11.0", "Visual Studio 11 2012"}, {"12.0", "Visual Studio 12 2013"}, - {"14.0", "Visual Studio 14"}, + {"14.0", "Visual Studio 14 2015"}, {0, 0}}; for(int i=0; version[i].MSVersion != 0; i++) { diff --git a/Source/kwsys/SharedForward.h.in b/Source/kwsys/SharedForward.h.in index 7ff29b4..c6f345f 100644 --- a/Source/kwsys/SharedForward.h.in +++ b/Source/kwsys/SharedForward.h.in @@ -813,7 +813,7 @@ static void kwsys_shared_forward_print_failure(char const* const* argv) } /* Static storage space to store the updated environment variable. */ -static char kwsys_shared_forward_ldpath[KWSYS_SHARED_FORWARD_MAXPATH*16] = KWSYS_SHARED_FORWARD_LDPATH "="; +static char kwsys_shared_forward_ldpath[65535] = KWSYS_SHARED_FORWARD_LDPATH "="; /*--------------------------------------------------------------------------*/ /* Main driver function to be called from main. */ diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 8df331e..6209bb8 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -28,10 +28,6 @@ function(help_xcode_depends) endif() endfunction() -if("${CMAKE_GENERATOR}" MATCHES "Ninja") - set(HELP_NINJA 1) # TODO Why is this needed? -endif() - # The Intel compiler causes the MSVC linker to crash during # incremental linking, so avoid the /INCREMENTAL:YES flag. if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel") @@ -218,7 +214,7 @@ try_compile(RESULT OUTPUT_VARIABLE OUTPUT) # Xcode is in serious need of help here -if(HELP_XCODE OR HELP_NINJA) +if(HELP_XCODE) try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ab83d41..c9d9568 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -292,11 +292,11 @@ if(BUILD_TESTING) endif() ADD_TEST_MACRO(SourcesProperty SourcesProperty) if(CMAKE_CXX_COMPILER_ID STREQUAL GNU - AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) + AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) set(runCxxDialectTest 1) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL Clang - AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.9) + AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) if(NOT APPLE OR POLICY CMP0025) set(runCxxDialectTest 1) endif() @@ -690,7 +690,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release FAIL_REGULAR_EXPRESSION "Unexpected: ") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ArgumentExpansion") - add_test(GeneratorExpression ${CMAKE_CTEST_COMMAND} + add_test(GeneratorExpression + ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/GeneratorExpression" "${CMake_BINARY_DIR}/Tests/GeneratorExpression" @@ -715,6 +716,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand") + ADD_TEST_MACRO(CustomCommandByproducts CustomCommandByproducts) + ADD_TEST_MACRO(EmptyDepends ${CMAKE_CTEST_COMMAND}) add_test(CustomCommandWorkingDirectory ${CMAKE_CTEST_COMMAND} @@ -950,7 +953,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(CPackRun_CPackGen "-DCPackGen=${CPackGen}") foreach(CPackComponentWay ${CWAYLST}) set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}") - add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} ${CMAKE_CTEST_COMMAND} + add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} + ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll" "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}" @@ -2041,7 +2045,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release PASS_REGULAR_EXPRESSION "uninitialized variable 'USED_VARIABLE'") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUninitialized") - add_test(TestsWorkingDirectory ${CMAKE_CTEST_COMMAND} + add_test(TestsWorkingDirectory + ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/TestsWorkingDirectory" "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory" diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index a9fe428..92e70c3 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -63,7 +63,7 @@ check_cmake_test(String # Execute each test listed in StringTestScript.cmake: # set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake") -set(number_of_tests_expected 69) +set(number_of_tests_expected 70) include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake") execute_all_script_tests(${scriptname} number_of_tests_executed) @@ -75,6 +75,6 @@ message(STATUS "scriptname='${scriptname}'") message(STATUS "number_of_tests_executed='${number_of_tests_executed}'") message(STATUS "number_of_tests_expected='${number_of_tests_expected}'") -if(number_of_tests_executed LESS number_of_tests_expected) +if(NOT number_of_tests_executed EQUAL number_of_tests_expected) message(FATAL_ERROR "error: some test cases were skipped") endif() diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake index a562e71..44d5653 100644 --- a/Tests/CMakeTests/StringTestScript.cmake +++ b/Tests/CMakeTests/StringTestScript.cmake @@ -122,14 +122,17 @@ elseif(testname STREQUAL substring_not_enough_args) # fail elseif(testname STREQUAL substring_begin_too_large) # fail string(SUBSTRING "abcdefg" 25 100 v) -elseif(testname STREQUAL substring_end_too_large) # fail +elseif(testname STREQUAL substring_end_larger_than_strlen) # pass string(SUBSTRING "abcdefg" 1 100 v) elseif(testname STREQUAL substring_begin_less_than_zero) # fail - string(SUBSTRING "abcdefg" -2 4 v) + string(SUBSTRING "abcdefg" -1 4 v) -elseif(testname STREQUAL substring_end_less_than_begin) # fail - string(SUBSTRING "abcdefg" 6 3 v) +elseif(testname STREQUAL substring_end_less_than_zero) # pass + string(SUBSTRING "abcdefg" 0 -1 v) + +elseif(testname STREQUAL substring_end_less_than_begin) # pass + string(SUBSTRING "abcdefg" 6 0 v) elseif(testname STREQUAL length_not_enough_args) # fail string(LENGTH) diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index d02ddaf..ff5d745 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -77,36 +77,60 @@ foreach(lang CXX C) endif() endforeach() -add_executable(CompileFeatures main.cpp) -set_property(TARGET CompileFeatures - PROPERTY COMPILE_FEATURES "cxx_auto_type" -) -set_property(TARGET CompileFeatures - PROPERTY CXX_STANDARD_REQUIRED TRUE -) +if (CMAKE_C_COMPILE_FEATURES) + string(FIND "${CMAKE_C_FLAGS}" "-std=" std_flag_idx) + if (std_flag_idx EQUAL -1) + add_executable(default_dialect_C default_dialect.c) + target_compile_definitions(default_dialect_C PRIVATE + DEFAULT_C11=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},11> + DEFAULT_C99=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},99> + DEFAULT_C90=$<EQUAL:${CMAKE_C_STANDARD_DEFAULT},90> + ) + endif() +endif() + +if (CMAKE_CXX_COMPILE_FEATURES) + string(FIND "${CMAKE_CXX_FLAGS}" "-std=" std_flag_idx) + if (std_flag_idx EQUAL -1) + add_executable(default_dialect default_dialect.cpp) + target_compile_definitions(default_dialect PRIVATE + DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14> + DEFAULT_CXX11=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},11> + DEFAULT_CXX98=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},98> + ) + endif() -add_executable(GenexCompileFeatures main.cpp) -set_property(TARGET GenexCompileFeatures - PROPERTY COMPILE_FEATURES "$<1:cxx_auto_type>;$<0:not_a_feature>" -) + add_executable(CompileFeatures main.cpp) + set_property(TARGET CompileFeatures + PROPERTY COMPILE_FEATURES "cxx_auto_type" + ) + set_property(TARGET CompileFeatures + PROPERTY CXX_STANDARD_REQUIRED TRUE + ) + + add_executable(GenexCompileFeatures main.cpp) + set_property(TARGET GenexCompileFeatures + PROPERTY COMPILE_FEATURES "$<1:cxx_auto_type>;$<0:not_a_feature>" + ) -add_library(iface INTERFACE) -set_property(TARGET iface - PROPERTY INTERFACE_COMPILE_FEATURES "cxx_auto_type" -) -add_executable(IfaceCompileFeatures main.cpp) -target_link_libraries(IfaceCompileFeatures iface) + add_library(iface INTERFACE) + set_property(TARGET iface + PROPERTY INTERFACE_COMPILE_FEATURES "cxx_auto_type" + ) + add_executable(IfaceCompileFeatures main.cpp) + target_link_libraries(IfaceCompileFeatures iface) -add_executable(CompileFeaturesGenex genex_test.cpp) -set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) -target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + add_executable(CompileFeaturesGenex genex_test.cpp) + set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) + target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) -add_executable(CompileFeaturesGenex2 genex_test.cpp) -target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr) -target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + add_executable(CompileFeaturesGenex2 genex_test.cpp) + target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr) + target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) -add_library(noexcept_iface INTERFACE) -target_compile_features(noexcept_iface INTERFACE cxx_noexcept) -add_executable(CompileFeaturesGenex3 genex_test.cpp) -target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface) -target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + add_library(noexcept_iface INTERFACE) + target_compile_features(noexcept_iface INTERFACE cxx_noexcept) + add_executable(CompileFeaturesGenex3 genex_test.cpp) + target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface) + target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) +endif() diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c new file mode 100644 index 0000000..1b39dec --- /dev/null +++ b/Tests/CompileFeatures/default_dialect.c @@ -0,0 +1,22 @@ + +#if DEFAULT_C11 +# if __STDC_VERSION__ != 201112L +# error Unexpected value for __STDC_VERSION__. +# endif +#elif DEFAULT_C99 +# if __STDC_VERSION__ != 199901L +# error Unexpected value for __STDC_VERSION__. +# endif +#else +# if !DEFAULT_C90 +# error Buildsystem error +# endif +# if defined(__STDC_VERSION__) +# error Unexpected __STDC_VERSION__ definition +# endif +#endif + +int main() +{ + return 0; +} diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp new file mode 100644 index 0000000..8d97926 --- /dev/null +++ b/Tests/CompileFeatures/default_dialect.cpp @@ -0,0 +1,25 @@ + +template<long l> +struct Outputter; + +#if DEFAULT_CXX14 +# if __cplusplus != 201402L +Outputter<__cplusplus> o; +# endif +#elif DEFAULT_CXX11 +# if __cplusplus != 201103L +Outputter<__cplusplus> o; +# endif +#else +# if !DEFAULT_CXX98 +# error Buildsystem error +# endif +# if __cplusplus != 199711L +Outputter<__cplusplus> o; +# endif +#endif + +int main() +{ + return 0; +} diff --git a/Tests/CompileFeatures/main.c b/Tests/CompileFeatures/main.c deleted file mode 100644 index 831c5eb2..0000000 --- a/Tests/CompileFeatures/main.c +++ /dev/null @@ -1,12 +0,0 @@ - -int foo(int * restrict a, int * restrict b) -{ - (void)a; - (void)b; - return 0; -} - -int main() -{ - return 0; -} diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index b97cd16..915da0a 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -117,6 +117,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1pre.txt to doc2post.txt." COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1pre.txt ${PROJECT_BINARY_DIR}/doc2post.txt + BYPRODUCTS ${PROJECT_BINARY_DIR}/doc2post.txt COMMENT "Running TDocument post-build commands" ) @@ -483,3 +484,26 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}") add_library(NormDepends "${gen_file}") + +# Test that USES_TERMINAL is parsed correctly. +# It seems much more difficult to test that USES_TERMINAL actually gives +# the subprocess console access, as test output is piped through CTest, +# and CTest itself might not be connected to the console. + +set(gen_file "${gen_path}/bar2.cxx") + +add_custom_command( + OUTPUT "${gen_file}" + DEPENDS "${gen_path}" + COMMAND ${CMAKE_COMMAND} -E touch "${gen_file}" + VERBATIM + USES_TERMINAL +) + +add_library(UseConsole "${gen_file}") + +add_custom_target(UseConsoleTarget ALL + COMMAND ${CMAKE_COMMAND} -E echo "Custom console target." + VERBATIM + USES_TERMINAL +) diff --git a/Tests/CustomCommandByproducts/CMakeLists.txt b/Tests/CustomCommandByproducts/CMakeLists.txt new file mode 100644 index 0000000..884f8c2 --- /dev/null +++ b/Tests/CustomCommandByproducts/CMakeLists.txt @@ -0,0 +1,127 @@ +cmake_minimum_required(VERSION 3.1) +project(CustomCommandByproducts C) + +# Generate a byproduct in a rule that runs in the target consuming it. +add_custom_command( + OUTPUT timestamp1.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct1.c.in byproduct1.c + BYPRODUCTS byproduct1.c + COMMAND ${CMAKE_COMMAND} -E touch timestamp1.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/byproduct1.c.in + ) + +# Generate a byproduct in a rule that runs in a dependency of the consumer. +add_custom_command( + OUTPUT timestamp2.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct2.c.in byproduct2.c + BYPRODUCTS byproduct2.c + COMMAND ${CMAKE_COMMAND} -E touch timestamp2.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/byproduct2.c.in + ) +add_custom_target(Producer2 DEPENDS timestamp2.txt) + +# Generate a byproduct in a custom target. +add_custom_target(Producer3_4 + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct3.c.in byproduct3.c + BYPRODUCTS byproduct3.c + ) + +# Generate a byproduct in a custom target POST_BUILD command. +add_custom_command( + TARGET Producer3_4 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct4.c.in byproduct4.c + BYPRODUCTS byproduct4.c + ) + +add_executable(ProducerExe ProducerExe.c) + +# Generate a byproduct in an executable POST_BUILD command. +add_custom_command( + TARGET ProducerExe POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct5.c.in byproduct5.c + BYPRODUCTS byproduct5.c + ) + +# Generate a byproduct in an executable PRE_LINK command. +add_custom_command( + TARGET ProducerExe PRE_LINK + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct6.c.in byproduct6.c + BYPRODUCTS byproduct6.c + ) + +# Generate a byproduct in an executable PRE_BUILD command. +add_custom_command( + TARGET ProducerExe PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct7.c.in byproduct7.c + BYPRODUCTS byproduct7.c + ) + +# Generate a byproduct in a custom command that consumes other byproducts. +add_custom_command(OUTPUT timestamp8.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct8.c.in byproduct8.c + COMMAND ${CMAKE_COMMAND} -E touch timestamp8.txt + BYPRODUCTS byproduct8.c + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/byproduct2.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct3.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct4.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct5.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct6.c + ${CMAKE_CURRENT_BINARY_DIR}/byproduct7.c + ${CMAKE_CURRENT_SOURCE_DIR}/byproduct8.c.in + ) + +# Generate the library file of an imported target as a byproduct +# of an external project. +if(CMAKE_CONFIGURATION_TYPES) + set(cfg /${CMAKE_CFG_INTDIR}) +else() + set(cfg) +endif() +set(ExternalLibrary_LIBRARY + ${CMAKE_CURRENT_BINARY_DIR}/External-build${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX} + ) +include(ExternalProject) +ExternalProject_Add(ExternalTarget + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/External-build" + PREFIX "${CMAKE_CURRENT_BINARY_DIR}/External-build/root" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" + BUILD_BYPRODUCTS "${ExternalLibrary_LIBRARY}" + ) +add_library(ExternalLibrary STATIC IMPORTED) +set_property(TARGET ExternalLibrary PROPERTY IMPORTED_LOCATION ${ExternalLibrary_LIBRARY}) +add_dependencies(ExternalLibrary ExternalTarget) + +# Add an executable consuming all the byproducts. +add_executable(CustomCommandByproducts + CustomCommandByproducts.c + byproduct1.c timestamp1.txt + byproduct2.c + byproduct3.c + byproduct4.c + byproduct5.c + byproduct6.c + byproduct7.c + byproduct8.c timestamp8.txt + ) +add_dependencies(CustomCommandByproducts Producer2) +add_dependencies(CustomCommandByproducts Producer3_4) +add_dependencies(CustomCommandByproducts ProducerExe) +target_link_libraries(CustomCommandByproducts ExternalLibrary) + +if(CMAKE_GENERATOR STREQUAL "Ninja") + add_custom_target(CheckNinja ALL + COMMENT "Checking build.ninja" + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/ninja-check.cmake + ) +endif() diff --git a/Tests/CustomCommandByproducts/CustomCommandByproducts.c b/Tests/CustomCommandByproducts/CustomCommandByproducts.c new file mode 100644 index 0000000..1916427 --- /dev/null +++ b/Tests/CustomCommandByproducts/CustomCommandByproducts.c @@ -0,0 +1,23 @@ +extern int byproduct1(void); +extern int byproduct2(void); +extern int byproduct3(void); +extern int byproduct4(void); +extern int byproduct5(void); +extern int byproduct6(void); +extern int byproduct7(void); +extern int byproduct8(void); +extern int ExternalLibrary(void); +int main(void) +{ + return ( + byproduct1() + + byproduct2() + + byproduct3() + + byproduct4() + + byproduct5() + + byproduct6() + + byproduct7() + + byproduct8() + + ExternalLibrary() + + 0); +} diff --git a/Tests/CustomCommandByproducts/External/CMakeLists.txt b/Tests/CustomCommandByproducts/External/CMakeLists.txt new file mode 100644 index 0000000..feaa12e --- /dev/null +++ b/Tests/CustomCommandByproducts/External/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(External C) + +add_library(ExternalLibrary STATIC ExternalLibrary.c) diff --git a/Tests/CustomCommandByproducts/External/ExternalLibrary.c b/Tests/CustomCommandByproducts/External/ExternalLibrary.c new file mode 100644 index 0000000..a1dacf0 --- /dev/null +++ b/Tests/CustomCommandByproducts/External/ExternalLibrary.c @@ -0,0 +1 @@ +int ExternalLibrary(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/ProducerExe.c b/Tests/CustomCommandByproducts/ProducerExe.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/CustomCommandByproducts/ProducerExe.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct1.c.in b/Tests/CustomCommandByproducts/byproduct1.c.in new file mode 100644 index 0000000..5c3cc24 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct1.c.in @@ -0,0 +1 @@ +int byproduct1(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct2.c.in b/Tests/CustomCommandByproducts/byproduct2.c.in new file mode 100644 index 0000000..eeb69ef --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct2.c.in @@ -0,0 +1 @@ +int byproduct2(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct3.c.in b/Tests/CustomCommandByproducts/byproduct3.c.in new file mode 100644 index 0000000..7d15310 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct3.c.in @@ -0,0 +1 @@ +int byproduct3(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct4.c.in b/Tests/CustomCommandByproducts/byproduct4.c.in new file mode 100644 index 0000000..8b243dd --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct4.c.in @@ -0,0 +1 @@ +int byproduct4(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct5.c.in b/Tests/CustomCommandByproducts/byproduct5.c.in new file mode 100644 index 0000000..47f5990 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct5.c.in @@ -0,0 +1 @@ +int byproduct5(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct6.c.in b/Tests/CustomCommandByproducts/byproduct6.c.in new file mode 100644 index 0000000..d70c14f --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct6.c.in @@ -0,0 +1 @@ +int byproduct6(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct7.c.in b/Tests/CustomCommandByproducts/byproduct7.c.in new file mode 100644 index 0000000..0be5006 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct7.c.in @@ -0,0 +1 @@ +int byproduct7(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/byproduct8.c.in b/Tests/CustomCommandByproducts/byproduct8.c.in new file mode 100644 index 0000000..abefd62 --- /dev/null +++ b/Tests/CustomCommandByproducts/byproduct8.c.in @@ -0,0 +1 @@ +int byproduct8(void) { return 0; } diff --git a/Tests/CustomCommandByproducts/ninja-check.cmake b/Tests/CustomCommandByproducts/ninja-check.cmake new file mode 100644 index 0000000..2fc3cc2 --- /dev/null +++ b/Tests/CustomCommandByproducts/ninja-check.cmake @@ -0,0 +1,20 @@ +file(READ build.ninja build_ninja) +if("${build_ninja}" MATCHES [====[ +# Unknown Build Time Dependencies. +# Tell Ninja that they may appear as side effects of build rules +# otherwise ordered by order-only dependencies. + +((build [^:]*: phony [^\n]* +)*)# ========]====]) + set(phony "${CMAKE_MATCH_1}") + if(NOT phony) + message(STATUS "build.ninja correctly does not have extra phony rules") + else() + string(REGEX REPLACE "\n+$" "" phony "${phony}") + string(REGEX REPLACE "\n" "\n " phony " ${phony}") + message(FATAL_ERROR "build.ninja incorrectly has extra phony rules:\n" + "${phony}") + endif() +else() + message(FATAL_ERROR "build.ninja is incorrectly missing expected block") +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index a99b46f..c5825fe 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -95,6 +95,8 @@ endif() add_RunCMake_test(CompatibleInterface) add_RunCMake_test(Syntax) +add_RunCMake_test(add_custom_command) +add_RunCMake_test(add_custom_target) add_RunCMake_test(add_dependencies) add_RunCMake_test(build_command) add_RunCMake_test(export) diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/File_Generate/ReRunCMake.cmake b/Tests/RunCMake/File_Generate/ReRunCMake.cmake new file mode 100644 index 0000000..109d60e --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake.cmake @@ -0,0 +1,5 @@ + +file(GENERATE + OUTPUT output_file.txt + INPUT "${CMAKE_CURRENT_BINARY_DIR}/input_file.txt" +) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 7db77d4..97f93d5 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -61,3 +61,34 @@ if (UNIX AND EXISTS /bin/sh) message(SEND_ERROR "Generated script did not execute correctly:\n${script_output}\n====\n${script_error}") endif() endif() + +if (RunCMake_GENERATOR MATCHES Makefiles) + file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "InitialContent\n") + + set(RunCMake_TEST_NO_CLEAN ON) + run_cmake(ReRunCMake) + unset(RunCMake_TEST_NO_CLEAN) + file(TIMESTAMP "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" timestamp ${timeformat}) + if(NOT timestamp) + message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") + endif() + + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) + + file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "ChangedContent\n") + execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + file(READ "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" out_content) + + if(NOT out_content STREQUAL "ChangedContent\n") + message(SEND_ERROR "File did not change: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") + endif() + + + file(REMOVE "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") + execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + + if (NOT EXISTS "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") + message(SEND_ERROR "File did not re-generate: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") + endif() +endif() diff --git a/Tests/RunCMake/add_custom_command/AppendNoOutput-result.txt b/Tests/RunCMake/add_custom_command/AppendNoOutput-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNoOutput-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/AppendNoOutput-stderr.txt b/Tests/RunCMake/add_custom_command/AppendNoOutput-stderr.txt new file mode 100644 index 0000000..abbfc5a --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNoOutput-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at AppendNoOutput.cmake:1 \(add_custom_command\): + add_custom_command given APPEND option with no OUTPUT. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/AppendNoOutput.cmake b/Tests/RunCMake/add_custom_command/AppendNoOutput.cmake new file mode 100644 index 0000000..c6c716b --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNoOutput.cmake @@ -0,0 +1 @@ +add_custom_command(TARGET x APPEND DEPENDS a b c d) diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput-result.txt b/Tests/RunCMake/add_custom_command/AppendNotOutput-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt new file mode 100644 index 0000000..96d0972 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at AppendNotOutput.cmake:1 \(add_custom_command\): + add_custom_command given APPEND option with output.* + which is not already a custom command output. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput.cmake b/Tests/RunCMake/add_custom_command/AppendNotOutput.cmake new file mode 100644 index 0000000..cc16129 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput.cmake @@ -0,0 +1 @@ +add_custom_command(OUTPUT out APPEND DEPENDS dep) diff --git a/Tests/RunCMake/add_custom_command/BadArgument-result.txt b/Tests/RunCMake/add_custom_command/BadArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/BadArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/BadArgument-stderr.txt b/Tests/RunCMake/add_custom_command/BadArgument-stderr.txt new file mode 100644 index 0000000..04c5350 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/BadArgument-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BadArgument.cmake:1 \(add_custom_command\): + add_custom_command Wrong syntax. Unknown type of argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/BadArgument.cmake b/Tests/RunCMake/add_custom_command/BadArgument.cmake new file mode 100644 index 0000000..d9e7bd4 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/BadArgument.cmake @@ -0,0 +1 @@ +add_custom_command(bad_arg OUTPUT a b c d) diff --git a/Tests/RunCMake/add_custom_command/CMakeLists.txt b/Tests/RunCMake/add_custom_command/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/add_custom_command/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_custom_command/NoArguments-result.txt b/Tests/RunCMake/add_custom_command/NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/NoArguments-stderr.txt b/Tests/RunCMake/add_custom_command/NoArguments-stderr.txt new file mode 100644 index 0000000..11e0cb0 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoArguments-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoArguments.cmake:1 \(add_custom_command\): + add_custom_command called with wrong number of arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/NoArguments.cmake b/Tests/RunCMake/add_custom_command/NoArguments.cmake new file mode 100644 index 0000000..8781a87 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoArguments.cmake @@ -0,0 +1 @@ +add_custom_command() diff --git a/Tests/RunCMake/add_custom_command/NoOutputOrTarget-result.txt b/Tests/RunCMake/add_custom_command/NoOutputOrTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoOutputOrTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/NoOutputOrTarget-stderr.txt b/Tests/RunCMake/add_custom_command/NoOutputOrTarget-stderr.txt new file mode 100644 index 0000000..6a5c0a3 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoOutputOrTarget-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoOutputOrTarget.cmake:1 \(add_custom_command\): + add_custom_command Wrong syntax. A TARGET or OUTPUT must be specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/NoOutputOrTarget.cmake b/Tests/RunCMake/add_custom_command/NoOutputOrTarget.cmake new file mode 100644 index 0000000..933ee32 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/NoOutputOrTarget.cmake @@ -0,0 +1 @@ +add_custom_command(COMMAND echo a b c d) diff --git a/Tests/RunCMake/add_custom_command/OutputAndTarget-result.txt b/Tests/RunCMake/add_custom_command/OutputAndTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/OutputAndTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/OutputAndTarget-stderr.txt b/Tests/RunCMake/add_custom_command/OutputAndTarget-stderr.txt new file mode 100644 index 0000000..632880e --- /dev/null +++ b/Tests/RunCMake/add_custom_command/OutputAndTarget-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at OutputAndTarget.cmake:1 \(add_custom_command\): + add_custom_command Wrong syntax. A TARGET and OUTPUT can not both be + specified. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/OutputAndTarget.cmake b/Tests/RunCMake/add_custom_command/OutputAndTarget.cmake new file mode 100644 index 0000000..55806f3 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/OutputAndTarget.cmake @@ -0,0 +1 @@ +add_custom_command(OUTPUT out TARGET target) diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake new file mode 100644 index 0000000..2f5c938 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCMake) + +run_cmake(AppendNoOutput) +run_cmake(AppendNotOutput) +run_cmake(BadArgument) +run_cmake(NoArguments) +run_cmake(NoOutputOrTarget) +run_cmake(OutputAndTarget) +run_cmake(SourceByproducts) +run_cmake(SourceUsesTerminal) diff --git a/Tests/RunCMake/add_custom_command/SourceByproducts-result.txt b/Tests/RunCMake/add_custom_command/SourceByproducts-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceByproducts-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt b/Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt new file mode 100644 index 0000000..a9cd64c --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceByproducts-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceByproducts.cmake:1 \(add_custom_command\): + add_custom_command BYPRODUCTS may not be specified with SOURCE signatures +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/SourceByproducts.cmake b/Tests/RunCMake/add_custom_command/SourceByproducts.cmake new file mode 100644 index 0000000..824f41d --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceByproducts.cmake @@ -0,0 +1 @@ +add_custom_command(SOURCE t TARGET t BYPRODUCTS b) diff --git a/Tests/RunCMake/add_custom_command/SourceUsesTerminal-result.txt b/Tests/RunCMake/add_custom_command/SourceUsesTerminal-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceUsesTerminal-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt b/Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt new file mode 100644 index 0000000..1a76c54 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceUsesTerminal-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at SourceUsesTerminal.cmake:1 \(add_custom_command\): + add_custom_command USES_TERMINAL may not be used with SOURCE signatures +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake b/Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake new file mode 100644 index 0000000..295fab1 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/SourceUsesTerminal.cmake @@ -0,0 +1 @@ +add_custom_command(SOURCE t TARGET t USES_TERMINAL) diff --git a/Tests/RunCMake/add_custom_target/BadTargetName-result.txt b/Tests/RunCMake/add_custom_target/BadTargetName-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_target/BadTargetName-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt b/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt new file mode 100644 index 0000000..f352457 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/BadTargetName-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadTargetName.cmake:1 \(add_custom_target\): + add_custom_target called with target name containing a "#". This character + is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetName.cmake:2 \(add_custom_target\): + add_custom_target called with target name containing a "<". This character + is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadTargetName.cmake:3 \(add_custom_target\): + add_custom_target called with target name containing a ">". This character + is not allowed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_target/BadTargetName.cmake b/Tests/RunCMake/add_custom_target/BadTargetName.cmake new file mode 100644 index 0000000..c4381a2 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/BadTargetName.cmake @@ -0,0 +1,3 @@ +add_custom_target("#") +add_custom_target("<") +add_custom_target(">") diff --git a/Tests/RunCMake/add_custom_target/ByproductsNoCommand-result.txt b/Tests/RunCMake/add_custom_target/ByproductsNoCommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_target/ByproductsNoCommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_target/ByproductsNoCommand-stderr.txt b/Tests/RunCMake/add_custom_target/ByproductsNoCommand-stderr.txt new file mode 100644 index 0000000..6c80ca6 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/ByproductsNoCommand-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at ByproductsNoCommand.cmake:1 \(add_custom_target\): + BYPRODUCTS may not be specified without any COMMAND +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_target/ByproductsNoCommand.cmake b/Tests/RunCMake/add_custom_target/ByproductsNoCommand.cmake new file mode 100644 index 0000000..6c142a2 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/ByproductsNoCommand.cmake @@ -0,0 +1 @@ +add_custom_target(MyTarget BYPRODUCTS a b c d) diff --git a/Tests/RunCMake/add_custom_target/CMakeLists.txt b/Tests/RunCMake/add_custom_target/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/add_custom_target/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_custom_target/NoArguments-result.txt b/Tests/RunCMake/add_custom_target/NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_target/NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_target/NoArguments-stderr.txt b/Tests/RunCMake/add_custom_target/NoArguments-stderr.txt new file mode 100644 index 0000000..2230093 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/NoArguments-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoArguments.cmake:1 \(add_custom_target\): + add_custom_target called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_target/NoArguments.cmake b/Tests/RunCMake/add_custom_target/NoArguments.cmake new file mode 100644 index 0000000..ec6a212 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/NoArguments.cmake @@ -0,0 +1 @@ +add_custom_target() diff --git a/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake new file mode 100644 index 0000000..92c4a38 --- /dev/null +++ b/Tests/RunCMake/add_custom_target/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(NoArguments) +run_cmake(BadTargetName) +run_cmake(ByproductsNoCommand) +run_cmake(UsesTerminalNoCommand) diff --git a/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-result.txt b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-stderr.txt b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-stderr.txt new file mode 100644 index 0000000..beafa7c --- /dev/null +++ b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at UsesTerminalNoCommand.cmake:1 \(add_custom_target\): + USES_TERMINAL may not be specified without any COMMAND +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand.cmake b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand.cmake new file mode 100644 index 0000000..b0c207b --- /dev/null +++ b/Tests/RunCMake/add_custom_target/UsesTerminalNoCommand.cmake @@ -0,0 +1 @@ +add_custom_target(MyTarget USES_TERMINAL) diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index ec39596..e20679a 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -203,6 +203,7 @@ class CMakeTransform(Transform): # Insert the object link target. targetid = '%s:%s' % (objtype, title) targetnode = nodes.target('', '', ids=[targetid]) + self.document.note_explicit_target(targetnode) self.document.insert(0, targetnode) # Insert the object index entry. indexnode = addnodes.index() diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index c4a930e..eaf276b 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -443,15 +443,15 @@ if(CMAKE_USE_OPENSSL) set(HAVE_LIBSSL ON) include_directories(${OPENSSL_INCLUDE_DIR}) set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) - check_include_file_concat("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H) - check_include_file_concat("openssl/engine.h" HAVE_OPENSSL_ENGINE_H) - check_include_file_concat("openssl/err.h" HAVE_OPENSSL_ERR_H) - check_include_file_concat("openssl/pem.h" HAVE_OPENSSL_PEM_H) - check_include_file_concat("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H) - check_include_file_concat("openssl/rsa.h" HAVE_OPENSSL_RSA_H) - check_include_file_concat("openssl/ssl.h" HAVE_OPENSSL_SSL_H) - check_include_file_concat("openssl/x509.h" HAVE_OPENSSL_X509_H) - check_include_file_concat("openssl/rand.h" HAVE_OPENSSL_RAND_H) + check_include_file("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H) + check_include_file("openssl/engine.h" HAVE_OPENSSL_ENGINE_H) + check_include_file("openssl/err.h" HAVE_OPENSSL_ERR_H) + check_include_file("openssl/pem.h" HAVE_OPENSSL_PEM_H) + check_include_file("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H) + check_include_file("openssl/rsa.h" HAVE_OPENSSL_RSA_H) + check_include_file("openssl/ssl.h" HAVE_OPENSSL_SSL_H) + check_include_file("openssl/x509.h" HAVE_OPENSSL_X509_H) + check_include_file("openssl/rand.h" HAVE_OPENSSL_RAND_H) # Optionally build with a specific CA cert bundle. set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle") |