diff options
57 files changed, 423 insertions, 339 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index 9610410..7fcdc72 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -353,6 +353,7 @@ syn keyword cmakeProperty contained \ XCODE_EMIT_EFFECTIVE_PLATFORM_NAME \ XCODE_EXPLICIT_FILE_TYPE \ XCODE_FILE_ATTRIBUTES + \ XCODE_GENERATE_SCHEME \ XCODE_LAST_KNOWN_FILE_TYPE \ XCODE_PRODUCT_TYPE \ XCODE_SCHEME_ADDRESS_SANITIZER diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index fce5584..4d4b9ff 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -349,6 +349,7 @@ Properties on Targets /prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS /prop_tgt/XCODE_ATTRIBUTE_an-attribute /prop_tgt/XCODE_EXPLICIT_FILE_TYPE + /prop_tgt/XCODE_GENERATE_SCHEME /prop_tgt/XCODE_PRODUCT_TYPE /prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER /prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN diff --git a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst new file mode 100644 index 0000000..a56a210 --- /dev/null +++ b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst @@ -0,0 +1,39 @@ +XCODE_GENERATE_SCHEME +--------------------- + +If enabled, the Xcode generator will generate schema files. These +are useful to invoke analyze, archive, build-for-testing and test +actions from the command line. + +This property is initialized by the value of the variable +:variable:`CMAKE_XCODE_GENERATE_SCHEME` if it is set when a target +is created. + +The following target properties overwrite the default of the +corresponding settings on the "Diagnostic" tab for each schema file. +Each of those is initialized by the respective ``CMAKE_`` variable +at target creation time. + +- :prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER` +- :prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN` +- :prop_tgt:`XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER` +- :prop_tgt:`XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS` +- :prop_tgt:`XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE` +- :prop_tgt:`XCODE_SCHEME_GUARD_MALLOC` +- :prop_tgt:`XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP` +- :prop_tgt:`XCODE_SCHEME_MALLOC_GUARD_EDGES` +- :prop_tgt:`XCODE_SCHEME_MALLOC_SCRIBBLE` +- :prop_tgt:`XCODE_SCHEME_MALLOC_STACK` +- :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER` +- :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER_STOP` +- :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER` +- :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP` +- :prop_tgt:`XCODE_SCHEME_ZOMBIE_OBJECTS` + +The following target properties will be applied on the +"Info" and "Arguments" tab: + +- :prop_tgt:`XCODE_SCHEME_ARGUMENTS` +- :prop_tgt:`XCODE_SCHEME_DEBUG_AS_ROOT` +- :prop_tgt:`XCODE_SCHEME_ENVIRONMENT` +- :prop_tgt:`XCODE_SCHEME_EXECUTABLE` diff --git a/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER.rst b/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER.rst index 694cd77..cc9bac2 100644 --- a/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER.rst +++ b/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst b/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst index 2803da0..37a043a 100644 --- a/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst +++ b/Help/prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_ARGUMENTS.rst b/Help/prop_tgt/XCODE_SCHEME_ARGUMENTS.rst index 2eac4a9..1f228e3 100644 --- a/Help/prop_tgt/XCODE_SCHEME_ARGUMENTS.rst +++ b/Help/prop_tgt/XCODE_SCHEME_ARGUMENTS.rst @@ -6,5 +6,5 @@ section of the generated Xcode scheme. If set to a list of arguments those will be added to the scheme. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT.rst b/Help/prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT.rst index a53f836..5407e80 100644 --- a/Help/prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT.rst +++ b/Help/prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT.rst @@ -3,5 +3,5 @@ XCODE_SCHEME_DEBUG_AS_ROOT Whether to debug the target as 'root'. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst b/Help/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst index 75fc326..1a6fcfd 100644 --- a/Help/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst +++ b/Help/prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst b/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst index a7fab66..9224022 100644 --- a/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst +++ b/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst b/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst index 162fc45..203c803 100644 --- a/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst +++ b/Help/prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_ENVIRONMENT.rst b/Help/prop_tgt/XCODE_SCHEME_ENVIRONMENT.rst index 1dbd6c4..c6d875e 100644 --- a/Help/prop_tgt/XCODE_SCHEME_ENVIRONMENT.rst +++ b/Help/prop_tgt/XCODE_SCHEME_ENVIRONMENT.rst @@ -8,5 +8,5 @@ If set to a list of environment variables and values of the form ``MYVAR=value`` those environment variables will be added to the scheme. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_EXECUTABLE.rst b/Help/prop_tgt/XCODE_SCHEME_EXECUTABLE.rst index d0427e2..104841b 100644 --- a/Help/prop_tgt/XCODE_SCHEME_EXECUTABLE.rst +++ b/Help/prop_tgt/XCODE_SCHEME_EXECUTABLE.rst @@ -5,5 +5,5 @@ Specify path to executable in the Info section of the generated Xcode scheme. If not set the schema generator will select the current target if it is actually executable. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_GUARD_MALLOC.rst b/Help/prop_tgt/XCODE_SCHEME_GUARD_MALLOC.rst index 64e1990..c4e83da 100644 --- a/Help/prop_tgt/XCODE_SCHEME_GUARD_MALLOC.rst +++ b/Help/prop_tgt/XCODE_SCHEME_GUARD_MALLOC.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_GUARD_MALLOC` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst b/Help/prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst index 99c112f..73992c3 100644 --- a/Help/prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst +++ b/Help/prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst @@ -9,5 +9,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES.rst b/Help/prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES.rst index ef3852a..ca761c0 100644 --- a/Help/prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES.rst +++ b/Help/prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE.rst b/Help/prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE.rst index 75baba2..c5ddb95 100644 --- a/Help/prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE.rst +++ b/Help/prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_MALLOC_STACK.rst b/Help/prop_tgt/XCODE_SCHEME_MALLOC_STACK.rst index 984022c..170f33d 100644 --- a/Help/prop_tgt/XCODE_SCHEME_MALLOC_STACK.rst +++ b/Help/prop_tgt/XCODE_SCHEME_MALLOC_STACK.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_MALLOC_STACK` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER.rst b/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER.rst index 825ac5b..bb70141 100644 --- a/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER.rst +++ b/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_THREAD_SANITIZER` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP.rst b/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP.rst index 86f894e..5deadb1 100644 --- a/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP.rst +++ b/Help/prop_tgt/XCODE_SCHEME_THREAD_SANITIZER_STOP.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst b/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst index 829a62e..0cd823d 100644 --- a/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst +++ b/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst b/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst index 5e382ca..d1a9bca 100644 --- a/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst +++ b/Help/prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst @@ -9,5 +9,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS.rst b/Help/prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS.rst index 80b954a..6e70e8b 100644 --- a/Help/prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS.rst +++ b/Help/prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS.rst @@ -8,5 +8,5 @@ This property is initialized by the value of the variable :variable:`CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS` if it is set when a target is created. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/release/dev/cmake-e-tar-error-handling.rst b/Help/release/dev/cmake-e-tar-error-handling.rst new file mode 100644 index 0000000..d1f2c72 --- /dev/null +++ b/Help/release/dev/cmake-e-tar-error-handling.rst @@ -0,0 +1,8 @@ +cmake-e-tar-error-handling +-------------------------- + +* The :manual:`cmake(1)` ``-E tar`` tool now parses all flags, and if an + invalid flag was provided, a warning is issued. +* The :manual:`cmake(1)` ``-E tar`` tool now displays an error if no action + flag was specified, along with a list of possible actions: ``t`` (list), + ``c`` (create) or ``x`` (extract). diff --git a/Help/release/dev/xcode-scheme-per-target.rst b/Help/release/dev/xcode-scheme-per-target.rst new file mode 100644 index 0000000..3febe79 --- /dev/null +++ b/Help/release/dev/xcode-scheme-per-target.rst @@ -0,0 +1,6 @@ +xcode-scheme-per-target +----------------------- + +* The :generator:`Xcode` generator now supports per-target schemes. + See the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable and + :prop_tgt:`XCODE_GENERATE_SCHEME` target property. diff --git a/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst b/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst index 707c6a0..1fb84d7 100644 --- a/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst +++ b/Help/variable/CMAKE_XCODE_GENERATE_SCHEME.rst @@ -5,31 +5,6 @@ If enabled, the Xcode generator will generate schema files. These are useful to invoke analyze, archive, build-for-testing and test actions from the command line. -The following target properties overwrite the default of the -corresponding settings on the "Diagnostic" tab for each schema file. -Each of those is initialized by the respective ``CMAKE_`` variable -at target creation time. - -- :prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER` -- :prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN` -- :prop_tgt:`XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER` -- :prop_tgt:`XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS` -- :prop_tgt:`XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE` -- :prop_tgt:`XCODE_SCHEME_GUARD_MALLOC` -- :prop_tgt:`XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP` -- :prop_tgt:`XCODE_SCHEME_MALLOC_GUARD_EDGES` -- :prop_tgt:`XCODE_SCHEME_MALLOC_SCRIBBLE` -- :prop_tgt:`XCODE_SCHEME_MALLOC_STACK` -- :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER` -- :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER_STOP` -- :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER` -- :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP` -- :prop_tgt:`XCODE_SCHEME_ZOMBIE_OBJECTS` - -The following target properties will be applied on the -"Info" and "Arguments" tab: - -- :prop_tgt:`XCODE_SCHEME_ARGUMENTS` -- :prop_tgt:`XCODE_SCHEME_DEBUG_AS_ROOT` -- :prop_tgt:`XCODE_SCHEME_ENVIRONMENT` -- :prop_tgt:`XCODE_SCHEME_EXECUTABLE` +This variable initializes the +:prop_tgt:`XCODE_GENERATE_SCHEME` +target property on all targets. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER.rst b/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER.rst index 37dc0ce..b972ba5 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst b/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst index 05949c3..59eb32d 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst b/Help/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst index 81f4974..71bcf42 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst b/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst index 5e133ac..53f55e6 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst b/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst index 33162d9..784ceb6 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC.rst b/Help/variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC.rst index 03d88c2..9350244 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_GUARD_MALLOC` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst b/Help/variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst index fd6135f..45a2dad 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP.rst @@ -9,5 +9,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES.rst b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES.rst index 8fedc20..94d1c61 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_MALLOC_GUARD_EDGES` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE.rst b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE.rst index cddca7c..9bf0eb4 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_MALLOC_SCRIBBLE` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_STACK.rst b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_STACK.rst index 9c83698..4cc21ee 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_STACK.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_MALLOC_STACK.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_MALLOC_STACK` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER.rst b/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER.rst index c937369..6d1b56e 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP.rst b/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP.rst index eed796c..de40478 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER_STOP` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst b/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst index d14ba3f..ec5df66 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst b/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst index f8df304..dcec9b0 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP.rst @@ -9,5 +9,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS.rst b/Help/variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS.rst index efc331a..82e9d76 100644 --- a/Help/variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS.rst +++ b/Help/variable/CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS.rst @@ -8,5 +8,5 @@ This variable initializes the :prop_tgt:`XCODE_SCHEME_ZOMBIE_OBJECTS` property on all targets. -Please refer to the :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property documentation to see all Xcode schema related properties. diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 243d8fc..672ceae 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 14) -set(CMake_VERSION_PATCH 20190321) +set(CMake_VERSION_PATCH 20190322) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4bfa0b1..4025073 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3402,10 +3402,8 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( } this->WriteXCodePBXProj(fout, root, generators); - if (this->IsGeneratingScheme(root)) { - this->OutputXCodeSharedSchemes(xcodeDir); - } - this->OutputXCodeWorkspaceSettings(xcodeDir, root); + bool hasGeneratedSchemes = this->OutputXCodeSharedSchemes(xcodeDir, root); + this->OutputXCodeWorkspaceSettings(xcodeDir, hasGeneratedSchemes); this->ClearXCodeObjects(); @@ -3415,17 +3413,8 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( root->GetBinaryDirectory()); } -bool cmGlobalXCodeGenerator::IsGeneratingScheme(cmLocalGenerator* root) const -{ - // Since the lowest available Xcode version for testing was 6.4, - // I'm setting this as a limit then - return this->XcodeVersion >= 64 && - (root->GetMakefile()->GetCMakeInstance()->GetIsInTryCompile() || - root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_SCHEME")); -} - -void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes( - const std::string& xcProjDir) +bool cmGlobalXCodeGenerator::OutputXCodeSharedSchemes( + const std::string& xcProjDir, cmLocalGenerator* root) { // collect all tests for the targets std::map<std::string, cmXCodeScheme::TestObjects> testables; @@ -3449,21 +3438,33 @@ void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes( } // generate scheme - for (auto obj : this->XCodeObjects) { - if (obj->GetType() == cmXCodeObject::OBJECT && - (obj->GetIsA() == cmXCodeObject::PBXNativeTarget || - obj->GetIsA() == cmXCodeObject::PBXAggregateTarget)) { - const std::string& targetName = obj->GetTarget()->GetName(); - cmXCodeScheme schm(obj, testables[targetName], - this->CurrentConfigurationTypes, this->XcodeVersion); - schm.WriteXCodeSharedScheme(xcProjDir, - this->RelativeToSource(xcProjDir)); + bool ret = false; + + // Since the lowest available Xcode version for testing was 6.4, + // I'm setting this as a limit then + if (this->XcodeVersion >= 64) { + for (auto obj : this->XCodeObjects) { + if (obj->GetType() == cmXCodeObject::OBJECT && + (obj->GetIsA() == cmXCodeObject::PBXNativeTarget || + obj->GetIsA() == cmXCodeObject::PBXAggregateTarget) && + (root->GetMakefile()->GetCMakeInstance()->GetIsInTryCompile() || + obj->GetTarget()->GetPropertyAsBool("XCODE_GENERATE_SCHEME"))) { + const std::string& targetName = obj->GetTarget()->GetName(); + cmXCodeScheme schm(obj, testables[targetName], + this->CurrentConfigurationTypes, + this->XcodeVersion); + schm.WriteXCodeSharedScheme(xcProjDir, + this->RelativeToSource(xcProjDir)); + ret = true; + } } } + + return ret; } void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings( - const std::string& xcProjDir, cmLocalGenerator* root) + const std::string& xcProjDir, bool hasGeneratedSchemes) { std::string xcodeSharedDataDir = xcProjDir; xcodeSharedDataDir += "/project.xcworkspace/xcshareddata"; @@ -3489,7 +3490,7 @@ void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings( xout.Element("key", "BuildSystemType"); xout.Element("string", "Original"); } - if (this->IsGeneratingScheme(root)) { + if (hasGeneratedSchemes) { xout.Element("key", "IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded"); xout.Element("false"); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index b80a9ad..8daa95b 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -186,11 +186,12 @@ private: std::vector<cmLocalGenerator*>& generators); void OutputXCodeProject(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); - bool IsGeneratingScheme(cmLocalGenerator* root) const; // Write shared scheme files for all the native targets - void OutputXCodeSharedSchemes(const std::string& xcProjDir); + // return true if any were written + bool OutputXCodeSharedSchemes(const std::string& xcProjDir, + cmLocalGenerator* root); void OutputXCodeWorkspaceSettings(const std::string& xcProjDir, - cmLocalGenerator* root); + bool hasGeneratedSchemes); void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); cmXCodeObject* CreateXCodeFileReferenceFromPath(const std::string& fullpath, diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b5f65c7..0b75025 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -406,6 +406,14 @@ public: /** Setup the environment to enable VS 8 IDE output. */ static void EnableVSConsoleOutput(); + enum cmTarAction + { + TarActionCreate, + TarActionList, + TarActionExtract, + TarActionNone + }; + /** Create tar */ enum cmTarCompression { @@ -414,6 +422,7 @@ public: TarCompressXZ, TarCompressNone }; + static bool ListTar(const char* outFileName, bool verbose); static bool CreateTar(const char* outFileName, const std::vector<std::string>& files, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d3f7a45..c6a69be 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -290,6 +290,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("FOLDER", nullptr); #ifdef __APPLE__ if (this->GetGlobalGenerator()->IsXcode()) { + this->SetPropertyDefault("XCODE_GENERATE_SCHEME", nullptr); this->SetPropertyDefault("XCODE_SCHEME_ADDRESS_SANITIZER", nullptr); this->SetPropertyDefault( "XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN", nullptr); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 0828a16..8d63971 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1078,21 +1078,47 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) files.push_back(arg); } } + cmSystemTools::cmTarAction action = cmSystemTools::TarActionNone; cmSystemTools::cmTarCompression compress = cmSystemTools::TarCompressNone; bool verbose = false; int nCompress = 0; - if (flags.find_first_of('j') != std::string::npos) { - compress = cmSystemTools::TarCompressBZip2; - ++nCompress; - } - if (flags.find_first_of('J') != std::string::npos) { - compress = cmSystemTools::TarCompressXZ; - ++nCompress; - } - if (flags.find_first_of('z') != std::string::npos) { - compress = cmSystemTools::TarCompressGZip; - ++nCompress; + + for (auto flag : flags) { + switch (flag) { + case '-': + case 'f': { + // Keep for backward compatibility. Ignored + } break; + case 'j': { + compress = cmSystemTools::TarCompressBZip2; + ++nCompress; + } break; + case 'J': { + compress = cmSystemTools::TarCompressXZ; + ++nCompress; + } break; + case 'z': { + compress = cmSystemTools::TarCompressGZip; + ++nCompress; + } break; + case 'v': { + verbose = true; + } break; + case 't': { + action = cmSystemTools::TarActionList; + } break; + case 'c': { + action = cmSystemTools::TarActionCreate; + } break; + case 'x': { + action = cmSystemTools::TarActionExtract; + } break; + default: { + cmSystemTools::Message( + std::string("tar: Unknown argument: ") + flag, "Warning"); + } + } } if ((format == "7zip" || format == "zip") && nCompress > 0) { cmSystemTools::Error("Can not use compression flags with format: " + @@ -1104,16 +1130,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) "at most one flag of z, j, or J may be used"); return 1; } - if (flags.find_first_of('v') != std::string::npos) { - verbose = true; - } - - if (flags.find_first_of('t') != std::string::npos) { + if (action == cmSystemTools::TarActionList) { if (!cmSystemTools::ListTar(outFile.c_str(), verbose)) { cmSystemTools::Error("Problem listing tar: " + outFile); return 1; } - } else if (flags.find_first_of('c') != std::string::npos) { + } else if (action == cmSystemTools::TarActionCreate) { if (files.empty()) { cmSystemTools::Message("tar: No files or directories specified", "Warning"); @@ -1123,7 +1145,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) cmSystemTools::Error("Problem creating tar: " + outFile); return 1; } - } else if (flags.find_first_of('x') != std::string::npos) { + } else if (action == cmSystemTools::TarActionExtract) { if (!cmSystemTools::ExtractTar(outFile.c_str(), verbose)) { cmSystemTools::Error("Problem extracting tar: " + outFile); return 1; @@ -1144,6 +1166,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) cmSystemTools::Delay(delay); } #endif + } else { + cmSystemTools::Error("tar: No action specified. Please choose: 't' " + "(list), 'c' (create) or 'x' (extract)"); + return 1; } return 0; } diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 33a92e4..b736ed4 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -28,6 +28,7 @@ #include <iostream> #include <set> #include <sstream> +#include <utility> #include <vector> // Work-around CMake dependency scanning limitation. This must @@ -363,10 +364,6 @@ double SystemTools::GetTime(void) #endif } -class SystemToolsTranslationMap : public std::map<std::string, std::string> -{ -}; - /* Type of character storing the environment. */ #if defined(_WIN32) typedef wchar_t envchar; @@ -447,15 +444,139 @@ struct SystemToolsPathCaseCmp # endif } }; +#endif -class SystemToolsPathCaseMap - : public std::map<std::string, std::string, SystemToolsPathCaseCmp> +/** + * SystemTools static variables singleton class. + */ +class SystemToolsStatic { +public: + typedef std::map<std::string, std::string> StringMap; + /** + * Path translation table from dir to refdir + * Each time 'dir' will be found it will be replace by 'refdir' + */ + StringMap TranslationMap; +#ifdef _WIN32 + static std::string GetCasePathName(std::string const& pathIn); + static std::string GetActualCaseForPathCached(std::string const& path); + static const char* GetEnvBuffered(const char* key); + std::map<std::string, std::string, SystemToolsPathCaseCmp> PathCaseMap; + std::map<std::string, std::string> EnvMap; +#endif +#ifdef __CYGWIN__ + StringMap Cyg2Win32Map; +#endif + + /** + * Actual implementation of ReplaceString. + */ + static void ReplaceString(std::string& source, const char* replace, + size_t replaceSize, const std::string& with); + + /** + * Actual implementation of FileIsFullPath. + */ + static bool FileIsFullPath(const char*, size_t); + + /** + * Find a filename (file or directory) in the system PATH, with + * optional extra paths. + */ + static std::string FindName( + const std::string& name, + const std::vector<std::string>& path = std::vector<std::string>(), + bool no_system_path = false); }; -class SystemToolsEnvMap : public std::map<std::string, std::string> +#ifdef _WIN32 +std::string SystemToolsStatic::GetCasePathName(std::string const& pathIn) { -}; + std::string casePath; + + // First check if the file is relative. We don't fix relative paths since the + // real case depends on the root directory and the given path fragment may + // have meaning elsewhere in the project. + if (!SystemTools::FileIsFullPath(pathIn)) { + // This looks unnecessary, but it allows for the return value optimization + // since all return paths return the same local variable. + casePath = pathIn; + return casePath; + } + + std::vector<std::string> path_components; + SystemTools::SplitPath(pathIn, path_components); + + // Start with root component. + std::vector<std::string>::size_type idx = 0; + casePath = path_components[idx++]; + // make sure drive letter is always upper case + if (casePath.size() > 1 && casePath[1] == ':') { + casePath[0] = toupper(casePath[0]); + } + const char* sep = ""; + + // If network path, fill casePath with server/share so FindFirstFile + // will work after that. Maybe someday call other APIs to get + // actual case of servers and shares. + if (path_components.size() > 2 && path_components[0] == "//") { + casePath += path_components[idx++]; + casePath += "/"; + casePath += path_components[idx++]; + sep = "/"; + } + + // Convert case of all components that exist. + bool converting = true; + for (; idx < path_components.size(); idx++) { + casePath += sep; + sep = "/"; + + if (converting) { + // If path component contains wildcards, we skip matching + // because these filenames are not allowed on windows, + // and we do not want to match a different file. + if (path_components[idx].find('*') != std::string::npos || + path_components[idx].find('?') != std::string::npos) { + converting = false; + } else { + std::string test_str = casePath; + test_str += path_components[idx]; + WIN32_FIND_DATAW findData; + HANDLE hFind = + ::FindFirstFileW(Encoding::ToWide(test_str).c_str(), &findData); + if (INVALID_HANDLE_VALUE != hFind) { + path_components[idx] = Encoding::ToNarrow(findData.cFileName); + ::FindClose(hFind); + } else { + converting = false; + } + } + } + + casePath += path_components[idx]; + } + return casePath; +} + +std::string SystemToolsStatic::GetActualCaseForPathCached(std::string const& p) +{ + // Check to see if actual case has already been called + // for this path, and the result is stored in the PathCaseMap + auto& pcm = SystemTools::Statics->PathCaseMap; + { + auto itr = pcm.find(p); + if (itr != pcm.end()) { + return itr->second; + } + } + std::string casePath = SystemToolsStatic::GetCasePathName(p); + if (casePath.size() <= MAX_PATH) { + pcm[p] = casePath; + } + return casePath; +} #endif // adds the elements of the env variable path to the arg passed in @@ -496,30 +617,35 @@ void SystemTools::GetPath(std::vector<std::string>& path, const char* env) } } -const char* SystemTools::GetEnvImpl(const char* key) -{ - const char* v = KWSYS_NULLPTR; #if defined(_WIN32) +const char* SystemToolsStatic::GetEnvBuffered(const char* key) +{ std::string env; if (SystemTools::GetEnv(key, env)) { - std::string& menv = (*SystemTools::EnvMap)[key]; - menv = env; - v = menv.c_str(); + std::string& menv = SystemTools::Statics->EnvMap[key]; + menv = std::move(env); + return menv.c_str(); } -#else - v = getenv(key); -#endif - return v; + return KWSYS_NULLPTR; } +#endif const char* SystemTools::GetEnv(const char* key) { - return SystemTools::GetEnvImpl(key); +#if defined(_WIN32) + return SystemToolsStatic::GetEnvBuffered(key); +#else + return getenv(key); +#endif } const char* SystemTools::GetEnv(const std::string& key) { - return SystemTools::GetEnvImpl(key.c_str()); +#if defined(_WIN32) + return SystemToolsStatic::GetEnvBuffered(key.c_str()); +#else + return getenv(key.c_str()); +#endif } bool SystemTools::GetEnv(const char* key, std::string& result) @@ -822,7 +948,8 @@ void SystemTools::ReplaceString(std::string& source, return; } - SystemTools::ReplaceString(source, replace.c_str(), replace.size(), with); + SystemToolsStatic::ReplaceString(source, replace.c_str(), replace.size(), + with); } void SystemTools::ReplaceString(std::string& source, const char* replace, @@ -833,12 +960,13 @@ void SystemTools::ReplaceString(std::string& source, const char* replace, return; } - SystemTools::ReplaceString(source, replace, strlen(replace), - with ? with : ""); + SystemToolsStatic::ReplaceString(source, replace, strlen(replace), + with ? with : ""); } -void SystemTools::ReplaceString(std::string& source, const char* replace, - size_t replaceSize, const std::string& with) +void SystemToolsStatic::ReplaceString(std::string& source, const char* replace, + size_t replaceSize, + const std::string& with) { const char* src = source.c_str(); char* searchPos = const_cast<char*>(strstr(src, replace)); @@ -1316,18 +1444,16 @@ int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf) #ifdef __CYGWIN__ bool SystemTools::PathCygwinToWin32(const char* path, char* win32_path) { - SystemToolsTranslationMap::iterator i = - SystemTools::Cyg2Win32Map->find(path); - - if (i != SystemTools::Cyg2Win32Map->end()) { - strncpy(win32_path, i->second.c_str(), MAX_PATH); + auto itr = SystemTools::Statics->Cyg2Win32Map.find(path); + if (itr != SystemTools::Statics->Cyg2Win32Map.end()) { + strncpy(win32_path, itr->second.c_str(), MAX_PATH); } else { if (cygwin_conv_path(CCP_POSIX_TO_WIN_A, path, win32_path, MAX_PATH) != 0) { win32_path[0] = 0; } - SystemToolsTranslationMap::value_type entry(path, win32_path); - SystemTools::Cyg2Win32Map->insert(entry); + SystemTools::Statics->Cyg2Win32Map.insert( + SystemToolsStatic::StringMap::value_type(path, win32_path)); } return win32_path[0] != 0; } @@ -2673,9 +2799,9 @@ size_t SystemTools::GetMaximumFilePathLength() * the system search path. Returns the full path to the file if it is * found. Otherwise, the empty string is returned. */ -std::string SystemTools::FindName(const std::string& name, - const std::vector<std::string>& userPaths, - bool no_system_path) +std::string SystemToolsStatic::FindName( + const std::string& name, const std::vector<std::string>& userPaths, + bool no_system_path) { // Add the system search path to our path first std::vector<std::string> path; @@ -2723,7 +2849,8 @@ std::string SystemTools::FindFile(const std::string& name, const std::vector<std::string>& userPaths, bool no_system_path) { - std::string tryPath = SystemTools::FindName(name, userPaths, no_system_path); + std::string tryPath = + SystemToolsStatic::FindName(name, userPaths, no_system_path); if (!tryPath.empty() && !SystemTools::FileIsDirectory(tryPath)) { return SystemTools::CollapseFullPath(tryPath); } @@ -2740,7 +2867,8 @@ std::string SystemTools::FindDirectory( const std::string& name, const std::vector<std::string>& userPaths, bool no_system_path) { - std::string tryPath = SystemTools::FindName(name, userPaths, no_system_path); + std::string tryPath = + SystemToolsStatic::FindName(name, userPaths, no_system_path); if (!tryPath.empty() && SystemTools::FileIsDirectory(tryPath)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3244,8 +3372,9 @@ void SystemTools::AddTranslationPath(const std::string& a, path_b += '/'; } if (!(path_a == path_b)) { - SystemTools::TranslationMap->insert( - SystemToolsTranslationMap::value_type(path_a, path_b)); + SystemTools::Statics->TranslationMap.insert( + SystemToolsStatic::StringMap::value_type(std::move(path_a), + std::move(path_b))); } } } @@ -3269,21 +3398,19 @@ void SystemTools::CheckTranslationPath(std::string& path) // Always add a trailing slash before translation. It does not // matter if this adds an extra slash, but we do not want to // translate part of a directory (like the foo part of foo-dir). - path += "/"; + path += '/'; // In case a file was specified we still have to go through this: // Now convert any path found in the table back to the one desired: - std::map<std::string, std::string>::const_iterator it; - for (it = SystemTools::TranslationMap->begin(); - it != SystemTools::TranslationMap->end(); ++it) { + for (auto const& pair : SystemTools::Statics->TranslationMap) { // We need to check of the path is a substring of the other path - if (path.find(it->first) == 0) { - path = path.replace(0, it->first.size(), it->second); + if (path.find(pair.first) == 0) { + path = path.replace(0, pair.first.size(), pair.second); } } // Remove the trailing slash we added before. - path.erase(path.end() - 1, path.end()); + path.pop_back(); } static void SystemToolsAppendComponents( @@ -3371,7 +3498,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path, SystemTools::CheckTranslationPath(newPath); #ifdef _WIN32 - newPath = SystemTools::GetActualCaseForPathCached(newPath); + newPath = SystemTools::Statics->GetActualCaseForPathCached(newPath); SystemTools::ConvertToUnixSlashes(newPath); #endif // Return the reconstructed path. @@ -3457,104 +3584,15 @@ std::string SystemTools::RelativePath(const std::string& local, return relativePath; } -#ifdef _WIN32 -static std::string GetCasePathName(std::string const& pathIn) -{ - std::string casePath; - - // First check if the file is relative. We don't fix relative paths since the - // real case depends on the root directory and the given path fragment may - // have meaning elsewhere in the project. - if (!SystemTools::FileIsFullPath(pathIn)) { - // This looks unnecessary, but it allows for the return value optimization - // since all return paths return the same local variable. - casePath = pathIn; - return casePath; - } - - std::vector<std::string> path_components; - SystemTools::SplitPath(pathIn, path_components); - - // Start with root component. - std::vector<std::string>::size_type idx = 0; - casePath = path_components[idx++]; - // make sure drive letter is always upper case - if (casePath.size() > 1 && casePath[1] == ':') { - casePath[0] = toupper(casePath[0]); - } - const char* sep = ""; - - // If network path, fill casePath with server/share so FindFirstFile - // will work after that. Maybe someday call other APIs to get - // actual case of servers and shares. - if (path_components.size() > 2 && path_components[0] == "//") { - casePath += path_components[idx++]; - casePath += "/"; - casePath += path_components[idx++]; - sep = "/"; - } - - // Convert case of all components that exist. - bool converting = true; - for (; idx < path_components.size(); idx++) { - casePath += sep; - sep = "/"; - - if (converting) { - // If path component contains wildcards, we skip matching - // because these filenames are not allowed on windows, - // and we do not want to match a different file. - if (path_components[idx].find('*') != std::string::npos || - path_components[idx].find('?') != std::string::npos) { - converting = false; - } else { - std::string test_str = casePath; - test_str += path_components[idx]; - WIN32_FIND_DATAW findData; - HANDLE hFind = - ::FindFirstFileW(Encoding::ToWide(test_str).c_str(), &findData); - if (INVALID_HANDLE_VALUE != hFind) { - path_components[idx] = Encoding::ToNarrow(findData.cFileName); - ::FindClose(hFind); - } else { - converting = false; - } - } - } - - casePath += path_components[idx]; - } - return casePath; -} -#endif - std::string SystemTools::GetActualCaseForPath(const std::string& p) { -#ifndef _WIN32 - return p; +#ifdef _WIN32 + return SystemToolsStatic::GetCasePathName(p); #else - return GetCasePathName(p); + return p; #endif } -#ifdef _WIN32 -std::string SystemTools::GetActualCaseForPathCached(std::string const& p) -{ - // Check to see if actual case has already been called - // for this path, and the result is stored in the PathCaseMap - SystemToolsPathCaseMap::iterator i = SystemTools::PathCaseMap->find(p); - if (i != SystemTools::PathCaseMap->end()) { - return i->second; - } - std::string casePath = GetCasePathName(p); - if (casePath.size() > MAX_PATH) { - return casePath; - } - (*SystemTools::PathCaseMap)[p] = casePath; - return casePath; -} -#endif - const char* SystemTools::SplitPathRootComponent(const std::string& p, std::string* root) { @@ -4047,16 +4085,16 @@ bool SystemTools::LocateFileInDir(const char* filename, const char* dir, bool SystemTools::FileIsFullPath(const std::string& in_name) { - return SystemTools::FileIsFullPath(in_name.c_str(), in_name.size()); + return SystemToolsStatic::FileIsFullPath(in_name.c_str(), in_name.size()); } bool SystemTools::FileIsFullPath(const char* in_name) { - return SystemTools::FileIsFullPath(in_name, - in_name[0] ? (in_name[1] ? 2 : 1) : 0); + return SystemToolsStatic::FileIsFullPath( + in_name, in_name[0] ? (in_name[1] ? 2 : 1) : 0); } -bool SystemTools::FileIsFullPath(const char* in_name, size_t len) +bool SystemToolsStatic::FileIsFullPath(const char* in_name, size_t len) { #if defined(_WIN32) || defined(__CYGWIN__) // On Windows, the name must be at least two characters long. @@ -4654,14 +4692,7 @@ bool SystemTools::ParseURL(const std::string& URL, std::string& protocol, // These must NOT be initialized. Default initialization to zero is // necessary. static unsigned int SystemToolsManagerCount; -SystemToolsTranslationMap* SystemTools::TranslationMap; -#ifdef _WIN32 -SystemToolsPathCaseMap* SystemTools::PathCaseMap; -SystemToolsEnvMap* SystemTools::EnvMap; -#endif -#ifdef __CYGWIN__ -SystemToolsTranslationMap* SystemTools::Cyg2Win32Map; -#endif +SystemToolsStatic* SystemTools::Statics; // SystemToolsManager manages the SystemTools singleton. // SystemToolsManager should be included in any translation unit @@ -4702,15 +4733,9 @@ void SystemTools::ClassInitialize() #ifdef __VMS SetVMSFeature("DECC$FILENAME_UNIX_ONLY", 1); #endif - // Allocate the translation map first. - SystemTools::TranslationMap = new SystemToolsTranslationMap; -#ifdef _WIN32 - SystemTools::PathCaseMap = new SystemToolsPathCaseMap; - SystemTools::EnvMap = new SystemToolsEnvMap; -#endif -#ifdef __CYGWIN__ - SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap; -#endif + + // Create statics singleton instance + SystemTools::Statics = new SystemToolsStatic; // Add some special translation paths for unix. These are not added // for windows because drive letters need to be maintained. Also, @@ -4758,14 +4783,7 @@ void SystemTools::ClassInitialize() void SystemTools::ClassFinalize() { - delete SystemTools::TranslationMap; -#ifdef _WIN32 - delete SystemTools::PathCaseMap; - delete SystemTools::EnvMap; -#endif -#ifdef __CYGWIN__ - delete SystemTools::Cyg2Win32Map; -#endif + delete SystemTools::Statics; } } // namespace KWSYS_NAMESPACE diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 33b579f..cdc9483 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -41,9 +41,7 @@ typedef @KWSYS_NAMESPACE@_VA_LIST::hack_va_list va_list; namespace @KWSYS_NAMESPACE@ { -class SystemToolsTranslationMap; -class SystemToolsPathCaseMap; -class SystemToolsEnvMap; +class SystemToolsStatic; /** \class SystemToolsManager * \brief Use to make sure SystemTools is initialized before it is used @@ -967,41 +965,8 @@ private: return &SystemToolsManagerInstance; } - /** - * Actual implementation of ReplaceString. - */ - static void ReplaceString(std::string& source, const char* replace, - size_t replaceSize, const std::string& with); - - /** - * Actual implementation of FileIsFullPath. - */ - static bool FileIsFullPath(const char*, size_t); - - /** - * Find a filename (file or directory) in the system PATH, with - * optional extra paths. - */ - static std::string FindName( - const std::string& name, - const std::vector<std::string>& path = std::vector<std::string>(), - bool no_system_path = false); - - static const char* GetEnvImpl(const char* key); - - /** - * Path translation table from dir to refdir - * Each time 'dir' will be found it will be replace by 'refdir' - */ - static SystemToolsTranslationMap* TranslationMap; -#ifdef _WIN32 - static std::string GetActualCaseForPathCached(std::string const& path); - static SystemToolsPathCaseMap* PathCaseMap; - static SystemToolsEnvMap* EnvMap; -#endif -#ifdef __CYGWIN__ - static SystemToolsTranslationMap* Cyg2Win32Map; -#endif + static SystemToolsStatic* Statics; + friend class SystemToolsStatic; friend class SystemToolsManager; }; diff --git a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake index c8a3de9..5deb110 100644 --- a/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLineTar/RunCMakeTest.cmake @@ -4,21 +4,23 @@ function(external_command_test NAME) run_cmake_command(${NAME} ${CMAKE_COMMAND} -E ${ARGN}) endfunction() -external_command_test(without-files tar cvf bad.tar) -external_command_test(bad-opt1 tar cvf bad.tar --bad) -external_command_test(bad-mtime1 tar cvf bad.tar --mtime=bad .) -external_command_test(bad-from1 tar cvf bad.tar --files-from=bad) -external_command_test(bad-from2 tar cvf bad.tar --files-from=.) -external_command_test(bad-from3 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from3.txt) -external_command_test(bad-from4 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from4.txt) -external_command_test(bad-from5 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from5.txt) -external_command_test(bad-file tar cf bad.tar badfile.txt ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) -external_command_test(end-opt1 tar cvf bad.tar -- --bad) -external_command_test(end-opt2 tar cvf bad.tar --) -external_command_test(mtime tar cvf bad.tar "--mtime=1970-01-01 00:00:00 UTC" ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) -external_command_test(bad-format tar cvf bad.tar "--format=bad-format" ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) -external_command_test(zip-bz2 tar cvjf bad.tar "--format=zip" ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) -external_command_test(7zip-gz tar cvzf bad.tar "--format=7zip" ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) +external_command_test(without-files tar cvf bad.tar) +external_command_test(bad-opt1 tar cvf bad.tar --bad) +external_command_test(bad-mtime1 tar cvf bad.tar --mtime=bad .) +external_command_test(bad-from1 tar cvf bad.tar --files-from=bad) +external_command_test(bad-from2 tar cvf bad.tar --files-from=.) +external_command_test(bad-from3 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from3.txt) +external_command_test(bad-from4 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from4.txt) +external_command_test(bad-from5 tar cvf bad.tar --files-from=${CMAKE_CURRENT_LIST_DIR}/bad-from5.txt) +external_command_test(bad-file tar cf bad.tar badfile.txt ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) +external_command_test(bad-without-action tar f bad.tar ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) +external_command_test(bad-wrong-flag tar cvfq bad.tar ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) +external_command_test(end-opt1 tar cvf bad.tar -- --bad) +external_command_test(end-opt2 tar cvf bad.tar --) +external_command_test(mtime tar cvf bad.tar "--mtime=1970-01-01 00:00:00 UTC" ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) +external_command_test(bad-format tar cvf bad.tar "--format=bad-format" ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) +external_command_test(zip-bz2 tar cvjf bad.tar "--format=zip" ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) +external_command_test(7zip-gz tar cvzf bad.tar "--format=7zip" ${CMAKE_CURRENT_LIST_DIR}/test-file.txt) run_cmake(7zip) run_cmake(gnutar) diff --git a/Tests/RunCMake/CommandLineTar/bad-without-action-result.txt b/Tests/RunCMake/CommandLineTar/bad-without-action-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/bad-without-action-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLineTar/bad-without-action-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-without-action-stderr.txt new file mode 100644 index 0000000..2fec254 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/bad-without-action-stderr.txt @@ -0,0 +1 @@ +^CMake Error: tar: No action specified. Please choose: 't' \(list\), 'c' \(create\) or 'x' \(extract\)$ diff --git a/Tests/RunCMake/CommandLineTar/bad-wrong-flag-stderr.txt b/Tests/RunCMake/CommandLineTar/bad-wrong-flag-stderr.txt new file mode 100644 index 0000000..d5c1e01 --- /dev/null +++ b/Tests/RunCMake/CommandLineTar/bad-wrong-flag-stderr.txt @@ -0,0 +1 @@ +^tar: Unknown argument: q diff --git a/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake b/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake index 5f2674a..53ee961 100644 --- a/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake +++ b/Tests/RunCMake/CommandLineTar/gnutar-gz.cmake @@ -1,9 +1,9 @@ set(OUTPUT_NAME "test.tar.gz") -set(COMPRESSION_FLAGS cvzf) +set(COMPRESSION_FLAGS -cvzf) set(COMPRESSION_OPTIONS --format=gnutar) -set(DECOMPRESSION_FLAGS xvzf) +set(DECOMPRESSION_FLAGS -xvzf) include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) diff --git a/Tests/RunCMake/CommandLineTar/pax.cmake b/Tests/RunCMake/CommandLineTar/pax.cmake index 60ed238..77f74d1 100644 --- a/Tests/RunCMake/CommandLineTar/pax.cmake +++ b/Tests/RunCMake/CommandLineTar/pax.cmake @@ -1,9 +1,9 @@ set(OUTPUT_NAME "test.tar") -set(COMPRESSION_FLAGS cvf) +set(COMPRESSION_FLAGS -cvf) set(COMPRESSION_OPTIONS --format=pax) -set(DECOMPRESSION_FLAGS xvf) +set(DECOMPRESSION_FLAGS -xvf) include(${CMAKE_CURRENT_LIST_DIR}/roundtrip.cmake) diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake index f675d81..88077b3 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake @@ -7,6 +7,13 @@ function(check_property property matcher) endif() endfunction() +function(expect_no_schema target) + set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${target}.xcscheme") + if(EXISTS ${schema}) + message(SEND_ERROR "Found unexpected schema ${schema}") + endif() +endfunction() + check_property("ADDRESS_SANITIZER" "enableAddressSanitizer") check_property("ADDRESS_SANITIZER_USE_AFTER_RETURN" "enableASanStackUseAfterReturn") check_property("THREAD_SANITIZER" "enableThreadSanitizer") @@ -31,3 +38,5 @@ check_property("ENVIRONMENT" [=[key="FOO"]=]) check_property("ENVIRONMENT" [=[value="foo"]=]) check_property("ENVIRONMENT" [=[key="BAR"]=]) check_property("ENVIRONMENT" [=[value="bar"]=]) + +expect_no_schema("NoSchema") diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake index 2b72a64..73ef5ca 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake @@ -35,3 +35,6 @@ endfunction() create_scheme_for_property(EXECUTABLE myExecutable) create_scheme_for_property(ARGUMENTS "--foo;--bar=baz") create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar") + +add_executable(NoSchema main.cpp) +set_target_properties(NoSchema PROPERTIES XCODE_GENERATE_SCHEME OFF) diff --git a/Utilities/Scripts/update-third-party.bash b/Utilities/Scripts/update-third-party.bash index 670946e..fcab871 100644 --- a/Utilities/Scripts/update-third-party.bash +++ b/Utilities/Scripts/update-third-party.bash @@ -71,8 +71,6 @@ warn () { readonly regex_date='20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]' readonly basehash_regex="$name $regex_date ([0-9a-f]*)" -readonly basehash="$( git rev-list --author="$ownership" --grep="$basehash_regex" -n 1 HEAD )" -readonly upstream_old_short="$( git cat-file commit "$basehash" | sed -n '/'"$basehash_regex"'/ {s/.*(//;s/)//;p}' | egrep '^[0-9a-f]+$' )" ######################################################################## # Sanity checking @@ -87,6 +85,18 @@ readonly upstream_old_short="$( git cat-file commit "$basehash" | sed -n '/'"$ba die "'repo' is empty" [ -n "$tag" ] || \ die "'tag' is empty" + +# Check for an empty destination directory on disk. By checking on disk and +# not in the repo it allows a library to be freshly re-inialized in a single +# commit rather than first deleting the old copy in one commit and adding the +# new copy in a seperate commit. +if [ ! -d "$(git rev-parse --show-toplevel)/$subtree" ]; then + readonly basehash="" +else + readonly basehash="$( git rev-list --author="$ownership" --grep="$basehash_regex" -n 1 HEAD )" +fi +readonly upstream_old_short="$( git cat-file commit "$basehash" | sed -n '/'"$basehash_regex"'/ {s/.*(//;s/)//;p}' | egrep '^[0-9a-f]+$' )" + [ -n "$basehash" ] || \ warn "'basehash' is empty; performing initial import" readonly do_shortlog="${shortlog-false}" @@ -104,6 +114,8 @@ trap "rm -rf '$workdir'" EXIT git clone "$repo" "$upstreamdir" if [ -n "$basehash" ]; then + # Remove old worktrees + git worktree prune # Use the existing package's history git worktree add "$extractdir" "$basehash" # Clear out the working tree @@ -163,13 +175,17 @@ popd if [ -n "$basehash" ]; then git merge --log -s recursive "-Xsubtree=$subtree/" --no-commit "upstream-$name" else + # Note: on Windows 'git merge --help' will open a browser, and the check + # will fail, so use the flag by default. unrelated_histories_flag="" - if git merge --help | grep -q -e allow-unrelated-histories; then + if git --version | grep -q windows; then + unrelated_histories_flag="--allow-unrelated-histories " + elif git merge --help | grep -q -e allow-unrelated-histories; then unrelated_histories_flag="--allow-unrelated-histories " fi readonly unrelated_histories_flag - git fetch "$extractdir" "upstream-$name:upstream-$name" + git fetch "$extractdir" "+upstream-$name:upstream-$name" git merge --log -s ours --no-commit $unrelated_histories_flag "upstream-$name" git read-tree -u --prefix="$subtree/" "upstream-$name" fi |