From bb08c70e019f50a6031028b9ea27a1e9bb75430f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 6 Jun 2023 13:38:04 -0400 Subject: [PATCH 001/627] Begin post-3.27 development --- Help/release/dev/0-sample-topic.rst | 7 +++++++ Help/release/index.rst | 2 ++ Source/CMakeVersion.cmake | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/0-sample-topic.rst diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 00000000000..e4cc01e23fe --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/index.rst b/Help/release/index.rst index fc1f74449fe..3851b7ec065 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -7,6 +7,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 42b8be6614d..0c9ff38add7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,8 +1,8 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 0) +set(CMake_VERSION_PATCH 20230606) +#set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) # Start with the full version number used in tags. It has no dev info. From 883ff2b2c02b1bd3e8ab6af8286dbc7f97c7f54a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 7 Jun 2023 00:01:13 -0400 Subject: [PATCH 002/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0c9ff38add7..3c3a6ab9b0d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230606) +set(CMake_VERSION_PATCH 20230607) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 9ba9b6c658dd086129687e0345e5968b60051ca7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Jun 2023 10:38:25 -0400 Subject: [PATCH 003/627] Add deprecation warnings for policies CMP0120 and below The OLD behaviors of all policies are deprecated, but only by documentation. Add an explicit deprecation diagnostic for policies introduced in CMake 3.20 and below to encourage projects to port away from setting policies to OLD. --- Source/cmMakefile.cxx | 2 +- Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt | 11 ++++++++++- Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt | 13 ++++++++++++- .../RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt | 8 ++++++++ Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt | 8 ++++++++ Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt | 13 ++++++++++++- .../RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt | 13 ++++++++++++- .../RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt | 13 ++++++++++++- .../RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt | 13 ++++++++++++- .../RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt | 13 ++++++++++++- .../RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt | 13 ++++++++++++- .../RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt | 13 ++++++++++++- .../RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt | 13 ++++++++++++- .../RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt | 13 ++++++++++++- Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt | 10 ++++++++++ .../MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt | 10 ++++++++++ Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt | 8 ++++++++ .../CMP0120-OLD-Direct-stderr.txt | 10 ++++++++++ .../CMP0120-OLD-stderr.txt | 10 ++++++++++ 28 files changed, 303 insertions(+), 21 deletions(-) create mode 100644 Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt create mode 100644 Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt create mode 100644 Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0af0ed079ad..c3c8d464d8c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4613,7 +4613,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, } // Deprecate old policies. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0114 && + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0120 && !(this->GetCMakeInstance()->GetIsInTryCompile() && ( // Policies set by cmCoreTryCompile::TryCompileCode. diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt index 67d00f75dde..3472f33e88b 100644 --- a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt @@ -1,4 +1,13 @@ -^CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): +^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0115 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. ++ +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): Cannot find source file: noexist diff --git a/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt index 10e83a9058a..930dd3cfeb2 100644 --- a/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt +++ b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt @@ -1,4 +1,15 @@ -^CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\): +^CMake Deprecation Warning at CMP0116-Mixed\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\): Policy CMP0116 is not set: Ninja generators transform DEPFILEs from add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy details\. Use the cmake_policy command to set the policy and suppress this diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt new file mode 100644 index 00000000000..887601c989c --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\.$ diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt new file mode 100644 index 00000000000..887601c989c --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt index 2af72a433c1..9285f9d8a84 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt @@ -1,4 +1,15 @@ -^prop: `0` +^CMake Deprecation Warning at CMP0118-OLD-Test1\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +prop: `0` CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(target_sources\): Cannot find source file: diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt index 6109f65898c..9bd3d335511 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test10\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt index e5e97def757..4730cafefaa 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test11\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt index e6c429c7448..69a07e1ec4a 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): +^CMake Deprecation Warning at CMP0118-OLD-Test12\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): TARGET 'custom[4-6]' was not created in this directory\. + CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt index 75dbf2308e7..45c1dcbaae8 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): +^CMake Deprecation Warning at CMP0118-OLD-Test13\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): TARGET 'custom[4-6]' was not created in this directory\. + CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt index f5b3d1a6243..7ade0cf1d19 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test14\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt index a30bc842094..5735539a853 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test15\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt index 403ce5a56be..74eb3e18c29 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt @@ -1 +1,12 @@ -^prop: `1`$ +^CMake Deprecation Warning at CMP0118-OLD-Test2\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +prop: `1`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt index 4f4fea3e060..cce5b194905 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test3\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `1` Generated_with_full_path1\.txt: # 1b # GENERATED = `1` Generated_with_full_path1\.txt: # 2a # GENERATED = `1` Generated_with_full_path1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt index 3c80531f173..47eee2e8000 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test3b\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `1` Generated_with_full_path1\.txt: # 1b # GENERATED = `1` Generated_with_full_path1\.txt: # 2a # GENERATED = `1` Generated_with_full_path1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt index 9600feeb914..f17c9be0640 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test4\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` Generated_with_full_path1\.txt: # 1b # GENERATED = `0` Generated_with_full_path1\.txt: # 2a # GENERATED = `0` Generated_with_full_path1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt index e6386605a19..388e90ed9c4 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test4b\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` Generated_with_full_path1\.txt: # 1b # GENERATED = `0` Generated_with_full_path1\.txt: # 2a # GENERATED = `0` Generated_with_full_path1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt index 18e6a8c715e..4a67fa7b6da 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test5\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `1` Generated_with_full_path1\.txt: # 1b # GENERATED = `1` Generated_with_full_path1\.txt: # 2a # GENERATED = `1` Generated_with_full_path1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt index a60545f4359..0cad373f013 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test6\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `1` Generated_source1\.txt: # 1b # GENERATED = `1` Generated_source1\.txt: # 2a # GENERATED = `1` Generated_source1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt index fd496cbd227..7f232d5bbbb 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test7\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `1` Generated_source1\.txt: # 1b # GENERATED = `1` Generated_source1\.txt: # 2a # GENERATED = `1` Generated_source1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt index 3505242f9ce..dd9d2ef22dc 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test8\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `0` Generated_source1\.txt: # 1b # GENERATED = `0` Generated_source1\.txt: # 2a # GENERATED = `0` Generated_source1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt index 63a9341a057..e01f7828a1b 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test9\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `0` Generated_source1\.txt: # 1b # GENERATED = `0` Generated_source1\.txt: # 2a # GENERATED = `0` Generated_source1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt index 5e9cf6cd79e..2fc472b81d0 100644 --- a/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at GenInSubdir/CMakeLists\.txt:[0-9]+ \(target_sources\): +^CMake Deprecation Warning at GenInSubdir-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at GenInSubdir/CMakeLists\.txt:[0-9]+ \(target_sources\): Cannot find source file: [^ diff --git a/Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt b/Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt new file mode 100644 index 00000000000..86eac411934 --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0119-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0119 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt new file mode 100644 index 00000000000..4499d97a482 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0117-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0117 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt b/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt new file mode 100644 index 00000000000..60249841388 --- /dev/null +++ b/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at QtSubDir1/CMakeLists\.txt:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\.$ diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt new file mode 100644 index 00000000000..53f603ecfa2 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0120-OLD-Direct\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0120 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt new file mode 100644 index 00000000000..fea708f3100 --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0120-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0120 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ From ee80960f786e85c69a6f40b5299549149d9fc7df Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Jun 2023 13:44:18 -0400 Subject: [PATCH 004/627] export: Increase maximum policy version in exported files to 3.26 The files generatd by `install(EXPORT)` and `export()` commands are known to work with policies as of CMake 3.26, so enable them in sufficiently new CMake versions. --- Source/cmExportFileGenerator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 22276ae5083..9176d12d57c 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -955,13 +955,13 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os) // Isolate the file policy level. // Support CMake versions as far back as 2.6 but also support using NEW - // policy settings for up to CMake 3.25 (this upper limit may be reviewed + // policy settings for up to CMake 3.26 (this upper limit may be reviewed // and increased from time to time). This reduces the opportunity for CMake // warnings when an older export file is later used with newer CMake // versions. /* clang-format off */ os << "cmake_policy(PUSH)\n" - << "cmake_policy(VERSION 2.8.3...3.25)\n"; + << "cmake_policy(VERSION 2.8.3...3.26)\n"; /* clang-format on */ } From 1b11f48741de0d5bd8b08b2ea6b6776d3afd980c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Jun 2023 13:47:34 -0400 Subject: [PATCH 005/627] Configure CMake itself with policies through CMake 3.26 --- CMakeLists.txt | 2 +- Source/Checks/Curses/CMakeLists.txt | 2 +- Utilities/Doxygen/CMakeLists.txt | 2 +- Utilities/Sphinx/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d559c085511..c1d50cab499 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -cmake_minimum_required(VERSION 3.13...3.25 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR) set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideC.cmake) set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideCXX.cmake) diff --git a/Source/Checks/Curses/CMakeLists.txt b/Source/Checks/Curses/CMakeLists.txt index 0fee7acbdb3..bc6b9064121 100644 --- a/Source/Checks/Curses/CMakeLists.txt +++ b/Source/Checks/Curses/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13...3.24 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR) project(CheckCurses C) set(CURSES_NEED_NCURSES TRUE) diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt index fee21b65d64..12b5407c8fc 100644 --- a/Utilities/Doxygen/CMakeLists.txt +++ b/Utilities/Doxygen/CMakeLists.txt @@ -3,7 +3,7 @@ if(NOT CMake_SOURCE_DIR) set(CMakeDeveloperReference_STANDALONE 1) - cmake_minimum_required(VERSION 3.13...3.25 FATAL_ERROR) + cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR) get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH) include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake) diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index bde6c6bf20b..694ba3c0b38 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -3,7 +3,7 @@ if(NOT CMake_SOURCE_DIR) set(CMakeHelp_STANDALONE 1) - cmake_minimum_required(VERSION 3.13...3.25 FATAL_ERROR) + cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR) get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH) include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake) From ccb866448f03a4cf5601f271fc0030eef288acd3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 8 Jun 2023 00:01:11 -0400 Subject: [PATCH 006/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3c3a6ab9b0d..339b9fab02a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230607) +set(CMake_VERSION_PATCH 20230608) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From bb5ec5c9b484770e0b0f470da723bdce442a090b Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 2 Jun 2023 10:56:48 -0400 Subject: [PATCH 007/627] cmUVProcessChain: Do some internal refactoring Move most of cmUVProcessChain::InternalData::Finish() to Prepare() so that error codes can be checked before attepting to spawn any processes. Check some error codes that weren't being checked before. Change return type of Finish() to void as it can't fail. --- Source/cmUVProcessChain.cxx | 46 ++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index ed5f38beae2..436ada265c7 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -66,6 +66,7 @@ struct cmUVProcessChain::InternalData StreamData OutputStreamData; StreamData ErrorStreamData; + cm::uv_pipe_ptr TempErrorPipe; unsigned int ProcessesCompleted = 0; std::vector> Processes; @@ -73,7 +74,7 @@ struct cmUVProcessChain::InternalData bool Prepare(const cmUVProcessChainBuilder* builder); bool AddCommand(const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first, bool last); - bool Finish(); + void Finish(); static const Status* GetStatus(const ProcessData& data); }; @@ -207,12 +208,23 @@ bool cmUVProcessChain::InternalData::Prepare( return false; } - errorData.BuiltinStream.init(*this->Loop, 0); + if (errorData.BuiltinStream.init(*this->Loop, 0) < 0) { + return false; + } if (uv_pipe_open(errorData.BuiltinStream, pipeFd[0]) < 0) { return false; } errorData.Stdio.flags = UV_INHERIT_FD; errorData.Stdio.data.fd = pipeFd[1]; + + if (this->TempErrorPipe.init(*this->Loop, 0) < 0) { + return false; + } + if (uv_pipe_open(this->TempErrorPipe, errorData.Stdio.data.fd) < 0) { + return false; + } + + errorData.Streambuf.open(errorData.BuiltinStream); break; } @@ -235,10 +247,13 @@ bool cmUVProcessChain::InternalData::Prepare( outputData.Stdio.flags = UV_INHERIT_FD; outputData.Stdio.data.fd = errorData.Stdio.data.fd; } else { - outputData.BuiltinStream.init(*this->Loop, 0); + if (outputData.BuiltinStream.init(*this->Loop, 0) < 0) { + return false; + } outputData.Stdio.flags = static_cast(UV_CREATE_PIPE | UV_WRITABLE_PIPE); outputData.Stdio.data.stream = outputData.BuiltinStream; + outputData.Streambuf.open(outputData.BuiltinStream); } break; @@ -313,31 +328,10 @@ bool cmUVProcessChain::InternalData::AddCommand( return process.Process.spawn(*this->Loop, options, &process) >= 0; } -bool cmUVProcessChain::InternalData::Finish() +void cmUVProcessChain::InternalData::Finish() { - if (this->Builder->Stdio[cmUVProcessChainBuilder::Stream_OUTPUT].Type == - cmUVProcessChainBuilder::Builtin && - !this->Builder->MergedBuiltinStreams) { - this->OutputStreamData.Streambuf.open( - this->OutputStreamData.BuiltinStream); - } - - if (this->Builder->Stdio[cmUVProcessChainBuilder::Stream_ERROR].Type == - cmUVProcessChainBuilder::Builtin) { - cm::uv_pipe_ptr tmpPipe; - if (tmpPipe.init(*this->Loop, 0) < 0) { - return false; - } - if (uv_pipe_open(tmpPipe, this->ErrorStreamData.Stdio.data.fd) < 0) { - return false; - } - tmpPipe.reset(); - - this->ErrorStreamData.Streambuf.open(this->ErrorStreamData.BuiltinStream); - } - + this->TempErrorPipe.reset(); this->Valid = true; - return true; } cmUVProcessChain::cmUVProcessChain() From 5be0cd9f3c07b60b1f60ea678c1d82c38185ca27 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 2 Jun 2023 14:34:42 -0400 Subject: [PATCH 008/627] cmUVProcessChain: Manually create pipes between processes Previously, we were letting libuv create the output pipe for each process. However, in order to facilitate use cases where process spawn is expected to fail (in the case of a missing executable), we want pipe creation to be separate from process creation. Manually create all of the pipes. --- Source/cmUVProcessChain.cxx | 91 +++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 23 deletions(-) diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index 436ada265c7..6517e60389b 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -5,11 +5,9 @@ #include "cmUVProcessChain.h" #include -#include #include #include #include // IWYU pragma: keep -#include #include #include @@ -53,6 +51,7 @@ struct cmUVProcessChain::InternalData { cmUVProcessChain::InternalData* Data; cm::uv_process_ptr Process; + cm::uv_pipe_ptr InputPipe; cm::uv_pipe_ptr OutputPipe; bool Finished = false; Status ProcessStatus; @@ -66,14 +65,17 @@ struct cmUVProcessChain::InternalData StreamData OutputStreamData; StreamData ErrorStreamData; + cm::uv_pipe_ptr TempOutputPipe; cm::uv_pipe_ptr TempErrorPipe; unsigned int ProcessesCompleted = 0; std::vector> Processes; bool Prepare(const cmUVProcessChainBuilder* builder); - bool AddCommand(const cmUVProcessChainBuilder::ProcessConfiguration& config, - bool first, bool last); + bool SpawnProcess( + std::size_t index, + const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first, + bool last); void Finish(); static const Status* GetStatus(const ProcessData& data); @@ -168,9 +170,9 @@ cmUVProcessChain cmUVProcessChainBuilder::Start() const return chain; } - for (auto it = this->Processes.begin(); it != this->Processes.end(); ++it) { - if (!chain.Data->AddCommand(*it, it == this->Processes.begin(), - it == std::prev(this->Processes.end()))) { + for (std::size_t i = 0; i < this->Processes.size(); i++) { + if (!chain.Data->SpawnProcess(i, this->Processes[i], i == 0, + i == this->Processes.size() - 1)) { return chain; } } @@ -247,12 +249,27 @@ bool cmUVProcessChain::InternalData::Prepare( outputData.Stdio.flags = UV_INHERIT_FD; outputData.Stdio.data.fd = errorData.Stdio.data.fd; } else { + int pipeFd[2]; + if (cmGetPipes(pipeFd) < 0) { + return false; + } + if (outputData.BuiltinStream.init(*this->Loop, 0) < 0) { return false; } - outputData.Stdio.flags = - static_cast(UV_CREATE_PIPE | UV_WRITABLE_PIPE); - outputData.Stdio.data.stream = outputData.BuiltinStream; + if (uv_pipe_open(outputData.BuiltinStream, pipeFd[0]) < 0) { + return false; + } + outputData.Stdio.flags = UV_INHERIT_FD; + outputData.Stdio.data.fd = pipeFd[1]; + + if (this->TempOutputPipe.init(*this->Loop, 0) < 0) { + return false; + } + if (uv_pipe_open(this->TempOutputPipe, outputData.Stdio.data.fd) < 0) { + return false; + } + outputData.Streambuf.open(outputData.BuiltinStream); } break; @@ -263,16 +280,46 @@ bool cmUVProcessChain::InternalData::Prepare( break; } + bool first = true; + for (std::size_t i = 0; i < this->Builder->Processes.size(); i++) { + this->Processes.emplace_back(cm::make_unique()); + auto& process = *this->Processes.back(); + process.Data = this; + + if (!first) { + auto& prevProcess = *this->Processes[i - 1]; + + int pipeFd[2]; + if (cmGetPipes(pipeFd) < 0) { + return false; + } + + if (prevProcess.OutputPipe.init(*this->Loop, 0) < 0) { + return false; + } + if (uv_pipe_open(prevProcess.OutputPipe, pipeFd[1]) < 0) { + return false; + } + if (process.InputPipe.init(*this->Loop, 0) < 0) { + return false; + } + if (uv_pipe_open(process.InputPipe, pipeFd[0]) < 0) { + return false; + } + } + + first = false; + } + return true; } -bool cmUVProcessChain::InternalData::AddCommand( +bool cmUVProcessChain::InternalData::SpawnProcess( + std::size_t index, const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first, bool last) { - this->Processes.emplace_back(cm::make_unique()); - auto& process = *this->Processes.back(); - process.Data = this; + auto& process = *this->Processes[index]; auto options = uv_process_options_t(); @@ -296,20 +343,14 @@ bool cmUVProcessChain::InternalData::AddCommand( if (first) { stdio[0].flags = UV_IGNORE; } else { - assert(this->Processes.size() >= 2); - auto& prev = *this->Processes[this->Processes.size() - 2]; stdio[0].flags = UV_INHERIT_STREAM; - stdio[0].data.stream = prev.OutputPipe; + stdio[0].data.stream = process.InputPipe; } if (last) { stdio[1] = this->OutputStreamData.Stdio; } else { - if (process.OutputPipe.init(*this->Loop, 0) < 0) { - return false; - } stdio[1] = uv_stdio_container_t(); - stdio[1].flags = - static_cast(UV_CREATE_PIPE | UV_WRITABLE_PIPE); + stdio[1].flags = UV_INHERIT_STREAM; stdio[1].data.stream = process.OutputPipe; } stdio[2] = this->ErrorStreamData.Stdio; @@ -325,11 +366,15 @@ bool cmUVProcessChain::InternalData::AddCommand( processData->Data->ProcessesCompleted++; }; - return process.Process.spawn(*this->Loop, options, &process) >= 0; + bool result = process.Process.spawn(*this->Loop, options, &process) >= 0; + process.InputPipe.reset(); + process.OutputPipe.reset(); + return result; } void cmUVProcessChain::InternalData::Finish() { + this->TempOutputPipe.reset(); this->TempErrorPipe.reset(); this->Valid = true; } From 891b60d691812c45b92d4ad2127e1559f80f8332 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 2 Jun 2023 16:02:23 -0400 Subject: [PATCH 009/627] cmUVProcessChain: Add Status::SpawnResult field --- ...uxELFObjdumpGetRuntimeDependenciesTool.cxx | 5 +- ...OSMachOOToolGetRuntimeDependenciesTool.cxx | 5 +- ...owsPEDumpbinGetRuntimeDependenciesTool.cxx | 5 +- ...owsPEObjdumpGetRuntimeDependenciesTool.cxx | 5 +- Source/cmLDConfigLDConfigTool.cxx | 5 +- Source/cmUVProcessChain.cxx | 61 ++-- Source/cmUVProcessChain.h | 5 +- Source/cmake.cxx | 2 +- Source/cmcmd.cxx | 10 +- Tests/CMakeLib/testUVProcessChain.cxx | 263 +++++++++++++----- Tests/CMakeLib/testUVProcessChainHelper.cxx | 4 +- 11 files changed, 250 insertions(+), 120 deletions(-) diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx index 566e4a488c6..c5c41e03923 100644 --- a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx @@ -35,7 +35,7 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo( builder.AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::ostringstream e; e << "Failed to start objdump process for:\n " << file; this->SetError(e.str()); @@ -73,8 +73,7 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo( this->SetError(e.str()); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { std::ostringstream e; e << "Failed to run objdump on:\n " << file; this->SetError(e.str()); diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx index 6d97720c256..cf4a8fe3de9 100644 --- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx @@ -34,7 +34,7 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( .AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::ostringstream e; e << "Failed to start otool process for:\n " << file; this->SetError(e.str()); @@ -88,8 +88,7 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( this->SetError(e.str()); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { std::ostringstream e; e << "Failed to run otool on:\n " << file; this->SetError(e.str()); diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx index f342884dcd2..3b02c2e59b6 100644 --- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx @@ -33,7 +33,7 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo( builder.AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::ostringstream e; e << "Failed to start dumpbin process for:\n " << file; this->SetError(e.str()); @@ -56,8 +56,7 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo( this->SetError(e.str()); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { std::ostringstream e; e << "Failed to run dumpbin on:\n " << file; this->SetError(e.str()); diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx index f14de5596b4..2139b4b5c41 100644 --- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx @@ -34,7 +34,7 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo( builder.AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::ostringstream e; e << "Failed to start objdump process for:\n " << file; this->SetError(e.str()); @@ -57,8 +57,7 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo( this->SetError(e.str()); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { std::ostringstream e; e << "Failed to run objdump on:\n " << file; this->SetError(e.str()); diff --git a/Source/cmLDConfigLDConfigTool.cxx b/Source/cmLDConfigLDConfigTool.cxx index 0752b3353d2..7ce1a59dae9 100644 --- a/Source/cmLDConfigLDConfigTool.cxx +++ b/Source/cmLDConfigLDConfigTool.cxx @@ -43,7 +43,7 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector& paths) builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT) .AddCommand(ldConfigCommand); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { this->Archive->SetError("Failed to start ldconfig process"); return false; } @@ -61,8 +61,7 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector& paths) this->Archive->SetError("Failed to wait on ldconfig process"); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { this->Archive->SetError("Failed to run ldconfig"); return false; } diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index 6517e60389b..a9e57e67b2c 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -53,8 +53,9 @@ struct cmUVProcessChain::InternalData cm::uv_process_ptr Process; cm::uv_pipe_ptr InputPipe; cm::uv_pipe_ptr OutputPipe; - bool Finished = false; Status ProcessStatus; + + void Finish(); }; const cmUVProcessChainBuilder* Builder = nullptr; @@ -72,13 +73,11 @@ struct cmUVProcessChain::InternalData std::vector> Processes; bool Prepare(const cmUVProcessChainBuilder* builder); - bool SpawnProcess( + void SpawnProcess( std::size_t index, const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first, bool last); void Finish(); - - static const Status* GetStatus(const ProcessData& data); }; cmUVProcessChainBuilder::cmUVProcessChainBuilder() @@ -171,10 +170,8 @@ cmUVProcessChain cmUVProcessChainBuilder::Start() const } for (std::size_t i = 0; i < this->Processes.size(); i++) { - if (!chain.Data->SpawnProcess(i, this->Processes[i], i == 0, - i == this->Processes.size() - 1)) { - return chain; - } + chain.Data->SpawnProcess(i, this->Processes[i], i == 0, + i == this->Processes.size() - 1); } chain.Data->Finish(); @@ -182,15 +179,6 @@ cmUVProcessChain cmUVProcessChainBuilder::Start() const return chain; } -const cmUVProcessChain::Status* cmUVProcessChain::InternalData::GetStatus( - const cmUVProcessChain::InternalData::ProcessData& data) -{ - if (data.Finished) { - return &data.ProcessStatus; - } - return nullptr; -} - bool cmUVProcessChain::InternalData::Prepare( const cmUVProcessChainBuilder* builder) { @@ -285,6 +273,7 @@ bool cmUVProcessChain::InternalData::Prepare( this->Processes.emplace_back(cm::make_unique()); auto& process = *this->Processes.back(); process.Data = this; + process.ProcessStatus.Finished = false; if (!first) { auto& prevProcess = *this->Processes[i - 1]; @@ -314,7 +303,7 @@ bool cmUVProcessChain::InternalData::Prepare( return true; } -bool cmUVProcessChain::InternalData::SpawnProcess( +void cmUVProcessChain::InternalData::SpawnProcess( std::size_t index, const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first, bool last) @@ -360,16 +349,17 @@ bool cmUVProcessChain::InternalData::SpawnProcess( options.exit_cb = [](uv_process_t* handle, int64_t exitStatus, int termSignal) { auto* processData = static_cast(handle->data); - processData->Finished = true; processData->ProcessStatus.ExitStatus = exitStatus; processData->ProcessStatus.TermSignal = termSignal; - processData->Data->ProcessesCompleted++; + processData->Finish(); }; - bool result = process.Process.spawn(*this->Loop, options, &process) >= 0; + if ((process.ProcessStatus.SpawnResult = + process.Process.spawn(*this->Loop, options, &process)) < 0) { + process.Finish(); + } process.InputPipe.reset(); process.OutputPipe.reset(); - return result; } void cmUVProcessChain::InternalData::Finish() @@ -451,19 +441,15 @@ std::vector cmUVProcessChain::GetStatus() std::vector statuses( this->Data->Processes.size(), nullptr); for (std::size_t i = 0; i < statuses.size(); i++) { - statuses[i] = this->GetStatus(i); + statuses[i] = &this->GetStatus(i); } return statuses; } -const cmUVProcessChain::Status* cmUVProcessChain::GetStatus( +const cmUVProcessChain::Status& cmUVProcessChain::GetStatus( std::size_t index) const { - auto const& process = *this->Data->Processes[index]; - if (process.Finished) { - return &process.ProcessStatus; - } - return nullptr; + return this->Data->Processes[index]->ProcessStatus; } bool cmUVProcessChain::Finished() const @@ -474,8 +460,12 @@ bool cmUVProcessChain::Finished() const std::pair cmUVProcessChain::Status::GetException() const { + if (this->SpawnResult) { + return std::make_pair(ExceptionCode::Spawn, + uv_strerror(this->SpawnResult)); + } #ifdef _WIN32 - if ((this->ExitStatus & 0xF0000000) == 0xC0000000) { + if (this->Finished && (this->ExitStatus & 0xF0000000) == 0xC0000000) { // Child terminated due to exceptional behavior. switch (this->ExitStatus) { case STATUS_CONTROL_C_EXIT: @@ -550,9 +540,8 @@ cmUVProcessChain::Status::GetException() const } } } - return std::make_pair(ExceptionCode::None, ""); #else - if (this->TermSignal) { + if (this->Finished && this->TermSignal) { switch (this->TermSignal) { # ifdef SIGSEGV case SIGSEGV: @@ -709,6 +698,12 @@ cmUVProcessChain::Status::GetException() const } } } - return std::make_pair(ExceptionCode::None, ""); #endif + return std::make_pair(ExceptionCode::None, ""); +} + +void cmUVProcessChain::InternalData::ProcessData::Finish() +{ + this->ProcessStatus.Finished = true; + this->Data->ProcessesCompleted++; } diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h index f92742f20ae..547a944d87f 100644 --- a/Source/cmUVProcessChain.h +++ b/Source/cmUVProcessChain.h @@ -74,11 +74,14 @@ class cmUVProcessChain Illegal, Interrupt, Numerical, + Spawn, Other, }; struct Status { + int SpawnResult; + bool Finished; int64_t ExitStatus; int TermSignal; @@ -102,7 +105,7 @@ class cmUVProcessChain bool Valid() const; bool Wait(int64_t milliseconds = -1); std::vector GetStatus() const; - const Status* GetStatus(std::size_t index) const; + const Status& GetStatus(std::size_t index) const; bool Finished() const; private: diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f30d4d357f0..791569ccf00 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3916,7 +3916,7 @@ std::function cmake::BuildWorkflowStep( return [builder]() -> int { auto chain = builder.Start(); chain.Wait(); - return static_cast(chain.GetStatus().front()->ExitStatus); + return static_cast(chain.GetStatus(0).ExitStatus); }; } #endif diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 9929e85905e..1bbd0ac0e00 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -2008,7 +2008,7 @@ int cmcmd::RunPreprocessor(const std::vector& command, .SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR) .AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::cerr << "Failed to start preprocessor."; return 1; } @@ -2016,8 +2016,7 @@ int cmcmd::RunPreprocessor(const std::vector& command, std::cerr << "Failed to wait for preprocessor"; return 1; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { auto* errorStream = process.ErrorStream(); if (errorStream) { std::cerr << errorStream->rdbuf(); @@ -2130,7 +2129,7 @@ int cmcmd::RunLLVMRC(std::vector const& args) .AddCommand(resource_compile); auto process = builder.Start(); result = 0; - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::cerr << "Failed to start resource compiler."; result = 1; } else { @@ -2144,8 +2143,7 @@ int cmcmd::RunLLVMRC(std::vector const& args) if (result != 0) { return result; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { auto* errorStream = process.ErrorStream(); if (errorStream) { std::cerr << errorStream->rdbuf(); diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index 7027689a046..e0a67e97e20 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -20,7 +20,6 @@ struct ExpectedStatus { - bool Finished; bool MatchExitStatus; bool MatchTermSignal; cmUVProcessChain::Status Status; @@ -28,38 +27,6 @@ struct ExpectedStatus std::string ExceptionString; }; -static const std::vector status1 = { - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, -}; - -static const std::vector status2 = { - { true, true, true, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, -}; - -static const std::vector status3 = { - { true, true, true, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { true, true, true, { 1, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, -#ifdef _WIN32 - { true, - true, - true, - { STATUS_ACCESS_VIOLATION, 0 }, - cmUVProcessChain::ExceptionCode::Fault, - "Access violation" }, -#else - { true, - false, - true, - { 0, SIGABRT }, - cmUVProcessChain::ExceptionCode::Other, - "Subprocess aborted" }, -#endif -}; - static const char* ExceptionCodeToString(cmUVProcessChain::ExceptionCode code) { switch (code) { @@ -73,6 +40,8 @@ static const char* ExceptionCodeToString(cmUVProcessChain::ExceptionCode code) return "Interrupt"; case cmUVProcessChain::ExceptionCode::Numerical: return "Numerical"; + case cmUVProcessChain::ExceptionCode::Spawn: + return "Spawn"; case cmUVProcessChain::ExceptionCode::Other: return "Other"; default: @@ -83,9 +52,10 @@ static const char* ExceptionCodeToString(cmUVProcessChain::ExceptionCode code) bool operator==(const cmUVProcessChain::Status* actual, const ExpectedStatus& expected) { - if (!expected.Finished) { - return !actual; - } else if (!actual) { + if (expected.Status.SpawnResult != actual->SpawnResult) { + return false; + } + if (expected.Status.Finished != actual->Finished) { return false; } if (expected.MatchExitStatus && @@ -96,7 +66,7 @@ bool operator==(const cmUVProcessChain::Status* actual, expected.Status.TermSignal != actual->TermSignal) { return false; } - if (expected.Finished && + if (expected.Status.Finished && std::make_pair(expected.ExceptionCode, expected.ExceptionString) != actual->GetException()) { return false; @@ -150,39 +120,96 @@ static void printResults( { std::cout << "Expected: " << std::endl; for (auto const& e : expected) { - if (e.Finished) { - std::cout << " ExitStatus: " - << printExpected(e.MatchExitStatus, e.Status.ExitStatus) - << ", TermSignal: " - << printExpected(e.MatchTermSignal, e.Status.TermSignal) - << ", ExceptionCode: " - << printExpected(e.Finished, - ExceptionCodeToString(e.ExceptionCode)) - << ", ExceptionString: \"" - << printExpected(e.Finished, e.ExceptionString) << '"' - << std::endl; - } else { - std::cout << " null" << std::endl; - } + std::cout << " SpawnResult: " << e.Status.SpawnResult + << ", Finished: " << e.Status.Finished << ", ExitStatus: " + << printExpected(e.MatchExitStatus, e.Status.ExitStatus) + << ", TermSignal: " + << printExpected(e.MatchTermSignal, e.Status.TermSignal) + << ", ExceptionCode: " + << printExpected(e.Status.Finished, + ExceptionCodeToString(e.ExceptionCode)) + << ", ExceptionString: \"" + << printExpected(e.Status.Finished, e.ExceptionString) << '"' + << std::endl; } std::cout << "Actual:" << std::endl; for (auto const& a : actual) { - if (a) { - auto exception = a->GetException(); - std::cout << " ExitStatus: " << a->ExitStatus - << ", TermSignal: " << a->TermSignal << ", ExceptionCode: " - << ExceptionCodeToString(exception.first) - << ", ExceptionString: \"" << exception.second << '"' - << std::endl; - } else { - std::cout << " null" << std::endl; - } + auto exception = a->GetException(); + std::cout << " SpawnResult: " << a->SpawnResult + << ", Finished: " << a->Finished + << ", ExitStatus: " << a->ExitStatus + << ", TermSignal: " << a->TermSignal + << ", ExceptionCode: " << ExceptionCodeToString(exception.first) + << ", ExceptionString: \"" << exception.second << '"' + << std::endl; } } static bool checkExecution(cmUVProcessChainBuilder& builder, std::unique_ptr& chain) { + static const std::vector status1 = { + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + }; + + static const std::vector status2 = { + { true, + true, + { 0, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + }; + + static const std::vector status3 = { + { true, + true, + { 0, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { true, + true, + { 0, true, 1, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, +#ifdef _WIN32 + { true, + true, + { 0, true, STATUS_ACCESS_VIOLATION, 0 }, + cmUVProcessChain::ExceptionCode::Fault, + "Access violation" }, +#else + { false, + true, + { 0, true, 0, SIGABRT }, + cmUVProcessChain::ExceptionCode::Other, + "Subprocess aborted" }, +#endif + }; + std::vector status; chain = cm::make_unique(builder.Start()); @@ -201,7 +228,7 @@ static bool checkExecution(cmUVProcessChainBuilder& builder, return false; } - if (chain->Wait(6000)) { + if (chain->Wait(9000)) { std::cout << "Wait() returned true, should be false" << std::endl; return false; } @@ -481,6 +508,113 @@ bool testUVProcessChainCwdChanged(const char* helperCommand) return true; } +bool testUVProcessChainSpawnFail(const char* helperCommand) +{ + static const std::vector status1 = { + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { UV_ENOENT, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::Spawn, + uv_strerror(UV_ENOENT) }, +#ifdef _WIN32 + { true, + true, + { 0, true, STATUS_ACCESS_VIOLATION, 0 }, + cmUVProcessChain::ExceptionCode::Fault, + "Access violation" }, +#else + { false, + true, + { 0, true, 0, SIGABRT }, + cmUVProcessChain::ExceptionCode::Other, + "Subprocess aborted" }, +#endif + }; + + static const std::vector status2 = { +#ifdef _WIN32 + { true, + true, + { 0, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, +#else + { false, + true, + { 0, true, 0, SIGPIPE }, + cmUVProcessChain::ExceptionCode::Other, + "SIGPIPE" }, +#endif + { false, + false, + { UV_ENOENT, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::Spawn, + uv_strerror(UV_ENOENT) }, +#ifdef _WIN32 + { true, + true, + { 0, true, STATUS_ACCESS_VIOLATION, 0 }, + cmUVProcessChain::ExceptionCode::Fault, + "Access violation" }, +#else + { false, + true, + { 0, true, 0, SIGABRT }, + cmUVProcessChain::ExceptionCode::Other, + "Subprocess aborted" }, +#endif + }; + + std::vector status; + + cmUVProcessChainBuilder builder; + builder.AddCommand({ helperCommand, "echo" }) + .AddCommand({ "this_command_is_for_cmake_and_should_never_exist" }) + .AddCommand({ helperCommand, "dedup" }) + .SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT) + .SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR); + + auto chain = builder.Start(); + if (!chain.Valid()) { + std::cout << "Valid() returned false, should be true" << std::endl; + return false; + } + + // Some platforms, like Solaris 10, take a long time to report a trapped + // subprocess to the parent process (about 1.7 seconds in the case of + // Solaris 10.) Wait 3 seconds to give it enough time. + if (chain.Wait(3000)) { + std::cout << "Wait() did not time out" << std::endl; + return false; + } + + status = chain.GetStatus(); + if (!resultsMatch(status, status1)) { + std::cout << "GetStatus() did not produce expected output" << std::endl; + printResults(status, status1); + return false; + } + + if (!chain.Wait()) { + std::cout << "Wait() timed out" << std::endl; + return false; + } + + status = chain.GetStatus(); + if (!resultsMatch(status, status2)) { + std::cout << "GetStatus() did not produce expected output" << std::endl; + printResults(status, status2); + return false; + } + + return true; +} + int testUVProcessChain(int argc, char** const argv) { if (argc < 2) { @@ -518,5 +652,10 @@ int testUVProcessChain(int argc, char** const argv) return -1; } + if (!testUVProcessChainSpawnFail(argv[1])) { + std::cout << "While executing testUVProcessChainSpawnFail().\n"; + return -1; + } + return 0; } diff --git a/Tests/CMakeLib/testUVProcessChainHelper.cxx b/Tests/CMakeLib/testUVProcessChainHelper.cxx index 99743e7ace8..fcc45b04960 100644 --- a/Tests/CMakeLib/testUVProcessChainHelper.cxx +++ b/Tests/CMakeLib/testUVProcessChainHelper.cxx @@ -32,13 +32,13 @@ int main(int argc, char** argv) std::string command = argv[1]; if (command == "echo") { - std::this_thread::sleep_for(std::chrono::milliseconds(3000)); + std::this_thread::sleep_for(std::chrono::milliseconds(6000)); std::cout << "HELLO world!" << std::flush; std::cerr << "1" << std::flush; return 0; } if (command == "capitalize") { - std::this_thread::sleep_for(std::chrono::milliseconds(9000)); + std::this_thread::sleep_for(std::chrono::milliseconds(12000)); std::string input = getStdin(); for (auto& c : input) { c = static_cast(std::toupper(c)); From f3c5fd98d8421c9f222ef001fd4219b465f1d18a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 9 Jun 2023 00:01:13 -0400 Subject: [PATCH 010/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 339b9fab02a..df731bdd00b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230608) +set(CMake_VERSION_PATCH 20230609) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 0b4e9ddfc88d0e2a484fefa03f0f5736daf74487 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 10 Jun 2023 00:01:13 -0400 Subject: [PATCH 011/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index df731bdd00b..22a96fc4649 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230609) +set(CMake_VERSION_PATCH 20230610) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From f15ab882b1e1b70a61938cbafe3b88e0bb4f6aeb Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 11 Jun 2023 00:01:10 -0400 Subject: [PATCH 012/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 22a96fc4649..41b4626f874 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230610) +set(CMake_VERSION_PATCH 20230611) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 6bbbd01f7524ab04bea1486a043f313b1a0cf38c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 12 Jun 2023 00:01:30 -0400 Subject: [PATCH 013/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 41b4626f874..d06a7dc1b60 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230611) +set(CMake_VERSION_PATCH 20230612) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From e3297045467e7bb6389237e9ace2815abef61159 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 5 Jun 2023 13:11:19 -0400 Subject: [PATCH 014/627] cmUVProcessChain: Add support for SetExternalStream(Stream_INPUT) --- Source/cmUVProcessChain.cxx | 27 ++++++++++++++++++---- Tests/CMakeLib/CMakeLists.txt | 1 + Tests/CMakeLib/testUVProcessChain.cxx | 33 +++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index a9e57e67b2c..cf4475b6967 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -64,6 +64,7 @@ struct cmUVProcessChain::InternalData cm::uv_loop_ptr Loop; + StreamData InputStreamData; StreamData OutputStreamData; StreamData ErrorStreamData; cm::uv_pipe_ptr TempOutputPipe; @@ -134,9 +135,6 @@ cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetExternalStream( { switch (stdio) { case Stream_INPUT: - // FIXME - break; - case Stream_OUTPUT: case Stream_ERROR: { auto& streamData = this->Stdio[stdio]; @@ -184,6 +182,25 @@ bool cmUVProcessChain::InternalData::Prepare( { this->Builder = builder; + auto const& input = + this->Builder->Stdio[cmUVProcessChainBuilder::Stream_INPUT]; + auto& inputData = this->InputStreamData; + switch (input.Type) { + case cmUVProcessChainBuilder::None: + inputData.Stdio.flags = UV_IGNORE; + break; + + case cmUVProcessChainBuilder::Builtin: { + // FIXME + break; + } + + case cmUVProcessChainBuilder::External: + inputData.Stdio.flags = UV_INHERIT_FD; + inputData.Stdio.data.fd = input.FileDescriptor; + break; + } + auto const& error = this->Builder->Stdio[cmUVProcessChainBuilder::Stream_ERROR]; auto& errorData = this->ErrorStreamData; @@ -328,10 +345,10 @@ void cmUVProcessChain::InternalData::SpawnProcess( } std::array stdio; - stdio[0] = uv_stdio_container_t(); if (first) { - stdio[0].flags = UV_IGNORE; + stdio[0] = this->InputStreamData.Stdio; } else { + stdio[0] = uv_stdio_container_t(); stdio[0].flags = UV_INHERIT_STREAM; stdio[0].data.stream = process.InputPipe; } diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 5c14de2c0da..b22d76d36a7 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -63,6 +63,7 @@ if(WIN32) endif() configure_file(testXMLParser.h.in testXMLParser.h @ONLY) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testUVProcessChainInput.txt" "HELLO WORLD!") create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS}) add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS}) diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index e0a67e97e20..f3024dc71f6 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -615,6 +616,33 @@ bool testUVProcessChainSpawnFail(const char* helperCommand) return true; } +bool testUVProcessChainInputFile(const char* helperCommand) +{ + std::unique_ptr f( + fopen("testUVProcessChainInput.txt", "rb"), fclose); + + cmUVProcessChainBuilder builder; + builder.AddCommand({ helperCommand, "dedup" }) + .SetExternalStream(cmUVProcessChainBuilder::Stream_INPUT, fileno(f.get())) + .SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT); + + auto chain = builder.Start(); + + if (!chain.Wait()) { + std::cout << "Wait() timed out" << std::endl; + return false; + } + + std::string output = getInput(*chain.OutputStream()); + if (output != "HELO WRD!") { + std::cout << "Output was \"" << output << "\", expected \"HELO WRD!\"" + << std::endl; + return false; + } + + return true; +} + int testUVProcessChain(int argc, char** const argv) { if (argc < 2) { @@ -657,5 +685,10 @@ int testUVProcessChain(int argc, char** const argv) return -1; } + if (!testUVProcessChainInputFile(argv[1])) { + std::cout << "While executing testUVProcessChainInputFile().\n"; + return -1; + } + return 0; } From 704c9b5a81d6c41104ae9229b1cefa8803a58b52 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 13 Jun 2023 00:01:11 -0400 Subject: [PATCH 015/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d06a7dc1b60..c59fc45923b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230612) +set(CMake_VERSION_PATCH 20230613) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 15b1cdd67b275a48504b1cc3cba97953b2010f86 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 13 Jun 2023 08:29:38 -0400 Subject: [PATCH 016/627] ci: Update ISPC 1.20.0 macOS binary hashes The ISPC 1.20.0 release page on GitHub replaced existing macOS release binaries with new ones. Update the hashes added by commit 44d13f50a2 (ci: Update to ISPC 1.20.0, 2023-05-09, v3.27.0-rc1~110^2). --- .gitlab/ci/ispc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/ci/ispc.sh b/.gitlab/ci/ispc.sh index 59ee200ea64..c1e379368c3 100755 --- a/.gitlab/ci/ispc.sh +++ b/.gitlab/ci/ispc.sh @@ -12,12 +12,12 @@ case "$(uname -s)-$(uname -m)" in ;; Darwin-arm64) shatool="shasum -a 256" - sha256sum="62cee043a3a4dbff8c2f6d3885a7e573901bbc1325dd93d50f92904b7ea67fec" + sha256sum="c423a5a88d7a9a6ed667e41d025801c123fa0c5fd384d4ea138fa1fcf2bc24c9" platform="macOS.arm64" ;; Darwin-x86_64) shatool="shasum -a 256" - sha256sum="da0f11a048a316081a8ad8170d48b170b2ed7efc3b140fc88b8611238809c8e4" + sha256sum="e25222d2d6f4f8e3561556ac73f88721ceb5486439d6c2a566d37407ad9a5907" platform="macOS.x86_64" ;; *) From ac44557c7b216bf7e1f613070c5406bc1bc07656 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 13 Jun 2023 11:20:55 -0400 Subject: [PATCH 017/627] ci: Disable sccache for macOS Ninja Multi-Config nightly job The job frequently fails during `ctest_build`, and the log shows sccache: Compiler killed by signal 9 It does not compile much anyway, so disable sccache pending further investigation. --- .gitlab/ci/configure_macos_arm64_ninja_multi.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake b/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake index b22285c65b7..d81bd300547 100644 --- a/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake +++ b/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake @@ -2,5 +2,9 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "") set(CMake_TEST_ISPC "ON" CACHE STRING "") endif() +# FIXME: sccache sometimes fails with "Compiler killed by signal 9". +# This job does not compile much anyway, so suppress it for now. +set(configure_no_sccache 1) + include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_common.cmake") include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") From f444f172c3c00c3aa61395a9eb3a80fef6bd9528 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 13 Jun 2023 13:47:28 -0400 Subject: [PATCH 018/627] cmVisualStudio10TargetGenerator: Remove unused VS-10-only code Remove code that is not used since commit 8d6f015d59 (Drop Visual Studio 10 2010 generator, 2022-09-26, v3.25.0-rc1~78^2). --- Source/cmVisualStudio10TargetGenerator.cxx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 79750188081..5887ca2f7ad 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2533,18 +2533,6 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) break; case cmGeneratorTarget::SourceKindExternalObject: tool = "Object"; - if (this->LocalGenerator->GetVersion() < - cmGlobalVisualStudioGenerator::VSVersion::VS11) { - // For VS == 10 we cannot use LinkObjects to avoid linking custom - // command outputs. If an object file is generated in this target, - // then vs10 will use it in the build, and we have to list it as - // None instead of Object. - std::vector const* d = - this->GeneratorTarget->GetSourceDepends(si.Source); - if (d && !d->empty()) { - tool = "None"; - } - } break; case cmGeneratorTarget::SourceKindExtra: this->WriteExtraSource(e1, si.Source, toolSettings); From 7005dea00589143e2d91d863a7d419385a0babf4 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 6 Jun 2023 08:43:39 -0400 Subject: [PATCH 019/627] CrossCompiling: Load CMAKE_CROSSCOMPILING_EMULATOR from environment Read `CMAKE_CROSSCOMPILING_EMULATOR` from an environment variable of the same name if not specified with `-D` or an initial cache value. Along with existing environment variable settings such as `CMAKE_TOOLCHAIN_FILE`, cross compilation configuration can be more completely set via environment variables. Suggested-by: Henry Schreiner --- Help/envvar/CMAKE_CROSSCOMPILING_EMULATOR.rst | 11 +++++++++++ Help/manual/cmake-env-variables.7.rst | 1 + .../CMAKE_CROSSCOMPILING_EMULATOR-env-variable.rst | 6 ++++++ Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst | 4 ++++ Source/cmake.cxx | 12 ++++++++++++ .../EnvCrossCompilingEmulator-stdout.txt | 2 ++ .../EnvCrossCompilingEmulator.cmake | 6 ++++++ .../CrosscompilingEmulator/RunCMakeTest.cmake | 8 ++++++++ 8 files changed, 50 insertions(+) create mode 100644 Help/envvar/CMAKE_CROSSCOMPILING_EMULATOR.rst create mode 100644 Help/release/dev/CMAKE_CROSSCOMPILING_EMULATOR-env-variable.rst create mode 100644 Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt create mode 100644 Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake diff --git a/Help/envvar/CMAKE_CROSSCOMPILING_EMULATOR.rst b/Help/envvar/CMAKE_CROSSCOMPILING_EMULATOR.rst new file mode 100644 index 00000000000..3e397d85bbb --- /dev/null +++ b/Help/envvar/CMAKE_CROSSCOMPILING_EMULATOR.rst @@ -0,0 +1,11 @@ +CMAKE_CROSSCOMPILING_EMULATOR +----------------------------- + +.. versionadded:: 3.28 + +.. include:: ENV_VAR.txt + +The default value for :variable:`CMAKE_CROSSCOMPILING_EMULATOR` when there +is no explicit configuration given on the first run while creating a new +build tree. On later runs in an existing build tree the value persists in +the cache as :variable:`CMAKE_CROSSCOMPILING_EMULATOR`. diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 197e56eb1f3..356e73d7f5a 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -43,6 +43,7 @@ Environment Variables that Control the Build /envvar/CMAKE_COLOR_DIAGNOSTICS /envvar/CMAKE_CONFIGURATION_TYPES /envvar/CMAKE_CONFIG_TYPE + /envvar/CMAKE_CROSSCOMPILING_EMULATOR /envvar/CMAKE_EXPORT_COMPILE_COMMANDS /envvar/CMAKE_GENERATOR /envvar/CMAKE_GENERATOR_INSTANCE diff --git a/Help/release/dev/CMAKE_CROSSCOMPILING_EMULATOR-env-variable.rst b/Help/release/dev/CMAKE_CROSSCOMPILING_EMULATOR-env-variable.rst new file mode 100644 index 00000000000..269e739d403 --- /dev/null +++ b/Help/release/dev/CMAKE_CROSSCOMPILING_EMULATOR-env-variable.rst @@ -0,0 +1,6 @@ +CMAKE_CROSSCOMPILING_EMULATOR-env-variable +------------------------------------------ + +* The :envvar:`CMAKE_CROSSCOMPILING_EMULATOR` environment variable + was added to initialize the :variable:`CMAKE_CROSSCOMPILING_EMULATOR` + cache variable. diff --git a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst index e21b35d619c..1c3a26c1865 100644 --- a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst +++ b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst @@ -12,6 +12,10 @@ for the target system. Lists>`, then the first value is the command and remaining values are its arguments. +.. versionadded:: 3.28 + This variable can be initialized via an + :envvar:`CMAKE_CROSSCOMPILING_EMULATOR` environment variable. + The command will be used to run :command:`try_run` generated executables, which avoids manual population of the ``TryRunResults.cmake`` file. diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f30d4d357f0..f0a88816ebe 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2507,6 +2507,18 @@ int cmake::ActualConfigure() "Name of generator toolset.", cmStateEnums::INTERNAL); } + if (!this->State->GetInitializedCacheValue( + "CMAKE_CROSSCOMPILING_EMULATOR")) { + cm::optional emulator = + cmSystemTools::GetEnvVar("CMAKE_CROSSCOMPILING_EMULATOR"); + if (emulator && !emulator->empty()) { + std::string message = + "Emulator to run executables and tests when cross compiling."; + this->AddCacheEntry("CMAKE_CROSSCOMPILING_EMULATOR", *emulator, message, + cmStateEnums::STRING); + } + } + // reset any system configuration information, except for when we are // InTryCompile. With TryCompile the system info is taken from the parent's // info to save time diff --git a/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt new file mode 100644 index 00000000000..9a7d7465186 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt @@ -0,0 +1,2 @@ +-- env_emulator='pseudo_emulator(\.exe)?' +-- emulator='pseudo_emulator(\.exe)?' diff --git a/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake new file mode 100644 index 00000000000..55fc4834d1b --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake @@ -0,0 +1,6 @@ +message(STATUS "ENV{CMAKE_CROSS_COMPILING_EMULATOR}='$ENV{CMAKE_CROSSCOMPILING_EMULATOR}'") +message(STATUS "CMAKE_CROSSCOMPLING_EMULATOR='${CMAKE_CROSSCOMPILING_EMULATOR}'") +get_filename_component(env_emulator "$ENV{CMAKE_CROSSCOMPILING_EMULATOR}" NAME) +message(STATUS "env_emulator='${env_emulator}'") +get_filename_component(emulator "${CMAKE_CROSSCOMPILING_EMULATOR}" NAME) +message(STATUS "emulator='${emulator}'") diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake index 97b7b5a3176..1ffd91c7450 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake @@ -26,3 +26,11 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR_CUSTOM_COMMAND_ARG}\;custom_argument") CustomCommandGenerator_run_and_build(AddCustomCommandWithArg) CustomCommandGenerator_run_and_build(AddCustomTargetWithArg) +unset(RunCMake_TEST_OPTIONS) + +function(run_EnvCrossCompilingEmulator) + set(ENV{CMAKE_CROSSCOMPILING_EMULATOR} "${PSEUDO_EMULATOR}") + run_cmake(EnvCrossCompilingEmulator) + unset(ENV{CMAKE_CROSSCOMPILING_EMULATOR}) +endfunction() +run_EnvCrossCompilingEmulator() From 536c1de1d442c46c23e40ae7b3f60f1a34b11134 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 13 Jun 2023 13:48:20 -0400 Subject: [PATCH 020/627] Drop Visual Studio 11 2012 generator This generator has been deprecated since CMake 3.25. Remove it. --- Help/command/add_custom_command.rst | 2 +- Help/generator/Visual Studio 11 2012.rst | 59 +------- Help/prop_tgt/VS_DEBUGGER_COMMAND.rst | 2 +- .../VS_DEBUGGER_COMMAND_ARGUMENTS.rst | 2 +- Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst | 2 +- .../VS_DEBUGGER_WORKING_DIRECTORY.rst | 2 +- Help/prop_tgt/VS_DOTNET_STARTUP_OBJECT.rst | 2 +- Help/prop_tgt/VS_KEYWORD.rst | 2 +- Help/release/dev/remove-vs11-generator.rst | 4 + Help/variable/CMAKE_CFG_INTDIR.rst | 2 +- Help/variable/CMAKE_VS_DEVENV_COMMAND.rst | 2 +- Help/variable/CMAKE_VS_MSBUILD_COMMAND.rst | 2 +- Modules/CMakeDetermineCSharpCompiler.cmake | 2 +- Modules/UseSWIG.cmake | 4 +- Source/cmGlobalVisualStudio10Generator.cxx | 1 - Source/cmGlobalVisualStudio11Generator.cxx | 139 ------------------ Source/cmGlobalVisualStudio11Generator.h | 9 -- Source/cmGlobalVisualStudio7Generator.cxx | 20 --- Source/cmGlobalVisualStudioGenerator.cxx | 10 -- Source/cmGlobalVisualStudioGenerator.h | 1 - ...cmGlobalVisualStudioVersionedGenerator.cxx | 9 -- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmVisualStudioGeneratorOptions.cxx | 1 - Source/cmake.cxx | 3 - Tests/CMakeLists.txt | 18 --- .../CommandLine/DeprecateVS11-WARN-OFF.cmake | 0 .../DeprecateVS11-WARN-ON-stderr.txt | 5 - .../CommandLine/DeprecateVS11-WARN-ON.cmake | 0 Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 7 - 29 files changed, 23 insertions(+), 291 deletions(-) create mode 100644 Help/release/dev/remove-vs11-generator.rst delete mode 100644 Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake delete mode 100644 Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt delete mode 100644 Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index 7b3aa1a00c2..6dc68321cc1 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -512,7 +512,7 @@ one of the keywords to make clear the behavior they expect. Because generator expressions can be used in custom commands, it is possible to define ``COMMAND`` lines or whole custom commands which evaluate to empty strings for certain configurations. - For **Visual Studio 11 2012 (and newer)** generators these command + For **Visual Studio 12 2013 (and newer)** generators these command lines or custom commands will be omitted for the specific configuration and no "empty-string-command" will be added. diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst index 4e7195c66e0..fd8c314c5e5 100644 --- a/Help/generator/Visual Studio 11 2012.rst +++ b/Help/generator/Visual Studio 11 2012.rst @@ -1,57 +1,8 @@ Visual Studio 11 2012 --------------------- -Deprecated. Generates Visual Studio 11 (VS 2012) project files. - -.. note:: - This generator is deprecated and will be removed in a future version - of CMake. It will still be possible to build with VS 11 2012 tools - using the :generator:`Visual Studio 12 2013` (or above) generator - with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v110``, or by - using the :generator:`NMake Makefiles` generator. - -For compatibility with CMake versions prior to 3.0, one may specify this -generator using the name "Visual Studio 11" without the year component. - -Project Types -^^^^^^^^^^^^^ - -Only Visual C++ and C# projects may be generated (and Fortran with -Intel compiler integration). Other types of projects (JavaScript, -Database, Website, etc.) are not supported. - -Platform Selection -^^^^^^^^^^^^^^^^^^ - -The default target platform name (architecture) is ``Win32``. - -.. versionadded:: 3.1 - The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps - via the :option:`cmake -A` option, to specify a target platform - name (architecture). For example: - - * ``cmake -G "Visual Studio 11 2012" -A Win32`` - * ``cmake -G "Visual Studio 11 2012" -A x64`` - * ``cmake -G "Visual Studio 11 2012" -A ARM`` - * ``cmake -G "Visual Studio 11 2012" -A `` - (Specify a target platform matching a Windows CE SDK name.) - -For compatibility with CMake versions prior to 3.1, one may specify -a target platform name optionally at the end of the generator name. -This is supported only for: - -``Visual Studio 11 2012 Win64`` - Specify target platform ``x64``. - -``Visual Studio 11 2012 ARM`` - Specify target platform ``ARM``. - -``Visual Studio 11 2012 `` - Specify target platform matching a Windows CE SDK name. - -Toolset Selection -^^^^^^^^^^^^^^^^^ - -The ``v110`` toolset that comes with Visual Studio 11 2012 is selected by -default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps -via the :option:`cmake -T` option, to specify another toolset. +Removed. This once generated Visual Studio 11 2012 project files, but +the generator has been removed since CMake 3.28. It is still possible +to build with VS 11 2012 tools using the :generator:`Visual Studio 12 2013` +(or above) generator with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v110``, +or by using the :generator:`NMake Makefiles` generator. diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst index 5bf47a38a9b..8c136f24cb0 100644 --- a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst +++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst @@ -11,5 +11,5 @@ project file. This property is initialized by the value of the variable :variable:`CMAKE_VS_DEBUGGER_COMMAND` if it is set when a target is created. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst index 4b9dff71555..2656826aa52 100644 --- a/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst +++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst @@ -11,5 +11,5 @@ project file. This property is initialized by the value of the variable :variable:`CMAKE_VS_DEBUGGER_COMMAND_ARGUMENTS` if it is set when a target is created. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst b/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst index 8373dbb5c8b..d78d594ef3a 100644 --- a/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst +++ b/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst @@ -11,5 +11,5 @@ project file. This property is initialized by the value of the variable :variable:`CMAKE_VS_DEBUGGER_ENVIRONMENT` if it is set when a target is created. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst index 39420475bd5..1026dfae8ac 100644 --- a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst +++ b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst @@ -11,5 +11,5 @@ project file. This property is initialized by the value of the variable :variable:`CMAKE_VS_DEBUGGER_WORKING_DIRECTORY` if it is set when a target is created. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DOTNET_STARTUP_OBJECT.rst b/Help/prop_tgt/VS_DOTNET_STARTUP_OBJECT.rst index 8a85ba489e8..eeb7ddad2cf 100644 --- a/Help/prop_tgt/VS_DOTNET_STARTUP_OBJECT.rst +++ b/Help/prop_tgt/VS_DOTNET_STARTUP_OBJECT.rst @@ -12,7 +12,7 @@ If the property is unset, Visual Studio uses the first matching than one ``Main()`` method is available in the current project, the property becomes mandatory for building the project. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. .. code-block:: cmake diff --git a/Help/prop_tgt/VS_KEYWORD.rst b/Help/prop_tgt/VS_KEYWORD.rst index 221b986ac32..f04d1091b26 100644 --- a/Help/prop_tgt/VS_KEYWORD.rst +++ b/Help/prop_tgt/VS_KEYWORD.rst @@ -7,4 +7,4 @@ Can be set to change the visual studio keyword, for example Qt integration works better if this is set to Qt4VSv1.0. Use the :prop_tgt:`VS_GLOBAL_KEYWORD` target property to set the -keyword for Visual Studio 11 (2012) and newer. +keyword for Visual Studio 12 (2013) and newer. diff --git a/Help/release/dev/remove-vs11-generator.rst b/Help/release/dev/remove-vs11-generator.rst new file mode 100644 index 00000000000..971d679af2f --- /dev/null +++ b/Help/release/dev/remove-vs11-generator.rst @@ -0,0 +1,4 @@ +remove-vs11-generator +--------------------- + +* The :generator:`Visual Studio 11 2012` generator has been removed. diff --git a/Help/variable/CMAKE_CFG_INTDIR.rst b/Help/variable/CMAKE_CFG_INTDIR.rst index 3a57659c05e..3045d914a78 100644 --- a/Help/variable/CMAKE_CFG_INTDIR.rst +++ b/Help/variable/CMAKE_CFG_INTDIR.rst @@ -19,7 +19,7 @@ Example values: :: $(ConfigurationName) = Visual Studio 9 - $(Configuration) = Visual Studio 11 and above + $(Configuration) = Visual Studio 12 and above $(CONFIGURATION) = Xcode . = Make-based tools . = Ninja diff --git a/Help/variable/CMAKE_VS_DEVENV_COMMAND.rst b/Help/variable/CMAKE_VS_DEVENV_COMMAND.rst index 2bb97c42dd7..155931f8f67 100644 --- a/Help/variable/CMAKE_VS_DEVENV_COMMAND.rst +++ b/Help/variable/CMAKE_VS_DEVENV_COMMAND.rst @@ -10,5 +10,5 @@ This variable is not defined by other generators even if ``devenv.com`` is installed on the computer. The :variable:`CMAKE_VS_MSBUILD_COMMAND` is also provided for -:generator:`Visual Studio 11 2012` and above. +:generator:`Visual Studio 12 2013` and above. See also the :variable:`CMAKE_MAKE_PROGRAM` variable. diff --git a/Help/variable/CMAKE_VS_MSBUILD_COMMAND.rst b/Help/variable/CMAKE_VS_MSBUILD_COMMAND.rst index 8a521a3c8cf..96924d59c54 100644 --- a/Help/variable/CMAKE_VS_MSBUILD_COMMAND.rst +++ b/Help/variable/CMAKE_VS_MSBUILD_COMMAND.rst @@ -1,7 +1,7 @@ CMAKE_VS_MSBUILD_COMMAND ------------------------ -The generators for :generator:`Visual Studio 11 2012` and above set this +The generators for :generator:`Visual Studio 12 2013` and above set this variable to the ``MSBuild.exe`` command installed with the corresponding Visual Studio version. diff --git a/Modules/CMakeDetermineCSharpCompiler.cmake b/Modules/CMakeDetermineCSharpCompiler.cmake index fe98469330e..652eb63e2ce 100644 --- a/Modules/CMakeDetermineCSharpCompiler.cmake +++ b/Modules/CMakeDetermineCSharpCompiler.cmake @@ -3,7 +3,7 @@ if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") message(FATAL_ERROR - "C# is currently only supported for Microsoft Visual Studio 11 2012 and later.") + "C# is currently only supported for Microsoft Visual Studio 12 2013 and later.") endif() include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index ca16bc2eae5..cece97352f6 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -189,7 +189,7 @@ ensure generated files will receive the required settings. :ref:`Makefile `, :ref:`Ninja `, :generator:`Xcode`, and :ref:`Visual Studio ` - (:generator:`Visual Studio 11 2012` and above) generators. Default value is + (:generator:`Visual Studio 12 2013` and above) generators. Default value is ``FALSE``. .. versionadded:: 3.21 @@ -353,7 +353,7 @@ as well as ``SWIG``: :ref:`Makefile `, :ref:`Ninja `, :generator:`Xcode`, and :ref:`Visual Studio ` - (:generator:`Visual Studio 11 2012` and above) generators. Default value is + (:generator:`Visual Studio 12 2013` and above) generators. Default value is ``FALSE``. Source file property ``USE_SWIG_DEPENDENCIES``, if not defined, will be diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 321f3779d02..f1d04e56101 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1230,7 +1230,6 @@ const char* cmGlobalVisualStudio10Generator::GetToolsVersion() const { switch (this->Version) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: - case cmGlobalVisualStudioGenerator::VSVersion::VS11: return "4.0"; // in Visual Studio 2013 they detached the MSBuild tools version diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 3ad10eb2236..c4e1e1115d6 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -8,156 +8,17 @@ #include #include "cmGlobalGenerator.h" -#include "cmGlobalGeneratorFactory.h" #include "cmGlobalVisualStudioGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -static const char vs11generatorName[] = "Visual Studio 11 2012"; - -// Map generator name without year to name with year. -static const char* cmVS11GenName(const std::string& name, std::string& genName) -{ - if (strncmp(name.c_str(), vs11generatorName, - sizeof(vs11generatorName) - 6) != 0) { - return nullptr; - } - const char* p = name.c_str() + sizeof(vs11generatorName) - 6; - if (cmHasLiteralPrefix(p, " 2012")) { - p += 5; - } - genName = std::string(vs11generatorName) + p; - return p; -} - -class cmGlobalVisualStudio11Generator::Factory - : public cmGlobalGeneratorFactory -{ -public: - std::unique_ptr CreateGlobalGenerator( - const std::string& name, bool allowArch, cmake* cm) const override - { - std::string genName; - const char* p = cmVS11GenName(name, genName); - if (!p) { - return std::unique_ptr(); - } - if (!*p) { - return std::unique_ptr( - new cmGlobalVisualStudio11Generator(cm, genName, "")); - } - if (!allowArch || *p++ != ' ') { - return std::unique_ptr(); - } - if (strcmp(p, "Win64") == 0) { - return std::unique_ptr( - new cmGlobalVisualStudio11Generator(cm, genName, "x64")); - } - if (strcmp(p, "ARM") == 0) { - return std::unique_ptr( - new cmGlobalVisualStudio11Generator(cm, genName, "ARM")); - } - - std::set installedSDKs = - cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); - - if (installedSDKs.find(p) == installedSDKs.end()) { - return std::unique_ptr(); - } - - auto ret = std::unique_ptr( - new cmGlobalVisualStudio11Generator(cm, name, p)); - ret->WindowsCEVersion = "8.00"; - return std::unique_ptr(std::move(ret)); - } - - cmDocumentationEntry GetDocumentation() const override - { - return { std::string(vs11generatorName) + " [arch]", - "Deprecated. Generates Visual Studio 2012 project files. " - "Optional [arch] can be \"Win64\" or \"ARM\"." }; - } - - std::vector GetGeneratorNames() const override - { - std::vector names; - names.push_back(vs11generatorName); - return names; - } - - std::vector GetGeneratorNamesWithPlatform() const override - { - std::vector names; - names.push_back(vs11generatorName + std::string(" ARM")); - names.push_back(vs11generatorName + std::string(" Win64")); - - std::set installedSDKs = - cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); - for (std::string const& i : installedSDKs) { - names.push_back(std::string(vs11generatorName) + " " + i); - } - - return names; - } - - bool SupportsToolset() const override { return true; } - bool SupportsPlatform() const override { return true; } - - std::vector GetKnownPlatforms() const override - { - std::vector platforms; - platforms.emplace_back("x64"); - platforms.emplace_back("Win32"); - platforms.emplace_back("ARM"); - - std::set installedSDKs = - cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); - for (std::string const& i : installedSDKs) { - platforms.emplace_back(i); - } - - return platforms; - } - - std::string GetDefaultPlatformName() const override { return "Win32"; } -}; - -std::unique_ptr -cmGlobalVisualStudio11Generator::NewFactory() -{ - return std::unique_ptr(new Factory); -} - cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( cmake* cm, const std::string& name, std::string const& platformInGeneratorName) : cmGlobalVisualStudio10Generator(cm, name, platformInGeneratorName) { - std::string vc11Express; - this->ExpressEdition = cmSystemTools::ReadRegistryValue( - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;" - "ProductDir", - vc11Express, cmSystemTools::KeyWOW64_32); - this->DefaultPlatformToolset = "v110"; - this->DefaultCLFlagTableName = "v11"; - this->DefaultCSharpFlagTableName = "v11"; - this->DefaultLibFlagTableName = "v11"; - this->DefaultLinkFlagTableName = "v11"; - this->DefaultMasmFlagTableName = "v11"; - this->DefaultRCFlagTableName = "v11"; - this->Version = VSVersion::VS11; -} - -bool cmGlobalVisualStudio11Generator::MatchesGeneratorName( - const std::string& name) const -{ - std::string genName; - if (cmVS11GenName(name, genName)) { - return genName == this->GetName(); - } - return false; } void cmGlobalVisualStudio11Generator::EnableLanguage( diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index fd25984f5bd..ad12c1f37fa 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -13,7 +13,6 @@ #include "cmGlobalVisualStudio10Generator.h" #include "cmTransformDepfile.h" -class cmGlobalGeneratorFactory; class cmMakefile; class cmake; @@ -21,10 +20,6 @@ class cmake; class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator { public: - static std::unique_ptr NewFactory(); - - bool MatchesGeneratorName(const std::string& name) const override; - void EnableLanguage(std::vector const& languages, cmMakefile*, bool optional) override; @@ -58,8 +53,4 @@ class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator /** Return true if target system supports debugging deployment. */ bool TargetSystemSupportsDeployment() const override; - -private: - class Factory; - friend class Factory; }; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index b254777f3c6..62c0b5b20c3 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -329,26 +329,6 @@ void cmGlobalVisualStudio7Generator::Generate() "Add CMAKE_WARN_VS9=OFF to the cache to disable this warning."); } } - - if (this->Version == VSVersion::VS11 && - !this->CMakeInstance->GetIsInTryCompile()) { - std::string cmakeWarnVS11; - if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue( - "CMAKE_WARN_VS11")) { - this->CMakeInstance->MarkCliAsUsed("CMAKE_WARN_VS11"); - cmakeWarnVS11 = *cached; - } else { - cmSystemTools::GetEnv("CMAKE_WARN_VS11", cmakeWarnVS11); - } - if (cmakeWarnVS11.empty() || !cmIsOff(cmakeWarnVS11)) { - this->CMakeInstance->IssueMessage( - MessageType::WARNING, - "The \"Visual Studio 11 2012\" generator is deprecated " - "and will be removed in a future version of CMake." - "\n" - "Add CMAKE_WARN_VS11=OFF to the cache to disable this warning."); - } - } } void cmGlobalVisualStudio7Generator::OutputSLNFile( diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 702199d3e9f..eac0672cb53 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -97,8 +97,6 @@ const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const switch (this->Version) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: return "9.0"; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - return "11.0"; case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "12.0"; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -124,14 +122,6 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; fout << "# Visual Studio 2008\n"; break; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 2012 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 2012\n"; - } - break; case cmGlobalVisualStudioGenerator::VSVersion::VS12: fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; if (this->ExpressEdition) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 3e20ada2d4f..3008c1841c6 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -35,7 +35,6 @@ class cmGlobalVisualStudioGenerator : public cmGlobalGenerator enum class VSVersion : uint16_t { VS9 = 90, - VS11 = 110, VS12 = 120, /* VS13 = 130 was skipped */ VS14 = 140, diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 602b42fbc8a..9fe66d327cd 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -127,8 +127,6 @@ static unsigned int VSVersionToMajor( switch (v) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: return 9; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - return 11; case cmGlobalVisualStudioGenerator::VSVersion::VS12: return 12; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -149,8 +147,6 @@ static const char* VSVersionToToolset( switch (v) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: return "v90"; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - return "v110"; case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "v120"; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -171,8 +167,6 @@ static std::string VSVersionToMajorString( switch (v) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: return "9"; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - return "11"; case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "12"; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -192,7 +186,6 @@ static const char* VSVersionToAndroidToolset( { switch (v) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: - case cmGlobalVisualStudioGenerator::VSVersion::VS11: case cmGlobalVisualStudioGenerator::VSVersion::VS12: return ""; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -493,7 +486,6 @@ bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName( std::string genName; switch (this->Version) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: - case cmGlobalVisualStudioGenerator::VSVersion::VS11: case cmGlobalVisualStudioGenerator::VSVersion::VS12: case cmGlobalVisualStudioGenerator::VSVersion::VS14: break; @@ -761,7 +753,6 @@ cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision() { switch (this->Version) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: - case cmGlobalVisualStudioGenerator::VSVersion::VS11: case cmGlobalVisualStudioGenerator::VSVersion::VS12: return ""; case cmGlobalVisualStudioGenerator::VSVersion::VS14: diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index af0e118272a..24ef5c2c1a4 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -198,7 +198,7 @@ void cmLocalVisualStudio7Generator::GenerateTarget(cmGeneratorTarget* target) // Intel Fortran always uses VS9 format ".vfproj" files. cmGlobalVisualStudioGenerator::VSVersion realVersion = gg->GetVersion(); if (this->FortranProject && - gg->GetVersion() >= cmGlobalVisualStudioGenerator::VSVersion::VS11) { + gg->GetVersion() >= cmGlobalVisualStudioGenerator::VSVersion::VS12) { gg->SetVersion(cmGlobalVisualStudioGenerator::VSVersion::VS9); } diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 6e9887456b5..7e4503b7aab 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -75,7 +75,6 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() // the flag to disable exception handling. When the user does // remove the flag we need to override the IDE default of on. switch (this->Version) { - case cmGlobalVisualStudioGenerator::VSVersion::VS11: case cmGlobalVisualStudioGenerator::VSVersion::VS12: case cmGlobalVisualStudioGenerator::VSVersion::VS14: case cmGlobalVisualStudioGenerator::VSVersion::VS15: diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 791569ccf00..1fa6ba15960 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -94,7 +94,6 @@ # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" -# include "cmGlobalVisualStudio11Generator.h" # include "cmGlobalVisualStudio12Generator.h" # include "cmGlobalVisualStudio14Generator.h" # include "cmGlobalVisualStudio9Generator.h" @@ -2605,7 +2604,6 @@ std::unique_ptr cmake::EvaluateDefaultGlobalGenerator() static VSVersionedGenerator const vsGenerators[] = { { "14.0", "Visual Studio 14 2015" }, // { "12.0", "Visual Studio 12 2013" }, // - { "11.0", "Visual Studio 11 2012" }, // { "9.0", "Visual Studio 9 2008" } }; static const char* const vsEntries[] = { @@ -2990,7 +2988,6 @@ void cmake::AddDefaultGenerators() cmGlobalVisualStudioVersionedGenerator::NewFactory15()); this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory()); - this->Generators.push_back(cmGlobalVisualStudio11Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio9Generator::NewFactory()); this->Generators.push_back(cmGlobalBorlandMakefileGenerator::NewFactory()); this->Generators.push_back(cmGlobalNMakeMakefileGenerator::NewFactory()); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 53bb1e654bd..c08dd8616ca 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -42,8 +42,6 @@ endif() # Suppress generator deprecation warnings in test suite. if(CMAKE_GENERATOR MATCHES "^Visual Studio 9 2008") set(TEST_WARN_VS_CODE "set(ENV{CMAKE_WARN_VS9} OFF)") -elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 11 2012") - set(TEST_WARN_VS_CODE "set(ENV{CMAKE_WARN_VS11} OFF)") else() set(TEST_WARN_VS_CODE "") endif() @@ -2279,11 +2277,6 @@ if(BUILD_TESTING) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSWinStorePhone/${name}") endmacro() - if(vs11 AND ws80) - add_test_VSWinStorePhone(vs11-store80-X86 "Visual Studio 11 2012" WindowsStore 8.0 Win32) - add_test_VSWinStorePhone(vs11-store80-ARM "Visual Studio 11 2012" WindowsStore 8.0 ARM) - add_test_VSWinStorePhone(vs11-store80-X64 "Visual Studio 11 2012" WindowsStore 8.0 x64) - endif() if(vs12 AND ws81) add_test_VSWinStorePhone(vs12-store81-X86 "Visual Studio 12 2013" WindowsStore 8.1 Win32) add_test_VSWinStorePhone(vs12-store81-ARM "Visual Studio 12 2013" WindowsStore 8.1 ARM) @@ -2311,10 +2304,6 @@ if(BUILD_TESTING) add_test_VSWinStorePhone(vs14-store10_0-ARM "Visual Studio 14 2015" WindowsStore 10.0 ARM) add_test_VSWinStorePhone(vs14-store10_0-X64 "Visual Studio 14 2015" WindowsStore 10.0 x64) endif() - if(vs11 AND wp80) - add_test_VSWinStorePhone(vs11-phone80-X86 "Visual Studio 11 2012" WindowsPhone 8.0 Win32) - add_test_VSWinStorePhone(vs11-phone80-ARM "Visual Studio 11 2012" WindowsPhone 8.0 ARM) - endif() if(vs12 AND wp81) add_test_VSWinStorePhone(vs12-phone81-X86 "Visual Studio 12 2013" WindowsPhone 8.1 Win32) add_test_VSWinStorePhone(vs12-phone81-ARM "Visual Studio 12 2013" WindowsPhone 8.1 ARM) @@ -2341,10 +2330,6 @@ if(BUILD_TESTING) endforeach() endmacro() - if(vs11) - add_test_VSWinCE(vs11-ce80-ARM "Visual Studio 11 2012" WindowsCE 8.0 ${wince_sdk}) - endif() - if(vs12) add_test_VSWinCE(vs12-ce80-ARM "Visual Studio 12 2013" WindowsCE 8.0 ${wince_sdk}) endif() @@ -2471,9 +2456,6 @@ if(BUILD_TESTING) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSAndroid/${name}") endmacro() if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") - if(vs11) - add_test_VSAndroid(vs11 "Visual Studio 11 2012" "Tegra-Android") - endif() if(vs12) add_test_VSAndroid(vs12 "Visual Studio 12 2013" "Tegra-Android") endif() diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt deleted file mode 100644 index 90809420e80..00000000000 --- a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Warning: - The "Visual Studio 11 2012" generator is deprecated and will be removed in - a future version of CMake. - - Add CMAKE_WARN_VS11=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 45b4c0eeba9..53f13e46c60 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -1118,10 +1118,3 @@ if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 2008") run_cmake(DeprecateVS9-WARN-ON) run_cmake_with_options(DeprecateVS9-WARN-OFF -DCMAKE_WARN_VS9=OFF) endif() - -if(RunCMake_GENERATOR MATCHES "^Visual Studio 11 2012") - run_cmake_with_options(DeprecateVS11-WARN-ON -DCMAKE_WARN_VS11=ON) - unset(ENV{CMAKE_WARN_VS11}) - run_cmake(DeprecateVS11-WARN-ON) - run_cmake_with_options(DeprecateVS11-WARN-OFF -DCMAKE_WARN_VS11=OFF) -endif() From 12518c7b0f51086382f4b4865fdef28e54144908 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 14 Jun 2023 00:01:10 -0400 Subject: [PATCH 021/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c59fc45923b..ae28755ba6a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230613) +set(CMake_VERSION_PATCH 20230614) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 3b6c5efc086836d5006a184052f642004695b445 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Wed, 14 Jun 2023 11:53:28 -0400 Subject: [PATCH 022/627] cm::append: Add support for std::basic_string on SPARC/SunPro --- Utilities/std/cmext/algorithm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Utilities/std/cmext/algorithm b/Utilities/std/cmext/algorithm index 11514fcf7b0..46377f4932a 100644 --- a/Utilities/std/cmext/algorithm +++ b/Utilities/std/cmext/algorithm @@ -16,6 +16,7 @@ #if defined(__SUNPRO_CC) && defined(__sparc) # include +# include # include #endif @@ -67,11 +68,15 @@ namespace cm { APPEND_TWO(C1, C2) \ APPEND_TWO(C2, C1) -// For now, manage only support for std::vector and std::list. -// Other sequential container support can be added if needed. +// For now, manage only support for std::vector, std::list, and +// std::basic_string. Other sequential container support can be added if +// needed. APPEND(std::vector) APPEND(std::list) +APPEND(std::basic_string) APPEND_MIX(std::vector, std::list) +APPEND_MIX(std::vector, std::basic_string) +APPEND_MIX(std::list, std::basic_string) # undef APPEND # undef APPEND_MIX From ec81d40be437a0ca2362f3b8c84dbfbf7fe6a2b3 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 9 Jun 2023 12:55:35 -0400 Subject: [PATCH 023/627] cmUVPipeIStream: Add cmUVPipeIStream --- Source/CMakeLists.txt | 1 + Source/cmUVStream.h | 102 +++++++++++++++++++++++++++++ Tests/CMakeLib/testUVStreambuf.cxx | 40 +++++++++++ 3 files changed, 143 insertions(+) create mode 100644 Source/cmUVStream.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index b01e1e713f9..a79366e3174 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -438,6 +438,7 @@ add_library( cmUVHandlePtr.h cmUVProcessChain.cxx cmUVProcessChain.h + cmUVStream.h cmUVStreambuf.h cmUVSignalHackRAII.h cmVariableWatch.cxx diff --git a/Source/cmUVStream.h b/Source/cmUVStream.h new file mode 100644 index 00000000000..fff238147cd --- /dev/null +++ b/Source/cmUVStream.h @@ -0,0 +1,102 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include + +#include "cmUVHandlePtr.h" +#include "cmUVStreambuf.h" + +template > +class cmBasicUVIStream : public std::basic_istream +{ +public: + cmBasicUVIStream(); + cmBasicUVIStream(uv_stream_t* stream); + + bool is_open() const; + + void open(uv_stream_t* stream); + + void close(); + +private: + cmBasicUVStreambuf Buffer; +}; + +template +cmBasicUVIStream::cmBasicUVIStream() + : std::basic_istream(&this->Buffer) +{ +} + +template +cmBasicUVIStream::cmBasicUVIStream(uv_stream_t* stream) + : cmBasicUVIStream() +{ + this->open(stream); +} + +template +bool cmBasicUVIStream::is_open() const +{ + return this->Buffer.is_open(); +} + +template +void cmBasicUVIStream::open(uv_stream_t* stream) +{ + this->Buffer.open(stream); +} + +template +void cmBasicUVIStream::close() +{ + this->Buffer.close(); +} + +using cmUVIStream = cmBasicUVIStream; + +template > +class cmBasicUVPipeIStream : public cmBasicUVIStream +{ +public: + cmBasicUVPipeIStream(); + cmBasicUVPipeIStream(uv_loop_t& loop, int fd); + + using cmBasicUVIStream::is_open; + + void open(uv_loop_t& loop, int fd); + + void close(); + +private: + cm::uv_pipe_ptr Pipe; +}; + +template +cmBasicUVPipeIStream::cmBasicUVPipeIStream() = default; + +template +cmBasicUVPipeIStream::cmBasicUVPipeIStream(uv_loop_t& loop, + int fd) +{ + this->open(loop, fd); +} + +template +void cmBasicUVPipeIStream::open(uv_loop_t& loop, int fd) +{ + this->Pipe.init(loop, 0); + uv_pipe_open(this->Pipe, fd); + this->cmBasicUVIStream::open(this->Pipe); +} + +template +void cmBasicUVPipeIStream::close() +{ + this->cmBasicUVIStream::close(); + this->Pipe.reset(); +} + +using cmUVPipeIStream = cmBasicUVPipeIStream; diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx index f9ed6af3760..c97e695dbda 100644 --- a/Tests/CMakeLib/testUVStreambuf.cxx +++ b/Tests/CMakeLib/testUVStreambuf.cxx @@ -8,6 +8,7 @@ #include "cmGetPipes.h" #include "cmUVHandlePtr.h" +#include "cmUVStream.h" #include "cmUVStreambuf.h" #define TEST_STR_LINE_1 "This string must be exactly 128 characters long so" @@ -437,6 +438,40 @@ static bool testUVStreambufRead( return success; } +bool testUVPipeIStream() +{ + int pipe[] = { -1, -1 }; + if (cmGetPipes(pipe) < 0) { + std::cout << "cmGetPipes() returned an error" << std::endl; + return false; + } + + cm::uv_loop_ptr loop; + loop.init(); + cm::uv_pipe_ptr pipeSink; + pipeSink.init(*loop, 0); + uv_pipe_open(pipeSink, pipe[1]); + + std::string str = "Hello world!\n"; + uv_write_t writeReq; + uv_buf_t buf; + buf.base = &str.front(); + buf.len = str.length(); + uv_write(&writeReq, pipeSink, &buf, 1, nullptr); + uv_run(loop, UV_RUN_DEFAULT); + + cmUVPipeIStream pin(*loop, pipe[0]); + std::string line; + std::getline(pin, line); + if (line != "Hello world!") { + std::cout << "Line was \"" << line << "\", should be \"Hello world!\"" + << std::endl; + return false; + } + + return true; +} + int testUVStreambuf(int argc, char** const argv) { if (argc < 2) { @@ -454,5 +489,10 @@ int testUVStreambuf(int argc, char** const argv) return -1; } + if (!testUVPipeIStream()) { + std::cout << "While executing testUVPipeIStream().\n"; + return -1; + } + return 0; } From b8fd273ed7b14ff71cd55d39ffb7c41c2f5ee421 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 9 Jun 2023 10:02:47 -0400 Subject: [PATCH 024/627] cmUVProcessChain: Return output and error streams as file descriptors --- ...uxELFObjdumpGetRuntimeDependenciesTool.cxx | 4 +- ...OSMachOOToolGetRuntimeDependenciesTool.cxx | 12 ++-- ...owsPEDumpbinGetRuntimeDependenciesTool.cxx | 4 +- ...owsPEObjdumpGetRuntimeDependenciesTool.cxx | 4 +- Source/cmLDConfigLDConfigTool.cxx | 4 +- Source/cmUVProcessChain.cxx | 60 ++++--------------- Source/cmUVProcessChain.h | 5 +- Source/cmcmd.cxx | 13 ++-- Tests/CMakeLib/testUVProcessChain.cxx | 51 +++++++++------- 9 files changed, 68 insertions(+), 89 deletions(-) diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx index c5c41e03923..8043f82c32b 100644 --- a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx @@ -10,6 +10,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmSystemTools.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool:: cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool( @@ -46,7 +47,8 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo( static const cmsys::RegularExpression neededRegex("^ *NEEDED *([^\n]*)$"); static const cmsys::RegularExpression rpathRegex("^ *RPATH *([^\n]*)$"); static const cmsys::RegularExpression runpathRegex("^ *RUNPATH *([^\n]*)$"); - while (std::getline(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (std::getline(output, line)) { cmsys::RegularExpressionMatch match; if (neededRegex.find(line.c_str(), match)) { needed.push_back(match.match(1)); diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx index cf4a8fe3de9..4c3584153d4 100644 --- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx @@ -9,6 +9,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool:: cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool( @@ -49,11 +50,12 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( "^ *path (.*) \\(offset [0-9]+\\)$"); static const cmsys::RegularExpression nameRegex( "^ *name (.*) \\(offset [0-9]+\\)$"); - while (std::getline(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (std::getline(output, line)) { cmsys::RegularExpressionMatch cmdMatch; if (rpathRegex.find(line.c_str(), cmdMatch)) { - if (!std::getline(*process.OutputStream(), line) || - !std::getline(*process.OutputStream(), line)) { + // NOLINTNEXTLINE(misc-redundant-expression) + if (!std::getline(output, line) || !std::getline(output, line)) { this->SetError("Invalid output from otool"); return false; } @@ -66,8 +68,8 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( return false; } } else if (loadDylibRegex.find(line.c_str(), cmdMatch)) { - if (!std::getline(*process.OutputStream(), line) || - !std::getline(*process.OutputStream(), line)) { + // NOLINTNEXTLINE(misc-redundant-expression) + if (!std::getline(output, line) || !std::getline(output, line)) { this->SetError("Invalid output from otool"); return false; } diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx index 3b02c2e59b6..cd211400f43 100644 --- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx @@ -9,6 +9,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool:: cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool( @@ -43,7 +44,8 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo( std::string line; static const cmsys::RegularExpression regex( "^ ([^\n]*\\.[Dd][Ll][Ll])\r$"); - while (std::getline(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (std::getline(output, line)) { cmsys::RegularExpressionMatch match; if (regex.find(line.c_str(), match)) { needed.push_back(match.match(1)); diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx index 2139b4b5c41..d95da953cf2 100644 --- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx @@ -10,6 +10,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmSystemTools.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool:: cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool( @@ -44,7 +45,8 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo( std::string line; static const cmsys::RegularExpression regex( "^\t*DLL Name: ([^\n]*\\.[Dd][Ll][Ll])$"); - while (cmSystemTools::GetLineFromStream(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (cmSystemTools::GetLineFromStream(output, line)) { cmsys::RegularExpressionMatch match; if (regex.find(line.c_str(), match)) { needed.push_back(match.match(1)); diff --git a/Source/cmLDConfigLDConfigTool.cxx b/Source/cmLDConfigLDConfigTool.cxx index 7ce1a59dae9..154aa27f480 100644 --- a/Source/cmLDConfigLDConfigTool.cxx +++ b/Source/cmLDConfigLDConfigTool.cxx @@ -14,6 +14,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmSystemTools.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmLDConfigLDConfigTool::cmLDConfigLDConfigTool( cmRuntimeDependencyArchive* archive) @@ -50,7 +51,8 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector& paths) std::string line; static const cmsys::RegularExpression regex("^([^\t:]*):"); - while (std::getline(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (std::getline(output, line)) { cmsys::RegularExpressionMatch match; if (regex.find(line.c_str(), match)) { paths.push_back(match.match(1)); diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index cf4475b6967..3de7ae5621e 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -17,36 +17,15 @@ #include "cmGetPipes.h" #include "cmUVHandlePtr.h" -#include "cmUVStreambuf.h" struct cmUVProcessChain::InternalData { - struct BasicStreamData + struct StreamData { - cmUVStreambuf Streambuf; - cm::uv_pipe_ptr BuiltinStream; + int BuiltinStream = -1; uv_stdio_container_t Stdio; }; - template - struct StreamData : public BasicStreamData - { - StreamData() - : BuiltinIOStream(&this->Streambuf) - { - } - - IOStream BuiltinIOStream; - - IOStream* GetBuiltinStream() - { - if (this->BuiltinStream.get()) { - return &this->BuiltinIOStream; - } - return nullptr; - } - }; - struct ProcessData { cmUVProcessChain::InternalData* Data; @@ -64,9 +43,9 @@ struct cmUVProcessChain::InternalData cm::uv_loop_ptr Loop; - StreamData InputStreamData; - StreamData OutputStreamData; - StreamData ErrorStreamData; + StreamData InputStreamData; + StreamData OutputStreamData; + StreamData ErrorStreamData; cm::uv_pipe_ptr TempOutputPipe; cm::uv_pipe_ptr TempErrorPipe; @@ -215,12 +194,7 @@ bool cmUVProcessChain::InternalData::Prepare( return false; } - if (errorData.BuiltinStream.init(*this->Loop, 0) < 0) { - return false; - } - if (uv_pipe_open(errorData.BuiltinStream, pipeFd[0]) < 0) { - return false; - } + errorData.BuiltinStream = pipeFd[0]; errorData.Stdio.flags = UV_INHERIT_FD; errorData.Stdio.data.fd = pipeFd[1]; @@ -231,7 +205,6 @@ bool cmUVProcessChain::InternalData::Prepare( return false; } - errorData.Streambuf.open(errorData.BuiltinStream); break; } @@ -251,6 +224,7 @@ bool cmUVProcessChain::InternalData::Prepare( case cmUVProcessChainBuilder::Builtin: if (this->Builder->MergedBuiltinStreams) { + outputData.BuiltinStream = errorData.BuiltinStream; outputData.Stdio.flags = UV_INHERIT_FD; outputData.Stdio.data.fd = errorData.Stdio.data.fd; } else { @@ -259,12 +233,7 @@ bool cmUVProcessChain::InternalData::Prepare( return false; } - if (outputData.BuiltinStream.init(*this->Loop, 0) < 0) { - return false; - } - if (uv_pipe_open(outputData.BuiltinStream, pipeFd[0]) < 0) { - return false; - } + outputData.BuiltinStream = pipeFd[0]; outputData.Stdio.flags = UV_INHERIT_FD; outputData.Stdio.data.fd = pipeFd[1]; @@ -274,8 +243,6 @@ bool cmUVProcessChain::InternalData::Prepare( if (uv_pipe_open(this->TempOutputPipe, outputData.Stdio.data.fd) < 0) { return false; } - - outputData.Streambuf.open(outputData.BuiltinStream); } break; @@ -411,17 +378,14 @@ uv_loop_t& cmUVProcessChain::GetLoop() return *this->Data->Loop; } -std::istream* cmUVProcessChain::OutputStream() +int cmUVProcessChain::OutputStream() { - if (this->Data->Builder->MergedBuiltinStreams) { - return this->Data->ErrorStreamData.GetBuiltinStream(); - } - return this->Data->OutputStreamData.GetBuiltinStream(); + return this->Data->OutputStreamData.BuiltinStream; } -std::istream* cmUVProcessChain::ErrorStream() +int cmUVProcessChain::ErrorStream() { - return this->Data->ErrorStreamData.GetBuiltinStream(); + return this->Data->ErrorStreamData.BuiltinStream; } bool cmUVProcessChain::Valid() const diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h index 547a944d87f..d7a4a0e74e6 100644 --- a/Source/cmUVProcessChain.h +++ b/Source/cmUVProcessChain.h @@ -5,7 +5,6 @@ #include #include // IWYU pragma: keep #include -#include #include #include #include @@ -99,8 +98,8 @@ class cmUVProcessChain uv_loop_t& GetLoop(); // FIXME: Add stdin support - std::istream* OutputStream(); - std::istream* ErrorStream(); + int OutputStream(); + int ErrorStream(); bool Valid() const; bool Wait(int64_t milliseconds = -1); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 1bbd0ac0e00..eb1f93d24f3 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -28,6 +28,7 @@ #include "cmSystemTools.h" #include "cmTransformDepfile.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" #include "cmUtils.hxx" #include "cmValue.h" #include "cmVersion.h" @@ -2017,10 +2018,8 @@ int cmcmd::RunPreprocessor(const std::vector& command, return 1; } if (process.GetStatus(0).ExitStatus != 0) { - auto* errorStream = process.ErrorStream(); - if (errorStream) { - std::cerr << errorStream->rdbuf(); - } + cmUVPipeIStream errorStream(process.GetLoop(), process.ErrorStream()); + std::cerr << errorStream.rdbuf(); return 1; } @@ -2144,10 +2143,8 @@ int cmcmd::RunLLVMRC(std::vector const& args) return result; } if (process.GetStatus(0).ExitStatus != 0) { - auto* errorStream = process.ErrorStream(); - if (errorStream) { - std::cerr << errorStream->rdbuf(); - } + cmUVPipeIStream errorStream(process.GetLoop(), process.ErrorStream()); + std::cerr << errorStream.rdbuf(); return 1; } diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index f3024dc71f6..7630aa0de20 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -17,6 +17,7 @@ #include "cmStringAlgorithms.h" #include "cmUVHandlePtr.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" #include "cmUVStreambuf.h" struct ExpectedStatus @@ -301,16 +302,19 @@ bool testUVProcessChainBuiltin(const char* helperCommand) return false; } - if (!chain->OutputStream()) { - std::cout << "OutputStream() was null, expecting not null" << std::endl; + if (chain->OutputStream() < 0) { + std::cout << "OutputStream() was invalid, expecting valid" << std::endl; return false; } - if (!chain->ErrorStream()) { - std::cout << "ErrorStream() was null, expecting not null" << std::endl; + if (chain->ErrorStream() < 0) { + std::cout << "ErrorStream() was invalid, expecting valid" << std::endl; return false; } - if (!checkOutput(*chain->OutputStream(), *chain->ErrorStream())) { + cmUVPipeIStream output(chain->GetLoop(), chain->OutputStream()); + cmUVPipeIStream error(chain->GetLoop(), chain->ErrorStream()); + + if (!checkOutput(output, error)) { return false; } @@ -330,12 +334,12 @@ bool testUVProcessChainBuiltinMerged(const char* helperCommand) return false; } - if (!chain->OutputStream()) { - std::cout << "OutputStream() was null, expecting not null" << std::endl; + if (chain->OutputStream() < 0) { + std::cout << "OutputStream() was invalid, expecting valid" << std::endl; return false; } - if (!chain->ErrorStream()) { - std::cout << "ErrorStream() was null, expecting not null" << std::endl; + if (chain->ErrorStream() < 0) { + std::cout << "ErrorStream() was invalid, expecting valid" << std::endl; return false; } if (chain->OutputStream() != chain->ErrorStream()) { @@ -344,7 +348,9 @@ bool testUVProcessChainBuiltinMerged(const char* helperCommand) return false; } - std::string merged = getInput(*chain->OutputStream()); + cmUVPipeIStream mergedStream(chain->GetLoop(), chain->OutputStream()); + + std::string merged = getInput(mergedStream); auto qemuErrorPos = merged.find("qemu:"); if (qemuErrorPos != std::string::npos) { merged.resize(qemuErrorPos); @@ -398,12 +404,12 @@ bool testUVProcessChainExternal(const char* helperCommand) return false; } - if (chain->OutputStream()) { - std::cout << "OutputStream() was not null, expecting null" << std::endl; + if (chain->OutputStream() >= 0) { + std::cout << "OutputStream() was valid, expecting invalid" << std::endl; return false; } - if (chain->ErrorStream()) { - std::cout << "ErrorStream() was not null, expecting null" << std::endl; + if (chain->ErrorStream() >= 0) { + std::cout << "ErrorStream() was valid, expecting invalid" << std::endl; return false; } @@ -446,12 +452,12 @@ bool testUVProcessChainNone(const char* helperCommand) return false; } - if (chain->OutputStream()) { - std::cout << "OutputStream() was not null, expecting null" << std::endl; + if (chain->OutputStream() >= 0) { + std::cout << "OutputStream() was valid, expecting invalid" << std::endl; return false; } - if (chain->ErrorStream()) { - std::cout << "ErrorStream() was not null, expecting null" << std::endl; + if (chain->ErrorStream() >= 0) { + std::cout << "ErrorStream() was valid, expecting invalid" << std::endl; return false; } @@ -473,7 +479,8 @@ bool testUVProcessChainCwdUnchanged(const char* helperCommand) return false; } - auto cwd = getInput(*chain.OutputStream()); + cmUVPipeIStream output(chain.GetLoop(), chain.OutputStream()); + auto cwd = getInput(output); if (!cmHasLiteralSuffix(cwd, "/Tests/CMakeLib")) { std::cout << "Working directory was \"" << cwd << "\", expected to end in \"/Tests/CMakeLib\"" << std::endl; @@ -499,7 +506,8 @@ bool testUVProcessChainCwdChanged(const char* helperCommand) return false; } - auto cwd = getInput(*chain.OutputStream()); + cmUVPipeIStream output(chain.GetLoop(), chain.OutputStream()); + auto cwd = getInput(output); if (!cmHasLiteralSuffix(cwd, "/Tests")) { std::cout << "Working directory was \"" << cwd << "\", expected to end in \"/Tests\"" << std::endl; @@ -633,7 +641,8 @@ bool testUVProcessChainInputFile(const char* helperCommand) return false; } - std::string output = getInput(*chain.OutputStream()); + cmUVPipeIStream stream(chain.GetLoop(), chain.OutputStream()); + std::string output = getInput(stream); if (output != "HELO WRD!") { std::cout << "Output was \"" << output << "\", expected \"HELO WRD!\"" << std::endl; From 0878306386d42084e8abc3525393ae2b65acf725 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 9 Jun 2023 15:51:09 -0400 Subject: [PATCH 025/627] cmUVStream: Add cmUVStreamRead() function --- Source/cmUVStream.h | 38 ++++++++++++++++++++ Tests/CMakeLib/testUVStreambuf.cxx | 57 ++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/Source/cmUVStream.h b/Source/cmUVStream.h index fff238147cd..5998256068d 100644 --- a/Source/cmUVStream.h +++ b/Source/cmUVStream.h @@ -2,8 +2,11 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #pragma once +#include #include +#include + #include "cmUVHandlePtr.h" #include "cmUVStreambuf.h" @@ -100,3 +103,38 @@ void cmBasicUVPipeIStream::close() } using cmUVPipeIStream = cmBasicUVPipeIStream; + +template +void cmUVStreamRead(uv_stream_t* stream, ReadCallback onRead, + FinishCallback onFinish) +{ + struct ReadData + { + std::vector Buffer; + ReadCallback OnRead; + FinishCallback OnFinish; + }; + + stream->data = new ReadData{ {}, std::move(onRead), std::move(onFinish) }; + uv_read_start( + stream, + [](uv_handle_t* s, std::size_t suggestedSize, uv_buf_t* buffer) { + auto* data = static_cast(s->data); + data->Buffer.resize(suggestedSize); + buffer->base = data->Buffer.data(); + buffer->len = suggestedSize; + }, + [](uv_stream_t* s, ssize_t nread, const uv_buf_t* buffer) { + auto* data = static_cast(s->data); + if (nread > 0) { + (void)buffer; + assert(buffer->base == data->Buffer.data()); + data->Buffer.resize(nread); + data->OnRead(std::move(data->Buffer)); + } else if (nread < 0 /*|| nread == UV_EOF*/) { + data->OnFinish(); + uv_read_stop(s); + delete data; + } + }); +} diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx index c97e695dbda..f3977d4c6b5 100644 --- a/Tests/CMakeLib/testUVStreambuf.cxx +++ b/Tests/CMakeLib/testUVStreambuf.cxx @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -472,6 +474,56 @@ bool testUVPipeIStream() return true; } +bool testUVStreamRead() +{ + int pipe[] = { -1, -1 }; + if (cmGetPipes(pipe) < 0) { + std::cout << "cmGetPipes() returned an error" << std::endl; + return false; + } + + cm::uv_loop_ptr loop; + loop.init(); + cm::uv_pipe_ptr pipeSink; + pipeSink.init(*loop, 0); + uv_pipe_open(pipeSink, pipe[1]); + + std::string str = "Hello world!"; + uv_write_t writeReq; + uv_buf_t buf; + buf.base = &str.front(); + buf.len = str.length(); + uv_write(&writeReq, pipeSink, &buf, 1, nullptr); + uv_run(loop, UV_RUN_DEFAULT); + pipeSink.reset(); + + cm::uv_pipe_ptr pipeSource; + pipeSource.init(*loop, 0); + uv_pipe_open(pipeSource, pipe[0]); + + std::string output; + bool finished = false; + cmUVStreamRead( + pipeSource, + [&output](std::vector data) { cm::append(output, data); }, + [&output, &finished]() { + if (output != "Hello world!") { + std::cout << "Output was \"" << output + << "\", should be \"Hello world!\"" << std::endl; + return; + } + finished = true; + }); + uv_run(loop, UV_RUN_DEFAULT); + + if (!finished) { + std::cout << "finished was not set" << std::endl; + return false; + } + + return true; +} + int testUVStreambuf(int argc, char** const argv) { if (argc < 2) { @@ -494,5 +546,10 @@ int testUVStreambuf(int argc, char** const argv) return -1; } + if (!testUVStreamRead()) { + std::cout << "While executing testUVPipeIStream().\n"; + return -1; + } + return 0; } From b65d54e87694efb4962cd37348aec0ba598e5d4e Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Tue, 13 Jun 2023 13:23:40 -0400 Subject: [PATCH 026/627] cmUVStreambuf: Update URL for example code --- Source/cmUVStreambuf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h index efe45de053a..4f7b2092052 100644 --- a/Source/cmUVStreambuf.h +++ b/Source/cmUVStreambuf.h @@ -14,7 +14,8 @@ /* * This file is based on example code from: * - * http://www.voidcn.com/article/p-vjnlygmc-gy.html + * https://web.archive.org/web/20170515211805/ + * http://www.mr-edd.co.uk/blog/beginners_guide_streambuf * * The example code was distributed under the following license: * From f601a55fc2c2fb604cd4df9026219c75e15db0b6 Mon Sep 17 00:00:00 2001 From: Martin Duffy Date: Wed, 14 Jun 2023 10:04:38 -0400 Subject: [PATCH 027/627] ccmake: Additional keybindings Adds the following keys to ccmake: - w: writes changes to cache file and quits without generating - N: jump to previous search result - Home: jump to first option - End: jump to last option --- Source/CursesDialog/cmCursesMainForm.cxx | 68 +++++++++++++++++++----- Source/CursesDialog/cmCursesMainForm.h | 6 +++ 2 files changed, 62 insertions(+), 12 deletions(-) diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index a1b21494d6c..77a0048ac2d 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -458,6 +458,14 @@ void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog) } } +void cmCursesMainForm::Write() +{ + this->FillCacheManagerFromUI(); + this->CMakeInstance->SaveCache( + this->CMakeInstance->GetHomeOutputDirectory()); + this->LoadCache(nullptr); +} + int cmCursesMainForm::Configure(int noconfigure) { this->ResetOutputs(); @@ -471,10 +479,7 @@ int cmCursesMainForm::Configure(int noconfigure) } // always save the current gui values to disk - this->FillCacheManagerFromUI(); - this->CMakeInstance->SaveCache( - this->CMakeInstance->GetHomeOutputDirectory()); - this->LoadCache(nullptr); + this->Write(); // run the generate process this->OkToGenerate = true; @@ -794,6 +799,21 @@ void cmCursesMainForm::HandleInput() else if (key == KEY_PPAGE || key == ctrl('u')) { form_driver(this->Form, REQ_PREV_PAGE); } + // first entry + else if (key == KEY_HOME) { + form_driver(this->Form, REQ_FIRST_PAGE); + form_driver(this->Form, REQ_FIRST_FIELD); + } + // last entry + else if (key == KEY_END) { + form_driver(this->Form, REQ_LAST_PAGE); + form_driver(this->Form, REQ_LAST_FIELD); + } + // write and quit + else if (key == 'w') { + this->Write(); + break; + } // configure else if (key == 'c') { this->Configure(); @@ -854,6 +874,10 @@ void cmCursesMainForm::HandleInput() if (!this->OldSearchString.empty()) { this->JumpToCacheEntry(this->OldSearchString.c_str()); } + } else if (key == 'N') { + if (!this->OldSearchString.empty()) { + this->JumpToCacheEntry(this->OldSearchString.c_str(), true); + } } // switch advanced on/off else if (key == 't') { @@ -944,6 +968,11 @@ int cmCursesMainForm::LoadCache(const char* /*unused*/) } void cmCursesMainForm::JumpToCacheEntry(const char* astr) +{ + this->JumpToCacheEntry(astr, false); +} + +void cmCursesMainForm::JumpToCacheEntry(const char* astr, bool reverse) { std::string str; if (astr) { @@ -973,12 +1002,21 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr) } } } - if (static_cast(findex) >= 3 * this->NumberOfVisibleEntries - 1) { - set_current_field(this->Form, this->Fields[2]); - } else if (new_page(this->Fields[findex + 1])) { - form_driver(this->Form, REQ_NEXT_PAGE); + if (!reverse && + static_cast(findex) >= 3 * this->NumberOfVisibleEntries - 1) { + form_driver(this->Form, REQ_FIRST_PAGE); + form_driver(this->Form, REQ_FIRST_FIELD); + } else if (reverse && static_cast(findex) < 3) { + form_driver(this->Form, REQ_LAST_PAGE); + form_driver(this->Form, REQ_LAST_FIELD); + } else if (this->Fields[findex + (reverse ? -3 : 1)]->page != + this->Fields[findex]->page) { + form_driver(this->Form, reverse ? REQ_PREV_PAGE : REQ_NEXT_PAGE); + if (reverse) { + form_driver(this->Form, REQ_LAST_FIELD); + } } else { - form_driver(this->Form, REQ_NEXT_FIELD); + form_driver(this->Form, reverse ? REQ_PREV_FIELD : REQ_NEXT_FIELD); } cur = current_field(this->Form); findex = field_index(cur); @@ -1040,15 +1078,21 @@ const char* cmCursesMainForm::s_ConstHelpMessage = "hit 'g' to have CMake generate all the build files (i.e. makefiles or " "project files) and exit. " "At any point during the process, you can exit ccmake with 'q'. However, " - "this will not generate/change any build files.\n\n" + "this will not generate/change any build files. Additionally, you can exit " + "ccmake with 'w' to write changes to the cache file without generating or " + "changing the build files.\n\n" "ccmake KEYS:\n\n" "Navigation: " "You can use the arrow keys and page up, down to navigate the options. " - "Alternatively, you can use the following keys: \n" + "Additionally, you can use the following keys: \n" " C-n or j : next option\n" " C-p or k : previous options\n" " C-d : down one page\n" - " C-u : up one page\n\n" + " C-u : up one page\n" + " Home : jump to first option\n" + " End : jump to last option\n" + " n : next search result\n" + " N : previous search result\n\n" "Editing options: " "To change an option press enter or return. If the current options is a " "boolean, this will toggle its value. " diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 112b7e87a83..1ce75e70686 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -86,6 +86,11 @@ class cmCursesMainForm : public cmCursesForm */ void AddError(const std::string& message, const char* title) override; + /** + * Write files to cache file without reconfiguring. + */ + void Write(); + /** * Used to do a configure. If argument is specified, it does only the check * and not configure. @@ -123,6 +128,7 @@ class cmCursesMainForm : public cmCursesForm // Jump to the cache entry whose name matches the string. void JumpToCacheEntry(const char* str); + void JumpToCacheEntry(const char* str, bool reverse); // Clear and reset the output log and state void ResetOutputs(); From 883cbf41710ce3a4c4798f9ced93681ec87115cc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 15 Jun 2023 00:01:10 -0400 Subject: [PATCH 028/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ae28755ba6a..1310b1e6272 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230614) +set(CMake_VERSION_PATCH 20230615) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 711d1da1255a028947d1117852caa8f33604bd81 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Tue, 13 Jun 2023 17:46:32 +0200 Subject: [PATCH 029/627] FindPython: add capability to select python version for the tests --- .../ci/configure_debian10_aarch64_ninja.cmake | 9 +- .gitlab/ci/configure_debian10_ninja.cmake | 11 +- .gitlab/ci/configure_fedora38_makefiles.cmake | 9 +- .gitlab/ci/docker/debian10/deps_packages.lst | 2 +- Tests/CMakeLists.txt | 36 +- .../ArtifactsInteractive/CMakeLists.txt | 6 +- Tests/FindPython/CMakeLists.txt | 419 +++++++++--------- .../CustomFailureMessage/CMakeLists.txt | 2 +- .../MultiplePackages/CMakeLists.txt | 52 ++- Tests/FindPython/NumPy/CMakeLists.txt | 37 +- Tests/FindPython/NumPyOnly/CMakeLists.txt | 20 +- .../RequiredArtifacts/CMakeLists.txt | 27 +- Tests/FindPython/SOABI/CMakeLists.txt | 51 ++- Tests/FindPython/VirtualEnv/CMakeLists.txt | 26 +- .../FindPython/VirtualEnvConda/CMakeLists.txt | 26 +- Tests/RunCMake/CMakeLists.txt | 3 +- Tests/RunCMake/UseSWIG/RunCMakeTest.cmake | 2 +- .../AlternateLibraryName/CMakeLists.txt | 6 +- Tests/UseSWIG/CMakeLists.txt | 44 +- Tests/UseSWIG/ModuleName/CMakeLists.txt | 15 +- Tests/UseSWIG/ModuleVersion2/CMakeLists.txt | 98 ++-- Tests/UseSWIG/MultipleFiles/CMakeLists.txt | 4 +- .../CMakeLists.txt | 6 +- 23 files changed, 521 insertions(+), 390 deletions(-) diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake index dff0db15687..91d4632f72e 100644 --- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake +++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake @@ -74,9 +74,12 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "") set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "") -set(CMake_TEST_FindPython "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_NumPy "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "") set(CMake_TEST_FindRuby "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake index 211a2a74d9b..eca92bc74f3 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian10_ninja.cmake @@ -78,10 +78,13 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "") set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "") -set(CMake_TEST_FindPython "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_IronPython "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_NumPy "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_IronPython "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "") set(CMake_TEST_FindRuby "ON" CACHE BOOL "") set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_fedora38_makefiles.cmake b/.gitlab/ci/configure_fedora38_makefiles.cmake index c2f99822f13..a3881cf8175 100644 --- a/.gitlab/ci/configure_fedora38_makefiles.cmake +++ b/.gitlab/ci/configure_fedora38_makefiles.cmake @@ -74,9 +74,12 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "") set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "") -set(CMake_TEST_FindPython "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_NumPy "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "") set(CMake_TEST_FindRuby "ON" CACHE BOOL "") set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") diff --git a/.gitlab/ci/docker/debian10/deps_packages.lst b/.gitlab/ci/docker/debian10/deps_packages.lst index 0b79675846c..fc5c1741e51 100644 --- a/.gitlab/ci/docker/debian10/deps_packages.lst +++ b/.gitlab/ci/docker/debian10/deps_packages.lst @@ -96,5 +96,5 @@ ruby ruby-dev swig unixodbc-dev -# CMake_TEST_FindPython_IronPython +# CMake_TEST_FindPython2_IronPython libmono-system-windows-forms4.0-cil diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c08dd8616ca..8e6017e6852 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1538,10 +1538,38 @@ if(BUILD_TESTING) add_subdirectory(GoogleTest) endif() - if(CMake_TEST_FindPython OR CMake_TEST_FindPython_SABIModule OR CMake_TEST_FindPython_NumPy - OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython OR CMake_TEST_FindPython_PyPy) - if (CMake_TEST_FindPython AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") - set(CMake_TEST_FindPython_SABIModule TRUE) + if(CMake_TEST_FindPython) + set(CMake_TEST_FindPython2 TRUE) + set(CMake_TEST_FindPython3 TRUE) + endif() + if(CMake_TEST_FindPython_SABIMOdule) + set(CMake_TEST_FindPython2_SABIModule TRUE) + set(CMake_TEST_FindPython3_SABIModule TRUE) + endif() + if(CMake_TEST_FindPython_NumPy) + set(CMake_TEST_FindPython2_NumPyy TRUE) + set(CMake_TEST_FindPython3_NumPy TRUE) + endif() + if(CMake_TEST_FindPython_Conda) + set(CMake_TEST_FindPython3_Conda TRUE) + endif() + if(CMake_TEST_FindPython_IronPython) + set(CMake_TEST_FindPython2_IronPython TRUE) + endif() + if(CMake_TEST_FindPython_PyPy) + set(CMake_TEST_FindPython2_PyPy TRUE) + set(CMake_TEST_FindPython3_PyPy TRUE) + endif() + if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython2 + OR CMake_TEST_FindPython2_SABIModule OR CMake_TEST_FindPython3_SABIModule + OR CMake_TEST_FindPython2_NumPy OR CMake_TEST_FindPython3_NumPy + OR CMake_TEST_FindPython3_Conda OR CMake_TEST_FindPython2_IronPython + OR CMake_TEST_FindPython2_PyPy OR CMake_TEST_FindPython3_PyPy) + if (CMake_TEST_FindPython2 AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") + set(CMake_TEST_FindPython2_SABIModule TRUE) + endif() + if (CMake_TEST_FindPython3 AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") + set(CMake_TEST_FindPython3_SABIModule TRUE) endif() add_subdirectory(FindPython) endif() diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt index 99823a60d64..18f8fdab7e4 100644 --- a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt +++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5) project(TestArtifactsInteractive LANGUAGES C) set (components Interpreter Development) -if (CMake_TEST_FindPython_NumPy) +if (CMake_TEST_FindPython3_NumPy) list (APPEND components NumPy) endif() @@ -12,13 +12,13 @@ find_package(Python3 REQUIRED COMPONENTS ${components}) if (Python3_ARTIFACTS_INTERACTIVE) if (NOT DEFINED CACHE{Python3_EXECUTABLE} OR NOT DEFINED CACHE{Python3_LIBRARY} OR NOT DEFINED CACHE{Python3_INCLUDE_DIR} - OR (CMake_TEST_FindPython_NumPy AND NOT DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) + OR (CMake_TEST_FindPython3_NumPy AND NOT DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) message (FATAL_ERROR "Python3_ARTIFACTS_INTERACTIVE=ON Failed.") endif() else() if (DEFINED CACHE{Python3_EXECUTABLE} OR DEFINED CACHE{Python3_LIBRARY} OR DEFINED CACHE{Python3_INCLUDE_DIR} - OR (CMake_TEST_FindPython_NumPy AND DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) + OR (CMake_TEST_FindPython3_NumPy AND DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) message (FATAL_ERROR "Python3_ARTIFACTS_INTERACTIVE=OFF Failed.") endif() endif() diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index b6942c94f55..3e1993ecf43 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -1,4 +1,4 @@ -if(CMake_TEST_FindPython) +if(CMake_TEST_FindPython2) add_test(NAME FindPython.Python2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -44,6 +44,129 @@ if(CMake_TEST_FindPython) set_tests_properties(FindPython.Python2Fail PROPERTIES PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)") + add_test(NAME FindPython.Python.V2.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.LOCATION" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + add_test(NAME FindPython.Python.V2.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VERSION" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + + add_test(NAME FindPython.Python2.ExactVersion.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.LOCATION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_MAJOR_VERSION=2 + -DPython_REQUESTED_VERSION=2.1.2 + -DPython2_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + add_test(NAME FindPython.Python2.ExactVersion.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.VERSION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_MAJOR_VERSION=2 + -DPython_REQUESTED_VERSION=2.1.2 + -DPython2_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + + add_test(NAME FindPython.Python.V2.ExactVersion.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.LOCATION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 + -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + add_test(NAME FindPython.Python.V2.ExactVersion.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.VERSION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 + -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + + add_test(NAME FindPython.Python2.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 + -DPython2_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.Python2.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 + -DPython2_FIND_STRATEGY=VERSION + ) + add_test(NAME FindPython.Python.V2.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 + -DPython_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.Python.V2.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 + -DPython_FIND_STRATEGY=VERSION + ) + + add_test(NAME FindPython.Python2Embedded COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Embedded" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2Embedded" + ${build_generator_args} + --build-project TestPython2Embedded + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) +endif() + +if(CMake_TEST_FindPython3) add_test(NAME FindPython.Python3.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -89,46 +212,6 @@ if(CMake_TEST_FindPython) set_tests_properties(FindPython.Python3Fail PROPERTIES PASS_REGULAR_EXPRESSION "Could NOT find Python3 \\(missing: foobar\\)") - add_test(NAME FindPython.Python.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.LOCATION" - ${build_generator_args} - --build-project TestPython - --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) - add_test(NAME FindPython.Python.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.VERSION" - ${build_generator_args} - --build-project TestPython - --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) - add_test(NAME FindPython.Python.V2.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.LOCATION" - ${build_generator_args} - --build-project TestPython - --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) - add_test(NAME FindPython.Python.V2.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VERSION" - ${build_generator_args} - --build-project TestPython - --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) add_test(NAME FindPython.Python.V3.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -150,30 +233,6 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.Python2.ExactVersion.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.LOCATION" - ${build_generator_args} - --build-project TestExactVersion - --build-options ${build_options} -DPython_MAJOR_VERSION=2 - -DPython_REQUESTED_VERSION=2.1.2 - -DPython2_FIND_STRATEGY=LOCATION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) - add_test(NAME FindPython.Python2.ExactVersion.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.VERSION" - ${build_generator_args} - --build-project TestExactVersion - --build-options ${build_options} -DPython_MAJOR_VERSION=2 - -DPython_REQUESTED_VERSION=2.1.2 - -DPython2_FIND_STRATEGY=VERSION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) add_test(NAME FindPython.Python3.ExactVersion.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -198,28 +257,6 @@ if(CMake_TEST_FindPython) -DPython3_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.Python.V2.ExactVersion.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.LOCATION" - ${build_generator_args} - --build-project TestExactVersion - --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 - -DPython_FIND_STRATEGY=LOCATION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) - add_test(NAME FindPython.Python.V2.ExactVersion.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.VERSION" - ${build_generator_args} - --build-project TestExactVersion - --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 - -DPython_FIND_STRATEGY=VERSION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) add_test(NAME FindPython.Python.V3.ExactVersion.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -263,46 +300,6 @@ if(CMake_TEST_FindPython) --build-options ${build_options} -DPython=Python3 -DPython_REQUESTED_VERSION=3 -DPython3_FIND_STRATEGY=VERSION ) - add_test(NAME FindPython.Python2.VersionRange.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.LOCATION" - ${build_generator_args} - --build-project TestVersionRange - --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 - -DPython2_FIND_STRATEGY=LOCATION - ) - add_test(NAME FindPython.Python2.VersionRange.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.VERSION" - ${build_generator_args} - --build-project TestVersionRange - --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 - -DPython2_FIND_STRATEGY=VERSION - ) - add_test(NAME FindPython.Python.V2.VersionRange.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.LOCATION" - ${build_generator_args} - --build-project TestVersionRange - --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 - -DPython_FIND_STRATEGY=LOCATION - ) - add_test(NAME FindPython.Python.V2.VersionRange.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.VERSION" - ${build_generator_args} - --build-project TestVersionRange - --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 - -DPython_FIND_STRATEGY=VERSION - ) add_test(NAME FindPython.Python.V3.VersionRange.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -324,17 +321,6 @@ if(CMake_TEST_FindPython) -DPython_FIND_STRATEGY=VERSION ) - add_test(NAME FindPython.MultiplePackages COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages" - "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages" - ${build_generator_args} - --build-project TestMultiplePackages - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) - add_test(NAME FindPython.VirtualEnv COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -346,16 +332,6 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.Python2Embedded COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Embedded" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2Embedded" - ${build_generator_args} - --build-project TestPython2Embedded - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) add_test(NAME FindPython.Python3Embedded COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -377,7 +353,7 @@ if(CMake_TEST_FindPython) --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" - "-DCMake_TEST_FindPython_SABIModule=${CMake_TEST_FindPython_SABIModule}" + "-DCMake_TEST_FindPython3_SABIModule=${CMake_TEST_FindPython3_SABIModule}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) @@ -391,7 +367,7 @@ if(CMake_TEST_FindPython) --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" - "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DCMake_TEST_FindPython3_NumPy=${CMake_TEST_FindPython3_NumPy}" "-DPython3_ARTIFACTS_INTERACTIVE=ON" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) @@ -405,7 +381,7 @@ if(CMake_TEST_FindPython) --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" - "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DCMake_TEST_FindPython3_NumPy=${CMake_TEST_FindPython3_NumPy}" "-DPython3_ARTIFACTS_INTERACTIVE=OFF" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) @@ -420,7 +396,7 @@ if(CMake_TEST_FindPython) --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" - "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DCMake_TEST_FindPython3_NumPy=${CMake_TEST_FindPython3_NumPy}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) @@ -437,6 +413,41 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + add_test(NAME FindPython.UnversionedNames COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/UnversionedNames" + "${CMake_BINARY_DIR}/Tests/FindPython/UnversionedNames" + ${build_generator_args} + --build-project UnversionedNames + --build-options ${build_options} + ) + endif() +endif() + +if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3) + add_test(NAME FindPython.Python.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.LOCATION" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + add_test(NAME FindPython.Python.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.VERSION" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + if (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") add_test(NAME FindPython.Interpreter.SOABI COMMAND ${CMAKE_CTEST_COMMAND} -C $ @@ -466,20 +477,20 @@ if(CMake_TEST_FindPython) ) endif() - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - add_test(NAME FindPython.UnversionedNames COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/UnversionedNames" - "${CMake_BINARY_DIR}/Tests/FindPython/UnversionedNames" - ${build_generator_args} - --build-project UnversionedNames - --build-options ${build_options} + add_test(NAME FindPython.MultiplePackages COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages" + "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages" + ${build_generator_args} + --build-project TestMultiplePackages + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - endif() endif() -if(CMake_TEST_FindPython_SABIModule) + +if(CMake_TEST_FindPython2_SABIModule) add_test(NAME FindPython.Python2.Development.SABIModule COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -492,7 +503,9 @@ if(CMake_TEST_FindPython_SABIModule) ) set_tests_properties(FindPython.Python2.Development.SABIModule PROPERTIES PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: .*Development\\.SABIModule") +endif() +if(CMake_TEST_FindPython3_SABIModule) # Use exclusively Release configuration because Debug is, on Windows with MSVC, # unusable with SABI: Python force link with debug version of full versioned library rather than # the stable ABI one. @@ -508,7 +521,7 @@ if(CMake_TEST_FindPython_SABIModule) ) endif() -if(CMake_TEST_FindPython_NumPy) +if(CMake_TEST_FindPython2_NumPy OR CMake_TEST_FindPython3_NumPy) add_test(NAME FindPython.NumPy COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -530,7 +543,7 @@ if(CMake_TEST_FindPython_NumPy) ) endif() -if(CMake_TEST_FindPython_Conda) +if(CMake_TEST_FindPython3_Conda) add_test(NAME FindPython.VirtualEnvConda COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -543,7 +556,7 @@ if(CMake_TEST_FindPython_Conda) ) endif() -if (CMake_TEST_FindPython AND CMake_TEST_FindPython_IronPython) +if (CMake_TEST_FindPython2 AND CMake_TEST_FindPython2_IronPython) add_test(NAME FindPython.Implementation.CPython COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -566,7 +579,7 @@ if (CMake_TEST_FindPython AND CMake_TEST_FindPython_IronPython) ) endif() -if(CMake_TEST_FindPython_IronPython) +if(CMake_TEST_FindPython2_IronPython) add_test(NAME FindPython.IronPython2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -653,7 +666,7 @@ if(CMake_TEST_FindPython_IronPython) ) endif() -if(CMake_TEST_FindPython_PyPy) +if(CMake_TEST_FindPython2_PyPy) add_test(NAME FindPython.PyPy2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -675,85 +688,91 @@ if(CMake_TEST_FindPython_PyPy) --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.PyPy3.LOCATION COMMAND + add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION" + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.LOCATION" ${build_generator_args} - --build-project TestPyPy3 - --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.PyPy3.VERSION COMMAND + add_test(NAME FindPython.PyPy.V2.VERSION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION" + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.VERSION" ${build_generator_args} - --build-project TestPyPy3 - --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) +endif() - add_test(NAME FindPython.PyPy.LOCATION COMMAND +if(CMake_TEST_FindPython3_PyPy) + add_test(NAME FindPython.PyPy3.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION" + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION" ${build_generator_args} - --build-project TestPyPy - --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION + --build-project TestPyPy3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.PyPy.VERSION COMMAND + add_test(NAME FindPython.PyPy3.VERSION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION" + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION" ${build_generator_args} - --build-project TestPyPy - --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION + --build-project TestPyPy3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND + + add_test(NAME FindPython.PyPy.V3.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.LOCATION" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.LOCATION" ${build_generator_args} --build-project TestPyPy - --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.PyPy.V2.VERSION COMMAND + add_test(NAME FindPython.PyPy.V3.VERSION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.VERSION" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.VERSION" ${build_generator_args} --build-project TestPyPy - --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.PyPy.V3.LOCATION COMMAND +endif() + +if(CMake_TEST_FindPython2_PyPy OR CMake_TEST_FindPython3_PyPy) + add_test(NAME FindPython.PyPy.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.LOCATION" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION" ${build_generator_args} --build-project TestPyPy - --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION + --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.PyPy.V3.VERSION COMMAND + add_test(NAME FindPython.PyPy.VERSION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.VERSION" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION" ${build_generator_args} --build-project TestPyPy - --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION + --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) endif() diff --git a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt index 283aeec9b82..e0148f3e35d 100644 --- a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt +++ b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt @@ -62,7 +62,7 @@ set_tests_properties(FindPython.CustomFailureMessage.Multiple PROPERTIES PASS_REGULAR_EXPRESSION "Reason given by package:.+Interpreter: Cannot run the interpreter.+Development: Cannot find the library") -if (CMake_TEST_FindPython_NumPy) +if (CMake_TEST_FindPython3_NumPy) add_test(NAME FindPython.CustomFailureMessage.NumPy COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test diff --git a/Tests/FindPython/MultiplePackages/CMakeLists.txt b/Tests/FindPython/MultiplePackages/CMakeLists.txt index 48450352f06..352a2f6f3e5 100644 --- a/Tests/FindPython/MultiplePackages/CMakeLists.txt +++ b/Tests/FindPython/MultiplePackages/CMakeLists.txt @@ -2,32 +2,44 @@ cmake_minimum_required(VERSION 3.5) project(TestMultiplePackages C) -find_package (Python2 REQUIRED COMPONENTS Interpreter Development) -find_package (Python3 REQUIRED COMPONENTS Interpreter Development) - -# Must find Python 3 find_package (Python REQUIRED) -if (NOT Python3_EXECUTABLE STREQUAL Python_EXECUTABLE) - message (FATAL_ERROR - "Python interpreters do not match:\n" - " Python_EXECUTABLE='${Python_EXECUTABLE}'\n" - " Python3_EXECUTABLE='${Python3_EXECUTABLE}'\n" +if (CMake_TEST_FindPython2) + find_package (Python2 REQUIRED COMPONENTS Interpreter Development) + + if (NOT CMake_TEST_FindPython3 AND NOT Python2_EXECUTABLE STREQUAL Python_EXECUTABLE) + message (FATAL_ERROR + "Python interpreters do not match:\n" + " Python_EXECUTABLE='${Python_EXECUTABLE}'\n" + " Python2_EXECUTABLE='${Python3_EXECUTABLE}'\n" ) -endif() + endif() + + Python2_add_library (spam2 MODULE ../spam.c) + target_compile_definitions (spam2 PRIVATE PYTHON2) + add_test (NAME python2_spam2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") -Python2_add_library (spam2 MODULE ../spam.c) -target_compile_definitions (spam2 PRIVATE PYTHON2) +endif() + +if (CMake_TEST_FindPython3) + find_package (Python3 REQUIRED COMPONENTS Interpreter Development) -Python3_add_library (spam3 MODULE ../spam.c) -target_compile_definitions (spam3 PRIVATE PYTHON3) + if (NOT Python3_EXECUTABLE STREQUAL Python_EXECUTABLE) + message (FATAL_ERROR + "Python interpreters do not match:\n" + " Python_EXECUTABLE='${Python_EXECUTABLE}'\n" + " Python3_EXECUTABLE='${Python3_EXECUTABLE}'\n" + ) + endif() + Python3_add_library (spam3 MODULE ../spam.c) + target_compile_definitions (spam3 PRIVATE PYTHON3) -add_test (NAME python2_spam2 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" - "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") + add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") -add_test (NAME python3_spam3 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" - "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") +endif() diff --git a/Tests/FindPython/NumPy/CMakeLists.txt b/Tests/FindPython/NumPy/CMakeLists.txt index 9920336b774..336bb83e57c 100644 --- a/Tests/FindPython/NumPy/CMakeLists.txt +++ b/Tests/FindPython/NumPy/CMakeLists.txt @@ -2,21 +2,30 @@ cmake_minimum_required(VERSION 3.5) project(TestNumPy LANGUAGES C) -find_package (Python2 REQUIRED COMPONENTS Interpreter Development NumPy) -find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy) +if(CMake_TEST_FindPython2_NumPy) -Python2_add_library (arraytest2 MODULE arraytest.c) -target_compile_definitions (arraytest2 PRIVATE PYTHON2) -target_link_libraries (arraytest2 PRIVATE Python2::NumPy) + find_package (Python2 REQUIRED COMPONENTS Interpreter Development NumPy) -Python3_add_library (arraytest3 MODULE arraytest.c) -target_compile_definitions (arraytest3 PRIVATE PYTHON3) -target_link_libraries (arraytest3 PRIVATE Python3::NumPy) + Python2_add_library (arraytest2 MODULE arraytest.c) + target_compile_definitions (arraytest2 PRIVATE PYTHON2) + target_link_libraries (arraytest2 PRIVATE Python2::NumPy) -add_test (NAME python2_arraytest - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" - "${Python2_EXECUTABLE}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));") + add_test (NAME python2_arraytest + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python2_EXECUTABLE}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));") -add_test (NAME python3_arraytest - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" - "${Python3_EXECUTABLE}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));") +endif() + +if(CMake_TEST_FindPython3_NumPy) + + find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy) + + Python3_add_library (arraytest3 MODULE arraytest.c) + target_compile_definitions (arraytest3 PRIVATE PYTHON3) + target_link_libraries (arraytest3 PRIVATE Python3::NumPy) + + add_test (NAME python3_arraytest + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python3_EXECUTABLE}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));") + +endif() diff --git a/Tests/FindPython/NumPyOnly/CMakeLists.txt b/Tests/FindPython/NumPyOnly/CMakeLists.txt index 9aa1bcf9e10..115cf2b42bb 100644 --- a/Tests/FindPython/NumPyOnly/CMakeLists.txt +++ b/Tests/FindPython/NumPyOnly/CMakeLists.txt @@ -2,13 +2,23 @@ cmake_minimum_required(VERSION 3.5) project(TestNumPyOnly LANGUAGES C) -find_package(Python2 REQUIRED COMPONENTS NumPy) -find_package(Python3 REQUIRED COMPONENTS NumPy) +if(CMake_TEST_FindPython2_NumPy) + + find_package(Python2 REQUIRED COMPONENTS NumPy) + + Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c) + target_compile_definitions (arraytest2 PRIVATE PYTHON2) + target_link_libraries (arraytest2 PRIVATE Python2::NumPy) + +endif() -Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c) -target_compile_definitions (arraytest2 PRIVATE PYTHON2) -target_link_libraries (arraytest2 PRIVATE Python2::NumPy) + +if(CMake_TEST_FindPython3_NumPy) + +find_package(Python3 REQUIRED COMPONENTS NumPy) Python3_add_library (arraytest3 MODULE ../NumPy/arraytest.c) target_compile_definitions (arraytest3 PRIVATE PYTHON3) target_link_libraries (arraytest3 PRIVATE Python3::NumPy) + +endif() diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt index cb9d4d380e7..eec28a506f0 100644 --- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt @@ -4,13 +4,20 @@ project(TestRequiredArtifacts LANGUAGES C) include(CTest) -find_package(Python2 REQUIRED COMPONENTS Interpreter Development) -if (NOT Python2_FOUND) - message (FATAL_ERROR "Failed to find Python 2") +if(CMake_TEST_FindPython2) + find_package(Python2 REQUIRED COMPONENTS Interpreter Development) + if (NOT Python2_FOUND) + message (FATAL_ERROR "Failed to find Python 2") + endif() + set(USER_LIBRARY "${Python2_LIBRARY_RELEASE}") + set(USER_INCLUDE_DIR "${Python2_INCLUDE_DIRS}") +else() + set(USER_LIBRARY "/path/to/invalid${CMAKE_C_LINK_LIBRARY_SUFFIX}") + set(USER_INCLUDE_DIR "/path/to/invalid/dir") endif() set(components Interpreter Development) -if (CMake_TEST_FindPython_SABIModule AND WIN32) +if (CMake_TEST_FindPython3_SABIModule AND WIN32) list (APPEND components Development.SABIModule) endif() find_package(Python3 REQUIRED COMPONENTS ${components}) @@ -61,7 +68,7 @@ add_test(NAME FindPython.RequiredArtifacts.Library.INVALID COMMAND ${build_generator_args} --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_LIBRARY=ON - "-DPython3_LIBRARY=${Python2_LIBRARY_RELEASE}" + "-DPython3_LIBRARY=${USER_LIBRARY}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) @@ -84,7 +91,7 @@ add_test(NAME FindPython.RequiredArtifacts.Include.INVALID COMMAND ${build_generator_args} --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_INCLUDE=ON - "-DPython3_INCLUDE_DIR=${Python2_INCLUDE_DIRS}" + "-DPython3_INCLUDE_DIR=${USER_INCLUDE_DIR}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) @@ -97,7 +104,7 @@ add_test(NAME FindPython.RequiredArtifacts.Interpreter-Library.INVALID COMMAND --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_INTERPRETER=ON -DCHECK_LIBRARY=ON "-DPython3_EXECUTABLE=${Python3_EXECUTABLE}" - "-DPython3_LIBRARY=${Python2_LIBRARY_RELEASE}" + "-DPython3_LIBRARY=${USER_LIBRARY}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) @@ -110,11 +117,11 @@ add_test(NAME FindPython.RequiredArtifacts.Library-Include.INVALID COMMAND --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_LIBRARY=ON -DCHECK_INCLUDE=ON "-DPython3_LIBRARY=${Python3_LIBRARY_RELEASE}" - "-DPython3_INCLUDE_DIR=${Python2_INCLUDE_DIRS}" + "-DPython3_INCLUDE_DIR=${USER_INCLUDE_DIR}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) -if (CMake_TEST_FindPython_SABIModule AND WIN32) +if (CMake_TEST_FindPython3_SABIModule AND WIN32) add_test(NAME FindPython.RequiredArtifacts.SABILibrary.VALID COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -134,7 +141,7 @@ if (CMake_TEST_FindPython_SABIModule AND WIN32) ${build_generator_args} --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_SABI_LIBRARY=ON - "-DPython3_SABI_LIBRARY=${Python2_LIBRARY_RELEASE}" + "-DPython3_SABI_LIBRARY=${USER_LIBRARY}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) endif() diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt index 60399d3677d..6c0e9a927aa 100644 --- a/Tests/FindPython/SOABI/CMakeLists.txt +++ b/Tests/FindPython/SOABI/CMakeLists.txt @@ -2,37 +2,40 @@ cmake_minimum_required(VERSION 3.5) project(TestSOABI LANGUAGES C) -find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT}) -if (NOT Python3_FOUND) - message (FATAL_ERROR "Failed to find Python 3") -endif() +if(CMake_TEST_FindPython3) + find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT}) + if (NOT Python3_FOUND) + message (FATAL_ERROR "Failed to find Python 3") + endif() -if(NOT DEFINED Python3_SOABI) - message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") -endif() + if(NOT DEFINED Python3_SOABI) + message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") + endif() -if (Python3_Development_FOUND AND Python3_SOABI) - Python3_add_library (spam3 MODULE WITH_SOABI ../spam.c) - target_compile_definitions (spam3 PRIVATE PYTHON3) + if (Python3_Development_FOUND AND Python3_SOABI) + Python3_add_library (spam3 MODULE WITH_SOABI ../spam.c) + target_compile_definitions (spam3 PRIVATE PYTHON3) - get_property (suffix TARGET spam3 PROPERTY SUFFIX) - if (NOT suffix MATCHES "^.${Python3_SOABI}") - message(FATAL_ERROR "Module suffix do not include Python3_SOABI") + get_property (suffix TARGET spam3 PROPERTY SUFFIX) + if (NOT suffix MATCHES "^.${Python3_SOABI}") + message(FATAL_ERROR "Module suffix do not include Python3_SOABI") + endif() endif() endif() +if(CMake_TEST_FindPython2) + find_package(Python2 COMPONENTS ${CMake_TEST_FindPython_COMPONENT}) + if(NOT DEFINED Python2_SOABI) + message(FATAL_ERROR "Python2_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") + endif() -find_package(Python2 COMPONENTS ${CMake_TEST_FindPython_COMPONENT}) -if(NOT DEFINED Python2_SOABI) - message(FATAL_ERROR "Python2_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") -endif() - -if (Python2_Development_FOUND AND Python2_SOABI) - Python2_add_library (spam2 MODULE WITH_SOABI ../spam.c) - target_compile_definitions (spam2 PRIVATE PYTHON2) + if (Python2_Development_FOUND AND Python2_SOABI) + Python2_add_library (spam2 MODULE WITH_SOABI ../spam.c) + target_compile_definitions (spam2 PRIVATE PYTHON2) - get_property (suffix TARGET spam2 PROPERTY SUFFIX) - if (NOT suffix MATCHES "^.${Python2_SOABI}") - message(FATAL_ERROR "Module suffix do not include Python2_SOABI") + get_property (suffix TARGET spam2 PROPERTY SUFFIX) + if (NOT suffix MATCHES "^.${Python2_SOABI}") + message(FATAL_ERROR "Module suffix do not include Python2_SOABI") + endif() endif() endif() diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt index e2e5bd2b2f2..ea742eafaea 100644 --- a/Tests/FindPython/VirtualEnv/CMakeLists.txt +++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt @@ -27,21 +27,23 @@ add_test(NAME FindPython3.VirtualEnvDefault "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvDefault.cmake") -add_test(NAME FindPython3.VirtualEnvOnly - COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME - --unset=CONDA_PREFIX - "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" - "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" - -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") -add_test(NAME FindPython3.UnsetVirtualEnvOnly - COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME - --unset=VIRTUAL_ENV - --unset=CONDA_PREFIX - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") - add_test(NAME FindPython3.VirtualEnvStandard COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME --unset=CONDA_PREFIX "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvStandard.cmake") + +if(CMake_TEST_FindPython2) + add_test(NAME FindPython3.VirtualEnvOnly + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + --unset=CONDA_PREFIX + "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") + add_test(NAME FindPython3.UnsetVirtualEnvOnly + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + --unset=VIRTUAL_ENV + --unset=CONDA_PREFIX + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") +endif() diff --git a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt index 2f7c0db0c31..3a64c312896 100644 --- a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt +++ b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt @@ -26,21 +26,23 @@ add_test(NAME FindPython3.VirtualEnvDefaultConda "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvDefault.cmake") -add_test(NAME FindPython3.VirtualEnvOnlyConda - COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME - --unset=VIRTUAL_ENV - "CONDA_PREFIX=${Python3_VIRTUAL_ENV}" - "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" - -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") -add_test(NAME FindPython3.UnsetVirtualEnvOnlyConda - COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME - --unset=CONDA_PREFIX - --unset=VIRTUAL_ENV - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") - add_test(NAME FindPython3.VirtualEnvStandardConda COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME --unset=VIRTUAL_ENV "CONDA_PREFIX=${Python3_VIRTUAL_ENV}" "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvStandard.cmake") + +if(Cmake_TEST_FindPython2) + add_test(NAME FindPython3.VirtualEnvOnlyConda + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + --unset=VIRTUAL_ENV + "CONDA_PREFIX=${Python3_VIRTUAL_ENV}" + "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") + add_test(NAME FindPython3.UnsetVirtualEnvOnlyConda + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + --unset=CONDA_PREFIX + --unset=VIRTUAL_ENV + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index f089a963cd2..8baa98f815c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -363,7 +363,8 @@ if(CMake_TEST_FindOpenSSL) endif() if(CMake_TEST_UseSWIG) add_RunCMake_test(FindSWIG) - add_RunCMake_test(UseSWIG -DCMake_TEST_FindPython=${CMake_TEST_FindPython}) + add_RunCMake_test(UseSWIG -DCMake_TEST_FindPython2=${CMake_TEST_FindPython2} + -DCMake_TEST_FindPython3=${CMake_TEST_FindPython3}) endif() if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") add_RunCMake_test(GenerateExportHeader) diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake index c7a118ffc5e..537f67d923f 100644 --- a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake @@ -6,7 +6,7 @@ run_cmake(CMP0078-NEW) run_cmake(CMP0086-WARN) -if (CMake_TEST_FindPython) +if (CMake_TEST_FindPython2 OR CMake_TEST_FindPython3) macro(run_cmake_target test subtest target) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) diff --git a/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt b/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt index a2c239cbde9..f20593cd903 100644 --- a/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt +++ b/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt @@ -7,7 +7,7 @@ include(CTest) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(Python2 REQUIRED COMPONENTS Interpreter Development) +find_package(Python REQUIRED COMPONENTS Interpreter Development) # Path separator if (WIN32) @@ -27,9 +27,9 @@ swig_add_library(example_python set_target_properties (example_python PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.." SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE) -target_link_libraries(example_python PRIVATE Python2::Python) +target_link_libraries(example_python PRIVATE Python::Python) add_test (NAME AlternateLibraryName.example1 COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}${PS}$" - "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") + "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt index 7c4925e8412..3d80270376a 100644 --- a/Tests/UseSWIG/CMakeLists.txt +++ b/Tests/UseSWIG/CMakeLists.txt @@ -147,16 +147,18 @@ add_test(NAME UseSWIG.MultipleModules COMMAND --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) -add_test(NAME UseSWIG.MultiplePython COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultiplePython" - "${CMake_BINARY_DIR}/Tests/UseSWIG/MultiplePython" - ${build_generator_args} - --build-project TestMultiplePython - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ +if(CMake_TEST_FindPython2 AND CMake_TEST_FindPython3) + add_test(NAME UseSWIG.MultiplePython COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultiplePython" + "${CMake_BINARY_DIR}/Tests/UseSWIG/MultiplePython" + ${build_generator_args} + --build-project TestMultiplePython + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) +endif() add_test(NAME UseSWIG.MultipleFiles COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -165,20 +167,20 @@ add_test(NAME UseSWIG.MultipleFiles COMMAND ${build_generator_args} --build-project TestMultipleFiles --build-options ${build_options} - ) - +) -add_test(NAME UseSWIG.ModuleVersion2 COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/UseSWIG/ModuleVersion2" - "${CMake_BINARY_DIR}/Tests/UseSWIG/ModuleVersion2" - ${build_generator_args} - --build-project TestModuleVersion2 - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ +if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3) + add_test(NAME UseSWIG.ModuleVersion2 COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/ModuleVersion2" + "${CMake_BINARY_DIR}/Tests/UseSWIG/ModuleVersion2" + ${build_generator_args} + --build-project TestModuleVersion2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - +endif() add_test(NAME UseSWIG.UseTargetINCLUDE_DIRECTORIES COMMAND ${CMAKE_CTEST_COMMAND} -C $ diff --git a/Tests/UseSWIG/ModuleName/CMakeLists.txt b/Tests/UseSWIG/ModuleName/CMakeLists.txt index 435b441a4ff..c62319fcd36 100644 --- a/Tests/UseSWIG/ModuleName/CMakeLists.txt +++ b/Tests/UseSWIG/ModuleName/CMakeLists.txt @@ -8,14 +8,7 @@ find_package(SWIG REQUIRED) cmake_policy(SET CMP0086 NEW) include(${SWIG_USE_FILE}) -find_package(Python2 REQUIRED COMPONENTS Interpreter Development) - -# Path separator -if (WIN32) - set (PS "$") -else() - set (PS ":") -endif() +find_package(Python REQUIRED COMPONENTS Interpreter Development) unset(CMAKE_SWIG_FLAGS) @@ -34,9 +27,9 @@ set_target_properties (example1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1") -target_link_libraries(example1 PRIVATE Python2::Module) +target_link_libraries(example1 PRIVATE Python::Module) add_test (NAME ModuleName.example1 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Python2${PS}$" - "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py") + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py") diff --git a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt index 093e8582cf5..317ed4767b1 100644 --- a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt +++ b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt @@ -7,9 +7,6 @@ include(CTest) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(Python2 REQUIRED COMPONENTS Interpreter Development) -find_package(Python3 REQUIRED COMPONENTS Interpreter Development) - if (WIN32) set (PS $) else() @@ -25,32 +22,69 @@ set_property(SOURCE "../example.i" PROPERTY COMPILE_OPTIONS -includeall) set_property(SOURCE "../example.i" PROPERTY GENERATED_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/..") -swig_add_library(example1 - LANGUAGE python - SOURCES ../example.i ../example.cxx) -set_target_properties (example1 PROPERTIES - OUTPUT_NAME example - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2") -target_link_libraries(example1 PRIVATE Python2::Module) - -# re-use sample interface file for another plugin -swig_add_library(example2 - LANGUAGE python - SOURCES ../example.i ../example.cxx) -set_target_properties (example2 PROPERTIES - OUTPUT_NAME example - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3") -target_link_libraries(example2 PRIVATE Python3::Module) - - -add_test (NAME ModuleVersion2.example1 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$${PS}$" - "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") - -add_test (NAME ModuleVersion2.example2 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$${PS}$" - "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") +if(CMake_TEST_FindPython2) + find_package(Python2 REQUIRED COMPONENTS Interpreter Development) + + swig_add_library(example1 + LANGUAGE python + SOURCES ../example.i ../example.cxx) + set_target_properties (example1 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-1" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-1" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-1") + target_link_libraries(example1 PRIVATE Python2::Module) + + add_test (NAME ModuleVersion2.example1 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$${PS}$" + "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") + + # re-use sample interface file for another plugin + swig_add_library(example2 + LANGUAGE python + SOURCES ../example.i ../example.cxx) + set_target_properties (example2 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-2" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-2" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-2") + target_link_libraries(example2 PRIVATE Python2::Module) + + add_test (NAME ModuleVersion2.example2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$${PS}$" + "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") +endif() + +if(CMake_TEST_FindPython3) + find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + + swig_add_library(example3 + LANGUAGE python + SOURCES ../example.i ../example.cxx) + set_target_properties (example3 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-1" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-1" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-1") + target_link_libraries(example3 PRIVATE Python3::Module) + + add_test (NAME ModuleVersion2.example3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$${PS}$" + "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") + + + # re-use sample interface file for another plugin + swig_add_library(example4 + LANGUAGE python + SOURCES ../example.i ../example.cxx) + set_target_properties (example2 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-2" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-2" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-2") + target_link_libraries(example4 PRIVATE Python3::Module) + + add_test (NAME ModuleVersion2.example4 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$${PS}$" + "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") +endif() diff --git a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt index bf3d9469e16..36734f92930 100644 --- a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt +++ b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt @@ -11,7 +11,7 @@ unset(SWIG_LANG_DEFINITIONS) unset(SWIG_LANG_OPTIONS) unset(SWIG_LANG_LIBRARIES) -find_package(Python3 REQUIRED COMPONENTS Development) +find_package(Python REQUIRED COMPONENTS Development) set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY CPLUSPLUS ON) set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY CPLUSPLUS ON) @@ -27,4 +27,4 @@ swig_add_library(example "${CMAKE_CURRENT_SOURCE_DIR}/add.cxx" "${CMAKE_CURRENT_SOURCE_DIR}/sub.cxx") target_include_directories(example PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries(example PRIVATE Python3::Module) +target_link_libraries(example PRIVATE Python::Module) diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt index 80a2e1650d4..6cdf987fc0e 100644 --- a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt +++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt @@ -7,7 +7,7 @@ include(CTest) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +find_package(Python REQUIRED COMPONENTS Interpreter Development) unset(CMAKE_SWIG_FLAGS) @@ -25,7 +25,7 @@ set_target_properties (example1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1") -target_link_libraries(example1 PRIVATE Python3::Module) +target_link_libraries(example1 PRIVATE Python::Module) # Check that source property override target property @@ -42,4 +42,4 @@ set_target_properties (example2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2") -target_link_libraries(example2 PRIVATE Python3::Module) +target_link_libraries(example2 PRIVATE Python::Module) From da211a5996cb100d06017a28d534c674ebe819f0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 16 Jun 2023 00:01:08 -0400 Subject: [PATCH 030/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1310b1e6272..46e547aef81 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230615) +set(CMake_VERSION_PATCH 20230616) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From a5e29c4c4226e5e8b4edbcd81a240a28f4244674 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 17 Jun 2023 00:01:16 -0400 Subject: [PATCH 031/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 46e547aef81..919211887dd 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230616) +set(CMake_VERSION_PATCH 20230617) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From cb7dda1c69a8734a66cb284ae813df97d300fac7 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 18 Jun 2023 00:01:08 -0400 Subject: [PATCH 032/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 919211887dd..ee0c780f85d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230617) +set(CMake_VERSION_PATCH 20230618) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From af9489a4f2858db0bf666c29f99dd332426f5ca1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 19 Jun 2023 00:02:05 -0400 Subject: [PATCH 033/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ee0c780f85d..e9f73190459 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230618) +set(CMake_VERSION_PATCH 20230619) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From ea1cd8ee7d476b461e442b6d5fcb81b4823ef0a6 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 20 Jun 2023 00:01:10 -0400 Subject: [PATCH 034/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e9f73190459..a891d9364f1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230619) +set(CMake_VERSION_PATCH 20230620) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 70f36de1e54e072cc3f241f7d1fe8333aad2296e Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 19 Jun 2023 17:49:38 +0200 Subject: [PATCH 035/627] File set: Allow absolute CMAKE_INSTALL_INCLUDEDIR When install(TARGETS) and install(EXPORT) were called with file sets and an absolute CMAKE_INSTALL_INCLUDEDIR, "${_IMPORT_PREFIX}/" was still being prepended to the base directory and files, resulting in incorrect paths. Don't prepend this when absolute paths are used. Fixes: #25010 --- Source/cmExportInstallFileGenerator.cxx | 23 +++++++++++-------- ...leSetAbsoluteInstallIncludeDirExport.cmake | 16 +++++++++++++ ...leSetAbsoluteInstallIncludeDirImport.cmake | 9 ++++++++ .../target_sources/RunCMakeTest.cmake | 1 + 4 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirExport.cmake create mode 100644 Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirImport.cmake diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 538c88399ab..46cd9362960 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -590,10 +590,12 @@ std::string cmExportInstallFileGenerator::GetFileSetDirectories( auto cge = ge.Parse(te->FileSetGenerators.at(fileSet)->GetDestination()); for (auto const& config : configs) { - auto dest = cmStrCat("${_IMPORT_PREFIX}/", - cmOutputConverter::EscapeForCMake( - cge->Evaluate(gte->LocalGenerator, config, gte), - cmOutputConverter::WrapQuotes::NoWrap)); + auto unescapedDest = cge->Evaluate(gte->LocalGenerator, config, gte); + auto dest = cmOutputConverter::EscapeForCMake( + unescapedDest, cmOutputConverter::WrapQuotes::NoWrap); + if (!cmSystemTools::FileIsFullPath(unescapedDest)) { + dest = cmStrCat("${_IMPORT_PREFIX}/", dest); + } auto const& type = fileSet->GetType(); // C++ modules do not support interface file sets which are dependent upon @@ -645,11 +647,14 @@ std::string cmExportInstallFileGenerator::GetFileSetFiles( fileSet->EvaluateFileEntry(directories, files, entry, gte->LocalGenerator, config, gte); } - auto dest = cmStrCat("${_IMPORT_PREFIX}/", - cmOutputConverter::EscapeForCMake( - destCge->Evaluate(gte->LocalGenerator, config, gte), - cmOutputConverter::WrapQuotes::NoWrap), - '/'); + auto unescapedDest = destCge->Evaluate(gte->LocalGenerator, config, gte); + auto dest = + cmStrCat(cmOutputConverter::EscapeForCMake( + unescapedDest, cmOutputConverter::WrapQuotes::NoWrap), + '/'); + if (!cmSystemTools::FileIsFullPath(unescapedDest)) { + dest = cmStrCat("${_IMPORT_PREFIX}/", dest); + } bool const contextSensitive = destCge->GetHadContextSensitiveCondition() || std::any_of(directoryEntries.begin(), directoryEntries.end(), diff --git a/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirExport.cmake b/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirExport.cmake new file mode 100644 index 00000000000..f049d912058 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirExport.cmake @@ -0,0 +1,16 @@ +enable_language(C) + +# According to https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#module:GNUInstallDirs +# relative CMAKE_INSTALL_ are encouraged, but absolute path's are also allowed. +# Construct an absolute CMAKE_INSTALL_INCLUDEDIR. +set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include") + +add_library(lib1) +target_sources(lib1 + PRIVATE lib1.c + PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +# Expect install(TARGETS) to respect absolute CMAKE_INSTALL_INCLUDEDIR +# when installing the HEADERS. +# Must not prepend the CMAKE_INSTALL_PREFIX in the -config.cmake. +install(TARGETS lib1 EXPORT lib1-config FILE_SET HEADERS) +install(EXPORT lib1-config NAMESPACE lib1:: DESTINATION share/lib1) diff --git a/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirImport.cmake b/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirImport.cmake new file mode 100644 index 00000000000..123d6ae81a7 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetAbsoluteInstallIncludeDirImport.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +get_filename_component(CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}" DIRECTORY) +string(APPEND CMAKE_PREFIX_PATH "/FileSetAbsoluteInstallIncludeDirExport-build/install") + +find_package(lib1 REQUIRED) + +add_executable(exe main.cpp) +target_link_libraries(exe PRIVATE lib1::lib1) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index 90915cd7590..8505f71d79d 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -99,3 +99,4 @@ function(run_export_import name) endfunction() run_export_import(FileSet) +run_export_import(FileSetAbsoluteInstallIncludeDir) From 88e7ad0084bd6a2fa6f032d7be1ee5d993440dcf Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 21 Jun 2023 00:01:14 -0400 Subject: [PATCH 036/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a891d9364f1..9cc4320bed5 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230620) +set(CMake_VERSION_PATCH 20230621) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From a87ee958e83fb175c03bd2995666b8d278d62527 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 22 Jun 2023 00:01:12 -0400 Subject: [PATCH 037/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9cc4320bed5..fa9cd5d520f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230621) +set(CMake_VERSION_PATCH 20230622) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 45f17e5a8566fcdec0071a5ed1bc2656968bf258 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Tue, 20 Jun 2023 16:32:27 +0200 Subject: [PATCH 038/627] cmList: Add container conversion to string --- Source/CPack/cmCPackGenerator.cxx | 4 +- Source/CPack/cmCPackNuGetGenerator.cxx | 10 ++--- Source/CPack/cpack.cxx | 4 +- Source/cmAuxSourceDirectoryCommand.cxx | 3 +- .../cmCMakeHostSystemInformationCommand.cxx | 4 +- Source/cmExecuteProcessCommand.cxx | 3 +- Source/cmExportBuildFileGenerator.cxx | 3 +- Source/cmExportFileGenerator.cxx | 2 +- Source/cmExportInstallFileGenerator.cxx | 3 +- Source/cmExportTryCompileFileGenerator.cxx | 4 +- Source/cmFileCommand.cxx | 15 +++---- Source/cmFunctionCommand.cxx | 5 ++- Source/cmGeneratorExpressionNode.cxx | 14 +++---- Source/cmGeneratorTarget.cxx | 5 +-- Source/cmGetCMakePropertyCommand.cxx | 4 +- Source/cmLinkDirectoriesCommand.cxx | 3 +- Source/cmList.cxx | 11 ++--- Source/cmList.h | 41 +++++++++++++++++-- Source/cmMacroCommand.cxx | 6 ++- Source/cmMakefile.cxx | 9 ++-- Source/cmParseArgumentsCommand.cxx | 17 ++++---- Source/cmSeparateArgumentsCommand.cxx | 3 +- Source/cmSetCommand.cxx | 4 +- Source/cmSourceFile.cxx | 7 ++-- Source/cmState.cxx | 8 ++-- Source/cmStateDirectory.cxx | 24 +++++------ Source/cmTarget.cxx | 12 +++--- Source/cmTargetCompileFeaturesCommand.cxx | 3 +- Source/cmTargetCompileOptionsCommand.cxx | 3 +- Source/cmTargetLinkDirectoriesCommand.cxx | 3 +- Source/cmTargetLinkOptionsCommand.cxx | 3 +- Source/cmTargetPrecompileHeadersCommand.cxx | 3 +- Source/cmTargetSourcesCommand.cxx | 2 +- Utilities/std/cmext/iterator | 15 +++++-- 34 files changed, 161 insertions(+), 99 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index afd85cda757..11d90c07202 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1119,8 +1119,8 @@ int cmCPackGenerator::DoPackage() // Run post-build actions cmValue postBuildScripts = this->GetOption("CPACK_POST_BUILD_SCRIPTS"); if (postBuildScripts) { - this->MakefileMap->AddDefinition("CPACK_PACKAGE_FILES", - cmJoin(this->packageFileNames, ";")); + this->MakefileMap->AddDefinition( + "CPACK_PACKAGE_FILES", cmList::to_string(this->packageFileNames)); const cmList scripts{ postBuildScripts }; for (const auto& script : scripts) { diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx index 5de817937f0..aa99fb64871 100644 --- a/Source/CPack/cmCPackNuGetGenerator.cxx +++ b/Source/CPack/cmCPackNuGetGenerator.cxx @@ -12,7 +12,7 @@ #include "cmCPackComponentGroup.h" #include "cmCPackLog.h" -#include "cmStringAlgorithms.h" +#include "cmList.h" #include "cmSystemTools.h" #include "cmValue.h" @@ -82,10 +82,10 @@ void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup) std::back_inserter(components), [](cmCPackComponent const* comp) { return comp->Name; }); this->SetOption("CPACK_NUGET_" + compGUp + "_GROUP_COMPONENTS", - cmJoin(components, ";")); + cmList::to_string(components)); } if (!groups.empty()) { - this->SetOption("CPACK_NUGET_GROUPS", cmJoin(groups, ";")); + this->SetOption("CPACK_NUGET_GROUPS", cmList::to_string(groups)); } // Handle Orphan components (components not belonging to any groups) @@ -103,7 +103,7 @@ void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup) } } if (!components.empty()) { - this->SetOption("CPACK_NUGET_COMPONENTS", cmJoin(components, ";")); + this->SetOption("CPACK_NUGET_COMPONENTS", cmList::to_string(components)); } } else { @@ -114,7 +114,7 @@ void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup) [](std::pair const& comp) { return comp.first; }); - this->SetOption("CPACK_NUGET_COMPONENTS", cmJoin(components, ";")); + this->SetOption("CPACK_NUGET_COMPONENTS", cmList::to_string(components)); } } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 90716e6e0d9..00c8fa22471 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -363,11 +363,11 @@ int main(int argc, char const* const* argv) } if (!expandedPreset->Generators.empty() && generator.empty()) { - generator = cmJoin(expandedPreset->Generators, ";"); + generator = cmList::to_string(expandedPreset->Generators); } if (!expandedPreset->Configurations.empty() && cpackBuildConfig.empty()) { - cpackBuildConfig = cmJoin(expandedPreset->Configurations, ";"); + cpackBuildConfig = cmList::to_string(expandedPreset->Configurations); } definitions.insert(expandedPreset->Variables.begin(), diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 35f4c8881ca..b2e3cadd188 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -11,6 +11,7 @@ #include "cmsys/Directory.hxx" #include "cmExecutionStatus.h" +#include "cmList.h" #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmStringAlgorithms.h" @@ -67,7 +68,7 @@ bool cmAuxSourceDirectoryCommand(std::vector const& args, if (!sourceListValue.empty()) { sourceListValue += ";"; } - sourceListValue += cmJoin(files, ";"); + sourceListValue += cmList::to_string(files); mf.AddDefinition(args[1], sourceListValue); return true; } diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index 1c00f154356..81ed41ffaca 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -529,12 +529,12 @@ bool QueryWindowsRegistry(Range args, cmExecutionStatus& status, if (arguments.ValueNames) { auto result = registry.GetValueNames(key, view); if (result) { - makefile.AddDefinition(variable, cmJoin(*result, ";"_s)); + makefile.AddDefinition(variable, cmList::to_string(*result)); } } else if (arguments.SubKeys) { auto result = registry.GetSubKeys(key, view); if (result) { - makefile.AddDefinition(variable, cmJoin(*result, ";"_s)); + makefile.AddDefinition(variable, cmList::to_string(*result)); } } else { auto result = diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 7fbd8269064..3b98219d171 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -20,6 +20,7 @@ #include "cmArgumentParser.h" #include "cmExecutionStatus.h" +#include "cmList.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmProcessOutput.h" @@ -356,7 +357,7 @@ bool cmExecuteProcessCommand(std::vector const& args, } } status.GetMakefile().AddDefinition(arguments.ResultsVariable, - cmJoin(res, ";")); + cmList::to_string(res)); } break; case cmsysProcess_State_Exception: status.GetMakefile().AddDefinition( diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index df26bad53e1..8d3960cd1ee 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -19,6 +19,7 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" +#include "cmList.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -237,7 +238,7 @@ void cmExportBuildFileGenerator::SetImportLocationProperty( } // Store the property. - properties[prop] = cmJoin(objects, ";"); + properties[prop] = cmList::to_string(objects); } else { // Add the main target file. { diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 9176d12d57c..481c98f9f25 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -383,7 +383,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( cmGeneratorExpression ge(*target->Makefile->GetCMakeInstance()); std::string dirs = cmGeneratorExpression::Preprocess( - cmJoin(target->Target->GetInstallIncludeDirectoriesEntries(te), ";"), + cmList::to_string(target->Target->GetInstallIncludeDirectoriesEntries(te)), preprocessRule, true); this->ReplaceInstallPrefix(dirs); std::unique_ptr cge = ge.Parse(dirs); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 538c88399ab..66cae6456e2 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -19,6 +19,7 @@ #include "cmInstallExportGenerator.h" #include "cmInstallFileSetGenerator.h" #include "cmInstallTargetGenerator.h" +#include "cmList.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -430,7 +431,7 @@ void cmExportInstallFileGenerator::SetImportLocationProperty( } // Store the property. - properties[prop] = cmJoin(objects, ";"); + properties[prop] = cmList::to_string(objects); importedLocations.insert(prop); } else { if (target->IsFrameworkOnApple() && target->HasImportLibrary(config)) { diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index f30c3c3ba42..7e525d5f5c0 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -156,12 +156,12 @@ std::string cmExportTryCompileFileGenerator::GetFileSetDirectories( cmGeneratorTarget* /*gte*/, cmFileSet* fileSet, cmTargetExport* /*te*/) { return cmOutputConverter::EscapeForCMake( - cmJoin(fileSet->GetDirectoryEntries(), ";")); + cmList::to_string(fileSet->GetDirectoryEntries())); } std::string cmExportTryCompileFileGenerator::GetFileSetFiles( cmGeneratorTarget* /*gte*/, cmFileSet* fileSet, cmTargetExport* /*te*/) { return cmOutputConverter::EscapeForCMake( - cmJoin(fileSet->GetFileEntries(), ";")); + cmList::to_string(fileSet->GetFileEntries())); } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 45fba8bffbb..def09feed40 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -42,6 +42,7 @@ #include "cmGeneratorExpression.h" #include "cmGlobalGenerator.h" #include "cmHexFileConverter.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -805,7 +806,7 @@ bool HandleGlobImpl(std::vector const& args, bool recurse, std::sort(files.begin(), files.end()); files.erase(std::unique(files.begin(), files.end()), files.end()); - status.GetMakefile().AddDefinition(variable, cmJoin(files, ";")); + status.GetMakefile().AddDefinition(variable, cmList::to_string(files)); return true; } @@ -1556,7 +1557,7 @@ bool HandlePathCommand(std::vector const& args, #endif std::vector path = cmSystemTools::SplitString(args[1], pathSep); - std::string value = cmJoin(cmMakeRange(path).transform(convert), ";"); + std::string value = cmList::to_string(cmMakeRange(path).transform(convert)); status.GetMakefile().AddDefinition(args[2], value); return true; } @@ -3157,7 +3158,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector const& args, if (!parsedArgs.RPathPrefix.empty()) { status.GetMakefile().AddDefinition( parsedArgs.RPathPrefix + "_" + firstPath, - cmJoin(archive.GetRPaths().at(firstPath), ";")); + cmList::to_string(archive.GetRPaths().at(firstPath))); } } else if (!parsedArgs.ConflictingDependenciesPrefix.empty()) { conflictingDeps.push_back(val.first); @@ -3165,7 +3166,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector const& args, paths.insert(paths.begin(), val.second.begin(), val.second.end()); std::string varName = parsedArgs.ConflictingDependenciesPrefix + "_" + val.first; - std::string pathsStr = cmJoin(paths, ";"); + std::string pathsStr = cmList::to_string(paths); status.GetMakefile().AddDefinition(varName, pathsStr); } else { std::ostringstream e; @@ -3196,17 +3197,17 @@ bool HandleGetRuntimeDependenciesCommand(std::vector const& args, } if (!parsedArgs.ResolvedDependenciesVar.empty()) { - std::string val = cmJoin(deps, ";"); + std::string val = cmList::to_string(deps); status.GetMakefile().AddDefinition(parsedArgs.ResolvedDependenciesVar, val); } if (!parsedArgs.UnresolvedDependenciesVar.empty()) { - std::string val = cmJoin(unresolvedDeps, ";"); + std::string val = cmList::to_string(unresolvedDeps); status.GetMakefile().AddDefinition(parsedArgs.UnresolvedDependenciesVar, val); } if (!parsedArgs.ConflictingDependenciesPrefix.empty()) { - std::string val = cmJoin(conflictingDeps, ";"); + std::string val = cmList::to_string(conflictingDeps); status.GetMakefile().AddDefinition( parsedArgs.ConflictingDependenciesPrefix + "_FILENAMES", val); } diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index f4768b66ac4..8d2d9725ea1 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -11,6 +11,7 @@ #include "cmExecutionStatus.h" #include "cmFunctionBlocker.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmPolicies.h" @@ -89,9 +90,9 @@ bool cmFunctionHelperCommand::operator()( } // define ARGV and ARGN - auto const argvDef = cmJoin(expandedArgs, ";"); + auto const argvDef = cmList::to_string(expandedArgs); auto const eit = expandedArgs.begin() + (this->Args.size() - 1); - auto const argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";"); + auto const argnDef = cmList::to_string(cmMakeRange(eit, expandedArgs.end())); makefile.AddDefinition(ARGV, argvDef); makefile.MarkVariableAsUsed(ARGV); makefile.AddDefinition(ARGN, argnDef); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index bb4fc7e271b..647c62db4dc 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2538,7 +2538,7 @@ static const struct LinkLibraryNode : public cmGeneratorExpressionNode list.front() = LL_BEGIN; list.push_back(LL_END); - return cmJoin(list, ";"_s); + return list.to_string(); } } linkLibraryNode; @@ -2607,7 +2607,7 @@ static const struct LinkGroupNode : public cmGeneratorExpressionNode list.front() = LG_BEGIN; list.push_back(LG_END); - return cmJoin(list, ";"_s); + return list.to_string(); } } linkGroupNode; @@ -2632,7 +2632,7 @@ static const struct HostLinkNode : public cmGeneratorExpressionNode } return context->HeadTarget->IsDeviceLink() ? std::string() - : cmJoin(parameters, ";"); + : cmList::to_string(parameters); } } hostLinkNode; @@ -2667,7 +2667,7 @@ static const struct DeviceLinkNode : public cmGeneratorExpressionNode list.insert(list.begin(), static_cast(DL_BEGIN)); list.push_back(static_cast(DL_END)); - return cmJoin(list, ";"); + return list.to_string(); } return std::string(); @@ -3104,7 +3104,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode mf->AddTargetObject(tgtName, o); } - return cmJoin(objects, ";"); + return objects.to_string(); } } targetObjectsNode; @@ -3164,7 +3164,7 @@ static const struct TargetRuntimeDllsNode : public TargetRuntimeDllsBaseNode cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { std::vector dlls = CollectDlls(parameters, context, content); - return cmJoin(dlls, ";"); + return cmList::to_string(dlls); } } targetRuntimeDllsNode; @@ -3187,7 +3187,7 @@ static const struct TargetRuntimeDllDirsNode : public TargetRuntimeDllsBaseNode dllDirs.push_back(directory); } } - return cmJoin(dllDirs, ";"); + return cmList::to_string(dllDirs); } } targetRuntimeDllDirsNode; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 357d0a66a19..1148386f31a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -190,7 +190,7 @@ class TargetPropertyEntryFileSet } static std::string filesStr; - filesStr = cmJoin(files, ";"); + filesStr = cmList::to_string(files); return filesStr; } @@ -322,8 +322,7 @@ cmValue cmGeneratorTarget::GetSourcesProperty() const values.push_back(se->GetInput()); } static std::string value; - value.clear(); - value = cmJoin(values, ";"); + value = cmList::to_string(values); return cmValue(value); } diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 42bd206f7c4..d2c4fd6b653 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -6,9 +6,9 @@ #include "cmExecutionStatus.h" #include "cmGlobalGenerator.h" +#include "cmList.h" #include "cmMakefile.h" #include "cmState.h" -#include "cmStringAlgorithms.h" #include "cmValue.h" // cmGetCMakePropertyCommand @@ -35,7 +35,7 @@ bool cmGetCMakePropertyCommand(std::vector const& args, } else if (args[1] == "COMPONENTS") { const std::set* components = status.GetMakefile().GetGlobalGenerator()->GetInstallComponents(); - output = cmJoin(*components, ";"); + output = cmList::to_string(*components); } else { cmValue prop = nullptr; if (!args[1].empty()) { diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 1ec071b7579..6775a601558 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -6,6 +6,7 @@ #include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" +#include "cmList.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" @@ -39,7 +40,7 @@ bool cmLinkDirectoriesCommand(std::vector const& args, AddLinkDir(mf, *i, directories); } - mf.AddLinkDirectory(cmJoin(directories, ";"), before); + mf.AddLinkDirectory(cmList::to_string(directories), before); return true; } diff --git a/Source/cmList.cxx b/Source/cmList.cxx index 022fcd2b4ce..3835e59bd30 100644 --- a/Source/cmList.cxx +++ b/Source/cmList.cxx @@ -19,6 +19,7 @@ #include "cmAlgorithms.h" #include "cmGeneratorExpression.h" +#include "cmListFileCache.h" #include "cmRange.h" #include "cmStringAlgorithms.h" #include "cmStringReplaceHelper.h" @@ -802,11 +803,6 @@ cmList& cmList::transform(TransformAction action, return *this; } -std::string cmList::join(cm::string_view glue) const -{ - return cmJoin(this->Values, glue); -} - std::string& cmList::append(std::string& list, cm::string_view value) { if (list.empty()) { @@ -1001,3 +997,8 @@ cmList::container_type::iterator cmList::Insert( } return container.begin() + delta; } + +std::string const& cmList::ToString(BT const& s) +{ + return s.Value; +} diff --git a/Source/cmList.h b/Source/cmList.h index eba0400c934..9ee4a46b51f 100644 --- a/Source/cmList.h +++ b/Source/cmList.h @@ -22,6 +22,9 @@ #include "cmValue.h" +template +class BT; + /** * CMake lists management * A CMake list is a string where list elements are separated by the ';' @@ -936,7 +939,10 @@ class cmList std::vector const& args, std::unique_ptr = {}); - std::string join(cm::string_view glue) const; + std::string join(cm::string_view glue) const + { + return cmList::Join(this->Values, glue); + } void swap(cmList& other) noexcept { this->Values.swap(other.Values); } @@ -1092,8 +1098,8 @@ class cmList return cmList::append(list, cm::string_view{ std::accumulate( std::next(first), last, *first, - [](std::string a, const std::string& b) { - return std::move(a) + + [](const std::string& a, const std::string& b) { + return a + std::string(cmList::element_separator) + b; }) }); } @@ -1116,6 +1122,13 @@ class cmList }) }); } + template ::value, int> = 0> + static std::string to_string(Range const& r) + { + return cmList::Join(r, cmList::element_separator); + } + // Non-members // =========== friend inline bool operator==(const cmList& lhs, const cmList& rhs) noexcept @@ -1185,6 +1198,28 @@ class cmList return container.begin() + delta; } + static std::string const& ToString(std::string const& s) { return s; } + static std::string ToString(cm::string_view s) { return std::string{ s }; } + static std::string const& ToString(BT const&); + + template + static std::string Join(Range const& r, cm::string_view glue) + { + if (cm::size(r) == 0) { + return std::string{}; + } + + const auto sep = std::string{ glue }; + + return std::accumulate( + std::next(std::begin(r)), std::end(r), cmList::ToString(*std::begin(r)), + [&sep](std::string const& a, + typename std::iterator_traits::value_type const& b) -> std::string { + return a + sep + cmList::ToString(b); + }); + } + container_type Values; }; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 47ad7491b02..3d7cd8b068a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -12,6 +12,7 @@ #include "cmExecutionStatus.h" #include "cmFunctionBlocker.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmPolicies.h" @@ -66,8 +67,9 @@ bool cmMacroHelperCommand::operator()( std::string argcDef = std::to_string(expandedArgs.size()); auto eit = expandedArgs.begin() + (this->Args.size() - 1); - std::string expandedArgn = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";"); - std::string expandedArgv = cmJoin(expandedArgs, ";"); + std::string expandedArgn = + cmList::to_string(cmMakeRange(eit, expandedArgs.end())); + std::string expandedArgv = cmList::to_string(expandedArgs); std::vector variables; variables.reserve(this->Args.size() - 1); for (unsigned int j = 1; j < this->Args.size(); ++j) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c3c8d464d8c..58908192887 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1980,7 +1980,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector& incs, return; } - std::string entryString = cmJoin(incs, ";"); + std::string entryString = cmList::to_string(incs); if (before) { this->StateSnapshot.GetDirectory().PrependIncludeDirectoriesEntry( BT(entryString, this->Backtrace)); @@ -3004,12 +3004,11 @@ cm::optional cmMakefile::DeferGetCallIds() const { cm::optional ids; if (this->Defer) { - ids = cmJoin( + ids = cmList::to_string( cmMakeRange(this->Defer->Commands) .filter([](DeferCommand const& dc) -> bool { return !dc.Id.empty(); }) .transform( - [](DeferCommand const& dc) -> std::string const& { return dc.Id; }), - ";"); + [](DeferCommand const& dc) -> std::string const& { return dc.Id; })); } return ids; } @@ -4160,7 +4159,7 @@ cmValue cmMakefile::GetProperty(const std::string& prop) const std::transform( t->Tests.begin(), t->Tests.end(), std::back_inserter(keys), [](decltype(t->Tests)::value_type const& pair) { return pair.first; }); - output = cmJoin(keys, ";"); + output = cmList::to_string(keys); return cmValue(output); } diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index b0462f056a9..f193ed96241 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -20,7 +20,9 @@ #include "cmSystemTools.h" #include "cmValue.h" -static std::string EscapeArg(const std::string& arg) +namespace { + +std::string EscapeArg(const std::string& arg) { // replace ";" with "\;" so output argument lists will split correctly std::string escapedArg; @@ -33,14 +35,12 @@ static std::string EscapeArg(const std::string& arg) return escapedArg; } -static std::string JoinList(std::vector const& arg, bool escape) +std::string JoinList(std::vector const& arg, bool escape) { - return escape ? cmJoin(cmMakeRange(arg).transform(EscapeArg), ";") - : cmJoin(cmMakeRange(arg), ";"); + return escape ? cmList::to_string(cmMakeRange(arg).transform(EscapeArg)) + : cmList::to_string(cmMakeRange(arg)); } -namespace { - using options_map = std::map; using single_map = std::map; using multi_map = @@ -108,8 +108,9 @@ static void PassParsedArguments( } if (!keywordsMissingValues.empty()) { - makefile.AddDefinition(prefix + "KEYWORDS_MISSING_VALUES", - cmJoin(cmMakeRange(keywordsMissingValues), ";")); + makefile.AddDefinition( + prefix + "KEYWORDS_MISSING_VALUES", + cmList::to_string(cmMakeRange(keywordsMissingValues))); } else { makefile.RemoveDefinition(prefix + "KEYWORDS_MISSING_VALUES"); } diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx index 17285e723ad..3576e4f5585 100644 --- a/Source/cmSeparateArgumentsCommand.cxx +++ b/Source/cmSeparateArgumentsCommand.cxx @@ -9,6 +9,7 @@ #include "cmArgumentParser.h" #include "cmExecutionStatus.h" +#include "cmList.h" #include "cmMakefile.h" #include "cmRange.h" #include "cmStringAlgorithms.h" @@ -159,7 +160,7 @@ bool cmSeparateArgumentsCommand(std::vector const& args, pos += 2; } }); - auto value = cmJoin(values, ";"); + auto value = cmList::to_string(values); status.GetMakefile().AddDefinition(var, value); return true; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 040eb08c30e..c4bb949ce08 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -3,6 +3,7 @@ #include "cmSetCommand.h" #include "cmExecutionStatus.h" +#include "cmList.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmRange.h" @@ -103,7 +104,8 @@ bool cmSetCommand(std::vector const& args, } // collect any values into a single semi-colon separated value list - value = cmJoin(cmMakeRange(args).advance(1).retreat(ignoreLastArgs), ";"); + value = + cmList::to_string(cmMakeRange(args).advance(1).retreat(ignoreLastArgs)); if (parentScope) { status.GetMakefile().RaiseScope(variable, value.c_str()); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 340374522bc..1be680a3c56 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -8,6 +8,7 @@ #include #include "cmGlobalGenerator.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -390,7 +391,7 @@ cmValue cmSourceFile::GetProperty(const std::string& prop) const } static std::string output; - output = cmJoin(this->IncludeDirectories, ";"); + output = cmList::to_string(this->IncludeDirectories); return cmValue(output); } @@ -400,7 +401,7 @@ cmValue cmSourceFile::GetProperty(const std::string& prop) const } static std::string output; - output = cmJoin(this->CompileOptions, ";"); + output = cmList::to_string(this->CompileOptions); return cmValue(output); } @@ -410,7 +411,7 @@ cmValue cmSourceFile::GetProperty(const std::string& prop) const } static std::string output; - output = cmJoin(this->CompileDefinitions, ";"); + output = cmList::to_string(this->CompileDefinitions); return cmValue(output); } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 2596d8c050b..d41e8e5c568 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -17,6 +17,7 @@ #include "cmDefinitions.h" #include "cmExecutionStatus.h" #include "cmGlobVerificationManager.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -584,10 +585,10 @@ cmValue cmState::GetGlobalProperty(const std::string& prop) { if (prop == "CACHE_VARIABLES") { std::vector cacheKeys = this->GetCacheEntryKeys(); - this->SetGlobalProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";")); + this->SetGlobalProperty("CACHE_VARIABLES", cmList::to_string(cacheKeys)); } else if (prop == "COMMANDS") { std::vector commands = this->GetCommandNames(); - this->SetGlobalProperty("COMMANDS", cmJoin(commands, ";")); + this->SetGlobalProperty("COMMANDS", cmList::to_string(commands)); } else if (prop == "IN_TRY_COMPILE") { this->SetGlobalProperty( "IN_TRY_COMPILE", @@ -596,8 +597,7 @@ cmValue cmState::GetGlobalProperty(const std::string& prop) this->SetGlobalProperty("GENERATOR_IS_MULTI_CONFIG", this->IsGeneratorMultiConfig ? "1" : "0"); } else if (prop == "ENABLED_LANGUAGES") { - std::string langs; - langs = cmJoin(this->EnabledLanguages, ";"); + auto langs = cmList::to_string(this->EnabledLanguages); this->SetGlobalProperty("ENABLED_LANGUAGES", langs); } else if (prop == "CMAKE_ROLE") { std::string mode = this->GetModeString(); diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 6e6fcbd7576..39353f37c1e 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -13,6 +13,7 @@ #include #include "cmAlgorithms.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmProperty.h" #include "cmPropertyMap.h" @@ -20,7 +21,6 @@ #include "cmState.h" #include "cmStatePrivate.h" #include "cmStateTypes.h" -#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmValue.h" @@ -381,15 +381,15 @@ cmValue cmStateDirectory::GetProperty(const std::string& prop, for (cmStateSnapshot const& ci : children) { child_dirs.push_back(ci.GetDirectory().GetCurrentSource()); } - output = cmJoin(child_dirs, ";"); + output = cmList::to_string(child_dirs); return cmValue(output); } if (prop == kBUILDSYSTEM_TARGETS) { - output = cmJoin(this->DirectoryState->NormalTargetNames, ";"); + output = cmList::to_string(this->DirectoryState->NormalTargetNames); return cmValue(output); } if (prop == "IMPORTED_TARGETS"_s) { - output = cmJoin(this->DirectoryState->ImportedTargetNames, ";"); + output = cmList::to_string(this->DirectoryState->ImportedTargetNames); return cmValue(output); } @@ -401,38 +401,38 @@ cmValue cmStateDirectory::GetProperty(const std::string& prop, snp = snp.GetCallStackParent(); } std::reverse(listFiles.begin(), listFiles.end()); - output = cmJoin(listFiles, ";"); + output = cmList::to_string(listFiles); return cmValue(output); } if (prop == "CACHE_VARIABLES") { - output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";"); + output = cmList::to_string(this->Snapshot_.State->GetCacheEntryKeys()); return cmValue(output); } if (prop == "VARIABLES") { std::vector res = this->Snapshot_.ClosureKeys(); cm::append(res, this->Snapshot_.State->GetCacheEntryKeys()); std::sort(res.begin(), res.end()); - output = cmJoin(res, ";"); + output = cmList::to_string(res); return cmValue(output); } if (prop == "INCLUDE_DIRECTORIES") { - output = cmJoin(this->GetIncludeDirectoriesEntries(), ";"); + output = cmList::to_string(this->GetIncludeDirectoriesEntries()); return cmValue(output); } if (prop == "COMPILE_OPTIONS") { - output = cmJoin(this->GetCompileOptionsEntries(), ";"); + output = cmList::to_string(this->GetCompileOptionsEntries()); return cmValue(output); } if (prop == "COMPILE_DEFINITIONS") { - output = cmJoin(this->GetCompileDefinitionsEntries(), ";"); + output = cmList::to_string(this->GetCompileDefinitionsEntries()); return cmValue(output); } if (prop == "LINK_OPTIONS") { - output = cmJoin(this->GetLinkOptionsEntries(), ";"); + output = cmList::to_string(this->GetLinkOptionsEntries()); return cmValue(output); } if (prop == "LINK_DIRECTORIES") { - output = cmJoin(this->GetLinkDirectoriesEntries(), ";"); + output = cmList::to_string(this->GetLinkDirectoriesEntries()); return cmValue(output); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 81497f59aa1..15f45f5d223 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -811,12 +811,12 @@ std::pair FileSetType::ReadProperties( did_read = true; } else if (prop == this->SelfEntries.PropertyName) { static std::string output; - output = cmJoin(this->SelfEntries.Entries, ";"_s); + output = cmList::to_string(this->SelfEntries.Entries); value = cmValue(output); did_read = true; } else if (prop == this->InterfaceEntries.PropertyName) { static std::string output; - output = cmJoin(this->InterfaceEntries.Entries, ";"_s); + output = cmList::to_string(this->InterfaceEntries.Entries); value = cmValue(output); did_read = true; } else if (cmHasPrefix(prop, this->DirectoryPrefix)) { @@ -899,7 +899,7 @@ std::pair UsageRequirementProperty::Read( if (!this->Entries.empty()) { // Storage to back the returned `cmValue`. static std::string output; - output = cmJoin(this->Entries, ";"); + output = cmList::to_string(this->Entries); value = cmValue(output); } did_read = true; @@ -2130,7 +2130,7 @@ cmValue cmTargetInternals::GetFileSetDirectories( return nullptr; } static std::string output; - output = cmJoin(fileSet->GetDirectoryEntries(), ";"_s); + output = cmList::to_string(fileSet->GetDirectoryEntries()); return cmValue(output); } @@ -2150,7 +2150,7 @@ cmValue cmTargetInternals::GetFileSetPaths(cmTarget const* self, return nullptr; } static std::string output; - output = cmJoin(fileSet->GetFileEntries(), ";"_s); + output = cmList::to_string(fileSet->GetFileEntries()); return cmValue(output); } @@ -2495,7 +2495,7 @@ cmValue cmTarget::GetProperty(const std::string& prop) const [](const BT>& item) -> std::string { return item.Value.first; }); - output = cmJoin(utilities, ";"); + output = cmList::to_string(utilities); return cmValue(output); } if (prop == propIMPORTED) { diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx index aa1abdd64c0..37c125bd398 100644 --- a/Source/cmTargetCompileFeaturesCommand.cxx +++ b/Source/cmTargetCompileFeaturesCommand.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTargetCompileFeaturesCommand.h" +#include "cmList.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmStandardLevelResolver.h" @@ -43,7 +44,7 @@ class TargetCompileFeaturesImpl : public cmTargetPropCommandBase std::string Join(const std::vector& content) override { - return cmJoin(content, ";"); + return cmList::to_string(content); } }; diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index 8ca3842d3db..e73a75f008a 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTargetCompileOptionsCommand.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -44,7 +45,7 @@ class TargetCompileOptionsImpl : public cmTargetPropCommandBase std::string Join(const std::vector& content) override { - return cmJoin(content, ";"); + return cmList::to_string(content); } }; diff --git a/Source/cmTargetLinkDirectoriesCommand.cxx b/Source/cmTargetLinkDirectoriesCommand.cxx index 3ba27a83a30..dddb3483196 100644 --- a/Source/cmTargetLinkDirectoriesCommand.cxx +++ b/Source/cmTargetLinkDirectoriesCommand.cxx @@ -3,6 +3,7 @@ #include "cmTargetLinkDirectoriesCommand.h" #include "cmGeneratorExpression.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -58,7 +59,7 @@ std::string TargetLinkDirectoriesImpl::Join( directories.push_back(unixPath); } - return cmJoin(directories, ";"); + return cmList::to_string(directories); } } // namespace diff --git a/Source/cmTargetLinkOptionsCommand.cxx b/Source/cmTargetLinkOptionsCommand.cxx index 3ea2d7175e4..cd938354add 100644 --- a/Source/cmTargetLinkOptionsCommand.cxx +++ b/Source/cmTargetLinkOptionsCommand.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTargetLinkOptionsCommand.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -36,7 +37,7 @@ class TargetLinkOptionsImpl : public cmTargetPropCommandBase std::string Join(const std::vector& content) override { - return cmJoin(content, ";"); + return cmList::to_string(content); } }; diff --git a/Source/cmTargetPrecompileHeadersCommand.cxx b/Source/cmTargetPrecompileHeadersCommand.cxx index 4dd158d286e..0173a925e3c 100644 --- a/Source/cmTargetPrecompileHeadersCommand.cxx +++ b/Source/cmTargetPrecompileHeadersCommand.cxx @@ -5,6 +5,7 @@ #include #include "cmGeneratorExpression.h" +#include "cmList.h" #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -73,7 +74,7 @@ class TargetPrecompileHeadersImpl : public cmTargetPropCommandBase std::string Join(const std::vector& content) override { - return cmJoin(content, ";"); + return cmList::to_string(content); } }; diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index 12328b196fc..3d484f5e3a0 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -98,7 +98,7 @@ class TargetSourcesImpl : public cmTargetPropCommandBase std::string Join(const std::vector& content) override { - return cmJoin(content, ";"); + return cmList::to_string(content); } enum class IsInterface diff --git a/Utilities/std/cmext/iterator b/Utilities/std/cmext/iterator index eba10ddf74b..85a28fab315 100644 --- a/Utilities/std/cmext/iterator +++ b/Utilities/std/cmext/iterator @@ -24,9 +24,18 @@ using is_input_iterator = // checks if a type is a range type: std::begin() and std::end() are supported template -using is_range = cm::bool_constant< - cm::is_iterator()))>::value && - cm::is_iterator()))>::value>; +using is_range = +#if defined(_MSC_VER) && _MSC_VER < 1920 + // MS C++ is not able to evaluate complex type introspection, + // so use a simplified version + cm::bool_constant::value || + std::is_array::value>; +#else + cm::bool_constant< + cm::is_iterator()))>::value && + cm::is_iterator()))>::value>; +#endif // checks if a type is an input range type: std::begin() and std::end() are // returning an input iterator From 97d0f764536ec46c78f1b2c2bb02de9b730693b9 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 19 Jun 2023 16:58:37 +0200 Subject: [PATCH 039/627] FindCURL: add a CURL_USE_STATIC_LIBS hint The effect of that hint is to set a CURL_STATICLIB compile definition, and to auxiliary system windows libraries for MSVC builds. GDAL-Issue: https://github.com/OSGeo/gdal/issues/7955 --- Help/release/dev/FindCURL-static.rst | 5 +++++ Modules/FindCURL.cmake | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 Help/release/dev/FindCURL-static.rst diff --git a/Help/release/dev/FindCURL-static.rst b/Help/release/dev/FindCURL-static.rst new file mode 100644 index 00000000000..3c369d23698 --- /dev/null +++ b/Help/release/dev/FindCURL-static.rst @@ -0,0 +1,5 @@ +FindCURL-static +--------------- + +* The :module:`FindCURL` module gained a ``CURL_USE_STATIC_LIBS`` hint + to select static libraries. diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index acb87dc6051..2f33dac010d 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -58,6 +58,18 @@ returns its results with no further action. Set ``CURL_NO_CURL_CMAKE`` to ``ON`` to disable this search. +Hints +^^^^^ + +``CURL_USE_STATIC_LIBS`` + + .. versionadded:: 3.28 + + Set to ``TRUE`` to use static libraries. + + This is meaningful only when CURL is not found via its + CMake Package Configuration file. + #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) @@ -193,6 +205,11 @@ if(CURL_FOUND) set_target_properties(CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + if(CURL_USE_STATIC_LIBS) + set_property(TARGET CURL::libcurl APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB") + endif() + if(EXISTS "${CURL_LIBRARY}") set_target_properties(CURL::libcurl PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" @@ -212,5 +229,11 @@ if(CURL_FOUND) IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}") endif() + + if(CURL_USE_STATIC_LIBS AND MSVC) + set_target_properties(CURL::libcurl PROPERTIES + INTERFACE_LINK_LIBRARIES "normaliz.lib;ws2_32.lib;wldap32.lib") + endif() + endif() endif() From 302501ad363628176d15bf91687d9adc4df6e5ce Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 19 Jun 2023 16:49:59 +0200 Subject: [PATCH 040/627] FindEXPAT: add a EXPAT_USE_STATIC_LIBS hint The effect of that hint is to restrict the candidate library names, but more essentially to set the `XML_STATIC` compile definitions which is required to get proper linking. Vcpkg-Issue: https://github.com/microsoft/vcpkg/issues/1100 GDAL-Issue: https://github.com/OSGeo/gdal/issues/7955 --- Help/release/dev/FindEXPAT-static.rst | 5 +++++ Modules/FindEXPAT.cmake | 23 +++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/FindEXPAT-static.rst diff --git a/Help/release/dev/FindEXPAT-static.rst b/Help/release/dev/FindEXPAT-static.rst new file mode 100644 index 00000000000..8808ebd4696 --- /dev/null +++ b/Help/release/dev/FindEXPAT-static.rst @@ -0,0 +1,5 @@ +FindEXPAT-static +---------------- + +* The :module:`FindEXPAT` module gained a ``EXPAT_USE_STATIC_LIBS`` hint + to select static libraries. diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index 3bedc73cfc5..762931efa2a 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -30,6 +30,15 @@ This module will set the following variables in your project: ``EXPAT_FOUND`` true if the Expat headers and libraries were found. +Hints +^^^^^ + +``EXPAT_USE_STATIC_LIBS`` + + .. versionadded:: 3.28 + + Set to ``TRUE`` to use static libraries. + #]=======================================================================] find_package(PkgConfig QUIET) @@ -43,8 +52,13 @@ set(EXPAT_NAMES expat expatw) set(EXPAT_NAMES_DEBUG expatd expatwd) if(WIN32) - list(APPEND EXPAT_NAMES expatMT expatMD expatwMT expatwMD) - list(APPEND EXPAT_NAMES_DEBUG expatdMT expatdMD expatwdMT expatwdMD) + if(EXPAT_USE_STATIC_LIBS) + list(APPEND EXPAT_NAMES expatMT expatwMT) + list(APPEND EXPAT_NAMES_DEBUG expatdMT expatwdMT) + else() + list(APPEND EXPAT_NAMES expatMT expatMD expatwMT expatwMD) + list(APPEND EXPAT_NAMES_DEBUG expatdMT expatdMD expatwdMT expatwdMD) + endif() endif() # Allow EXPAT_LIBRARY to be set manually, as the location of the expat library @@ -115,6 +129,11 @@ if(EXPAT_FOUND) IMPORTED_LINK_INTERFACE_LANGUAGES "C" INTERFACE_INCLUDE_DIRECTORIES "${EXPAT_INCLUDE_DIRS}") + if(EXPAT_USE_STATIC_LIBS) + set_property(TARGET EXPAT::EXPAT APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS "XML_STATIC") + endif() + if(EXPAT_LIBRARY_RELEASE) set_property(TARGET EXPAT::EXPAT APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) From 870390ee811d51b3b35f50c8aba2eaca3cce2fda Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 19:15:56 +0200 Subject: [PATCH 041/627] cmFileLock: Remove expensive windows.h include As cmFileLock.h gets includes 116 times on windows this saves many unnecessary and expensive windows.h includes --- Source/cmFileLock.h | 6 +++--- Source/cmFileLockWin32.cxx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h index 94baea1fe83..0f2e7d99869 100644 --- a/Source/cmFileLock.h +++ b/Source/cmFileLock.h @@ -7,7 +7,7 @@ #include #if defined(_WIN32) -# include // HANDLE +using HANDLE = void*; #endif class cmFileLockResult; @@ -53,8 +53,8 @@ class cmFileLock cmFileLockResult LockWithTimeout(unsigned long timeoutSec); #if defined(_WIN32) - HANDLE File = INVALID_HANDLE_VALUE; - BOOL LockFile(DWORD flags); + HANDLE File = (HANDLE)-1; + int LockFile(int flags); #else int File = -1; int LockFile(int cmd, int type) const; diff --git a/Source/cmFileLockWin32.cxx b/Source/cmFileLockWin32.cxx index 7bee5f22bd7..244ade2a021 100644 --- a/Source/cmFileLockWin32.cxx +++ b/Source/cmFileLockWin32.cxx @@ -78,7 +78,7 @@ cmFileLockResult cmFileLock::LockWithTimeout(unsigned long seconds) } } -BOOL cmFileLock::LockFile(DWORD flags) +int cmFileLock::LockFile(int flags) { const DWORD reserved = 0; const unsigned long len = static_cast(-1); From 64821d8a267585c0d4d9350f162690c2c518860b Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 19:22:11 +0200 Subject: [PATCH 042/627] cmFileLockResult: Remove expensive windows.h include --- Source/cmFileLock.cxx | 12 ++---------- Source/cmFileLockResult.cxx | 4 ++++ Source/cmFileLockResult.h | 8 -------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Source/cmFileLock.cxx b/Source/cmFileLock.cxx index 5d197d2fbb9..548e3279b00 100644 --- a/Source/cmFileLock.cxx +++ b/Source/cmFileLock.cxx @@ -12,11 +12,7 @@ cmFileLock::cmFileLock(cmFileLock&& other) noexcept { this->File = other.File; -#if defined(_WIN32) - other.File = INVALID_HANDLE_VALUE; -#else - other.File = -1; -#endif + other.File = (decltype(other.File))-1; this->Filename = std::move(other.Filename); } @@ -32,11 +28,7 @@ cmFileLock::~cmFileLock() cmFileLock& cmFileLock::operator=(cmFileLock&& other) noexcept { this->File = other.File; -#if defined(_WIN32) - other.File = INVALID_HANDLE_VALUE; -#else - other.File = -1; -#endif + other.File = (decltype(other.File))-1; this->Filename = std::move(other.Filename); return *this; diff --git a/Source/cmFileLockResult.cxx b/Source/cmFileLockResult.cxx index b7f7f38b24e..632c0e9a966 100644 --- a/Source/cmFileLockResult.cxx +++ b/Source/cmFileLockResult.cxx @@ -5,6 +5,10 @@ #include #include +#ifdef _WIN32 +# include +#endif + cmFileLockResult cmFileLockResult::MakeOk() { return { OK, 0 }; diff --git a/Source/cmFileLockResult.h b/Source/cmFileLockResult.h index 8a58d1f0a37..e252de73942 100644 --- a/Source/cmFileLockResult.h +++ b/Source/cmFileLockResult.h @@ -6,10 +6,6 @@ #include -#if defined(_WIN32) -# include // DWORD -#endif - /** * @brief Result of the locking/unlocking file. * @note See @c cmFileLock @@ -17,11 +13,7 @@ class cmFileLockResult { public: -#if defined(_WIN32) - using Error = DWORD; -#else using Error = int; -#endif /** * @brief Successful lock/unlock. From 1bb0e59318f8160560d4010b95724de1cba36e7c Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 19:47:42 +0200 Subject: [PATCH 043/627] codecvt: Extrace codecvt::Encoding to remove codecvt includes --- Source/cmDebuggerVariablesHelper.cxx | 14 +++++++------- Source/cmGeneratedFileStream.cxx | 6 +++--- Source/cmGeneratedFileStream.h | 10 +++++----- Source/cmGlobalGenerator.cxx | 4 ++++ Source/cmGlobalGenerator.h | 7 ++----- Source/cmGlobalNMakeMakefileGenerator.h | 7 ++++--- Source/cmGlobalNinjaGenerator.cxx | 12 ++++++------ Source/cmGlobalNinjaGenerator.h | 6 +++--- Source/cmGlobalVisualStudioGenerator.h | 6 +++--- Source/cmMakefileTargetGenerator.cxx | 8 ++++---- Source/cm_codecvt.cxx | 12 ++++++------ Source/cm_codecvt.hxx | 13 +++---------- Source/cm_codecvt_Encoding.hxx | 12 ++++++++++++ 13 files changed, 62 insertions(+), 55 deletions(-) create mode 100644 Source/cm_codecvt_Encoding.hxx diff --git a/Source/cmDebuggerVariablesHelper.cxx b/Source/cmDebuggerVariablesHelper.cxx index 1322b20c782..b2e85f2d7ce 100644 --- a/Source/cmDebuggerVariablesHelper.cxx +++ b/Source/cmDebuggerVariablesHelper.cxx @@ -10,7 +10,7 @@ #include #include -#include "cm_codecvt.hxx" +#include "cm_codecvt_Encoding.hxx" #include "cmDebuggerStackFrame.h" #include "cmDebuggerVariables.h" @@ -578,17 +578,17 @@ std::shared_ptr cmDebuggerVariablesHelper::CreateIfAny( return {}; } - auto makeFileEncodingString = [](codecvt::Encoding encoding) { + auto makeFileEncodingString = [](codecvt_Encoding encoding) { switch (encoding) { - case codecvt::Encoding::None: + case codecvt_Encoding::None: return "None"; - case codecvt::Encoding::UTF8: + case codecvt_Encoding::UTF8: return "UTF8"; - case codecvt::Encoding::UTF8_WITH_BOM: + case codecvt_Encoding::UTF8_WITH_BOM: return "UTF8_WITH_BOM"; - case codecvt::Encoding::ANSI: + case codecvt_Encoding::ANSI: return "ANSI"; - case codecvt::Encoding::ConsoleOutput: + case codecvt_Encoding::ConsoleOutput: return "ConsoleOutput"; default: return "Unknown"; diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 133bf5fca06..e669f68d334 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -16,7 +16,7 @@ cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding) { #ifndef CMAKE_BOOTSTRAP - if (encoding != codecvt::None) { + if (encoding != codecvt_Encoding::None) { this->imbue(std::locale(this->getloc(), new codecvt(encoding))); } #else @@ -35,13 +35,13 @@ cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name, cmSystemTools::ReportLastSystemError(""); } #ifndef CMAKE_BOOTSTRAP - if (encoding != codecvt::None) { + if (encoding != codecvt_Encoding::None) { this->imbue(std::locale(this->getloc(), new codecvt(encoding))); } #else static_cast(encoding); #endif - if (encoding == codecvt::UTF8_WITH_BOM) { + if (encoding == codecvt_Encoding::UTF8_WITH_BOM) { // Write the BOM encoding header into the file char magic[] = { static_cast(0xEF), static_cast(0xBB), static_cast(0xBF) }; diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index bfc121fb818..a26616dc794 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -8,7 +8,7 @@ #include "cmsys/FStream.hxx" -#include "cm_codecvt.hxx" +#include "cm_codecvt_Encoding.hxx" // This is the first base class of cmGeneratedFileStream. It will be // created before and destroyed after the ofstream portion and can @@ -77,13 +77,13 @@ class cmGeneratedFileStream { public: using Stream = cmsys::ofstream; - using Encoding = codecvt::Encoding; + using Encoding = codecvt_Encoding; /** * This constructor prepares a default stream. The open method must * be used before writing to the stream. */ - cmGeneratedFileStream(Encoding encoding = codecvt::None); + cmGeneratedFileStream(codecvt_Encoding encoding = codecvt_Encoding::None); /** * This constructor takes the name of the file to be generated. It @@ -92,7 +92,7 @@ class cmGeneratedFileStream * second argument is set to true. */ cmGeneratedFileStream(std::string const& name, bool quiet = false, - Encoding encoding = codecvt::None); + codecvt_Encoding encoding = codecvt_Encoding::None); /** * The destructor checks the stream status to be sure the temporary @@ -151,5 +151,5 @@ class cmGeneratedFileStream * Write a specific string using an alternate encoding. * Afterward, the original encoding is restored. */ - void WriteAltEncoding(std::string const& data, Encoding encoding); + void WriteAltEncoding(std::string const& data, codecvt_Encoding encoding); }; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 5175aae4a2e..e334b966b95 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -142,6 +142,10 @@ cmGlobalGenerator::~cmGlobalGenerator() { this->ClearGeneratorMembers(); } +codecvt_Encoding cmGlobalGenerator::GetMakefileEncoding() const +{ + return codecvt_Encoding::None; +} #if !defined(CMAKE_BOOTSTRAP) Json::Value cmGlobalGenerator::GetJson() const diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 9aefaff0bc4..bc59514fb54 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -19,7 +19,7 @@ #include #include -#include "cm_codecvt.hxx" +#include "cm_codecvt_Encoding.hxx" #include "cmBuildOptions.h" #include "cmCustomCommandLines.h" @@ -120,10 +120,7 @@ class cmGlobalGenerator } /** Get encoding used by generator for makefile files */ - virtual codecvt::Encoding GetMakefileEncoding() const - { - return codecvt::None; - } + virtual codecvt_Encoding GetMakefileEncoding() const; #if !defined(CMAKE_BOOTSTRAP) /** Get a JSON object describing the generator. */ diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index 436ebcac1c1..bc8fc3427f2 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -7,7 +7,7 @@ #include #include -#include "cm_codecvt.hxx" +#include "cm_codecvt_Encoding.hxx" #include "cmGlobalGeneratorFactory.h" #include "cmGlobalUnixMakefileGenerator3.h" @@ -38,9 +38,10 @@ class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3 static std::string GetActualName() { return "NMake Makefiles"; } /** Get encoding used by generator for makefile files */ - codecvt::Encoding GetMakefileEncoding() const override + codecvt_Encoding GetMakefileEncoding() const override { - return this->NMakeSupportsUTF8 ? codecvt::UTF8_WITH_BOM : codecvt::ANSI; + return this->NMakeSupportsUTF8 ? codecvt_Encoding::UTF8_WITH_BOM + : codecvt_Encoding::ANSI; } /** Get the documentation entry for this generator. */ diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index e20f157c517..65851f3ecb9 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -566,7 +566,7 @@ std::unique_ptr cmGlobalNinjaGenerator::CreateLocalGenerator( cm::make_unique(this, mf)); } -codecvt::Encoding cmGlobalNinjaGenerator::GetMakefileEncoding() const +codecvt_Encoding cmGlobalNinjaGenerator::GetMakefileEncoding() const { return this->NinjaExpectedEncoding; } @@ -799,7 +799,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures() if (this->NinjaSupportsCodePage) { this->CheckNinjaCodePage(); } else { - this->NinjaExpectedEncoding = codecvt::ANSI; + this->NinjaExpectedEncoding = codecvt_Encoding::ANSI; } #endif } @@ -830,9 +830,9 @@ void cmGlobalNinjaGenerator::CheckNinjaCodePage() lineView.substr(cmStrLen("Build file encoding: ")); if (encoding == "UTF-8") { // Ninja expects UTF-8. We use that internally. No conversion needed. - this->NinjaExpectedEncoding = codecvt::None; + this->NinjaExpectedEncoding = codecvt_Encoding::None; } else { - this->NinjaExpectedEncoding = codecvt::ANSI; + this->NinjaExpectedEncoding = codecvt_Encoding::ANSI; } found = true; break; @@ -842,10 +842,10 @@ void cmGlobalNinjaGenerator::CheckNinjaCodePage() this->GetCMakeInstance()->IssueMessage( MessageType::WARNING, "Could not determine Ninja's code page, defaulting to UTF-8"); - this->NinjaExpectedEncoding = codecvt::None; + this->NinjaExpectedEncoding = codecvt_Encoding::None; } } else { - this->NinjaExpectedEncoding = codecvt::ANSI; + this->NinjaExpectedEncoding = codecvt_Encoding::ANSI; } } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index bfbe57f22bb..95d64e3a3a4 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -16,7 +16,7 @@ #include -#include "cm_codecvt.hxx" +#include "cm_codecvt_Encoding.hxx" #include "cmBuildOptions.h" #include "cmGeneratedFileStream.h" @@ -192,7 +192,7 @@ class cmGlobalNinjaGenerator : public cmGlobalCommonGenerator bool IsNinja() const override { return true; } /** Get encoding used by generator for ninja files */ - codecvt::Encoding GetMakefileEncoding() const override; + codecvt_Encoding GetMakefileEncoding() const override; static cmDocumentationEntry GetDocumentation(); @@ -590,7 +590,7 @@ class cmGlobalNinjaGenerator : public cmGlobalCommonGenerator bool NinjaSupportsMetadataOnRegeneration = false; bool NinjaSupportsCodePage = false; - codecvt::Encoding NinjaExpectedEncoding = codecvt::None; + codecvt_Encoding NinjaExpectedEncoding = codecvt_Encoding::None; bool DiagnosedCxxModuleNinjaSupport = false; diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 3008c1841c6..7d5b703101c 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -10,7 +10,7 @@ #include #include -#include "cm_codecvt.hxx" +#include "cm_codecvt_Encoding.hxx" #include "cmGlobalGenerator.h" #include "cmTargetDepend.h" @@ -119,9 +119,9 @@ class cmGlobalVisualStudioGenerator : public cmGlobalGenerator /** Get encoding used by generator for generated source files */ - codecvt::Encoding GetMakefileEncoding() const override + codecvt_Encoding GetMakefileEncoding() const override { - return codecvt::ANSI; + return codecvt_Encoding::ANSI; } class TargetSet : public std::set diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 5f27856d748..1dd48b3b715 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -17,7 +17,7 @@ #include #include -#include "cm_codecvt.hxx" +#include "cm_codecvt_Encoding.hxx" #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" @@ -2129,12 +2129,12 @@ std::string cmMakefileTargetGenerator::CreateResponseFile( // FIXME: Find a better way to determine the response file encoding, // perhaps using tool-specific platform information variables. // For now, use the makefile encoding as a heuristic. - codecvt::Encoding responseEncoding = + codecvt_Encoding responseEncoding = this->GlobalGenerator->GetMakefileEncoding(); // Non-MSVC tooling doesn't understand BOM encoded files. - if (responseEncoding == codecvt::UTF8_WITH_BOM && + if (responseEncoding == codecvt_Encoding::UTF8_WITH_BOM && (language == "CUDA" || !this->Makefile->IsOn("MSVC"))) { - responseEncoding = codecvt::UTF8; + responseEncoding = codecvt_Encoding::UTF8; } // Create the response file. diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx index 12877b835fd..7b3349b5fdc 100644 --- a/Source/cm_codecvt.cxx +++ b/Source/cm_codecvt.cxx @@ -13,19 +13,19 @@ # include "cm_utf8.h" #endif -codecvt::codecvt(Encoding e) +codecvt::codecvt(codecvt_Encoding e) #if defined(_WIN32) : m_codepage(0) #endif { switch (e) { - case codecvt::ConsoleOutput: + case codecvt_Encoding::ConsoleOutput: #if defined(_WIN32) m_noconv = false; m_codepage = GetConsoleOutputCP(); break; #endif - case codecvt::ANSI: + case codecvt_Encoding::ANSI: #if defined(_WIN32) m_noconv = false; m_codepage = CP_ACP; @@ -33,10 +33,10 @@ codecvt::codecvt(Encoding e) #endif // We don't know which ANSI encoding to use for other platforms than // Windows so we don't do any conversion there - case codecvt::UTF8: - case codecvt::UTF8_WITH_BOM: + case codecvt_Encoding::UTF8: + case codecvt_Encoding::UTF8_WITH_BOM: // Assume internal encoding is UTF-8 - case codecvt::None: + case codecvt_Encoding::None: // No encoding default: this->m_noconv = true; diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx index f628de718c1..eb98e98090a 100644 --- a/Source/cm_codecvt.hxx +++ b/Source/cm_codecvt.hxx @@ -7,21 +7,14 @@ #include #include +#include "cm_codecvt_Encoding.hxx" + class codecvt : public std::codecvt { public: - enum Encoding - { - None, - UTF8, - UTF8_WITH_BOM, - ANSI, - ConsoleOutput, - }; - #ifndef CMAKE_BOOTSTRAP - codecvt(Encoding e); + codecvt(codecvt_Encoding e); protected: ~codecvt() override; diff --git a/Source/cm_codecvt_Encoding.hxx b/Source/cm_codecvt_Encoding.hxx new file mode 100644 index 00000000000..b91ad8fbbc9 --- /dev/null +++ b/Source/cm_codecvt_Encoding.hxx @@ -0,0 +1,12 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +enum class codecvt_Encoding +{ + None, + UTF8, + UTF8_WITH_BOM, + ANSI, + ConsoleOutput, +}; From b928f52983e0aa28349b9b1f51fc574a34dfddf6 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 19:48:47 +0200 Subject: [PATCH 044/627] cmGlobalGenerator: Remove unused windows.h include --- Source/cmGlobalGenerator.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index e334b966b95..3d7d5a7a2e9 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -24,10 +24,6 @@ #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" -#if defined(_WIN32) && !defined(__CYGWIN__) -# include -#endif - #include "cmAlgorithms.h" #include "cmCPackPropertiesGenerator.h" #include "cmComputeTargetDepends.h" From 17b16696d4c5cc26ed956848f7d5e9fe59a09c0a Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Sat, 17 Jun 2023 13:05:27 +0200 Subject: [PATCH 045/627] CMake: Add CMake_BUILD_PCH option --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1d50cab499..2823ca4fcc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,6 +131,8 @@ if(CMake_BUILD_LTO) endif() endif() +option(CMake_BUILD_PCH "Compile CMake with precompiled headers" OFF) + # Check whether to build support for the debugger mode. if(NOT CMake_TEST_EXTERNAL_CMAKE) if(NOT DEFINED CMake_ENABLE_DEBUGGER) @@ -153,7 +155,6 @@ endif() # simply to improve readability of the main script #----------------------------------------------------------------------- macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) - # Options have dependencies. include(CMakeDependentOption) # Allow the user to enable/disable all system utility library options by @@ -324,6 +325,9 @@ configure_file(.clang-tidy .clang-tidy COPYONLY) option(CMake_RUN_IWYU "Run include-what-you-use with the compiler." OFF) if(CMake_RUN_IWYU) + if(CMake_BUILD_PCH) + message(FATAL_ERROR "CMake_RUN_IWYU and CMake_BUILD_PCH are ON, but they are incompatible!") + endif() find_program(IWYU_COMMAND NAMES include-what-you-use iwyu) if(NOT IWYU_COMMAND) message(FATAL_ERROR "CMake_RUN_IWYU is ON but include-what-you-use is not found!") From 30c882827ec6f7b26fe07e5fba42f1a7400e9b36 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Sat, 17 Jun 2023 13:10:50 +0200 Subject: [PATCH 046/627] C{Make,Test}Lib: Precompile common expensive headers --- Source/CMakeLists.txt | 56 ++++++++++++++++++++++++++++++++++++ Source/cmGeneratorTarget.cxx | 4 +-- Source/cmUuid.cxx | 10 +++---- 3 files changed, 63 insertions(+), 7 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a79366e3174..708aec7fa17 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -929,6 +929,44 @@ if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux") ) endif() +if(CMake_BUILD_PCH) + target_precompile_headers(CMakeLib PRIVATE + "$<$:>" + "$<$:>" + "$<$:>" + "$<$:>" + "$<$:>" + "$<$:>" + "$<$:cmMakefile.h>" + "$<$:cmGlobalGenerator.h>" + "$<$:cmLocalGenerator.h>" + "$<$:cmGeneratorTarget.h>" + "$<$:cmGeneratorExpression.h>" + "$<$:cmArgumentParser.h>" + "$<$:cmake.h>" + "$<$:cmCMakePath.h>" + "$<$:cmDebuggerPipeConnection.h>" + "$<$:cmCurl.h>") + + set_source_files_properties( + "LexerParser/cmFortranLexer.cxx" + PROPERTIES SKIP_PRECOMPILE_HEADERS ON) + + if(WIN32) + target_precompile_headers(CMakeLib PRIVATE + "$<$:>" + "$<$:cmVSSetupHelper.h>") + set_source_files_properties("LexerParser/cmFortranParser.cxx" PROPERTIES SKIP_PRECOMPILE_HEADERS ON) + else() + set_source_files_properties( + "LexerParser/cmCommandArgumentLexer.cxx" + "LexerParser/cmGccDepfileLexer.cxx" + "LexerParser/cmExprLexer.cxx" + "LexerParser/cmDependsJavaLexer.cxx" + PROPERTIES SKIP_PRECOMPILE_HEADERS ON) + endif() +endif() + # Temporary variable for tools targets set(_tools) @@ -1041,6 +1079,24 @@ target_include_directories( ) target_link_libraries(CTestLib PUBLIC CMakeLib) +if(CMake_BUILD_PCH) + target_precompile_headers(CTestLib PRIVATE + "cmDuration.h" + "cmMakefile.h" + "cmSystemTools.h" + "cmGlobalGenerator.h" + "cmake.h" + "CTest/cmCTestGenericHandler.h" + "" + "") + + if(WIN32) + target_precompile_headers(CTestLib PRIVATE "cmCurl.h" "CTest/cmCTestMultiProcessHandler.h") + else() + set_source_files_properties("LexerParser/cmCTestResourceGroupsLexer.cxx" PROPERTIES SKIP_PRECOMPILE_HEADERS ON) + endif() +endif() + # # Build CPackLib # diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 357d0a66a19..bce409bb745 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1493,9 +1493,9 @@ std::string AddLangSpecificInterfaceIncludeDirectories( } std::string directories; - if (const auto* interface = target->GetLinkInterfaceLibraries( + if (const auto* link_interface = target->GetLinkInterfaceLibraries( config, root, LinkInterfaceFor::Usage)) { - for (const cmLinkItem& library : interface->Libraries) { + for (const cmLinkItem& library : link_interface->Libraries) { if (const cmGeneratorTarget* dependency = library.Target) { if (cm::contains(dependency->GetAllConfigCompileLanguages(), lang)) { auto* lg = dependency->GetLocalGenerator(); diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx index 6688668f88f..5f5d3e45139 100644 --- a/Source/cmUuid.cxx +++ b/Source/cmUuid.cxx @@ -104,20 +104,20 @@ std::string cmUuid::BinaryToString(const unsigned char* input) const size_t bytes = kUuidGroups[i]; for (size_t j = 0; j < bytes; ++j) { - unsigned char byte = input[inputIndex++]; - output += this->ByteToHex(byte); + unsigned char inputByte = input[inputIndex++]; + output += this->ByteToHex(inputByte); } } return output; } -std::string cmUuid::ByteToHex(unsigned char byte) const +std::string cmUuid::ByteToHex(unsigned char inputByte) const { std::string result(" "); for (int i = 0; i < 2; ++i) { - unsigned char rest = byte % 16; - byte /= 16; + unsigned char rest = inputByte % 16; + inputByte /= 16; char c = (rest < 0xA) ? static_cast('0' + rest) : static_cast('a' + (rest - 0xA)); result.at(1 - i) = c; From 90dec6e9cc04f1e049ea35e2eaf7bf33f05f2d66 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Sat, 17 Jun 2023 13:11:26 +0200 Subject: [PATCH 047/627] CMakeLibTests: Precompile common expensive headers --- Tests/CMakeLib/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index b22d76d36a7..fc3c23b57ff 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -68,6 +68,10 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testUVProcessChainInput.txt" "HELLO WORL create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS}) add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS}) target_link_libraries(CMakeLibTests CMakeLib CTestLib) +if(CMake_BUILD_PCH) + target_precompile_headers(CMakeLibTests PRIVATE "" "") + target_compile_definitions(CMakeLibTests PRIVATE "NOMINMAX") +endif() set_property(TARGET CMakeLibTests PROPERTY C_CLANG_TIDY "") set_property(TARGET CMakeLibTests PROPERTY CXX_CLANG_TIDY "") From 59277bccd3834fafa775ad4e7ab11b281dcd44b2 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 21:17:29 +0200 Subject: [PATCH 048/627] bzip: Precompile common expensive headers --- Utilities/cmbzip2/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/cmbzip2/CMakeLists.txt b/Utilities/cmbzip2/CMakeLists.txt index 1d7b265d4cf..b52358e2d4a 100644 --- a/Utilities/cmbzip2/CMakeLists.txt +++ b/Utilities/cmbzip2/CMakeLists.txt @@ -19,3 +19,7 @@ endif() add_definitions(-D_FILE_OFFSET_BITS=64) add_library(cmbzip2 blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c) + +if(WIN32 AND CMake_BUILD_PCH) + target_precompile_headers(cmbzip2 PRIVATE "bzlib.h") +endif() From a8d91e271948e6ace999356c5b7d5f559ae5630e Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 21:18:00 +0200 Subject: [PATCH 049/627] curl: Precompile common expensive headers --- Utilities/cmcurl/lib/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/cmcurl/lib/CMakeLists.txt b/Utilities/cmcurl/lib/CMakeLists.txt index f1d0f768201..ba75420e6b8 100644 --- a/Utilities/cmcurl/lib/CMakeLists.txt +++ b/Utilities/cmcurl/lib/CMakeLists.txt @@ -110,6 +110,10 @@ set_target_properties(${LIB_NAME} PROPERTIES OUTPUT_NAME ${LIBCURL_OUTPUT_NAME} ) +if(WIN32 AND CMake_BUILD_PCH) + target_precompile_headers(${LIB_NAME} PRIVATE "curl_setup.h" "curl_sspi.h" "${CURL_SOURCE_DIR}/include/curl/curl.h") +endif() + if(0) # This code not needed for building within CMake. if(CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "Linux" OR From 6aaefdb3be439d82cd9b681a380032e0bd7326b7 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 20:05:55 +0200 Subject: [PATCH 050/627] libarchive: Precompile common expensive headers --- Utilities/cmlibarchive/libarchive/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/cmlibarchive/libarchive/CMakeLists.txt b/Utilities/cmlibarchive/libarchive/CMakeLists.txt index bee69c23e2f..e820853fab3 100644 --- a/Utilities/cmlibarchive/libarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/libarchive/CMakeLists.txt @@ -246,6 +246,10 @@ ENDIF() ADD_LIBRARY(cmlibarchive STATIC ${libarchive_SOURCES} ${include_HEADERS}) TARGET_LINK_LIBRARIES(cmlibarchive ${ADDITIONAL_LIBS}) +if(WIN32 AND CMake_BUILD_PCH) + target_precompile_headers(cmlibarchive PRIVATE "archive_platform.h" "archive_entry.h" "") +endif() + IF(0) # CMake does not build libarchive's full package. # Libarchive is a shared library ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) From 9d7921d3886e27f3d564d1f680b318766b9786e7 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 21:18:43 +0200 Subject: [PATCH 051/627] liblzma: Precompile common expensive headers --- Utilities/cmliblzma/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index 3121fbe4c21..3ba3ce952ed 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -186,4 +186,8 @@ ELSEIF((CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC" SET_PROPERTY(TARGET cmliblzma PROPERTY COMPILE_FLAGS "-O0") ENDIF() +if(WIN32 AND CMake_BUILD_PCH) + target_precompile_headers(cmliblzma PRIVATE "common/mythread.h") +endif() + INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmliblzma) From e2efa89c7f7f9b138b85145d78e17cb07a9e6fd1 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 22:30:13 +0200 Subject: [PATCH 052/627] cmcppdap: Precompile common expensive headers --- Utilities/cmcppdap/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/cmcppdap/CMakeLists.txt b/Utilities/cmcppdap/CMakeLists.txt index 39f72a27ac0..2aca681bfa4 100644 --- a/Utilities/cmcppdap/CMakeLists.txt +++ b/Utilities/cmcppdap/CMakeLists.txt @@ -34,4 +34,8 @@ elseif(NOT APPLE) target_link_libraries(cmcppdap PRIVATE Threads::Threads) endif() +if(CMake_BUILD_PCH) + target_precompile_headers(cmcppdap PRIVATE "include/dap/protocol.h") +endif() + install(FILES NOTICE DESTINATION ${CMAKE_DOC_DIR}/cmcppdap) From e0eb97e92328da570f5bd92d0ffd732701dc7646 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 16 Jun 2023 21:19:01 +0200 Subject: [PATCH 053/627] libuv: Precompile common expensive headers --- Utilities/cmlibuv/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt index ad3d433822a..9df0c7ffbbd 100644 --- a/Utilities/cmlibuv/CMakeLists.txt +++ b/Utilities/cmlibuv/CMakeLists.txt @@ -365,4 +365,8 @@ add_library(cmlibuv STATIC ${uv_sources}) target_link_libraries(cmlibuv ${uv_libraries}) set_property(TARGET cmlibuv PROPERTY COMPILE_DEFINITIONS ${uv_defines}) +if(WIN32 AND CMake_BUILD_PCH) + target_precompile_headers(cmlibuv PRIVATE "include/uv.h" "src/win/internal.h") +endif() + install(FILES LICENSE DESTINATION ${CMAKE_DOC_DIR}/cmlibuv) From 4f955834cfd4acbb9aa241067982db48e88b6635 Mon Sep 17 00:00:00 2001 From: Chris Mahoney Date: Thu, 22 Jun 2023 13:42:05 -0400 Subject: [PATCH 054/627] Tutorial: Fix Step 1 TODO 1 to be expandable --- Help/guide/tutorial/Adding a Library.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/guide/tutorial/Adding a Library.rst b/Help/guide/tutorial/Adding a Library.rst index 694dfaf621c..178334a24ea 100644 --- a/Help/guide/tutorial/Adding a Library.rst +++ b/Help/guide/tutorial/Adding a Library.rst @@ -96,7 +96,7 @@ a library target called ``MathFunctions`` with :command:`add_library`. The source files for the library are passed as an argument to :command:`add_library`. This looks like the following line: -.. raw:: html/ +.. raw:: html
TODO 1: Click to show/hide answer From 44f08e94ff0e3b075c3b6877f090ae2c01dd1ddf Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 22 Jun 2023 13:47:19 -0400 Subject: [PATCH 055/627] ci: Add nightly job to build CMake with PCH on Windows --- .gitlab-ci.yml | 9 +++++++++ .gitlab/ci/configure_windows_vs2022_x64_pch.cmake | 2 ++ .gitlab/os-windows.yml | 7 +++++++ 3 files changed, 18 insertions(+) create mode 100644 .gitlab/ci/configure_windows_vs2022_x64_pch.cmake diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 297afda7aa6..393e960953f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -998,6 +998,15 @@ b:windows-vs2022-x64-ninja: - .windows_x86_64_tags_nonconcurrent_vs2022 - .run_manually +b:windows-vs2022-x64-pch: + extends: + - .windows_vs2022_x64_pch + - .cmake_build_windows + - .windows_x86_64_tags_nonconcurrent_vs2022 + - .run_manually + variables: + CMAKE_CI_JOB_NIGHTLY: "true" + t:windows-vs2022-x64-ninja: extends: - .windows_vs2022_x64_ninja diff --git a/.gitlab/ci/configure_windows_vs2022_x64_pch.cmake b/.gitlab/ci/configure_windows_vs2022_x64_pch.cmake new file mode 100644 index 00000000000..2a2eed7a0ec --- /dev/null +++ b/.gitlab/ci/configure_windows_vs2022_x64_pch.cmake @@ -0,0 +1,2 @@ +set(CMake_BUILD_PCH "ON" CACHE BOOL "") +include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_common.cmake") diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index 026f2f44223..422e1472d3f 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -55,6 +55,13 @@ VCVARSPLATFORM: "arm64" VCVARSVERSION: "14.36.32532" +.windows_vs2022_x64_pch: + extends: + - .windows_vs2022_x64_ninja + + variables: + CMAKE_CONFIGURATION: windows_vs2022_x64_pch + .windows_vs2022_x64_ninja: extends: - .windows_build_ninja From aba5bab62ea2dbd218e88f2d430c975abb65949d Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 22 Jun 2023 13:47:42 -0400 Subject: [PATCH 056/627] ci: Add nightly job to build CMake with PCH on macOS --- .gitlab-ci.yml | 9 +++++++++ .gitlab/ci/configure_macos_arm64_pch.cmake | 7 +++++++ .gitlab/os-macos.yml | 6 ++++++ 3 files changed, 22 insertions(+) create mode 100644 .gitlab/ci/configure_macos_arm64_pch.cmake diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 393e960953f..d8806c3b496 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -826,6 +826,15 @@ b:macos-arm64-ninja: variables: CMAKE_CI_JOB_CONTINUOUS: "true" +b:macos-arm64-pch: + extends: + - .macos_arm64_pch + - .cmake_build_macos + - .macos_arm64_tags + - .run_manually + variables: + CMAKE_CI_JOB_NIGHTLY: "true" + t:macos-x86_64-ninja: extends: - .macos_x86_64_ninja diff --git a/.gitlab/ci/configure_macos_arm64_pch.cmake b/.gitlab/ci/configure_macos_arm64_pch.cmake new file mode 100644 index 00000000000..e2676ba8b06 --- /dev/null +++ b/.gitlab/ci/configure_macos_arm64_pch.cmake @@ -0,0 +1,7 @@ +set(CMake_BUILD_PCH "ON" CACHE BOOL "") + +# sccache does not forward the PCH '-Xarch_arm64 "-include/..."' flag correctly. +set(configure_no_sccache 1) + +include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_common.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 09d75984929..fbba288ded4 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -38,6 +38,12 @@ CMAKE_CONFIGURATION: macos_arm64_ninja CTEST_NO_WARNINGS_ALLOWED: 1 +.macos_arm64_pch: + extends: .macos_arm64_ninja + + variables: + CMAKE_CONFIGURATION: macos_arm64_pch + .macos_x86_64_makefiles: extends: .macos_build From 9f60cdd2990966a7a48d444397aef01f9e0e10df Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 23 Jun 2023 00:01:12 -0400 Subject: [PATCH 057/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fa9cd5d520f..7b6a2004494 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230622) +set(CMake_VERSION_PATCH 20230623) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From d605f728f76b84e1e60000b9cb8704e5c1396763 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 16 Jun 2023 11:54:24 -0400 Subject: [PATCH 058/627] macOS: Allow IMPORTED_LOCATION to be a framework folder Issue: #24946 --- Help/prop_tgt/IMPORTED_LOCATION.rst | 5 +++ .../dev/imported-target-framework-path.rst | 5 +++ Source/cmComputeLinkInformation.cxx | 31 +++++++++++++++---- Source/cmGeneratorTarget.cxx | 13 +++++++- Source/cmGeneratorTarget.h | 4 +++ Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt | 19 ++---------- .../RunCMake/CMP0111/CMP0111-WARN-stderr.txt | 29 +++-------------- .../Framework/FrameworkConsumption.cmake | 4 +++ .../ImportedFrameworkConsumption.cmake | 7 +++++ Tests/RunCMake/Framework/RunCMakeTest.cmake | 11 ++++++- 10 files changed, 79 insertions(+), 49 deletions(-) create mode 100644 Help/release/dev/imported-target-framework-path.rst create mode 100644 Tests/RunCMake/Framework/ImportedFrameworkConsumption.cmake diff --git a/Help/prop_tgt/IMPORTED_LOCATION.rst b/Help/prop_tgt/IMPORTED_LOCATION.rst index a7207d845be..50c3658e460 100644 --- a/Help/prop_tgt/IMPORTED_LOCATION.rst +++ b/Help/prop_tgt/IMPORTED_LOCATION.rst @@ -15,6 +15,11 @@ is the location of the ``.dll`` part of the library. For ``UNKNOWN`` libraries this is the location of the file to be linked. Ignored for non-imported targets. +.. versionadded:: 3.28 + + For frameworks on macOS, this may be the location of the framework folder + itself. + The ``IMPORTED_LOCATION`` target property may be overridden for a given configuration ```` by the configuration-specific :prop_tgt:`IMPORTED_LOCATION_` target property. Furthermore, diff --git a/Help/release/dev/imported-target-framework-path.rst b/Help/release/dev/imported-target-framework-path.rst new file mode 100644 index 00000000000..68c3431f76f --- /dev/null +++ b/Help/release/dev/imported-target-framework-path.rst @@ -0,0 +1,5 @@ +imported-target-framework-path +------------------------------ + +* The :prop_tgt:`IMPORTED_LOCATION` property of a macOS framework may now be + the location of the framework folder itself. diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index b80b3cb6ffd..04e4fc768fb 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1579,7 +1579,9 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry) this->OldLinkDirItems.push_back(item.Value); } - if (target->IsFrameworkOnApple()) { + const bool isImportedFrameworkFolderOnApple = + target->IsImportedFrameworkFolderOnApple(this->Config); + if (target->IsFrameworkOnApple() || isImportedFrameworkFolderOnApple) { // Add the framework directory and the framework item itself auto fwDescriptor = this->GlobalGenerator->SplitFrameworkPath( item.Value, cmGlobalGenerator::FrameworkFormat::Extended); @@ -1597,16 +1599,33 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry) } if (this->GlobalGenerator->IsXcode()) { - this->Items.emplace_back( - item, ItemIsPath::Yes, target, - this->FindLibraryFeature(entry.Feature == DEFAULT - ? "__CMAKE_LINK_FRAMEWORK" - : entry.Feature)); + if (isImportedFrameworkFolderOnApple) { + if (entry.Feature == DEFAULT) { + this->AddLibraryFeature("FRAMEWORK"); + this->Items.emplace_back(item, ItemIsPath::Yes, target, + this->FindLibraryFeature("FRAMEWORK")); + } else { + this->Items.emplace_back(item, ItemIsPath::Yes, target, + this->FindLibraryFeature(entry.Feature)); + } + } else { + this->Items.emplace_back( + item, ItemIsPath::Yes, target, + this->FindLibraryFeature(entry.Feature == DEFAULT + ? "__CMAKE_LINK_FRAMEWORK" + : entry.Feature)); + } } else { if (cmHasSuffix(entry.Feature, "FRAMEWORK"_s)) { this->Items.emplace_back(fwDescriptor->GetLinkName(), ItemIsPath::Yes, target, this->FindLibraryFeature(entry.Feature)); + } else if (entry.Feature == DEFAULT && + isImportedFrameworkFolderOnApple) { + this->AddLibraryFeature("FRAMEWORK"); + this->Items.emplace_back(fwDescriptor->GetLinkName(), ItemIsPath::Yes, + target, + this->FindLibraryFeature("FRAMEWORK")); } else { this->Items.emplace_back( item, ItemIsPath::Yes, target, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 357d0a66a19..f5921b3e3b0 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3828,7 +3828,8 @@ std::vector> cmGeneratorTarget::GetIncludeDirectories( if (lib.Target == nullptr) { libDir = cmSystemTools::CollapseFullPath( lib.AsStr(), this->Makefile->GetHomeOutputDirectory()); - } else if (lib.Target->Target->IsFrameworkOnApple()) { + } else if (lib.Target->Target->IsFrameworkOnApple() || + this->IsImportedFrameworkFolderOnApple(config)) { libDir = lib.Target->GetLocation(config); } else { continue; @@ -8572,6 +8573,16 @@ bool cmGeneratorTarget::IsFrameworkOnApple() const return this->Target->IsFrameworkOnApple(); } +bool cmGeneratorTarget::IsImportedFrameworkFolderOnApple( + const std::string& config) const +{ + return this->IsApple() && this->IsImported() && + (this->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::UNKNOWN_LIBRARY) && + cmSystemTools::IsPathToFramework(this->GetLocation(config)); +} + bool cmGeneratorTarget::IsAppBundleOnApple() const { return this->Target->IsAppBundleOnApple(); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 78945c3fa99..03452a1e916 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -812,6 +812,10 @@ class cmGeneratorTarget Apple. */ bool IsFrameworkOnApple() const; + /** Return whether this target is an IMPORTED library target on Apple + with a .framework folder as its location. */ + bool IsImportedFrameworkFolderOnApple(const std::string& config) const; + /** Return whether this target is an executable Bundle on Apple. */ bool IsAppBundleOnApple() const; diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt index 91a90e57aab..e5eb4bfbbf4 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt @@ -1,17 +1,4 @@ -^CMake Error in CMakeLists.txt: - IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration - "[^"]+")?. -+ -CMake Error in CMakeLists.txt: - IMPORTED_LOCATION not set for imported target "static_lib"( configuration - "[^"]+")?. -+ -CMake Error in CMakeLists.txt: - IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration - "[^"]+")?.( -+ -CMake Error in CMakeLists.txt: +^(CMake Error in CMakeLists.txt: IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration - "[^"]+")?.)* -+ -CMake Generate step failed. Build files cannot be regenerated correctly.$ + "[^"]+")?. ++)+CMake Generate step failed. Build files cannot be regenerated correctly.$ diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt index 27af9110837..52861349c84 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt @@ -1,34 +1,13 @@ -^CMake Warning \(dev\) in CMakeLists.txt: +^(CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0111 is not set: An imported target missing its location property fails during generation. Run "cmake --help-policy CMP0111" for policy details. Use the cmake_policy command to set the policy and suppress this warning. - IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration - "[^"]+")?. -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0111 is not set: An imported target missing its location property - fails during generation. Run "cmake --help-policy CMP0111" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - - IMPORTED_LOCATION not set for imported target "static_lib"( configuration + IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration "[^"]+")?. This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) in CMakeLists.txt: - Policy CMP0111 is not set: An imported target missing its location property - fails during generation. Run "cmake --help-policy CMP0111" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - - IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration - "[^"]+")?. -This warning is for project developers. Use -Wno-dev to suppress it.( -+ -CMake Warning \(dev\) in CMakeLists.txt: ++)+CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0111 is not set: An imported target missing its location property fails during generation. Run "cmake --help-policy CMP0111" for policy details. Use the cmake_policy command to set the policy and suppress this @@ -36,4 +15,4 @@ CMake Warning \(dev\) in CMakeLists.txt: IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration "[^"]+")?. -This warning is for project developers. Use -Wno-dev to suppress it.)*$ +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/Framework/FrameworkConsumption.cmake b/Tests/RunCMake/Framework/FrameworkConsumption.cmake index 2180cf92dc4..f831a94f0a6 100644 --- a/Tests/RunCMake/Framework/FrameworkConsumption.cmake +++ b/Tests/RunCMake/Framework/FrameworkConsumption.cmake @@ -1,5 +1,7 @@ enable_language(C) +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install") + # Create framework and ensure header is placed in Headers set(input_header "${CMAKE_SOURCE_DIR}/Gui.h") add_library(Gui SHARED Gui.c "${input_header}") @@ -8,6 +10,8 @@ set_target_properties(Gui PROPERTIES FRAMEWORK TRUE ) +install(TARGETS Gui DESTINATION .) + add_executable(app main.c) target_link_libraries(app PRIVATE Gui) diff --git a/Tests/RunCMake/Framework/ImportedFrameworkConsumption.cmake b/Tests/RunCMake/Framework/ImportedFrameworkConsumption.cmake new file mode 100644 index 00000000000..c44a1bbf6a7 --- /dev/null +++ b/Tests/RunCMake/Framework/ImportedFrameworkConsumption.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_library(Gui IMPORTED UNKNOWN) +set_property(TARGET Gui PROPERTY IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/../FrameworkConsumption-build/install/Gui.framework") + +add_executable(app main.c) +target_link_libraries(app PRIVATE Gui) diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index a767130e4c9..7319a592b50 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -113,7 +113,16 @@ function(framework_consumption) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") run_cmake(FrameworkConsumption) - run_cmake_command(FrameworkConsumption-build ${CMAKE_COMMAND} --build .) + run_cmake_command(FrameworkConsumption-build ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(FrameworkConsumption-install ${CMAKE_COMMAND} --install . --config Release) + + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ImportedFrameworkConsumption-build") + set(RunCMake_TEST_NO_CLEAN 1) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(ImportedFrameworkConsumption) + run_cmake_command(ImportedFrameworkConsumption-build ${CMAKE_COMMAND} --build . --config Release) endfunction() framework_consumption() From 9326c2b46e337458bd11857ed03b28fcbb9a3746 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 24 Jun 2023 00:01:11 -0400 Subject: [PATCH 059/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7b6a2004494..d92a8b77c91 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230623) +set(CMake_VERSION_PATCH 20230624) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 7e38674e063cc7b5c3cff0748d6968a8f60907dc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 25 Jun 2023 00:01:10 -0400 Subject: [PATCH 060/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d92a8b77c91..a77d5b414c2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230624) +set(CMake_VERSION_PATCH 20230625) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 4e189e60f844671cd2cf1034ee5d06393291be71 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 26 Jun 2023 00:01:36 -0400 Subject: [PATCH 061/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a77d5b414c2..183dfeaf7dc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230625) +set(CMake_VERSION_PATCH 20230626) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 75b573a628d4296b237601d2a9cb4c0a05903f96 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sat, 24 Jun 2023 14:37:59 -0400 Subject: [PATCH 062/627] Deprecate Visual Studio 12 2013 generator Update documentation to mark the generator deprecated. Add a warning at the end of generation plus an option to turn off the warning. --- Help/generator/Visual Studio 10 2010.rst | 2 +- Help/generator/Visual Studio 11 2012.rst | 2 +- Help/generator/Visual Studio 12 2013.rst | 9 ++++++++- Help/generator/Visual Studio 9 2008.rst | 2 +- Help/release/dev/vs12-deprecate.rst | 5 +++++ Source/cmGlobalVisualStudio12Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 20 +++++++++++++++++++ Tests/CMakeLists.txt | 2 ++ .../CommandLine/DeprecateVS12-WARN-OFF.cmake | 0 .../DeprecateVS12-WARN-ON-stderr.txt | 5 +++++ .../CommandLine/DeprecateVS12-WARN-ON.cmake | 0 Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 7 +++++++ 12 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 Help/release/dev/vs12-deprecate.rst create mode 100644 Tests/RunCMake/CommandLine/DeprecateVS12-WARN-OFF.cmake create mode 100644 Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON.cmake diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst index 888164f3ca7..a36046a22e9 100644 --- a/Help/generator/Visual Studio 10 2010.rst +++ b/Help/generator/Visual Studio 10 2010.rst @@ -3,6 +3,6 @@ Visual Studio 10 2010 Removed. This once generated Visual Studio 10 2010 project files, but the generator has been removed since CMake 3.25. It is still possible -to build with VS 10 2010 tools using the :generator:`Visual Studio 12 2013` +to build with VS 10 2010 tools using the :generator:`Visual Studio 14 2015` (or above) generator with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v100``, or by using the :generator:`NMake Makefiles` generator. diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst index fd8c314c5e5..5ded24c8603 100644 --- a/Help/generator/Visual Studio 11 2012.rst +++ b/Help/generator/Visual Studio 11 2012.rst @@ -3,6 +3,6 @@ Visual Studio 11 2012 Removed. This once generated Visual Studio 11 2012 project files, but the generator has been removed since CMake 3.28. It is still possible -to build with VS 11 2012 tools using the :generator:`Visual Studio 12 2013` +to build with VS 11 2012 tools using the :generator:`Visual Studio 14 2015` (or above) generator with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v110``, or by using the :generator:`NMake Makefiles` generator. diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst index 3dbcfe65dfe..522522cc320 100644 --- a/Help/generator/Visual Studio 12 2013.rst +++ b/Help/generator/Visual Studio 12 2013.rst @@ -1,7 +1,14 @@ Visual Studio 12 2013 --------------------- -Generates Visual Studio 12 (VS 2013) project files. +Deprecated. Generates Visual Studio 12 (VS 2013) project files. + +.. note:: + This generator is deprecated and will be removed in a future version + of CMake. It will still be possible to build with VS 12 2013 tools + using the :generator:`Visual Studio 14 2015` (or above) generator + with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v120``, or by + using the :generator:`NMake Makefiles` generator. For compatibility with CMake versions prior to 3.0, one may specify this generator using the name "Visual Studio 12" without the year component. diff --git a/Help/generator/Visual Studio 9 2008.rst b/Help/generator/Visual Studio 9 2008.rst index 816969dd284..143927046bb 100644 --- a/Help/generator/Visual Studio 9 2008.rst +++ b/Help/generator/Visual Studio 9 2008.rst @@ -6,7 +6,7 @@ Deprecated. Generates Visual Studio 9 2008 project files. .. note:: This generator is deprecated and will be removed in a future version of CMake. It will still be possible to build with VS 9 2008 tools - using the :generator:`Visual Studio 12 2013` generator (or above, + using the :generator:`Visual Studio 14 2015` generator (or above, and with VS 10 2010 also installed) with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v90``, or by using the :generator:`NMake Makefiles` generator. diff --git a/Help/release/dev/vs12-deprecate.rst b/Help/release/dev/vs12-deprecate.rst new file mode 100644 index 00000000000..23d7e2a694b --- /dev/null +++ b/Help/release/dev/vs12-deprecate.rst @@ -0,0 +1,5 @@ +vs12-deprecate +-------------- + +* The :generator:`Visual Studio 12 2013` generator is now deprecated + and will be removed in a future version of CMake. diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index d417f9edbc0..b7af31b6dc2 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -64,7 +64,7 @@ class cmGlobalVisualStudio12Generator::Factory cmDocumentationEntry GetDocumentation() const override { return { std::string(vs12generatorName) + " [arch]", - "Generates Visual Studio 2013 project files. " + "Deprecated. Generates Visual Studio 2013 project files. " "Optional [arch] can be \"Win64\" or \"ARM\"." }; } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 62c0b5b20c3..203bb09ade9 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -329,6 +329,26 @@ void cmGlobalVisualStudio7Generator::Generate() "Add CMAKE_WARN_VS9=OFF to the cache to disable this warning."); } } + + if (this->Version == VSVersion::VS12 && + !this->CMakeInstance->GetIsInTryCompile()) { + std::string cmakeWarnVS12; + if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue( + "CMAKE_WARN_VS12")) { + this->CMakeInstance->MarkCliAsUsed("CMAKE_WARN_VS12"); + cmakeWarnVS12 = *cached; + } else { + cmSystemTools::GetEnv("CMAKE_WARN_VS12", cmakeWarnVS12); + } + if (cmakeWarnVS12.empty() || !cmIsOff(cmakeWarnVS12)) { + this->CMakeInstance->IssueMessage( + MessageType::WARNING, + "The \"Visual Studio 12 2013\" generator is deprecated " + "and will be removed in a future version of CMake." + "\n" + "Add CMAKE_WARN_VS12=OFF to the cache to disable this warning."); + } + } } void cmGlobalVisualStudio7Generator::OutputSLNFile( diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8e6017e6852..914ebce9a9e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -42,6 +42,8 @@ endif() # Suppress generator deprecation warnings in test suite. if(CMAKE_GENERATOR MATCHES "^Visual Studio 9 2008") set(TEST_WARN_VS_CODE "set(ENV{CMAKE_WARN_VS9} OFF)") +elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 12 2013") + set(TEST_WARN_VS_CODE "set(ENV{CMAKE_WARN_VS12} OFF)") else() set(TEST_WARN_VS_CODE "") endif() diff --git a/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-OFF.cmake new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON-stderr.txt new file mode 100644 index 00000000000..b69408e2fcb --- /dev/null +++ b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning: + The "Visual Studio 12 2013" generator is deprecated and will be removed in + a future version of CMake. + + Add CMAKE_WARN_VS12=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS12-WARN-ON.cmake new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 53f13e46c60..611dde21100 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -1118,3 +1118,10 @@ if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 2008") run_cmake(DeprecateVS9-WARN-ON) run_cmake_with_options(DeprecateVS9-WARN-OFF -DCMAKE_WARN_VS9=OFF) endif() + +if(RunCMake_GENERATOR MATCHES "^Visual Studio 12 2013") + run_cmake_with_options(DeprecateVS12-WARN-ON -DCMAKE_WARN_VS12=ON) + unset(ENV{CMAKE_WARN_VS12}) + run_cmake(DeprecateVS12-WARN-ON) + run_cmake_with_options(DeprecateVS12-WARN-OFF -DCMAKE_WARN_VS12=OFF) +endif() From 3fcb2d91ad1d8b287efa68eff1e670794d7bf1dc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 27 Jun 2023 00:01:09 -0400 Subject: [PATCH 063/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 183dfeaf7dc..8a97dd38efe 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230626) +set(CMake_VERSION_PATCH 20230627) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 8086ce2706dcbbea5d9ead0222666f2004826c53 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 28 Jun 2023 00:01:11 -0400 Subject: [PATCH 064/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8a97dd38efe..28651a6f168 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230627) +set(CMake_VERSION_PATCH 20230628) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 408964f947e6874c625661a5ee19b90e7b3bbde0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 29 Jun 2023 00:01:10 -0400 Subject: [PATCH 065/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 28651a6f168..06900c25e91 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230628) +set(CMake_VERSION_PATCH 20230629) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 9b45210b052c7c81ab84313c4a3b537e66c2a7b7 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Thu, 29 Jun 2023 15:11:12 +0200 Subject: [PATCH 066/627] FindPython: Add tests for IronPython v3 --- Modules/FindPython/Support.cmake | 4 +- Tests/CMakeLists.txt | 6 +- Tests/FindPython/CMakeLists.txt | 141 ++++++++++++++++---- Tests/FindPython/IronPython3/CMakeLists.txt | 31 +++++ 4 files changed, 154 insertions(+), 28 deletions(-) create mode 100644 Tests/FindPython/IronPython3/CMakeLists.txt diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 76d4a9b24f8..0f0e2af4529 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -981,7 +981,7 @@ function (_PYTHON_VALIDATE_COMPILER) # retrieve python environment version from compiler set (working_dir "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir") - file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))\n") + file (WRITE "${working_dir}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]])); sys.stdout.flush()\n") execute_process (COMMAND ${launcher} "${_${_PYTHON_PREFIX}_COMPILER}" ${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS} /target:exe /embed "${working_dir}/version.py" @@ -2520,7 +2520,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) # retrieve python environment version from compiler _python_get_launcher (_${_PYTHON_PREFIX}_COMPILER_LAUNCHER COMPILER) set (_${_PYTHON_PREFIX}_VERSION_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir") - file (WRITE "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))\n") + file (WRITE "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]])); sys.stdout.flush()\n") execute_process (COMMAND ${_${_PYTHON_PREFIX}_COMPILER_LAUNCHER} "${_${_PYTHON_PREFIX}_COMPILER}" ${_${_PYTHON_PREFIX}_IRON_PYTHON_COMPILER_ARCH_FLAGS} /target:exe /embed "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 914ebce9a9e..2a7c8396ca3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1557,15 +1557,17 @@ if(BUILD_TESTING) endif() if(CMake_TEST_FindPython_IronPython) set(CMake_TEST_FindPython2_IronPython TRUE) + set(CMake_TEST_FindPython3_IronPython TRUE) endif() if(CMake_TEST_FindPython_PyPy) set(CMake_TEST_FindPython2_PyPy TRUE) set(CMake_TEST_FindPython3_PyPy TRUE) endif() - if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython2 + if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3 OR CMake_TEST_FindPython2_SABIModule OR CMake_TEST_FindPython3_SABIModule OR CMake_TEST_FindPython2_NumPy OR CMake_TEST_FindPython3_NumPy - OR CMake_TEST_FindPython3_Conda OR CMake_TEST_FindPython2_IronPython + OR CMake_TEST_FindPython3_Conda + OR CMake_TEST_FindPython2_IronPython OR CMake_TEST_FindPython3_IronPython OR CMake_TEST_FindPython2_PyPy OR CMake_TEST_FindPython3_PyPy) if (CMake_TEST_FindPython2 AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") set(CMake_TEST_FindPython2_SABIModule TRUE) diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index 3e1993ecf43..bb9bef09efa 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -557,21 +557,21 @@ if(CMake_TEST_FindPython3_Conda) endif() if (CMake_TEST_FindPython2 AND CMake_TEST_FindPython2_IronPython) - add_test(NAME FindPython.Implementation.CPython COMMAND + add_test(NAME FindPython.Implementation.CPython2 COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation" - "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.CPython" + "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.CPython2" ${build_generator_args} --build-project TestImplementationCPython --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_REQUESTED_IMPLEMENTATIONS=CPython --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.Implementation.IronPython COMMAND + add_test(NAME FindPython.Implementation.IronPython2 COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation" - "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.IronPython" + "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.IronPython2" ${build_generator_args} --build-project TestImplementationIronPython --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_REQUESTED_IMPLEMENTATION=IronPython @@ -579,6 +579,29 @@ if (CMake_TEST_FindPython2 AND CMake_TEST_FindPython2_IronPython) ) endif() +if (CMake_TEST_FindPython3 AND CMake_TEST_FindPython3_IronPython) + add_test(NAME FindPython.Implementation.CPython3 COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation" + "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.CPython3" + ${build_generator_args} + --build-project TestImplementationCPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_REQUESTED_IMPLEMENTATIONS=CPython + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + add_test(NAME FindPython.Implementation.IronPython3 COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation" + "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.IronPython3" + ${build_generator_args} + --build-project TestImplementationIronPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_REQUESTED_IMPLEMENTATION=IronPython + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) +endif() + if(CMake_TEST_FindPython2_IronPython) add_test(NAME FindPython.IronPython2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ @@ -601,26 +624,6 @@ if(CMake_TEST_FindPython2_IronPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - add_test(NAME FindPython.IronPython.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" - "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.LOCATION" - ${build_generator_args} - --build-project TestIronPython - --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) - add_test(NAME FindPython.IronPython.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $ - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" - "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.VERSION" - ${build_generator_args} - --build-project TestIronPython - --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $ - ) add_test(NAME FindPython.IronPython.V2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ --build-and-test @@ -666,6 +669,96 @@ if(CMake_TEST_FindPython2_IronPython) ) endif() +if(CMake_TEST_FindPython3_IronPython) + add_test(NAME FindPython.IronPython3.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython3" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython3.LOCATION" + ${build_generator_args} + --build-project TestIronPython3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + add_test(NAME FindPython.IronPython3.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython3" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython3.VERSION" + ${build_generator_args} + --build-project TestIronPython3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + + add_test(NAME FindPython.IronPython.V3.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.V3.LOCATION" + ${build_generator_args} + --build-project TestIronPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + add_test(NAME FindPython.IronPython.V3.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.V3.VERSION" + ${build_generator_args} + --build-project TestIronPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + + add_test(NAME FindPython.IronPython3.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython3.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python3 -DPython_REQUESTED_VERSION=3 + -DPython3_FIND_IMPLEMENTATIONS=IronPython + -DPython3_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.IronPython3.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython3.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python3 -DPython_REQUESTED_VERSION=3 + -DPython3_FIND_IMPLEMENTATIONS=IronPython + -DPython3_FIND_STRATEGY=VERSION + ) +endif() + +if(CMake_TEST_FindPython2_IronPython OR CMake_TEST_FindPython3_IronPython) + add_test(NAME FindPython.IronPython.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.LOCATION" + ${build_generator_args} + --build-project TestIronPython + --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + add_test(NAME FindPython.IronPython.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/IronPython" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython.VERSION" + ${build_generator_args} + --build-project TestIronPython + --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) +endif() + if(CMake_TEST_FindPython2_PyPy) add_test(NAME FindPython.PyPy2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $ diff --git a/Tests/FindPython/IronPython3/CMakeLists.txt b/Tests/FindPython/IronPython3/CMakeLists.txt new file mode 100644 index 00000000000..b09097a3e85 --- /dev/null +++ b/Tests/FindPython/IronPython3/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.5) + +project(TestIronPython3 LANGUAGES NONE) + +set (Python3_FIND_IMPLEMENTATIONS "IronPython") + +find_package(Python3 COMPONENTS Interpreter Compiler) +if (NOT Python3_FOUND) + message (FATAL_ERROR "Failed to find Python 3") +endif() + +if (NOT Python3_Interpreter_FOUND) + message (FATAL_ERROR "Failed to find Python 3 Interpreter") +endif() +if (NOT Python3_INTERPRETER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous interpreter ID (${Python3_INTERPRETER_ID})") +endif() + +if (NOT Python3_Compiler_FOUND) + message (FATAL_ERROR "Failed to find Python 3 Compiler") +endif() +if (NOT Python3_COMPILER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous compiler ID (${Python3_COMPILER_ID})") +endif() + +if(NOT TARGET Python3::Interpreter) + message(SEND_ERROR "Python3::Interpreter not found") +endif() +if(NOT TARGET Python3::Compiler) + message(SEND_ERROR "Python3::Compiler not found") +endif() From 97b3a2ac17b0c28b27ff0a238b3466f610483d02 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Thu, 29 Jun 2023 16:12:16 +0200 Subject: [PATCH 067/627] FindPython: Add labels Python2 and/or Python3 on tests --- Tests/FindPython/CMakeLists.txt | 68 ++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index bb9bef09efa..636a7b0a5fd 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -164,6 +164,16 @@ if(CMake_TEST_FindPython2) --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + set_property(TEST FindPython.Python2.LOCATION FindPython.Python2.VERSION + FindPython.Python2.Development.Module FindPython.Python2Fail + FindPython.Python.V2.LOCATION FindPython.Python.V2.VERSION + FindPython.Python2.ExactVersion.LOCATION FindPython.Python2.ExactVersion.VERSION + FindPython.Python.V2.ExactVersion.LOCATION FindPython.Python.V2.ExactVersion.VERSION + FindPython.Python2.VersionRange.LOCATION FindPython.Python2.VersionRange.VERSION + FindPython.Python.V2.VersionRange.LOCATION FindPython.Python.V2.VersionRange.VERSION + FindPython.Python2Embedded + APPEND PROPERTY LABELS Python2) endif() if(CMake_TEST_FindPython3) @@ -413,6 +423,18 @@ if(CMake_TEST_FindPython3) --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + set_property(TEST FindPython.Python3.LOCATION FindPython.Python3.VERSION + FindPython.Python3.Development.Module FindPython.Python3Fail + FindPython.Python.V3.LOCATION FindPython.Python.V3.VERSION + FindPython.Python3.ExactVersion.LOCATION FindPython.Python3.ExactVersion.VERSION + FindPython.Python.V3.ExactVersion.LOCATION FindPython.Python.V3.ExactVersion.VERSION + FindPython.Python3.VersionRange.LOCATION FindPython.Python3.VersionRange.VERSION + FindPython.Python.V3.VersionRange.LOCATION FindPython.Python.V3.VersionRange.VERSION + FindPython.VirtualEnv FindPython.Python3Embedded FindPython.RequiredArtifacts + FindPython.ArtifactsInteractive.ON FindPython.ArtifactsInteractive.OFF + FindPython.CustomFailureMessage FindPython.DifferentComponents + APPEND PROPERTY LABELS Python3) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") add_test(NAME FindPython.UnversionedNames COMMAND ${CMAKE_CTEST_COMMAND} -C $ @@ -423,6 +445,7 @@ if(CMake_TEST_FindPython3) --build-project UnversionedNames --build-options ${build_options} ) + set_property(TEST FindPython.UnversionedNames APPEND PROPERTY LABELS Python3) endif() endif() @@ -475,6 +498,9 @@ if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3) "-DCMake_TEST_FindPython_COMPONENT=Development" --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + set_property(TEST FindPython.Interpreter.SOABI FindPython.Development.SOABI + APPEND PROPERTY LABELS Python2 Python3) endif() add_test(NAME FindPython.MultiplePackages COMMAND @@ -487,6 +513,9 @@ if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3) --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + set_property(TEST FindPython.Python.LOCATION FindPython.Python.VERSION FindPython.MultiplePackages + APPEND PROPERTY LABELS Python2 Python3) endif() @@ -501,8 +530,9 @@ if(CMake_TEST_FindPython2_SABIModule) --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) - set_tests_properties(FindPython.Python2.Development.SABIModule PROPERTIES - PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: .*Development\\.SABIModule") + set_tests_properties(FindPython.Python2.Development.SABIModule PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: .*Development\\.SABIModule") + set_property(TEST FindPython.Python2.Development.SABIModule APPEND PROPERTY LABELS Python2) endif() if(CMake_TEST_FindPython3_SABIModule) @@ -519,6 +549,7 @@ if(CMake_TEST_FindPython3_SABIModule) --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C Release ) + set_property(TEST FindPython.Python3.Development.SABIModule APPEND PROPERTY LABELS Python3) endif() if(CMake_TEST_FindPython2_NumPy OR CMake_TEST_FindPython3_NumPy) @@ -541,6 +572,8 @@ if(CMake_TEST_FindPython2_NumPy OR CMake_TEST_FindPython3_NumPy) --build-project TestNumPyOnly --build-options ${build_options} ) + + set_property(TEST FindPython.NumPy FindPython.NumPyOnly APPEND PROPERTY LABELS Python2 Python3) endif() if(CMake_TEST_FindPython3_Conda) @@ -554,6 +587,7 @@ if(CMake_TEST_FindPython3_Conda) --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + set_property(TEST FindPython.VirtualEnvConda APPEND PROPERTY LABELS Python3) endif() if (CMake_TEST_FindPython2 AND CMake_TEST_FindPython2_IronPython) @@ -577,6 +611,9 @@ if (CMake_TEST_FindPython2 AND CMake_TEST_FindPython2_IronPython) --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_REQUESTED_IMPLEMENTATION=IronPython --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + set_property(TEST FindPython.Implementation.CPython2 FindPython.Implementation.IronPython2 + APPEND PROPERTY LABELS Python2) endif() if (CMake_TEST_FindPython3 AND CMake_TEST_FindPython3_IronPython) @@ -600,6 +637,9 @@ if (CMake_TEST_FindPython3 AND CMake_TEST_FindPython3_IronPython) --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_REQUESTED_IMPLEMENTATION=IronPython --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + set_property(TEST FindPython.Implementation.CPython3 FindPython.Implementation.IronPython3 + APPEND PROPERTY LABELS Python3) endif() if(CMake_TEST_FindPython2_IronPython) @@ -667,6 +707,11 @@ if(CMake_TEST_FindPython2_IronPython) -DPython2_FIND_IMPLEMENTATIONS=IronPython -DPython2_FIND_STRATEGY=VERSION ) + + set_property(TEST FindPython.IronPython2.LOCATION FindPython.IronPython2.VERSION + FindPython.IronPython.V2.LOCATION FindPython.IronPython.V2.VERSION + FindPython.IronPython2.VersionRange.LOCATION FindPython.IronPython2.VersionRange.VERSION + APPEND PROPERTY LABELS Python2) endif() if(CMake_TEST_FindPython3_IronPython) @@ -734,6 +779,11 @@ if(CMake_TEST_FindPython3_IronPython) -DPython3_FIND_IMPLEMENTATIONS=IronPython -DPython3_FIND_STRATEGY=VERSION ) + + set_property(TEST FindPython.IronPython3.LOCATION FindPython.IronPython3.VERSION + FindPython.IronPython.V3.LOCATION FindPython.IronPython.V3.VERSION + FindPython.IronPython3.VersionRange.LOCATION FindPython.IronPython3.VersionRange.VERSION + APPEND PROPERTY LABELS Python3) endif() if(CMake_TEST_FindPython2_IronPython OR CMake_TEST_FindPython3_IronPython) @@ -757,6 +807,9 @@ if(CMake_TEST_FindPython2_IronPython OR CMake_TEST_FindPython3_IronPython) --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + set_property(TEST FindPython.IronPython.LOCATION FindPython.IronPython.VERSION + APPEND PROPERTY LABELS Python2 Python3) endif() if(CMake_TEST_FindPython2_PyPy) @@ -801,6 +854,10 @@ if(CMake_TEST_FindPython2_PyPy) --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + set_property(TEST FindPython.PyPy2.LOCATION FindPython.PyPy2.VERSION + FindPython.PyPy.V2.LOCATION FindPython.PyPy.V2.VERSION + APPEND PROPERTY LABELS Python2) endif() if(CMake_TEST_FindPython3_PyPy) @@ -845,6 +902,10 @@ if(CMake_TEST_FindPython3_PyPy) --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + set_property(TEST FindPython.PyPy3.LOCATION FindPython.PyPy3.VERSION + FindPython.PyPy.V3.LOCATION FindPython.PyPy.V3.VERSION + APPEND PROPERTY LABELS Python3) endif() if(CMake_TEST_FindPython2_PyPy OR CMake_TEST_FindPython3_PyPy) @@ -868,4 +929,7 @@ if(CMake_TEST_FindPython2_PyPy OR CMake_TEST_FindPython3_PyPy) --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $ ) + + set_property(TEST FindPython.PyPy.LOCATION FindPython.PyPy.VERSION + APPEND PROPERTY LABELS Python2 Python3) endif() From 2087cc5b85496f9dd16be8142702019074b9baa1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 30 Jun 2023 00:01:19 -0400 Subject: [PATCH 068/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 06900c25e91..c236941a4d3 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230629) +set(CMake_VERSION_PATCH 20230630) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 31adc11030b16072a8d7e8dd44ec9a3db6618364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Thu, 29 Jun 2023 16:22:51 +0200 Subject: [PATCH 069/627] FindProtobuf: Add PLUGIN_OPTIONS and PROTOC_OPTIONS to protobuf_generate --- Modules/FindProtobuf.cmake | 41 ++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index b046fcc7334..f7668478a4c 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -140,11 +140,11 @@ Example: function(protobuf_generate) set(_options APPEND_PATH DESCRIPTORS) - set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS) if(COMMAND target_sources) list(APPEND _singleargs TARGET) endif() - set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS) + set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS) cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") @@ -168,9 +168,18 @@ function(protobuf_generate) endif() if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) - set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") + set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}") endif() + foreach(_option ${_dll_export_decl} ${protobuf_generate_PLUGIN_OPTIONS}) + # append comma - not using CMake lists and string replacement as users + # might have semicolons in options + if(_plugin_options) + set( _plugin_options "${_plugin_options},") + endif() + set(_plugin_options "${_plugin_options}${_option}") + endforeach() + if(protobuf_generate_PLUGIN) set(_plugin "--plugin=${protobuf_generate_PLUGIN}") endif() @@ -204,14 +213,12 @@ function(protobuf_generate) # Create an include path for each file specified foreach(_file ${protobuf_generate_PROTOS}) get_filename_component(_abs_file ${_file} ABSOLUTE) - get_filename_component(_abs_path ${_abs_file} PATH) - list(FIND _protobuf_include_path ${_abs_path} _contains_already) + get_filename_component(_abs_dir ${_abs_file} DIRECTORY) + list(FIND _protobuf_include_path ${_abs_dir} _contains_already) if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${_abs_path}) + list(APPEND _protobuf_include_path -I ${_abs_dir}) endif() endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) endif() foreach(DIR ${protobuf_generate_IMPORT_DIRS}) @@ -222,6 +229,10 @@ function(protobuf_generate) endif() endforeach() + if(NOT _protobuf_include_path) + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + set(_generated_srcs_all) foreach(_proto ${protobuf_generate_PROTOS}) get_filename_component(_abs_file ${_proto} ABSOLUTE) @@ -246,12 +257,20 @@ function(protobuf_generate) endif() list(APPEND _generated_srcs_all ${_generated_srcs}) + set(_comment "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}") + if(protobuf_generate_PROTOC_OPTIONS) + set(_comment "${_comment}, protoc-options: ${protobuf_generate_PROTOC_OPTIONS}") + endif() + if(_plugin_options) + set(_comment "${_comment}, plugin-options: ${_plugin_options}") + endif() + add_custom_command( OUTPUT ${_generated_srcs} - COMMAND protobuf::protoc - ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} + COMMAND protobuf::protoc + ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} DEPENDS ${_abs_file} protobuf::protoc - COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" + COMMENT ${_comment} VERBATIM ) endforeach() From cd3ff53c8850458d8aaec13d40c698b6225903cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Thu, 29 Jun 2023 16:35:15 +0200 Subject: [PATCH 070/627] FindProtobuf: Add DEPENDENCIES to protobuf_generate See upstream PR for details https://github.com/protocolbuffers/protobuf/pull/10014. --- Modules/FindProtobuf.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index f7668478a4c..649e5718558 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -140,7 +140,7 @@ Example: function(protobuf_generate) set(_options APPEND_PATH DESCRIPTORS) - set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES) if(COMMAND target_sources) list(APPEND _singleargs TARGET) endif() @@ -269,7 +269,7 @@ function(protobuf_generate) OUTPUT ${_generated_srcs} COMMAND protobuf::protoc ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} - DEPENDS ${_abs_file} protobuf::protoc + DEPENDS ${_abs_file} protobuf::protoc ${protobuf_generate_DEPENDENCIES} COMMENT ${_comment} VERBATIM ) endforeach() From f784ef75a780760c795afea175fc0e2e5204cec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Thu, 29 Jun 2023 17:42:09 +0200 Subject: [PATCH 071/627] FindProtobuf: Add documentation for protobuf_generate() Note, the argument `DESCRIPTORS` is not documented as upstream doesn't provide this argument and code might break when switching to upstream later. Instead of the argument `DESCRIPTORS` `PROTOC_OPTIONS "--descriptor_set_out=NAME.desc"` can be used. Argument description has been copied from [1]. Fixes: #23037 [1] https://github.com/protocolbuffers/protobuf/blob/8ec0295ad7fc83d20609fcdf4830e3e3fddf2912/docs/cmake_protobuf_generate.md --- Modules/FindProtobuf.cmake | 80 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 649e5718558..34554123bc5 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -136,6 +136,86 @@ Example: Variable to define with autogenerated Python files ``ARGN`` ``.proto`` files + +.. command:: protobuf_generate + + .. versionadded:: 3.13 + + Automatically generate source files from ``.proto`` schema files at build time:: + + protobuf_generate ( + TARGET + [LANGUAGE ] + [OUT_VAR ] + [EXPORT_MACRO ] + [PROTOC_OUT_DIR ] + [PLUGIN ] + [PLUGIN_OPTIONS ] + [DEPENDENCIES ] + [IMPORT_DIRS ] + [GENERATE_EXTENSIONS ] + [PROTOC_OPTIONS ] + [APPEND_PATH]) + + ``APPEND_PATH`` + A flag that causes the base path of all proto schema files to be added to + ``IMPORT_DIRS``. + ``LANGUAGE`` + A single value: cpp or python. Determines what kind of source files are + being generated. Defaults to cpp. + ``OUT_VAR`` + Name of a CMake variable that will be filled with the paths to the generated + source files. + ``EXPORT_MACRO`` + Name of a macro that is applied to all generated Protobuf message classes + and extern variables. It can, for example, be used to declare DLL exports. + ``PROTOC_OUT_DIR`` + Output directory of generated source files. Defaults to ``CMAKE_CURRENT_BINARY_DIR``. + ``PLUGIN`` + .. versionadded:: 3.21 + + An optional plugin executable. This could, for example, be the path to + ``grpc_cpp_plugin``. + ``PLUGIN_OPTIONS`` + .. versionadded:: 3.28 + + Additional options provided to the plugin, such as ``generate_mock_code=true`` + for the gRPC cpp plugin. + ``DEPENDENCIES`` + .. versionadded:: 3.28 + + Arguments forwarded to the ``DEPENDS`` of the underlying ``add_custom_command`` + invocation. + ``TARGET`` + CMake target that will have the generated files added as sources. + ``PROTOS`` + List of proto schema files. If omitted, then every source file ending in *proto* of ``TARGET`` will be used. + ``IMPORT_DIRS`` + A common parent directory for the schema files. For example, if the schema file is + ``proto/helloworld/helloworld.proto`` and the import directory ``proto/`` then the + generated files are ``${PROTOC_OUT_DIR}/helloworld/helloworld.pb.h`` and + ``${PROTOC_OUT_DIR}/helloworld/helloworld.pb.cc``. + ``GENERATE_EXTENSIONS`` + If LANGUAGE is omitted then this must be set to the extensions that protoc generates. + ``PROTOC_OPTIONS`` + .. versionadded:: 3.28 + + Additional arguments that are forwarded to protoc. + + Example:: + + find_package(gRPC CONFIG REQUIRED) + find_package(Protobuf REQUIRED) + add_library(ProtoTest Test.proto) + target_link_libraries(ProtoTest PUBLIC gRPC::grpc++) + protobuf_generate(TARGET ProtoTest) + protobuf_generate( + TARGET ProtoTest + LANGUAGE grpc + PLUGIN protoc-gen-grpc=$ + PLUGIN_OPTIONS generate_mock_code=true + GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc) #]=======================================================================] function(protobuf_generate) From 5e5c145234db7cb2f853e5e46d3f91de1eea0dae Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 1 Jul 2023 00:01:14 -0400 Subject: [PATCH 072/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c236941a4d3..d4464c199f6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230630) +set(CMake_VERSION_PATCH 20230701) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 20f07467a740e5eb407689b8c2072dc63763f806 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 2 Jul 2023 00:01:13 -0400 Subject: [PATCH 073/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d4464c199f6..4147a69e5a2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230701) +set(CMake_VERSION_PATCH 20230702) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 083c6fd927327e48a2f6e87431657e4c9c6c5108 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 3 Jul 2023 00:02:10 -0400 Subject: [PATCH 074/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4147a69e5a2..7bcdeace625 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230702) +set(CMake_VERSION_PATCH 20230703) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 7bd24c1da5d093199dedab3fcfad6ec93d4c7aa5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 4 Jul 2023 00:01:10 -0400 Subject: [PATCH 075/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7bcdeace625..cacaa84d5f9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230703) +set(CMake_VERSION_PATCH 20230704) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 21c73b99bc041704d63f67b15291706b91f786b3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 5 Jul 2023 00:01:10 -0400 Subject: [PATCH 076/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cacaa84d5f9..63d112d922c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230704) +set(CMake_VERSION_PATCH 20230705) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From fff6c469f8480faf04826702c0e904823c6151e6 Mon Sep 17 00:00:00 2001 From: funsafe-ptr <136802754+funsafe-ptr@users.noreply.github.com> Date: Sat, 1 Jul 2023 02:35:04 +0700 Subject: [PATCH 077/627] Android: Populate CMAKE_HOST_SYSTEM_VERSION on native builds Follow up commit c5892e484e (Android: add support for native compilation, such as with the Termux app, 2019-10-15, v3.17.0-rc1~594^2). --- Modules/CMakeDetermineSystem.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 386be73f68b..fff4e9dee3f 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -47,6 +47,28 @@ if(CMAKE_HOST_UNIX) set(CMAKE_HOST_SYSTEM_VERSION "${_CMAKE_HOST_SYSTEM_MAJOR_VERSION}.${_CMAKE_HOST_SYSTEM_MINOR_VERSION}") unset(_CMAKE_HOST_SYSTEM_MAJOR_VERSION) unset(_CMAKE_HOST_SYSTEM_MINOR_VERSION) + elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android") + execute_process(COMMAND getprop ro.build.version.sdk + OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + + if(NOT DEFINED CMAKE_SYSTEM_VERSION) + set(_ANDROID_API_LEVEL_H $ENV{PREFIX}/include/android/api-level.h) + set(_ANDROID_API_REGEX "#define __ANDROID_API__ ([0-9]+)") + file(READ ${_ANDROID_API_LEVEL_H} _ANDROID_API_LEVEL_H_CONTENT) + string(REGEX MATCH ${_ANDROID_API_REGEX} _ANDROID_API_LINE "${_ANDROID_API_LEVEL_H_CONTENT}") + string(REGEX REPLACE ${_ANDROID_API_REGEX} "\\1" _ANDROID_API "${_ANDROID_API_LINE}") + if(_ANDROID_API) + set(CMAKE_SYSTEM_VERSION "${_ANDROID_API}") + endif() + + unset(_ANDROID_API_LEVEL_H) + unset(_ANDROID_API_LEVEL_H_CONTENT) + unset(_ANDROID_API_REGEX) + unset(_ANDROID_API_LINE) + unset(_ANDROID_API) + endif() else() execute_process(COMMAND ${CMAKE_UNAME} -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION From d85238a2f29c552041293f1f7e64e3de55e55907 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 29 Jun 2023 00:02:29 +0200 Subject: [PATCH 078/627] source_group: Fix TREE without FILES According to the documentation of `source_group()` the `FILES` parameter is optional, but that was actually not the case. When using `source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR})` cmake did not previously create the source tree, but recognized it as the old syntax. With this patch, cmake recognizes it as `TREE` syntax if the first argument is TREE followed by a directory. Then, if no files are given, it defaults to all files in the directory. PREFIX works too. Fixes: #24590 --- Source/cmSourceGroupCommand.cxx | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index bb75a14bac9..4b1685fa01c 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -11,6 +12,8 @@ #include "cmExecutionStatus.h" #include "cmMakefile.h" +#include "cmSourceFile.h" +#include "cmSourceFileLocation.h" #include "cmSourceGroup.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -194,7 +197,10 @@ bool cmSourceGroupCommand(std::vector const& args, // If only two arguments are given, the pre-1.8 version of the // command is being invoked. - if (args.size() == 2 && args[1] != "FILES") { + bool isShortTreeSyntax = + ((args.size() == 2) && (args[0] == kTreeOptionName) && + cmSystemTools::FileIsDirectory(args[1])); + if (args.size() == 2 && args[1] != kFilesOptionName && !isShortTreeSyntax) { cmSourceGroup* sg = mf.GetOrCreateSourceGroup(args[0]); if (!sg) { @@ -274,8 +280,19 @@ static bool processTree(cmMakefile& mf, ParsedArguments& parsedArguments, ? "" : parsedArguments[kPrefixOptionName].front(); - const std::vector filesVector = prepareFilesPathsForTree( - parsedArguments[kFilesOptionName], mf.GetCurrentSourceDirectory()); + std::vector files = parsedArguments[kFilesOptionName]; + if (files.empty()) { + const std::vector>& srcFiles = + mf.GetSourceFiles(); + for (const auto& srcFile : srcFiles) { + if (!srcFile->GetIsGenerated()) { + files.push_back(srcFile->GetLocation().GetFullPath()); + } + } + } + + const std::vector filesVector = + prepareFilesPathsForTree(files, mf.GetCurrentSourceDirectory()); if (!rootIsPrefix(root, filesVector, errorMsg)) { return false; From 87788353cc1cae7ee3b6f47d5f0f7a46df11d75e Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 30 Jun 2023 22:21:43 +0200 Subject: [PATCH 079/627] source_group: Add test/example for TREE without FILES This creates an additional target and for its three source files a directory tree is created. --- Tests/SourceGroups/CMakeLists.txt | 2 ++ Tests/SourceGroups/sub2/CMakeLists.txt | 4 ++++ Tests/SourceGroups/sub2/main.c | 11 +++++++++++ Tests/SourceGroups/sub2/qux.c | 4 ++++ Tests/SourceGroups/sub2/subsub/qax.c | 4 ++++ 5 files changed, 25 insertions(+) create mode 100644 Tests/SourceGroups/sub2/CMakeLists.txt create mode 100644 Tests/SourceGroups/sub2/main.c create mode 100644 Tests/SourceGroups/sub2/qux.c create mode 100644 Tests/SourceGroups/sub2/subsub/qax.c diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt index d726395ee39..550fe9ed1eb 100644 --- a/Tests/SourceGroups/CMakeLists.txt +++ b/Tests/SourceGroups/CMakeLists.txt @@ -63,3 +63,5 @@ add_executable(SourceGroups main.c bar.c foo.c sub1/foo.c sub1/foobar.c baz.c ${tree_files_with_prefix} ${tree_files_without_prefix} ${tree_files_with_empty_prefix} README.txt nested.c) + +add_subdirectory(sub2) diff --git a/Tests/SourceGroups/sub2/CMakeLists.txt b/Tests/SourceGroups/sub2/CMakeLists.txt new file mode 100644 index 00000000000..e457bc4db4e --- /dev/null +++ b/Tests/SourceGroups/sub2/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(SourceGroups2 main.c + qux.c subsub/qax.c) + +source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" ) #PREFIX TheSubDir2 ) diff --git a/Tests/SourceGroups/sub2/main.c b/Tests/SourceGroups/sub2/main.c new file mode 100644 index 00000000000..4cd8ae0caf3 --- /dev/null +++ b/Tests/SourceGroups/sub2/main.c @@ -0,0 +1,11 @@ +#include + +extern int qax(void); +extern int qux(void); + +int main() +{ + printf("qux: %d qax: %d\n", qux(), qax()); + + return 0; +} diff --git a/Tests/SourceGroups/sub2/qux.c b/Tests/SourceGroups/sub2/qux.c new file mode 100644 index 00000000000..1a8b6f9ba6e --- /dev/null +++ b/Tests/SourceGroups/sub2/qux.c @@ -0,0 +1,4 @@ +int qux(void) +{ + return 1234; +} diff --git a/Tests/SourceGroups/sub2/subsub/qax.c b/Tests/SourceGroups/sub2/subsub/qax.c new file mode 100644 index 00000000000..c1b10429c52 --- /dev/null +++ b/Tests/SourceGroups/sub2/subsub/qax.c @@ -0,0 +1,4 @@ +int qax(void) +{ + return 123; +} From fbea5d9f9945363f35aa16c3edcf0924e3dc4686 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 6 Jul 2023 00:01:14 -0400 Subject: [PATCH 080/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 63d112d922c..79d91142d42 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230705) +set(CMake_VERSION_PATCH 20230706) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From a6e8811cf0d0b9dbb09c984d427e651eb29d9faf Mon Sep 17 00:00:00 2001 From: Nicolas van Kempen Date: Mon, 3 Jul 2023 17:05:01 -0400 Subject: [PATCH 081/627] cmList: Fix performance regression in Join / to_string Refactoring in commit 45f17e5a85 (cmList: Add container conversion to string, 2023-06-20) accidentally introduced unnecessary string copies and allocations. Remove unnecessary copies. --- Source/cmList.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/cmList.h b/Source/cmList.h index 9ee4a46b51f..dc5850a979a 100644 --- a/Source/cmList.h +++ b/Source/cmList.h @@ -1211,13 +1211,12 @@ class cmList const auto sep = std::string{ glue }; - return std::accumulate( - std::next(std::begin(r)), std::end(r), cmList::ToString(*std::begin(r)), - [&sep](std::string const& a, - typename std::iterator_traits::value_type const& b) -> std::string { - return a + sep + cmList::ToString(b); - }); + std::string joined = cmList::ToString(*std::begin(r)); + for (auto it = std::next(std::begin(r)); it != std::end(r); ++it) { + joined += sep + cmList::ToString(*it); + } + + return joined; } container_type Values; From b75ff51947d494995b32e405f994de2819536b79 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 6 Jul 2023 14:21:20 -0400 Subject: [PATCH 082/627] Testing: Map RelWithDebInfo config in GeneratorExpression test --- Tests/GeneratorExpression/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index ef115e60a03..38ae6d8ad28 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -214,6 +214,7 @@ set_property(TARGET importedFallback2 PROPERTY IMPORTED_IMPLIB_SPECIAL special_i set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_NOCONFIG SPECIAL "") set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_DEBUG SPECIAL "") set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_RELEASE SPECIAL "") +set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_RELWITHDEBINFO SPECIAL "") add_library(importedFallback_genex STATIC IMPORTED) set_property(TARGET importedFallback_genex PROPERTY IMPORTED_CONFIGURATIONS RELEASE) From 15970e50f2448b0f38f47759c95c14a850af15c0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 7 Jul 2023 00:01:12 -0400 Subject: [PATCH 083/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 79d91142d42..be2bb1ab8dd 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230706) +set(CMake_VERSION_PATCH 20230707) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From d2a28d185a2f7ee61c5fe601dcf6189ef2b6d164 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 7 Jul 2023 10:22:02 -0400 Subject: [PATCH 084/627] Tests: Improve order of CMakeLibTests link libraries Avoid repeating `libCMakeLib.a` multiple times on the link line. --- Tests/CMakeLib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index fc3c23b57ff..8ce8f67ca03 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -67,7 +67,7 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testUVProcessChainInput.txt" "HELLO WORL create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS}) add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS}) -target_link_libraries(CMakeLibTests CMakeLib CTestLib) +target_link_libraries(CMakeLibTests PRIVATE CTestLib CMakeLib) if(CMake_BUILD_PCH) target_precompile_headers(CMakeLibTests PRIVATE "" "") target_compile_definitions(CMakeLibTests PRIVATE "NOMINMAX") From 248b64c5978f80ef0cd4535823a6e5e697d2d68f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 8 Jul 2023 00:01:13 -0400 Subject: [PATCH 085/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index be2bb1ab8dd..2a96d0b530d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230707) +set(CMake_VERSION_PATCH 20230708) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 14bddbe4235cebdc059f82c12052e8db17631450 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 9 Jul 2023 00:01:10 -0400 Subject: [PATCH 086/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2a96d0b530d..bd0ed78a8aa 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230708) +set(CMake_VERSION_PATCH 20230709) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From db50248b38a1baa801d31afad9a13befd86e7080 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 10 Jul 2023 00:01:42 -0400 Subject: [PATCH 087/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bd0ed78a8aa..8f5ef12b733 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230709) +set(CMake_VERSION_PATCH 20230710) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 2bd28ae38a70b7a871e503ca457acc0bd493ca53 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 11 Jul 2023 00:01:10 -0400 Subject: [PATCH 088/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8f5ef12b733..d50dbe88bf7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230710) +set(CMake_VERSION_PATCH 20230711) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 25977e177be14189796630fac9f1d6ecdccc56bd Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Thu, 22 Jun 2023 11:57:36 +0200 Subject: [PATCH 089/627] apple: add preliminary visionOS support --- Help/manual/cmake-toolchains.7.rst | 25 ++++++++++--------- .../XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst | 4 +-- Help/prop_tgt/IMPORTED_OBJECTS.rst | 2 +- Help/release/3.14.rst | 3 ++- Help/release/dev/apple-visionos.rst | 7 ++++++ Help/variable/APPLE.rst | 2 +- Help/variable/CMAKE_MACOSX_BUNDLE.rst | 2 +- Help/variable/CMAKE_OSX_VARIABLE.txt | 2 +- Modules/CMakeDetermineCompilerId.cmake | 1 + Modules/CMakeSwiftInformation.cmake | 6 +++-- Modules/CMakeSystemSpecificInitialize.cmake | 2 +- Modules/Platform/Apple-Clang.cmake | 4 +++ Modules/Platform/Darwin-Initialize.cmake | 4 ++- Modules/Platform/Darwin.cmake | 2 +- Modules/Platform/visionOS-Determine-CXX.cmake | 1 + Modules/Platform/visionOS-Initialize.cmake | 7 ++++++ Modules/Platform/visionOS.cmake | 1 + Source/cmGlobalXCodeGenerator.cxx | 4 +++ Source/cmLocalXCodeGenerator.cxx | 6 +++++ Source/cmMakefile.cxx | 2 ++ Source/cmMakefile.h | 2 ++ .../XcodeProject-Device/DeploymentTarget.c | 4 +++ .../DeploymentTarget.cmake | 6 +++++ .../XcodeProject-Device/RunCMakeTest.cmake | 23 +++++++++++++++++ .../XcodeProject-Device/XcodeBundles.cmake | 2 +- .../RunCMakeTest.cmake | 2 +- 26 files changed, 100 insertions(+), 26 deletions(-) create mode 100644 Help/release/dev/apple-visionos.rst create mode 100644 Modules/Platform/visionOS-Determine-CXX.cmake create mode 100644 Modules/Platform/visionOS-Initialize.cmake create mode 100644 Modules/Platform/visionOS.cmake diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index a831fa6ef14..e32bd29ae04 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -573,12 +573,12 @@ See also target properties: * :prop_tgt:`ANDROID_SKIP_ANT_STEP` * :prop_tgt:`ANDROID_STL_TYPE` -.. _`Cross Compiling for iOS, tvOS, or watchOS`: +.. _`Cross Compiling for iOS, tvOS, visionOS, or watchOS`: -Cross Compiling for iOS, tvOS, or watchOS ------------------------------------------ +Cross Compiling for iOS, tvOS, visionOS, or watchOS +--------------------------------------------------- -For cross-compiling to iOS, tvOS, or watchOS, the :generator:`Xcode` +For cross-compiling to iOS, tvOS, visionOS, or watchOS, the :generator:`Xcode` generator is recommended. The :generator:`Unix Makefiles` or :generator:`Ninja` generators can also be used, but they require the project to handle more areas like target CPU selection and code signing. @@ -591,13 +591,14 @@ a different SDK (e.g. a simulator) can be selected by setting the necessary (see :ref:`Switching Between Device and Simulator` below). A list of available SDKs can be obtained by running ``xcodebuild -showsdks``. -======= ================= ==================== ================ -OS CMAKE_SYSTEM_NAME Device SDK (default) Simulator SDK -======= ================= ==================== ================ -iOS iOS iphoneos iphonesimulator -tvOS tvOS appletvos appletvsimulator -watchOS watchOS watchos watchsimulator -======= ================= ==================== ================ +======== ================= ==================== ================ +OS CMAKE_SYSTEM_NAME Device SDK (default) Simulator SDK +======== ================= ==================== ================ +iOS iOS iphoneos iphonesimulator +tvOS tvOS appletvos appletvsimulator +visionOS visionOS xros xrsimulator +watchOS watchOS watchos watchsimulator +======== ================= ==================== ================ For example, to create a CMake configuration for iOS, the following command is sufficient: @@ -608,7 +609,7 @@ command is sufficient: Variable :variable:`CMAKE_OSX_ARCHITECTURES` can be used to set architectures for both device and simulator. Variable :variable:`CMAKE_OSX_DEPLOYMENT_TARGET` -can be used to set an iOS/tvOS/watchOS deployment target. +can be used to set an iOS/tvOS/visionOS/watchOS deployment target. Next configuration will install fat 5 architectures iOS library and add the ``-miphoneos-version-min=9.3``/``-mios-simulator-version-min=9.3`` diff --git a/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst b/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst index 392b704f890..6794a264e79 100644 --- a/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst +++ b/Help/prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME.rst @@ -16,8 +16,8 @@ generator emits the ``EFFECTIVE_PLATFORM_NAME`` variable: - If set to ``ON`` it will always be emitted - If set to ``OFF`` it will never be emitted - If unset (the default) it will only be emitted when the project was - configured for an embedded Xcode SDK like iOS, tvOS, watchOS or any - of the simulators. + configured for an embedded Xcode SDK like iOS, tvOS, visionOS, watchOS + or any of the simulators. .. note:: diff --git a/Help/prop_tgt/IMPORTED_OBJECTS.rst b/Help/prop_tgt/IMPORTED_OBJECTS.rst index d71c2199952..9aacea7454b 100644 --- a/Help/prop_tgt/IMPORTED_OBJECTS.rst +++ b/Help/prop_tgt/IMPORTED_OBJECTS.rst @@ -31,7 +31,7 @@ once per architecture for each source file. Unlike the other generators, it does not generate universal object file binaries. A further complication with the :generator:`Xcode` generator is that when -targeting device platforms (iOS, tvOS or watchOS), the :generator:`Xcode` +targeting device platforms (iOS, tvOS, visionOS or watchOS), the :generator:`Xcode` generator has the ability to use either the device or simulator SDK without needing CMake to be re-run. The SDK can be selected at build time. But since some architectures can be supported by both the device and the diff --git a/Help/release/3.14.rst b/Help/release/3.14.rst index 8a9738c84d2..5fedf7d2a58 100644 --- a/Help/release/3.14.rst +++ b/Help/release/3.14.rst @@ -63,7 +63,8 @@ File-Based API Platforms --------- -* CMake now supports :ref:`Cross Compiling for iOS, tvOS, or watchOS` +* CMake now supports + :ref:`Cross Compiling for iOS, tvOS, or watchOS ` using simple toolchain files. Command-Line diff --git a/Help/release/dev/apple-visionos.rst b/Help/release/dev/apple-visionos.rst new file mode 100644 index 00000000000..db7624824a0 --- /dev/null +++ b/Help/release/dev/apple-visionos.rst @@ -0,0 +1,7 @@ +apple-visionos +-------------- + +* CMake learned about Apple visionOS and its `xros` and `xrsimulator` SDKs. + Compiling for Apple visionOS can be requested by setting + :variable:`CMAKE_SYSTEM_NAME` to ``visionOS``. For more + information see :manual:`cmake-toolchains(7)`. diff --git a/Help/variable/APPLE.rst b/Help/variable/APPLE.rst index 810d5fc3a33..e79939753b2 100644 --- a/Help/variable/APPLE.rst +++ b/Help/variable/APPLE.rst @@ -2,4 +2,4 @@ APPLE ----- Set to ``True`` when the target system is an Apple platform -(macOS, iOS, tvOS or watchOS). +(macOS, iOS, tvOS, visionOS or watchOS). diff --git a/Help/variable/CMAKE_MACOSX_BUNDLE.rst b/Help/variable/CMAKE_MACOSX_BUNDLE.rst index 43ddff517a6..483c5b395f0 100644 --- a/Help/variable/CMAKE_MACOSX_BUNDLE.rst +++ b/Help/variable/CMAKE_MACOSX_BUNDLE.rst @@ -7,4 +7,4 @@ This variable is used to initialize the :prop_tgt:`MACOSX_BUNDLE` property on all the targets. See that target property for additional information. This variable is set to ``ON`` by default if :variable:`CMAKE_SYSTEM_NAME` -equals to :ref:`iOS, tvOS or watchOS `. +equals to :ref:`iOS, tvOS, visionOS or watchOS `. diff --git a/Help/variable/CMAKE_OSX_VARIABLE.txt b/Help/variable/CMAKE_OSX_VARIABLE.txt index 5670980ca4a..962fcd35234 100644 --- a/Help/variable/CMAKE_OSX_VARIABLE.txt +++ b/Help/variable/CMAKE_OSX_VARIABLE.txt @@ -7,6 +7,6 @@ remove it while initializing a cache entry of the same name) unless policy :policy:`CMP0126` is set to ``NEW``. Despite the ``OSX`` part in the variable name(s) they apply also to -other SDKs than macOS like iOS, tvOS, or watchOS. +other SDKs than macOS like iOS, tvOS, visionOS, or watchOS. This variable is ignored on platforms other than Apple. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 6c490960d59..4db9aa87ff4 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -608,6 +608,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} if(CMAKE_OSX_SYSROOT) set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";") if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]" OR + CMAKE_OSX_SYSROOT MATCHES "(^|/)[Xx][Rr]" OR CMAKE_OSX_SYSROOT MATCHES "(^|/)[Aa][Pp][Pp][Ll][Ee][Tt][Vv]") set(id_product_type "com.apple.product-type.bundle.unit-test") elseif(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ww][Aa][Tt][Cc][Hh]") diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index 777c6807c58..1c6f0df4c8f 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -21,7 +21,8 @@ set(CMAKE_INCLUDE_FLAG_Swift "-I ") # FIXME: Move compiler- and platform-specific flags to the above-included modules. if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS" - OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") + OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS" + OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -install_name -Xlinker ") elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Windows) set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -soname -Xlinker ") @@ -30,7 +31,8 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows) set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ") set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS" - OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") + OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS" + OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP "") set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP "") else() diff --git a/Modules/CMakeSystemSpecificInitialize.cmake b/Modules/CMakeSystemSpecificInitialize.cmake index e87d868a8fa..ee8cb860c2b 100644 --- a/Modules/CMakeSystemSpecificInitialize.cmake +++ b/Modules/CMakeSystemSpecificInitialize.cmake @@ -25,7 +25,7 @@ unset(LINUX) # It is useful to share the same aforementioned configuration files and # avoids duplicating them in case of tightly related platforms. # -# An example are the platforms supported by Xcode (macOS, iOS, tvOS, +# An example are the platforms supported by Xcode (macOS, iOS, tvOS, visionOS # and watchOS). For all of those the CMAKE_EFFECTIVE_SYSTEM_NAME is # set to Apple which results in using # Platform/Apple-AppleClang-CXX.cmake for the Apple C++ compiler. diff --git a/Modules/Platform/Apple-Clang.cmake b/Modules/Platform/Apple-Clang.cmake index 0681bfb0596..4d7546a7ac2 100644 --- a/Modules/Platform/Apple-Clang.cmake +++ b/Modules/Platform/Apple-Clang.cmake @@ -22,6 +22,10 @@ macro(__apple_compiler_clang lang) set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-version-min=") elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTVSimulator") set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-simulator-version-min=") + elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/XROS") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtargetos=xros") + elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/XRSimulator") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtargetos=xros") elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchOS") set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mwatchos-version-min=") elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchSimulator") diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake index e253392acd5..8d5bf8cb98a 100644 --- a/Modules/Platform/Darwin-Initialize.cmake +++ b/Modules/Platform/Darwin-Initialize.cmake @@ -43,7 +43,7 @@ if(NOT CMAKE_CROSSCOMPILING AND unset(_sysctl_stdout) endif() -# macOS, iOS, tvOS, and watchOS should lookup compilers from +# macOS, iOS, tvOS, visionOS, and watchOS should lookup compilers from # Platform/Apple-${CMAKE_CXX_COMPILER_ID}- set(CMAKE_EFFECTIVE_SYSTEM_NAME "Apple") @@ -76,6 +76,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL iOS) set(_CMAKE_OSX_SYSROOT_DEFAULT "iphoneos") elseif(CMAKE_SYSTEM_NAME STREQUAL tvOS) set(_CMAKE_OSX_SYSROOT_DEFAULT "appletvos") +elseif(CMAKE_SYSTEM_NAME STREQUAL visionOS) + set(_CMAKE_OSX_SYSROOT_DEFAULT "xros") elseif(CMAKE_SYSTEM_NAME STREQUAL watchOS) set(_CMAKE_OSX_SYSROOT_DEFAULT "watchos") elseif("${CMAKE_GENERATOR}" MATCHES Xcode diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 48a9065c8d2..d614182d1a5 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -1,4 +1,4 @@ -if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") +if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") if(NOT DEFINED CMAKE_MACOSX_BUNDLE) set(CMAKE_MACOSX_BUNDLE ON) endif() diff --git a/Modules/Platform/visionOS-Determine-CXX.cmake b/Modules/Platform/visionOS-Determine-CXX.cmake new file mode 100644 index 00000000000..ac80fa62d89 --- /dev/null +++ b/Modules/Platform/visionOS-Determine-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Darwin-Determine-CXX) diff --git a/Modules/Platform/visionOS-Initialize.cmake b/Modules/Platform/visionOS-Initialize.cmake new file mode 100644 index 00000000000..e8431bceb12 --- /dev/null +++ b/Modules/Platform/visionOS-Initialize.cmake @@ -0,0 +1,7 @@ +include(Platform/Darwin-Initialize) + +if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/XR(OS|Simulator)") + message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an visionOS SDK") +endif() + +set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY) diff --git a/Modules/Platform/visionOS.cmake b/Modules/Platform/visionOS.cmake new file mode 100644 index 00000000000..850ddc24163 --- /dev/null +++ b/Modules/Platform/visionOS.cmake @@ -0,0 +1 @@ +include(Platform/Darwin) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index fd58f75f139..0472631ed04 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -5155,6 +5155,10 @@ std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf) case cmMakefile::AppleSDK::WatchSimulator: return "WATCHOS_DEPLOYMENT_TARGET"; + case cmMakefile::AppleSDK::XROS: + case cmMakefile::AppleSDK::XRSimulator: + return "XROS_DEPLOYMENT_TARGET"; + case cmMakefile::AppleSDK::MacOS: default: return "MACOSX_DEPLOYMENT_TARGET"; diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 759ee7b85ae..eb05424486d 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -83,6 +83,12 @@ void cmLocalXCodeGenerator::AddGeneratorSpecificInstallSetup(std::ostream& os) case cmMakefile::AppleSDK::WatchSimulator: platformName = "watchsimulator"; break; + case cmMakefile::AppleSDK::XROS: + platformName = "xros"; + break; + case cmMakefile::AppleSDK::XRSimulator: + platformName = "xrsimulator"; + break; case cmMakefile::AppleSDK::MacOS: break; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 58908192887..e1841b6e7b1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2565,6 +2565,8 @@ cmMakefile::AppleSDK cmMakefile::GetAppleSDKType() const { "iphonesimulator", AppleSDK::IPhoneSimulator }, { "watchos", AppleSDK::WatchOS }, { "watchsimulator", AppleSDK::WatchSimulator }, + { "xros", AppleSDK::XROS }, + { "xrsimulator", AppleSDK::XRSimulator }, }; for (auto const& entry : sdkDatabase) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7005942dc4b..79a98cd9d38 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -561,6 +561,8 @@ class cmMakefile AppleTVSimulator, WatchOS, WatchSimulator, + XROS, + XRSimulator, }; /** What SDK type points CMAKE_OSX_SYSROOT to? */ diff --git a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c index 5e0f40fedd2..c00fce7f71e 100644 --- a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c +++ b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c @@ -5,6 +5,10 @@ # if __MAC_OS_X_VERSION_MIN_REQUIRED != __MAC_10_11 # error macOS deployment version mismatch # endif +#elif TARGET_OS_XR +# if __XR_OS_VERSION_MIN_REQUIRED != __XROS_1_0 +# error visionOS deployment version mismatch +# endif #elif TARGET_OS_IOS # if __IPHONE_OS_VERSION_MIN_REQUIRED != __IPHONE_9_1 # error iOS deployment version mismatch diff --git a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake index 234ceef8b16..80e387773df 100644 --- a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake +++ b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.cmake @@ -7,6 +7,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +elseif(CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_OSX_DEPLOYMENT_TARGET "1.0") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_OSX_DEPLOYMENT_TARGET "2.0") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") diff --git a/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake index e2ed045df61..b3ab624ae71 100644 --- a/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake @@ -93,6 +93,25 @@ if(NOT XCODE_VERSION VERSION_LESS 7.1) unset(RunCMake_TEST_OPTIONS) endif() +if(NOT XCODE_VERSION VERSION_LESS 15) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesVisionOS-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=visionOS" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeBundles) + run_cmake_command(XcodeBundles-build-visionOS ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeBundles-install-visionOS ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() + if(NOT XCODE_VERSION VERSION_LESS 7) set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake") run_cmake(XcodeTbdStub) @@ -242,6 +261,10 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8) deployment_target_test(tvOS appletvsimulator) deployment_target_test(watchOS watchos) deployment_target_test(watchOS watchsimulator) + if(XCODE_VERSION VERSION_GREATER_EQUAL 15) + deployment_target_test(visionOS xros) + deployment_target_test(visionOS xrsimulator) + endif() endif() if(XCODE_VERSION VERSION_GREATER_EQUAL 8) diff --git a/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake index a9fafd22b7b..376a7fc22b1 100644 --- a/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject-Device/XcodeBundles.cmake @@ -9,7 +9,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") endif() -if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake index 9b6581c516b..8e4745a5428 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake @@ -126,7 +126,7 @@ if ((CMAKE_SYSTEM_NAME STREQUAL "Windows" AND ((DEFINED MSVC_VERSION AND MSVC_VERSION GREATER "1900") OR (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND NOT CMAKE_C_SIMULATE_ID STREQUAL "MSVC"))) OR (CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND (NOT CMAKE_C_COMPILER_ID STREQUAL "SunPro" OR CMAKE_C_COMPILER_VERSION GREATER "5.9")) - OR CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS|Linux|BSD|MSYS|CYGWIN") + OR CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|visionOS|watchOS|Linux|BSD|MSYS|CYGWIN") run_cmake(feature-WHOLE_ARCHIVE) run_cmake_target(feature-WHOLE_ARCHIVE link-exe main) endif() From 8491ab38f269b6be48989939c24ad82983b0dd25 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 12 Jul 2023 00:01:09 -0400 Subject: [PATCH 090/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d50dbe88bf7..c98b86cf156 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230711) +set(CMake_VERSION_PATCH 20230712) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From dc88dd5e4a8f863d9fdc2275477e002b55e71a88 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 13 Jul 2023 00:01:13 -0400 Subject: [PATCH 091/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c98b86cf156..24daf135554 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230712) +set(CMake_VERSION_PATCH 20230713) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From e39b6ebc19d276f739500192a15fa809639857c2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 2 Jul 2023 16:08:30 -0400 Subject: [PATCH 092/627] cmCxxModuleMapper: use a `char` for streaming single bytes --- Source/cmCxxModuleMapper.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmCxxModuleMapper.cxx b/Source/cmCxxModuleMapper.cxx index e836a2ae6af..bb650eadd8f 100644 --- a/Source/cmCxxModuleMapper.cxx +++ b/Source/cmCxxModuleMapper.cxx @@ -122,7 +122,7 @@ std::string CxxModuleMapContentGcc(CxxModuleLocations const& loc, // generate any). // Write the root directory to use for module paths. - mm << "$root " << loc.RootDirectory << "\n"; + mm << "$root " << loc.RootDirectory << '\n'; for (auto const& p : obj.Provides) { auto bmi_loc = loc.BmiGeneratorPathForModule(p.LogicalName); From 71f1483aac64ccb3341376558f943021b1195e80 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 2 Jul 2023 16:11:54 -0400 Subject: [PATCH 093/627] Tests/RunCMake/CXXModules: require transitive usages Clang 17 is in a transition where it warns about transitive usages. Turn it into an error if the flag is available to make sure we're testing the feature properly. --- Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt | 2 +- .../CXXModules/examples/deep-chain/CMakeLists.txt | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt index 78bdf2b7922..659414dd3bf 100644 --- a/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt +++ b/Tests/RunCMake/CXXModules/examples/deep-chain-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): +CMake Warning \(dev\) at CMakeLists.txt:15 \(target_sources\): CMake's C\+\+ module support is experimental. It is meant only for experimentation and feedback to CMake developers. This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt index 515b2409d69..78a1d0b75c6 100644 --- a/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/deep-chain/CMakeLists.txt @@ -3,6 +3,14 @@ project(cxx_modules_deep_chain CXX) include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + include(CheckCompilerFlag) + check_compiler_flag(CXX "-Wread-modules-implicitly" have_implicit_module_warning) + if (have_implicit_module_warning) + add_compile_options(-Werror=read-modules-implicitly) + endif () +endif () + add_library(a STATIC) target_sources(a PUBLIC From c9df4568da7155d2c333e19f1b649a391633ccf0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 2 Jul 2023 15:58:25 -0400 Subject: [PATCH 094/627] cmCxxModuleMapper: factor out transitive usage computation Clang will need this in the future. --- Source/cmCxxModuleMapper.cxx | 87 +++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 30 deletions(-) diff --git a/Source/cmCxxModuleMapper.cxx b/Source/cmCxxModuleMapper.cxx index bb650eadd8f..63e670226c4 100644 --- a/Source/cmCxxModuleMapper.cxx +++ b/Source/cmCxxModuleMapper.cxx @@ -74,6 +74,59 @@ CxxBmiLocation CxxModuleLocations::BmiGeneratorPathForModule( namespace { +struct TransitiveUsage +{ + TransitiveUsage(std::string name, std::string location, LookupMethod method) + : LogicalName(std::move(name)) + , Location(std::move(location)) + , Method(method) + { + } + + std::string LogicalName; + std::string Location; + LookupMethod Method; +}; + +std::vector GetTransitiveUsages( + CxxModuleLocations const& loc, std::vector const& required, + CxxModuleUsage const& usages) +{ + std::set transitive_usage_directs; + std::set transitive_usage_names; + + std::vector all_usages; + + for (auto const& r : required) { + auto bmi_loc = loc.BmiGeneratorPathForModule(r.LogicalName); + if (bmi_loc.IsKnown()) { + all_usages.emplace_back(r.LogicalName, bmi_loc.Location(), r.Method); + transitive_usage_directs.insert(r.LogicalName); + + // Insert transitive usages. + auto transitive_usages = usages.Usage.find(r.LogicalName); + if (transitive_usages != usages.Usage.end()) { + transitive_usage_names.insert(transitive_usages->second.begin(), + transitive_usages->second.end()); + } + } + } + + for (auto const& transitive_name : transitive_usage_names) { + if (transitive_usage_directs.count(transitive_name)) { + continue; + } + + auto module_ref = usages.Reference.find(transitive_name); + if (module_ref != usages.Reference.end()) { + all_usages.emplace_back(transitive_name, module_ref->second.Path, + module_ref->second.Method); + } + } + + return all_usages; +} + std::string CxxModuleMapContentClang(CxxModuleLocations const& loc, cmScanDepInfo const& obj) { @@ -180,37 +233,11 @@ std::string CxxModuleMapContentMsvc(CxxModuleLocations const& loc, } } - std::set transitive_usage_directs; - std::set transitive_usage_names; + auto all_usages = GetTransitiveUsages(loc, obj.Requires, usages); + for (auto const& usage : all_usages) { + auto flag = flag_for_method(usage.Method); - for (auto const& r : obj.Requires) { - auto bmi_loc = loc.BmiGeneratorPathForModule(r.LogicalName); - if (bmi_loc.IsKnown()) { - auto flag = flag_for_method(r.Method); - - mm << flag << ' ' << r.LogicalName << '=' << bmi_loc.Location() << "\n"; - transitive_usage_directs.insert(r.LogicalName); - - // Insert transitive usages. - auto transitive_usages = usages.Usage.find(r.LogicalName); - if (transitive_usages != usages.Usage.end()) { - transitive_usage_names.insert(transitive_usages->second.begin(), - transitive_usages->second.end()); - } - } - } - - for (auto const& transitive_name : transitive_usage_names) { - if (transitive_usage_directs.count(transitive_name)) { - continue; - } - - auto module_ref = usages.Reference.find(transitive_name); - if (module_ref != usages.Reference.end()) { - auto flag = flag_for_method(module_ref->second.Method); - mm << flag << ' ' << transitive_name << '=' << module_ref->second.Path - << "\n"; - } + mm << flag << ' ' << usage.LogicalName << '=' << usage.Location << '\n'; } return mm.str(); From 7b05724ac81c3262ce8aded5578326ecec327ae4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 2 Jul 2023 16:06:53 -0400 Subject: [PATCH 095/627] cmCxxModuleMapper: give transitive usages to Clang as well In the future, Clang plans to require transitive module usage to be specified on the command line. This is in order to keep BMI files more reproducible. Handily, MSVC has already required this, so the logic can be reused for Clang easily. See: https://github.com/llvm/llvm-project/commit/e22fa1d4c6152d36cf1342ab9029adc97c79a310 See: https://github.com/llvm/llvm-project/issues/62707 See: https://discourse.llvm.org/t/c-20-modules-should-the-bmis-contain-paths-to-their-dependent-bmis/70422 --- Source/cmCxxModuleMapper.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/cmCxxModuleMapper.cxx b/Source/cmCxxModuleMapper.cxx index 63e670226c4..e6c10c62f95 100644 --- a/Source/cmCxxModuleMapper.cxx +++ b/Source/cmCxxModuleMapper.cxx @@ -128,7 +128,8 @@ std::vector GetTransitiveUsages( } std::string CxxModuleMapContentClang(CxxModuleLocations const& loc, - cmScanDepInfo const& obj) + cmScanDepInfo const& obj, + CxxModuleUsage const& usages) { std::stringstream mm; @@ -151,12 +152,11 @@ std::string CxxModuleMapContentClang(CxxModuleLocations const& loc, break; } } - for (auto const& r : obj.Requires) { - auto bmi_loc = loc.BmiGeneratorPathForModule(r.LogicalName); - if (bmi_loc.IsKnown()) { - mm << "-fmodule-file=" << r.LogicalName << "=" << bmi_loc.Location() - << '\n'; - } + + auto all_usages = GetTransitiveUsages(loc, obj.Requires, usages); + for (auto const& usage : all_usages) { + mm << "-fmodule-file=" << usage.LogicalName << '=' << usage.Location + << '\n'; } return mm.str(); @@ -420,7 +420,7 @@ std::string CxxModuleMapContent(CxxModuleMapFormat format, { switch (format) { case CxxModuleMapFormat::Clang: - return CxxModuleMapContentClang(loc, obj); + return CxxModuleMapContentClang(loc, obj, usages); case CxxModuleMapFormat::Gcc: return CxxModuleMapContentGcc(loc, obj); case CxxModuleMapFormat::Msvc: From 57ef353d222d7618f8fb872487aa70e205e56020 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Jul 2023 16:08:12 -0400 Subject: [PATCH 096/627] cmExperimental: refresh the C++ modules UUID The transitive support for Clang is a change in support for the ecosystem. --- Help/dev/experimental.rst | 2 +- Source/cmExperimental.cxx | 2 +- Tests/RunCMake/CXXModules/CMakeLists.txt | 2 +- Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake | 2 +- .../examples/export-bmi-and-interface-build/test/CMakeLists.txt | 2 +- .../export-bmi-and-interface-install/test/CMakeLists.txt | 2 +- .../examples/export-interface-build/test/CMakeLists.txt | 2 +- .../examples/export-interface-install/test/CMakeLists.txt | 2 +- .../export-interface-no-properties-build/test/CMakeLists.txt | 2 +- .../export-interface-no-properties-install/test/CMakeLists.txt | 2 +- .../target_sources/FileSetDefaultWrongTypeExperimental.cmake | 2 +- .../RunCMake/target_sources/FileSetWrongTypeExperimental.cmake | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Help/dev/experimental.rst b/Help/dev/experimental.rst index eac86ab04b6..7328d7b157e 100644 --- a/Help/dev/experimental.rst +++ b/Help/dev/experimental.rst @@ -18,7 +18,7 @@ C++20 Module APIs ================= Variable: ``CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API`` -Value: ``aa1f7df0-828a-4fcd-9afc-2dc80491aca7`` +Value: ``bf70d4b0-9fb7-465c-9803-34014e70d112`` In order to support C++20 modules, there are a number of behaviors that have CMake APIs to provide the required features to build and export them from a diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx index 2f266272765..0a746a9f33a 100644 --- a/Source/cmExperimental.cxx +++ b/Source/cmExperimental.cxx @@ -27,7 +27,7 @@ struct FeatureData bool Warned; } LookupTable[] = { // CxxModuleCMakeApi - { "aa1f7df0-828a-4fcd-9afc-2dc80491aca7", + { "bf70d4b0-9fb7-465c-9803-34014e70d112", "CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API", "CMake's C++ module support is experimental. It is meant only for " "experimentation and feedback to CMake developers.", diff --git a/Tests/RunCMake/CXXModules/CMakeLists.txt b/Tests/RunCMake/CXXModules/CMakeLists.txt index 88eb282072f..640d67b8fa6 100644 --- a/Tests/RunCMake/CXXModules/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.23) project(${RunCMake_TEST} NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake index ff7219a3a79..c17b5a47441 100644 --- a/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake +++ b/Tests/RunCMake/CXXModules/examples/cxx-modules-rules.cmake @@ -1,4 +1,4 @@ -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") if (NOT EXISTS "${CMake_TEST_MODULE_COMPILATION_RULES}") message(FATAL_ERROR diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt index d227e55acdf..a3e55f6f07f 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_bmi_and_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt index d46d28b9970..0144b706b07 100644 --- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_bmi_and_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt index 3cd156a7ba5..bd2f2d4a162 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt index 71bf86c439f..87451fe519c 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_interfaces REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt index 0c094aca855..5b6abc645e6 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_interfaces_no_properties REQUIRED) diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt index 0c094aca855..5b6abc645e6 100644 --- a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) project(cxx_modules_library NONE) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") find_package(export_interfaces_no_properties REQUIRED) diff --git a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake index 44f16261463..84e180243fe 100644 --- a/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetDefaultWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET UNKNOWN) diff --git a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake index adf118568d3..78e782d99b9 100644 --- a/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake +++ b/Tests/RunCMake/target_sources/FileSetWrongTypeExperimental.cmake @@ -1,6 +1,6 @@ enable_language(C) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "bf70d4b0-9fb7-465c-9803-34014e70d112") add_library(lib1 STATIC empty.c) target_sources(lib1 PRIVATE FILE_SET a TYPE UNKNOWN) From 1594a34250c04f2385d6d89bba5257039c005298 Mon Sep 17 00:00:00 2001 From: vim-cmake-syntax upstream Date: Thu, 13 Jul 2023 15:07:26 +0200 Subject: [PATCH 097/627] vim-cmake-syntax 2023-07-13 (7c6f28d0) Code extracted from: https://github.com/pboettch/vim-cmake-syntax.git at commit 7c6f28d008e3b9c372bd2a5d51b92c0966a72b1b (master). Upstream Shortlog ----------------- Patrick Boettcher (5): 5cb0409a update keywords to 3.26.4 0f46703c fix bracket-comment-regex 79121696 add syntax for FetchContent 9578e406 blacklist GNU as keyword 7c6f28d0 update to cmake version 3.27.20230713-gdc88dd5 VZ (1): ddb54ba6 Fix spell checking inside CMake functions --- cmake.vim.in | 6 +- extract-upper-case.pl | 6 +- syntax/cmake.vim | 965 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 917 insertions(+), 60 deletions(-) diff --git a/cmake.vim.in b/cmake.vim.in index 3471b5455bd..2adb477472b 100644 --- a/cmake.vim.in +++ b/cmake.vim.in @@ -22,20 +22,20 @@ set cpo&vim syn region cmakeBracketArgument start="\[\z(=\?\|=[0-9]*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell syn region cmakeComment start="#" end="$" contains=cmakeTodo,@Spell -syn region cmakeBracketComment start="#\[\z(=\?\|=[0-9]*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell +syn region cmakeBracketComment start="\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell syn match cmakeEscaped /\(\\\\\|\\"\|\\n\|\\t\)/ contained syn region cmakeRegistry start="\[" end="]" contained oneline contains=cmakeTodo,cmakeEscaped syn region cmakeGeneratorExpression start="$<" end=">" contained oneline contains=cmakeVariableValue,cmakeProperty,cmakeGeneratorExpressions,cmakeTodo -syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue,cmakeEscaped +syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue,cmakeEscaped,@Spell syn region cmakeVariableValue start="${" end="}" contained oneline contains=cmakeVariable,cmakeTodo,cmakeVariableValue syn region cmakeEnvironment start="$ENV{" end="}" contained oneline contains=cmakeTodo -syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeGeneratorExpressions,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeCommandManuallyAdded,cmakeArguments,cmakeTodo +syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeGeneratorExpressions,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeCommandManuallyAdded,cmakeArguments,cmakeTodo,@Spell syn case match diff --git a/extract-upper-case.pl b/extract-upper-case.pl index 11791991d77..7f40b7436d2 100755 --- a/extract-upper-case.pl +++ b/extract-upper-case.pl @@ -16,10 +16,10 @@ my %keywords; # command => keyword-list # find cmake/Modules/ | sed -rn 's/.*CMakeDetermine(.+)Compiler.cmake/\1/p' | sort -my @languages = qw(ASM ASM_MASM ASM_NASM C CSharp CUDA CXX Fortran Java RC Swift); +my @languages = qw(ASM ASM_MASM ASM_NASM C CSharp CUDA CXX Fortran Java RC Swift HIP); # unwanted upper-cases -my %unwanted = map { $_ => 1 } qw(VS CXX IDE NOTFOUND NO_ DFOO DBAR NEW); +my %unwanted = map { $_ => 1 } qw(VS CXX IDE NOTFOUND NO_ DFOO DBAR NEW GNU); # cannot remove ALL - exists for add_custom_command # control-statements @@ -30,7 +30,7 @@ my %deprecated = map { $_ => 1 } qw(build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory output_required_files remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file); # add some (popular) modules -push @modules, "ExternalProject"; +push @modules, "ExternalProject", "FetchContent"; # variables open(CMAKE, "$cmake --help-variable-list|") or die "could not run cmake"; diff --git a/syntax/cmake.vim b/syntax/cmake.vim index 81030407f68..3533fc2782a 100644 --- a/syntax/cmake.vim +++ b/syntax/cmake.vim @@ -1,13 +1,13 @@ " Vim syntax file " Program: CMake - Cross-Platform Makefile Generator -" Version: cmake version 3.19.20201028-gdab947f +" Version: cmake version 3.27.20230713-gdc88dd5 " Language: CMake " Author: Andy Cedilnik , " Nicholas Hutchinson , " Patrick Boettcher " Maintainer: Dimitri Merejkowsky " Former Maintainer: Karthik Krishnan -" Last Change: 2020 oct. 28 +" Last Change: 2023 Jul 13 " " Licence: The CMake license applies to this file. See " https://cmake.org/licensing @@ -22,20 +22,20 @@ set cpo&vim syn region cmakeBracketArgument start="\[\z(=\?\|=[0-9]*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell syn region cmakeComment start="#" end="$" contains=cmakeTodo,@Spell -syn region cmakeBracketComment start="#\[\z(=\?\|=[0-9]*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell +syn region cmakeBracketComment start="\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell syn match cmakeEscaped /\(\\\\\|\\"\|\\n\|\\t\)/ contained syn region cmakeRegistry start="\[" end="]" contained oneline contains=cmakeTodo,cmakeEscaped syn region cmakeGeneratorExpression start="$<" end=">" contained oneline contains=cmakeVariableValue,cmakeProperty,cmakeGeneratorExpressions,cmakeTodo -syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue,cmakeEscaped +syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue,cmakeEscaped,@Spell syn region cmakeVariableValue start="${" end="}" contained oneline contains=cmakeVariable,cmakeTodo,cmakeVariableValue syn region cmakeEnvironment start="$ENV{" end="}" contained oneline contains=cmakeTodo -syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeGeneratorExpressions,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeCommandManuallyAdded,cmakeArguments,cmakeTodo +syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeGeneratorExpressions,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeCommandManuallyAdded,cmakeArguments,cmakeTodo,@Spell syn case match @@ -75,6 +75,7 @@ syn keyword cmakeProperty contained \ AUTOGEN_SOURCE_GROUP \ AUTOGEN_TARGETS_FOLDER \ AUTOGEN_TARGET_DEPENDS + \ AUTOGEN_USE_SYSTEM_INCLUDE \ AUTOMOC \ AUTOMOC_COMPILER_PREDEFINES \ AUTOMOC_DEPEND_FILTERS @@ -92,6 +93,7 @@ syn keyword cmakeProperty contained \ AUTOUIC_EXECUTABLE \ AUTOUIC_OPTIONS \ AUTOUIC_SEARCH_PATHS + \ AUTOUIC_SOURCE_GROUP \ BINARY_DIR \ BUILDSYSTEM_TARGETS \ BUILD_RPATH @@ -118,6 +120,7 @@ syn keyword cmakeProperty contained \ COMPILE_OPTIONS \ COMPILE_PDB_NAME \ COMPILE_PDB_OUTPUT_DIRECTORY + \ COMPILE_WARNING_AS_ERROR \ COST \ CPACK_DESKTOP_SHORTCUTS \ CPACK_NEVER_OVERWRITE @@ -127,7 +130,10 @@ syn keyword cmakeProperty contained \ CPACK_WIX_ACL \ CROSSCOMPILING_EMULATOR \ CUDA_ARCHITECTURES + \ CUDA_CUBIN_COMPILATION \ CUDA_EXTENSIONS + \ CUDA_FATBIN_COMPILATION + \ CUDA_OPTIX_COMPILATION \ CUDA_PTX_COMPILATION \ CUDA_RESOLVE_DEVICE_SYMBOLS \ CUDA_RUNTIME_LIBRARY @@ -135,6 +141,10 @@ syn keyword cmakeProperty contained \ CUDA_STANDARD \ CUDA_STANDARD_REQUIRED \ CXX_EXTENSIONS + \ CXX_MODULE_DIRS + \ CXX_MODULE_SET + \ CXX_MODULE_SETS + \ CXX_SCAN_FOR_MODULES \ CXX_STANDARD \ CXX_STANDARD_REQUIRED \ C_EXTENSIONS @@ -151,6 +161,8 @@ syn keyword cmakeProperty contained \ DISABLED \ DISABLED_FEATURES \ DISABLE_PRECOMPILE_HEADERS + \ DLL_NAME_WITH_SOVERSION + \ DOTNET_SDK \ DOTNET_TARGET_FRAMEWORK \ DOTNET_TARGET_FRAMEWORK_VERSION \ ECLIPSE_EXTRA_CPROJECT_CONTENTS @@ -159,9 +171,12 @@ syn keyword cmakeProperty contained \ ENABLED_LANGUAGES \ ENABLE_EXPORTS \ ENVIRONMENT + \ ENVIRONMENT_MODIFICATION \ EXCLUDE_FROM_ALL \ EXCLUDE_FROM_DEFAULT_BUILD + \ EXPORT_COMPILE_COMMANDS \ EXPORT_NAME + \ EXPORT_NO_SYSTEM \ EXPORT_PROPERTIES \ EXTERNAL_OBJECT \ EchoString @@ -176,6 +191,7 @@ syn keyword cmakeProperty contained \ FOLDER \ FRAMEWORK \ FRAMEWORK_VERSION + \ Fortran_BUILDING_INSTRINSIC_MODULES \ Fortran_FORMAT \ Fortran_MODULE_DIRECTORY \ Fortran_PREPROCESS @@ -188,8 +204,15 @@ syn keyword cmakeProperty contained \ GLOBAL_DEPENDS_NO_CYCLES \ GNUtoMS \ HAS_CXX + \ HEADER_DIRS \ HEADER_FILE_ONLY + \ HEADER_SET + \ HEADER_SETS \ HELPSTRING + \ HIP_ARCHITECTURES + \ HIP_EXTENSIONS + \ HIP_STANDARD + \ HIP_STANDARD_REQUIRED \ IMPLICIT_DEPENDS_INCLUDE_TRANSFORM \ IMPORTED \ IMPORTED_COMMON_LANGUAGE_RUNTIME @@ -203,8 +226,10 @@ syn keyword cmakeProperty contained \ IMPORTED_LINK_INTERFACE_MULTIPLICITY \ IMPORTED_LOCATION \ IMPORTED_NO_SONAME + \ IMPORTED_NO_SYSTEM \ IMPORTED_OBJECTS \ IMPORTED_SONAME + \ IMPORTED_TARGETS \ IMPORT_PREFIX \ IMPORT_SUFFIX \ INCLUDE_DIRECTORIES @@ -213,14 +238,20 @@ syn keyword cmakeProperty contained \ INSTALL_REMOVE_ENVIRONMENT_RPATH \ INSTALL_RPATH \ INSTALL_RPATH_USE_LINK_PATH + \ INTERFACE_AUTOMOC_MACRO_NAMES \ INTERFACE_AUTOUIC_OPTIONS \ INTERFACE_COMPILE_DEFINITIONS \ INTERFACE_COMPILE_FEATURES \ INTERFACE_COMPILE_OPTIONS + \ INTERFACE_CXX_MODULE_SETS + \ INTERFACE_HEADER_SETS + \ INTERFACE_HEADER_SETS_TO_VERIFY \ INTERFACE_INCLUDE_DIRECTORIES \ INTERFACE_LINK_DEPENDS \ INTERFACE_LINK_DIRECTORIES \ INTERFACE_LINK_LIBRARIES + \ INTERFACE_LINK_LIBRARIES_DIRECT + \ INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE \ INTERFACE_LINK_OPTIONS \ INTERFACE_POSITION_INDEPENDENT_CODE \ INTERFACE_PRECOMPILE_HEADERS @@ -230,6 +261,7 @@ syn keyword cmakeProperty contained \ IN_TRY_COMPILE \ IOS_INSTALL_COMBINED \ ISPC_HEADER_DIRECTORY + \ ISPC_HEADER_SUFFIX \ ISPC_INSTRUCTION_SETS \ JOB_POOLS \ JOB_POOL_COMPILE @@ -248,6 +280,8 @@ syn keyword cmakeProperty contained \ LINK_INTERFACE_LIBRARIES \ LINK_INTERFACE_MULTIPLICITY \ LINK_LIBRARIES + \ LINK_LIBRARIES_ONLY_TARGETS + \ LINK_LIBRARY_OVERRIDE \ LINK_OPTIONS \ LINK_SEARCH_END_STATIC \ LINK_SEARCH_START_STATIC @@ -265,6 +299,7 @@ syn keyword cmakeProperty contained \ MANUALLY_ADDED_DEPENDENCIES \ MEASUREMENT \ MODIFIED + \ MSVC_DEBUG_INFORMATION_FORMAT \ MSVC_RUNTIME_LIBRARY \ NAME \ NO_SONAME @@ -317,6 +352,7 @@ syn keyword cmakeProperty contained \ SKIP_AUTORCC \ SKIP_AUTOUIC \ SKIP_BUILD_RPATH + \ SKIP_LINTING \ SKIP_PRECOMPILE_HEADERS \ SKIP_REGULAR_EXPRESSION \ SKIP_RETURN_CODE @@ -330,6 +366,7 @@ syn keyword cmakeProperty contained \ SUBDIRECTORIES \ SUFFIX \ SYMBOLIC + \ SYSTEM \ Swift_DEPENDENCIES_FILE \ Swift_DIAGNOSTICS_FILE \ Swift_LANGUAGE_VERSION @@ -343,16 +380,20 @@ syn keyword cmakeProperty contained \ TEST_INCLUDE_FILES \ TIMEOUT \ TIMEOUT_AFTER_MATCH + \ TIMEOUT_SIGNAL_GRACE_PERIOD + \ TIMEOUT_SIGNAL_NAME \ TYPE \ UNITY_BUILD \ UNITY_BUILD_BATCH_SIZE \ UNITY_BUILD_CODE_AFTER_INCLUDE \ UNITY_BUILD_CODE_BEFORE_INCLUDE \ UNITY_BUILD_MODE + \ UNITY_BUILD_UNIQUE_ID \ UNITY_GROUP \ USE_FOLDERS \ VALUE \ VARIABLES + \ VERIFY_INTERFACE_HEADER_SETS \ VERSION \ VISIBILITY_INLINES_HIDDEN \ VS_CONFIGURATION_TYPE @@ -367,6 +408,7 @@ syn keyword cmakeProperty contained \ VS_DOTNET_DOCUMENTATION_FILE \ VS_DOTNET_REFERENCES \ VS_DOTNET_REFERENCES_COPY_LOCAL + \ VS_DOTNET_STARTUP_OBJECT \ VS_DOTNET_TARGET_FRAMEWORK_VERSION \ VS_DPI_AWARE \ VS_GLOBAL_KEYWORD @@ -378,6 +420,7 @@ syn keyword cmakeProperty contained \ VS_JUST_MY_CODE_DEBUGGING \ VS_KEYWORD \ VS_MOBILE_EXTENSIONS_VERSION + \ VS_NO_COMPILE_BATCHING \ VS_NO_SOLUTION_DEPLOY \ VS_PACKAGE_REFERENCES \ VS_PLATFORM_TOOLSET @@ -407,11 +450,14 @@ syn keyword cmakeProperty contained \ VS_WINRT_EXTENSIONS \ VS_WINRT_REFERENCES \ VS_XAML_TYPE + \ WATCOM_RUNTIME_LIBRARY \ WILL_FAIL \ WIN32_EXECUTABLE \ WINDOWS_EXPORT_ALL_SYMBOLS \ WORKING_DIRECTORY \ WRAP_EXCLUDE + \ XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY + \ XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY \ XCODE_EMIT_EFFECTIVE_PLATFORM_NAME \ XCODE_EXPLICIT_FILE_TYPE \ XCODE_FILE_ATTRIBUTES @@ -427,9 +473,14 @@ syn keyword cmakeProperty contained \ XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER \ XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS \ XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE + \ XCODE_SCHEME_ENABLE_GPU_API_VALIDATION + \ XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE + \ XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION \ XCODE_SCHEME_ENVIRONMENT \ XCODE_SCHEME_EXECUTABLE \ XCODE_SCHEME_GUARD_MALLOC + \ XCODE_SCHEME_LAUNCH_CONFIGURATION + \ XCODE_SCHEME_LAUNCH_MODE \ XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP \ XCODE_SCHEME_MALLOC_GUARD_EDGES \ XCODE_SCHEME_MALLOC_SCRIBBLE @@ -440,15 +491,19 @@ syn keyword cmakeProperty contained \ XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP \ XCODE_SCHEME_WORKING_DIRECTORY \ XCODE_SCHEME_ZOMBIE_OBJECTS + \ XCODE_XCCONFIG \ XCTEST syn keyword cmakeVariable contained \ ANDROID \ APPLE \ BORLAND + \ BSD \ BUILD_SHARED_LIBS \ CACHE \ CMAKE_ABSOLUTE_DESTINATION_FILES + \ CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY + \ CMAKE_ADSP_ROOT \ CMAKE_AIX_EXPORT_ALL_SYMBOLS \ CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS \ CMAKE_ANDROID_API @@ -458,6 +513,7 @@ syn keyword cmakeVariable contained \ CMAKE_ANDROID_ARM_MODE \ CMAKE_ANDROID_ARM_NEON \ CMAKE_ANDROID_ASSETS_DIRECTORIES + \ CMAKE_ANDROID_EXCEPTIONS \ CMAKE_ANDROID_GUI \ CMAKE_ANDROID_JAR_DEPENDENCIES \ CMAKE_ANDROID_JAR_DIRECTORIES @@ -468,14 +524,17 @@ syn keyword cmakeVariable contained \ CMAKE_ANDROID_NDK_DEPRECATED_HEADERS \ CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG \ CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION + \ CMAKE_ANDROID_NDK_VERSION \ CMAKE_ANDROID_PROCESS_MAX \ CMAKE_ANDROID_PROGUARD \ CMAKE_ANDROID_PROGUARD_CONFIG_PATH + \ CMAKE_ANDROID_RTTI \ CMAKE_ANDROID_SECURE_PROPS_PATH \ CMAKE_ANDROID_SKIP_ANT_STEP \ CMAKE_ANDROID_STANDALONE_TOOLCHAIN \ CMAKE_ANDROID_STL_TYPE \ CMAKE_APPBUNDLE_PATH + \ CMAKE_APPLE_SILICON_PROCESSOR \ CMAKE_AR \ CMAKE_ARCHIVE_OUTPUT_DIRECTORY \ CMAKE_ARGC @@ -487,12 +546,15 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_ARCHIVE_APPEND \ CMAKE_ASM_ARCHIVE_CREATE \ CMAKE_ASM_ARCHIVE_FINISH + \ CMAKE_ASM_BYTE_ORDER \ CMAKE_ASM_CLANG_TIDY + \ CMAKE_ASM_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_ASM_COMPILER \ CMAKE_ASM_COMPILER_ABI \ CMAKE_ASM_COMPILER_AR \ CMAKE_ASM_COMPILER_ARCHITECTURE_ID \ CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_ASM_COMPILER_FRONTEND_VARIANT \ CMAKE_ASM_COMPILER_ID \ CMAKE_ASM_COMPILER_LAUNCHER \ CMAKE_ASM_COMPILER_LOADED @@ -507,6 +569,8 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_CREATE_SHARED_LIBRARY \ CMAKE_ASM_CREATE_SHARED_MODULE \ CMAKE_ASM_CREATE_STATIC_LIBRARY + \ CMAKE_ASM_EXTENSIONS + \ CMAKE_ASM_EXTENSIONS_DEFAULT \ CMAKE_ASM_FLAGS \ CMAKE_ASM_FLAGS_DEBUG \ CMAKE_ASM_FLAGS_DEBUG_INIT @@ -525,6 +589,7 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_INCLUDE_WHAT_YOU_USE \ CMAKE_ASM_INIT \ CMAKE_ASM_LIBRARY_ARCHITECTURE + \ CMAKE_ASM_LINKER_LAUNCHER \ CMAKE_ASM_LINKER_PREFERENCE \ CMAKE_ASM_LINKER_PREFERENCE_PROPAGATES \ CMAKE_ASM_LINKER_WRAPPER_FLAG @@ -533,6 +598,7 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_LINK_LIBRARY_FILE_FLAG \ CMAKE_ASM_LINK_LIBRARY_FLAG \ CMAKE_ASM_LINK_LIBRARY_SUFFIX + \ CMAKE_ASM_LINK_WHAT_YOU_USE_FLAG \ CMAKE_ASM_MASM \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_MACHINE \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_PREFIX @@ -540,12 +606,15 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_MASM_ARCHIVE_APPEND \ CMAKE_ASM_MASM_ARCHIVE_CREATE \ CMAKE_ASM_MASM_ARCHIVE_FINISH + \ CMAKE_ASM_MASM_BYTE_ORDER \ CMAKE_ASM_MASM_CLANG_TIDY + \ CMAKE_ASM_MASM_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_ASM_MASM_COMPILER \ CMAKE_ASM_MASM_COMPILER_ABI \ CMAKE_ASM_MASM_COMPILER_AR \ CMAKE_ASM_MASM_COMPILER_ARCHITECTURE_ID \ CMAKE_ASM_MASM_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_ASM_MASM_COMPILER_FRONTEND_VARIANT \ CMAKE_ASM_MASM_COMPILER_ID \ CMAKE_ASM_MASM_COMPILER_LAUNCHER \ CMAKE_ASM_MASM_COMPILER_LOADED @@ -560,6 +629,8 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_MASM_CREATE_SHARED_LIBRARY \ CMAKE_ASM_MASM_CREATE_SHARED_MODULE \ CMAKE_ASM_MASM_CREATE_STATIC_LIBRARY + \ CMAKE_ASM_MASM_EXTENSIONS + \ CMAKE_ASM_MASM_EXTENSIONS_DEFAULT \ CMAKE_ASM_MASM_FLAGS \ CMAKE_ASM_MASM_FLAGS_DEBUG \ CMAKE_ASM_MASM_FLAGS_DEBUG_INIT @@ -578,6 +649,7 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_MASM_INCLUDE_WHAT_YOU_USE \ CMAKE_ASM_MASM_INIT \ CMAKE_ASM_MASM_LIBRARY_ARCHITECTURE + \ CMAKE_ASM_MASM_LINKER_LAUNCHER \ CMAKE_ASM_MASM_LINKER_PREFERENCE \ CMAKE_ASM_MASM_LINKER_PREFERENCE_PROPAGATES \ CMAKE_ASM_MASM_LINKER_WRAPPER_FLAG @@ -586,14 +658,19 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_MASM_LINK_LIBRARY_FILE_FLAG \ CMAKE_ASM_MASM_LINK_LIBRARY_FLAG \ CMAKE_ASM_MASM_LINK_LIBRARY_SUFFIX + \ CMAKE_ASM_MASM_LINK_WHAT_YOU_USE_FLAG \ CMAKE_ASM_MASM_OUTPUT_EXTENSION \ CMAKE_ASM_MASM_PLATFORM_ID \ CMAKE_ASM_MASM_SIMULATE_ID \ CMAKE_ASM_MASM_SIMULATE_VERSION \ CMAKE_ASM_MASM_SIZEOF_DATA_PTR \ CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS + \ CMAKE_ASM_MASM_STANDARD + \ CMAKE_ASM_MASM_STANDARD_DEFAULT \ CMAKE_ASM_MASM_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_ASM_MASM_STANDARD_LIBRARIES + \ CMAKE_ASM_MASM_STANDARD_REQUIRED + \ CMAKE_ASM_MASM_SUPPORTED \ CMAKE_ASM_MASM_VISIBILITY_PRESET \ CMAKE_ASM_NASM \ CMAKE_ASM_NASM_ANDROID_TOOLCHAIN_MACHINE @@ -602,12 +679,15 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_NASM_ARCHIVE_APPEND \ CMAKE_ASM_NASM_ARCHIVE_CREATE \ CMAKE_ASM_NASM_ARCHIVE_FINISH + \ CMAKE_ASM_NASM_BYTE_ORDER \ CMAKE_ASM_NASM_CLANG_TIDY + \ CMAKE_ASM_NASM_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_ASM_NASM_COMPILER \ CMAKE_ASM_NASM_COMPILER_ABI \ CMAKE_ASM_NASM_COMPILER_AR \ CMAKE_ASM_NASM_COMPILER_ARCHITECTURE_ID \ CMAKE_ASM_NASM_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_ASM_NASM_COMPILER_FRONTEND_VARIANT \ CMAKE_ASM_NASM_COMPILER_ID \ CMAKE_ASM_NASM_COMPILER_LAUNCHER \ CMAKE_ASM_NASM_COMPILER_LOADED @@ -622,6 +702,8 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_NASM_CREATE_SHARED_LIBRARY \ CMAKE_ASM_NASM_CREATE_SHARED_MODULE \ CMAKE_ASM_NASM_CREATE_STATIC_LIBRARY + \ CMAKE_ASM_NASM_EXTENSIONS + \ CMAKE_ASM_NASM_EXTENSIONS_DEFAULT \ CMAKE_ASM_NASM_FLAGS \ CMAKE_ASM_NASM_FLAGS_DEBUG \ CMAKE_ASM_NASM_FLAGS_DEBUG_INIT @@ -640,6 +722,7 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_NASM_INCLUDE_WHAT_YOU_USE \ CMAKE_ASM_NASM_INIT \ CMAKE_ASM_NASM_LIBRARY_ARCHITECTURE + \ CMAKE_ASM_NASM_LINKER_LAUNCHER \ CMAKE_ASM_NASM_LINKER_PREFERENCE \ CMAKE_ASM_NASM_LINKER_PREFERENCE_PROPAGATES \ CMAKE_ASM_NASM_LINKER_WRAPPER_FLAG @@ -648,14 +731,19 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_NASM_LINK_LIBRARY_FILE_FLAG \ CMAKE_ASM_NASM_LINK_LIBRARY_FLAG \ CMAKE_ASM_NASM_LINK_LIBRARY_SUFFIX + \ CMAKE_ASM_NASM_LINK_WHAT_YOU_USE_FLAG \ CMAKE_ASM_NASM_OUTPUT_EXTENSION \ CMAKE_ASM_NASM_PLATFORM_ID \ CMAKE_ASM_NASM_SIMULATE_ID \ CMAKE_ASM_NASM_SIMULATE_VERSION \ CMAKE_ASM_NASM_SIZEOF_DATA_PTR \ CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS + \ CMAKE_ASM_NASM_STANDARD + \ CMAKE_ASM_NASM_STANDARD_DEFAULT \ CMAKE_ASM_NASM_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_ASM_NASM_STANDARD_LIBRARIES + \ CMAKE_ASM_NASM_STANDARD_REQUIRED + \ CMAKE_ASM_NASM_SUPPORTED \ CMAKE_ASM_NASM_VISIBILITY_PRESET \ CMAKE_ASM_OUTPUT_EXTENSION \ CMAKE_ASM_PLATFORM_ID @@ -663,22 +751,30 @@ syn keyword cmakeVariable contained \ CMAKE_ASM_SIMULATE_VERSION \ CMAKE_ASM_SIZEOF_DATA_PTR \ CMAKE_ASM_SOURCE_FILE_EXTENSIONS + \ CMAKE_ASM_STANDARD + \ CMAKE_ASM_STANDARD_DEFAULT \ CMAKE_ASM_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_ASM_STANDARD_LIBRARIES + \ CMAKE_ASM_STANDARD_REQUIRED + \ CMAKE_ASM_SUPPORTED \ CMAKE_ASM_VISIBILITY_PRESET \ CMAKE_AUTOGEN_ORIGIN_DEPENDS \ CMAKE_AUTOGEN_PARALLEL + \ CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE \ CMAKE_AUTOGEN_VERBOSE \ CMAKE_AUTOMOC \ CMAKE_AUTOMOC_COMPILER_PREDEFINES \ CMAKE_AUTOMOC_DEPEND_FILTERS + \ CMAKE_AUTOMOC_EXECUTABLE \ CMAKE_AUTOMOC_MACRO_NAMES \ CMAKE_AUTOMOC_MOC_OPTIONS \ CMAKE_AUTOMOC_PATH_PREFIX \ CMAKE_AUTOMOC_RELAXED_MODE \ CMAKE_AUTORCC + \ CMAKE_AUTORCC_EXECUTABLE \ CMAKE_AUTORCC_OPTIONS \ CMAKE_AUTOUIC + \ CMAKE_AUTOUIC_EXECUTABLE \ CMAKE_AUTOUIC_OPTIONS \ CMAKE_AUTOUIC_SEARCH_PATHS \ CMAKE_BACKWARDS_COMPATIBILITY @@ -700,6 +796,7 @@ syn keyword cmakeVariable contained \ CMAKE_CODEBLOCKS_COMPILER_ID \ CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES \ CMAKE_CODELITE_USE_TARGETS + \ CMAKE_COLOR_DIAGNOSTICS \ CMAKE_COLOR_MAKEFILE \ CMAKE_COMMAND \ CMAKE_COMPILER_2005 @@ -707,6 +804,7 @@ syn keyword cmakeVariable contained \ CMAKE_COMPILER_IS_GNUCXX \ CMAKE_COMPILER_IS_GNUG77 \ CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY + \ CMAKE_COMPILE_WARNING_AS_ERROR \ CMAKE_CONFIGURATION_TYPES \ CMAKE_CPACK_COMMAND \ CMAKE_CROSSCOMPILING @@ -719,12 +817,15 @@ syn keyword cmakeVariable contained \ CMAKE_CSharp_ARCHIVE_APPEND \ CMAKE_CSharp_ARCHIVE_CREATE \ CMAKE_CSharp_ARCHIVE_FINISH + \ CMAKE_CSharp_BYTE_ORDER \ CMAKE_CSharp_CLANG_TIDY + \ CMAKE_CSharp_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_CSharp_COMPILER \ CMAKE_CSharp_COMPILER_ABI \ CMAKE_CSharp_COMPILER_AR \ CMAKE_CSharp_COMPILER_ARCHITECTURE_ID \ CMAKE_CSharp_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_CSharp_COMPILER_FRONTEND_VARIANT \ CMAKE_CSharp_COMPILER_ID \ CMAKE_CSharp_COMPILER_LAUNCHER \ CMAKE_CSharp_COMPILER_LOADED @@ -739,6 +840,8 @@ syn keyword cmakeVariable contained \ CMAKE_CSharp_CREATE_SHARED_LIBRARY \ CMAKE_CSharp_CREATE_SHARED_MODULE \ CMAKE_CSharp_CREATE_STATIC_LIBRARY + \ CMAKE_CSharp_EXTENSIONS + \ CMAKE_CSharp_EXTENSIONS_DEFAULT \ CMAKE_CSharp_FLAGS \ CMAKE_CSharp_FLAGS_DEBUG \ CMAKE_CSharp_FLAGS_DEBUG_INIT @@ -757,6 +860,7 @@ syn keyword cmakeVariable contained \ CMAKE_CSharp_INCLUDE_WHAT_YOU_USE \ CMAKE_CSharp_INIT \ CMAKE_CSharp_LIBRARY_ARCHITECTURE + \ CMAKE_CSharp_LINKER_LAUNCHER \ CMAKE_CSharp_LINKER_PREFERENCE \ CMAKE_CSharp_LINKER_PREFERENCE_PROPAGATES \ CMAKE_CSharp_LINKER_WRAPPER_FLAG @@ -765,14 +869,19 @@ syn keyword cmakeVariable contained \ CMAKE_CSharp_LINK_LIBRARY_FILE_FLAG \ CMAKE_CSharp_LINK_LIBRARY_FLAG \ CMAKE_CSharp_LINK_LIBRARY_SUFFIX + \ CMAKE_CSharp_LINK_WHAT_YOU_USE_FLAG \ CMAKE_CSharp_OUTPUT_EXTENSION \ CMAKE_CSharp_PLATFORM_ID \ CMAKE_CSharp_SIMULATE_ID \ CMAKE_CSharp_SIMULATE_VERSION \ CMAKE_CSharp_SIZEOF_DATA_PTR \ CMAKE_CSharp_SOURCE_FILE_EXTENSIONS + \ CMAKE_CSharp_STANDARD + \ CMAKE_CSharp_STANDARD_DEFAULT \ CMAKE_CSharp_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_CSharp_STANDARD_LIBRARIES + \ CMAKE_CSharp_STANDARD_REQUIRED + \ CMAKE_CSharp_SUPPORTED \ CMAKE_CSharp_VISIBILITY_PRESET \ CMAKE_CTEST_ARGUMENTS \ CMAKE_CTEST_COMMAND @@ -784,12 +893,15 @@ syn keyword cmakeVariable contained \ CMAKE_CUDA_ARCHIVE_APPEND \ CMAKE_CUDA_ARCHIVE_CREATE \ CMAKE_CUDA_ARCHIVE_FINISH + \ CMAKE_CUDA_BYTE_ORDER \ CMAKE_CUDA_CLANG_TIDY + \ CMAKE_CUDA_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_CUDA_COMPILER \ CMAKE_CUDA_COMPILER_ABI \ CMAKE_CUDA_COMPILER_AR \ CMAKE_CUDA_COMPILER_ARCHITECTURE_ID \ CMAKE_CUDA_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_CUDA_COMPILER_FRONTEND_VARIANT \ CMAKE_CUDA_COMPILER_ID \ CMAKE_CUDA_COMPILER_LAUNCHER \ CMAKE_CUDA_COMPILER_LOADED @@ -806,6 +918,7 @@ syn keyword cmakeVariable contained \ CMAKE_CUDA_CREATE_SHARED_MODULE \ CMAKE_CUDA_CREATE_STATIC_LIBRARY \ CMAKE_CUDA_EXTENSIONS + \ CMAKE_CUDA_EXTENSIONS_DEFAULT \ CMAKE_CUDA_FLAGS \ CMAKE_CUDA_FLAGS_DEBUG \ CMAKE_CUDA_FLAGS_DEBUG_INIT @@ -825,6 +938,7 @@ syn keyword cmakeVariable contained \ CMAKE_CUDA_INCLUDE_WHAT_YOU_USE \ CMAKE_CUDA_INIT \ CMAKE_CUDA_LIBRARY_ARCHITECTURE + \ CMAKE_CUDA_LINKER_LAUNCHER \ CMAKE_CUDA_LINKER_PREFERENCE \ CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES \ CMAKE_CUDA_LINKER_WRAPPER_FLAG @@ -833,6 +947,7 @@ syn keyword cmakeVariable contained \ CMAKE_CUDA_LINK_LIBRARY_FILE_FLAG \ CMAKE_CUDA_LINK_LIBRARY_FLAG \ CMAKE_CUDA_LINK_LIBRARY_SUFFIX + \ CMAKE_CUDA_LINK_WHAT_YOU_USE_FLAG \ CMAKE_CUDA_OUTPUT_EXTENSION \ CMAKE_CUDA_PLATFORM_ID \ CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS @@ -843,9 +958,11 @@ syn keyword cmakeVariable contained \ CMAKE_CUDA_SIZEOF_DATA_PTR \ CMAKE_CUDA_SOURCE_FILE_EXTENSIONS \ CMAKE_CUDA_STANDARD + \ CMAKE_CUDA_STANDARD_DEFAULT \ CMAKE_CUDA_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_CUDA_STANDARD_LIBRARIES \ CMAKE_CUDA_STANDARD_REQUIRED + \ CMAKE_CUDA_SUPPORTED \ CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES \ CMAKE_CUDA_VISIBILITY_PRESET \ CMAKE_CURRENT_BINARY_DIR @@ -864,12 +981,15 @@ syn keyword cmakeVariable contained \ CMAKE_CXX_ARCHIVE_APPEND \ CMAKE_CXX_ARCHIVE_CREATE \ CMAKE_CXX_ARCHIVE_FINISH + \ CMAKE_CXX_BYTE_ORDER \ CMAKE_CXX_CLANG_TIDY + \ CMAKE_CXX_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_CXX_COMPILER \ CMAKE_CXX_COMPILER_ABI \ CMAKE_CXX_COMPILER_AR \ CMAKE_CXX_COMPILER_ARCHITECTURE_ID \ CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_CXX_COMPILER_FRONTEND_VARIANT \ CMAKE_CXX_COMPILER_ID \ CMAKE_CXX_COMPILER_LAUNCHER \ CMAKE_CXX_COMPILER_LOADED @@ -886,6 +1006,7 @@ syn keyword cmakeVariable contained \ CMAKE_CXX_CREATE_SHARED_MODULE \ CMAKE_CXX_CREATE_STATIC_LIBRARY \ CMAKE_CXX_EXTENSIONS + \ CMAKE_CXX_EXTENSIONS_DEFAULT \ CMAKE_CXX_FLAGS \ CMAKE_CXX_FLAGS_DEBUG \ CMAKE_CXX_FLAGS_DEBUG_INIT @@ -904,6 +1025,7 @@ syn keyword cmakeVariable contained \ CMAKE_CXX_INCLUDE_WHAT_YOU_USE \ CMAKE_CXX_INIT \ CMAKE_CXX_LIBRARY_ARCHITECTURE + \ CMAKE_CXX_LINKER_LAUNCHER \ CMAKE_CXX_LINKER_PREFERENCE \ CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES \ CMAKE_CXX_LINKER_WRAPPER_FLAG @@ -912,16 +1034,20 @@ syn keyword cmakeVariable contained \ CMAKE_CXX_LINK_LIBRARY_FILE_FLAG \ CMAKE_CXX_LINK_LIBRARY_FLAG \ CMAKE_CXX_LINK_LIBRARY_SUFFIX + \ CMAKE_CXX_LINK_WHAT_YOU_USE_FLAG \ CMAKE_CXX_OUTPUT_EXTENSION \ CMAKE_CXX_PLATFORM_ID + \ CMAKE_CXX_SCAN_FOR_MODULES \ CMAKE_CXX_SIMULATE_ID \ CMAKE_CXX_SIMULATE_VERSION \ CMAKE_CXX_SIZEOF_DATA_PTR \ CMAKE_CXX_SOURCE_FILE_EXTENSIONS \ CMAKE_CXX_STANDARD + \ CMAKE_CXX_STANDARD_DEFAULT \ CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_CXX_STANDARD_LIBRARIES \ CMAKE_CXX_STANDARD_REQUIRED + \ CMAKE_CXX_SUPPORTED \ CMAKE_CXX_VISIBILITY_PRESET \ CMAKE_C_ANDROID_TOOLCHAIN_MACHINE \ CMAKE_C_ANDROID_TOOLCHAIN_PREFIX @@ -929,12 +1055,15 @@ syn keyword cmakeVariable contained \ CMAKE_C_ARCHIVE_APPEND \ CMAKE_C_ARCHIVE_CREATE \ CMAKE_C_ARCHIVE_FINISH + \ CMAKE_C_BYTE_ORDER \ CMAKE_C_CLANG_TIDY + \ CMAKE_C_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_C_COMPILER \ CMAKE_C_COMPILER_ABI \ CMAKE_C_COMPILER_AR \ CMAKE_C_COMPILER_ARCHITECTURE_ID \ CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_C_COMPILER_FRONTEND_VARIANT \ CMAKE_C_COMPILER_ID \ CMAKE_C_COMPILER_LAUNCHER \ CMAKE_C_COMPILER_LOADED @@ -951,6 +1080,7 @@ syn keyword cmakeVariable contained \ CMAKE_C_CREATE_SHARED_MODULE \ CMAKE_C_CREATE_STATIC_LIBRARY \ CMAKE_C_EXTENSIONS + \ CMAKE_C_EXTENSIONS_DEFAULT \ CMAKE_C_FLAGS \ CMAKE_C_FLAGS_DEBUG \ CMAKE_C_FLAGS_DEBUG_INIT @@ -969,6 +1099,7 @@ syn keyword cmakeVariable contained \ CMAKE_C_INCLUDE_WHAT_YOU_USE \ CMAKE_C_INIT \ CMAKE_C_LIBRARY_ARCHITECTURE + \ CMAKE_C_LINKER_LAUNCHER \ CMAKE_C_LINKER_PREFERENCE \ CMAKE_C_LINKER_PREFERENCE_PROPAGATES \ CMAKE_C_LINKER_WRAPPER_FLAG @@ -977,6 +1108,7 @@ syn keyword cmakeVariable contained \ CMAKE_C_LINK_LIBRARY_FILE_FLAG \ CMAKE_C_LINK_LIBRARY_FLAG \ CMAKE_C_LINK_LIBRARY_SUFFIX + \ CMAKE_C_LINK_WHAT_YOU_USE_FLAG \ CMAKE_C_OUTPUT_EXTENSION \ CMAKE_C_PLATFORM_ID \ CMAKE_C_SIMULATE_ID @@ -984,18 +1116,23 @@ syn keyword cmakeVariable contained \ CMAKE_C_SIZEOF_DATA_PTR \ CMAKE_C_SOURCE_FILE_EXTENSIONS \ CMAKE_C_STANDARD + \ CMAKE_C_STANDARD_DEFAULT \ CMAKE_C_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_C_STANDARD_LIBRARIES \ CMAKE_C_STANDARD_REQUIRED + \ CMAKE_C_SUPPORTED \ CMAKE_C_VISIBILITY_PRESET \ CMAKE_DEBUG_POSTFIX \ CMAKE_DEBUG_TARGET_PROPERTIES \ CMAKE_DEFAULT_BUILD_TYPE \ CMAKE_DEFAULT_CONFIGS \ CMAKE_DEPENDS_IN_PROJECT_ONLY + \ CMAKE_DEPENDS_USE_COMPILER \ CMAKE_DIRECTORY_LABELS \ CMAKE_DISABLE_PRECOMPILE_HEADERS + \ CMAKE_DLL_NAME_WITH_SOVERSION \ CMAKE_DL_LIBS + \ CMAKE_DOTNET_SDK \ CMAKE_DOTNET_TARGET_FRAMEWORK \ CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION \ CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES @@ -1007,7 +1144,20 @@ syn keyword cmakeVariable contained \ CMAKE_ENABLE_EXPORTS \ CMAKE_ERROR_DEPRECATED \ CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION + \ CMAKE_EXECUTABLE_ENABLE_EXPORTS \ CMAKE_EXECUTABLE_SUFFIX + \ CMAKE_EXECUTABLE_SUFFIX_ASM + \ CMAKE_EXECUTABLE_SUFFIX_ASM_MASM + \ CMAKE_EXECUTABLE_SUFFIX_ASM_NASM + \ CMAKE_EXECUTABLE_SUFFIX_C + \ CMAKE_EXECUTABLE_SUFFIX_CSharp + \ CMAKE_EXECUTABLE_SUFFIX_CUDA + \ CMAKE_EXECUTABLE_SUFFIX_CXX + \ CMAKE_EXECUTABLE_SUFFIX_Fortran + \ CMAKE_EXECUTABLE_SUFFIX_HIP + \ CMAKE_EXECUTABLE_SUFFIX_Java + \ CMAKE_EXECUTABLE_SUFFIX_RC + \ CMAKE_EXECUTABLE_SUFFIX_Swift \ CMAKE_EXECUTE_PROCESS_COMMAND_ECHO \ CMAKE_EXE_LINKER_FLAGS \ CMAKE_EXE_LINKER_FLAGS_INIT @@ -1027,9 +1177,11 @@ syn keyword cmakeVariable contained \ CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY \ CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY \ CMAKE_FIND_PACKAGE_PREFER_CONFIG + \ CMAKE_FIND_PACKAGE_REDIRECTS_DIR \ CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS \ CMAKE_FIND_PACKAGE_SORT_DIRECTION \ CMAKE_FIND_PACKAGE_SORT_ORDER + \ CMAKE_FIND_PACKAGE_TARGETS_GLOBAL \ CMAKE_FIND_PACKAGE_WARN_NO_MODULE \ CMAKE_FIND_ROOT_PATH \ CMAKE_FIND_ROOT_PATH_MODE_INCLUDE @@ -1039,6 +1191,7 @@ syn keyword cmakeVariable contained \ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH \ CMAKE_FIND_USE_CMAKE_PATH \ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH + \ CMAKE_FIND_USE_INSTALL_PREFIX \ CMAKE_FIND_USE_PACKAGE_REGISTRY \ CMAKE_FIND_USE_PACKAGE_ROOT_PATH \ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH @@ -1053,12 +1206,15 @@ syn keyword cmakeVariable contained \ CMAKE_Fortran_ARCHIVE_APPEND \ CMAKE_Fortran_ARCHIVE_CREATE \ CMAKE_Fortran_ARCHIVE_FINISH + \ CMAKE_Fortran_BYTE_ORDER \ CMAKE_Fortran_CLANG_TIDY + \ CMAKE_Fortran_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_Fortran_COMPILER \ CMAKE_Fortran_COMPILER_ABI \ CMAKE_Fortran_COMPILER_AR \ CMAKE_Fortran_COMPILER_ARCHITECTURE_ID \ CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_Fortran_COMPILER_FRONTEND_VARIANT \ CMAKE_Fortran_COMPILER_ID \ CMAKE_Fortran_COMPILER_LAUNCHER \ CMAKE_Fortran_COMPILER_LOADED @@ -1073,6 +1229,8 @@ syn keyword cmakeVariable contained \ CMAKE_Fortran_CREATE_SHARED_LIBRARY \ CMAKE_Fortran_CREATE_SHARED_MODULE \ CMAKE_Fortran_CREATE_STATIC_LIBRARY + \ CMAKE_Fortran_EXTENSIONS + \ CMAKE_Fortran_EXTENSIONS_DEFAULT \ CMAKE_Fortran_FLAGS \ CMAKE_Fortran_FLAGS_DEBUG \ CMAKE_Fortran_FLAGS_DEBUG_INIT @@ -1092,6 +1250,7 @@ syn keyword cmakeVariable contained \ CMAKE_Fortran_INCLUDE_WHAT_YOU_USE \ CMAKE_Fortran_INIT \ CMAKE_Fortran_LIBRARY_ARCHITECTURE + \ CMAKE_Fortran_LINKER_LAUNCHER \ CMAKE_Fortran_LINKER_PREFERENCE \ CMAKE_Fortran_LINKER_PREFERENCE_PROPAGATES \ CMAKE_Fortran_LINKER_WRAPPER_FLAG @@ -1100,6 +1259,7 @@ syn keyword cmakeVariable contained \ CMAKE_Fortran_LINK_LIBRARY_FILE_FLAG \ CMAKE_Fortran_LINK_LIBRARY_FLAG \ CMAKE_Fortran_LINK_LIBRARY_SUFFIX + \ CMAKE_Fortran_LINK_WHAT_YOU_USE_FLAG \ CMAKE_Fortran_MODDIR_DEFAULT \ CMAKE_Fortran_MODDIR_FLAG \ CMAKE_Fortran_MODOUT_FLAG @@ -1111,8 +1271,12 @@ syn keyword cmakeVariable contained \ CMAKE_Fortran_SIMULATE_VERSION \ CMAKE_Fortran_SIZEOF_DATA_PTR \ CMAKE_Fortran_SOURCE_FILE_EXTENSIONS + \ CMAKE_Fortran_STANDARD + \ CMAKE_Fortran_STANDARD_DEFAULT \ CMAKE_Fortran_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_Fortran_STANDARD_LIBRARIES + \ CMAKE_Fortran_STANDARD_REQUIRED + \ CMAKE_Fortran_SUPPORTED \ CMAKE_Fortran_VISIBILITY_PRESET \ CMAKE_GENERATOR \ CMAKE_GENERATOR_INSTANCE @@ -1124,8 +1288,84 @@ syn keyword cmakeVariable contained \ CMAKE_GLOBAL_AUTORCC_TARGET \ CMAKE_GLOBAL_AUTORCC_TARGET_NAME \ CMAKE_GNUtoMS + \ CMAKE_HIP + \ CMAKE_HIP_ANDROID_TOOLCHAIN_MACHINE + \ CMAKE_HIP_ANDROID_TOOLCHAIN_PREFIX + \ CMAKE_HIP_ANDROID_TOOLCHAIN_SUFFIX + \ CMAKE_HIP_ARCHITECTURES + \ CMAKE_HIP_ARCHIVE_APPEND + \ CMAKE_HIP_ARCHIVE_CREATE + \ CMAKE_HIP_ARCHIVE_FINISH + \ CMAKE_HIP_BYTE_ORDER + \ CMAKE_HIP_CLANG_TIDY + \ CMAKE_HIP_CLANG_TIDY_EXPORT_FIXES_DIR + \ CMAKE_HIP_COMPILER + \ CMAKE_HIP_COMPILER_ABI + \ CMAKE_HIP_COMPILER_AR + \ CMAKE_HIP_COMPILER_ARCHITECTURE_ID + \ CMAKE_HIP_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_HIP_COMPILER_FRONTEND_VARIANT + \ CMAKE_HIP_COMPILER_ID + \ CMAKE_HIP_COMPILER_LAUNCHER + \ CMAKE_HIP_COMPILER_LOADED + \ CMAKE_HIP_COMPILER_PREDEFINES_COMMAND + \ CMAKE_HIP_COMPILER_RANLIB + \ CMAKE_HIP_COMPILER_TARGET + \ CMAKE_HIP_COMPILER_VERSION + \ CMAKE_HIP_COMPILER_VERSION_INTERNAL + \ CMAKE_HIP_COMPILE_OBJECT + \ CMAKE_HIP_CPPCHECK + \ CMAKE_HIP_CPPLINT + \ CMAKE_HIP_CREATE_SHARED_LIBRARY + \ CMAKE_HIP_CREATE_SHARED_MODULE + \ CMAKE_HIP_CREATE_STATIC_LIBRARY + \ CMAKE_HIP_EXTENSIONS + \ CMAKE_HIP_EXTENSIONS_DEFAULT + \ CMAKE_HIP_FLAGS + \ CMAKE_HIP_FLAGS_DEBUG + \ CMAKE_HIP_FLAGS_DEBUG_INIT + \ CMAKE_HIP_FLAGS_INIT + \ CMAKE_HIP_FLAGS_MINSIZEREL + \ CMAKE_HIP_FLAGS_MINSIZEREL_INIT + \ CMAKE_HIP_FLAGS_RELEASE + \ CMAKE_HIP_FLAGS_RELEASE_INIT + \ CMAKE_HIP_FLAGS_RELWITHDEBINFO + \ CMAKE_HIP_FLAGS_RELWITHDEBINFO_INIT + \ CMAKE_HIP_IGNORE_EXTENSIONS + \ CMAKE_HIP_IMPLICIT_INCLUDE_DIRECTORIES + \ CMAKE_HIP_IMPLICIT_LINK_DIRECTORIES + \ CMAKE_HIP_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES + \ CMAKE_HIP_IMPLICIT_LINK_LIBRARIES + \ CMAKE_HIP_INCLUDE_WHAT_YOU_USE + \ CMAKE_HIP_INIT + \ CMAKE_HIP_LIBRARY_ARCHITECTURE + \ CMAKE_HIP_LINKER_LAUNCHER + \ CMAKE_HIP_LINKER_PREFERENCE + \ CMAKE_HIP_LINKER_PREFERENCE_PROPAGATES + \ CMAKE_HIP_LINKER_WRAPPER_FLAG + \ CMAKE_HIP_LINKER_WRAPPER_FLAG_SEP + \ CMAKE_HIP_LINK_EXECUTABLE + \ CMAKE_HIP_LINK_LIBRARY_FILE_FLAG + \ CMAKE_HIP_LINK_LIBRARY_FLAG + \ CMAKE_HIP_LINK_LIBRARY_SUFFIX + \ CMAKE_HIP_LINK_WHAT_YOU_USE_FLAG + \ CMAKE_HIP_OUTPUT_EXTENSION + \ CMAKE_HIP_PLATFORM_ID + \ CMAKE_HIP_SIMULATE_ID + \ CMAKE_HIP_SIMULATE_VERSION + \ CMAKE_HIP_SIZEOF_DATA_PTR + \ CMAKE_HIP_SOURCE_FILE_EXTENSIONS + \ CMAKE_HIP_STANDARD + \ CMAKE_HIP_STANDARD_DEFAULT + \ CMAKE_HIP_STANDARD_INCLUDE_DIRECTORIES + \ CMAKE_HIP_STANDARD_LIBRARIES + \ CMAKE_HIP_STANDARD_REQUIRED + \ CMAKE_HIP_SUPPORTED + \ CMAKE_HIP_VISIBILITY_PRESET \ CMAKE_HOME_DIRECTORY \ CMAKE_HOST_APPLE + \ CMAKE_HOST_BSD + \ CMAKE_HOST_LINUX \ CMAKE_HOST_SOLARIS \ CMAKE_HOST_SYSTEM \ CMAKE_HOST_SYSTEM_NAME @@ -1134,6 +1374,7 @@ syn keyword cmakeVariable contained \ CMAKE_HOST_UNIX \ CMAKE_HOST_WIN32 \ CMAKE_IGNORE_PATH + \ CMAKE_IGNORE_PREFIX_PATH \ CMAKE_IMPORT_LIBRARY_PREFIX \ CMAKE_IMPORT_LIBRARY_SUFFIX \ CMAKE_INCLUDE_CURRENT_DIR @@ -1154,6 +1395,7 @@ syn keyword cmakeVariable contained \ CMAKE_INTERPROCEDURAL_OPTIMIZATION \ CMAKE_IOS_INSTALL_COMBINED \ CMAKE_ISPC_HEADER_DIRECTORY + \ CMAKE_ISPC_HEADER_SUFFIX \ CMAKE_ISPC_INSTRUCTION_SETS \ CMAKE_JOB_POOLS \ CMAKE_JOB_POOL_COMPILE @@ -1166,12 +1408,15 @@ syn keyword cmakeVariable contained \ CMAKE_Java_ARCHIVE_APPEND \ CMAKE_Java_ARCHIVE_CREATE \ CMAKE_Java_ARCHIVE_FINISH + \ CMAKE_Java_BYTE_ORDER \ CMAKE_Java_CLANG_TIDY + \ CMAKE_Java_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_Java_COMPILER \ CMAKE_Java_COMPILER_ABI \ CMAKE_Java_COMPILER_AR \ CMAKE_Java_COMPILER_ARCHITECTURE_ID \ CMAKE_Java_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_Java_COMPILER_FRONTEND_VARIANT \ CMAKE_Java_COMPILER_ID \ CMAKE_Java_COMPILER_LAUNCHER \ CMAKE_Java_COMPILER_LOADED @@ -1186,6 +1431,8 @@ syn keyword cmakeVariable contained \ CMAKE_Java_CREATE_SHARED_LIBRARY \ CMAKE_Java_CREATE_SHARED_MODULE \ CMAKE_Java_CREATE_STATIC_LIBRARY + \ CMAKE_Java_EXTENSIONS + \ CMAKE_Java_EXTENSIONS_DEFAULT \ CMAKE_Java_FLAGS \ CMAKE_Java_FLAGS_DEBUG \ CMAKE_Java_FLAGS_DEBUG_INIT @@ -1204,6 +1451,7 @@ syn keyword cmakeVariable contained \ CMAKE_Java_INCLUDE_WHAT_YOU_USE \ CMAKE_Java_INIT \ CMAKE_Java_LIBRARY_ARCHITECTURE + \ CMAKE_Java_LINKER_LAUNCHER \ CMAKE_Java_LINKER_PREFERENCE \ CMAKE_Java_LINKER_PREFERENCE_PROPAGATES \ CMAKE_Java_LINKER_WRAPPER_FLAG @@ -1212,15 +1460,22 @@ syn keyword cmakeVariable contained \ CMAKE_Java_LINK_LIBRARY_FILE_FLAG \ CMAKE_Java_LINK_LIBRARY_FLAG \ CMAKE_Java_LINK_LIBRARY_SUFFIX + \ CMAKE_Java_LINK_WHAT_YOU_USE_FLAG \ CMAKE_Java_OUTPUT_EXTENSION \ CMAKE_Java_PLATFORM_ID \ CMAKE_Java_SIMULATE_ID \ CMAKE_Java_SIMULATE_VERSION \ CMAKE_Java_SIZEOF_DATA_PTR \ CMAKE_Java_SOURCE_FILE_EXTENSIONS + \ CMAKE_Java_STANDARD + \ CMAKE_Java_STANDARD_DEFAULT \ CMAKE_Java_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_Java_STANDARD_LIBRARIES + \ CMAKE_Java_STANDARD_REQUIRED + \ CMAKE_Java_SUPPORTED \ CMAKE_Java_VISIBILITY_PRESET + \ CMAKE_KATE_FILES_MODE + \ CMAKE_KATE_MAKE_ARGUMENTS \ CMAKE_LIBRARY_ARCHITECTURE \ CMAKE_LIBRARY_ARCHITECTURE_REGEX \ CMAKE_LIBRARY_OUTPUT_DIRECTORY @@ -1228,14 +1483,17 @@ syn keyword cmakeVariable contained \ CMAKE_LIBRARY_PATH_FLAG \ CMAKE_LINK_DEF_FILE_FLAG \ CMAKE_LINK_DEPENDS_NO_SHARED + \ CMAKE_LINK_DEPENDS_USE_LINKER \ CMAKE_LINK_DIRECTORIES_BEFORE \ CMAKE_LINK_INTERFACE_LIBRARIES + \ CMAKE_LINK_LIBRARIES_ONLY_TARGETS \ CMAKE_LINK_LIBRARY_FILE_FLAG \ CMAKE_LINK_LIBRARY_FLAG \ CMAKE_LINK_LIBRARY_SUFFIX \ CMAKE_LINK_SEARCH_END_STATIC \ CMAKE_LINK_SEARCH_START_STATIC \ CMAKE_LINK_WHAT_YOU_USE + \ CMAKE_LINK_WHAT_YOU_USE_CHECK \ CMAKE_MACOSX_BUNDLE \ CMAKE_MACOSX_RPATH \ CMAKE_MAJOR_VERSION @@ -1253,6 +1511,7 @@ syn keyword cmakeVariable contained \ CMAKE_MODULE_LINKER_FLAGS_INIT \ CMAKE_MODULE_PATH \ CMAKE_MSVCIDE_RUN_PATH + \ CMAKE_MSVC_DEBUG_INFORMATION_FORMAT \ CMAKE_MSVC_RUNTIME_LIBRARY \ CMAKE_NETRC \ CMAKE_NETRC_FILE @@ -1276,6 +1535,7 @@ syn keyword cmakeVariable contained \ CMAKE_PCH_INSTANTIATE_TEMPLATES \ CMAKE_PCH_WARN_INVALID \ CMAKE_PDB_OUTPUT_DIRECTORY + \ CMAKE_PLATFORM_NO_VERSIONED_SONAME \ CMAKE_POSITION_INDEPENDENT_CODE \ CMAKE_PREFIX_PATH \ CMAKE_PROGRAM_PATH @@ -1284,6 +1544,7 @@ syn keyword cmakeVariable contained \ CMAKE_PROJECT_INCLUDE \ CMAKE_PROJECT_INCLUDE_BEFORE \ CMAKE_PROJECT_NAME + \ CMAKE_PROJECT_TOP_LEVEL_INCLUDES \ CMAKE_PROJECT_VERSION \ CMAKE_PROJECT_VERSION_MAJOR \ CMAKE_PROJECT_VERSION_MINOR @@ -1297,12 +1558,15 @@ syn keyword cmakeVariable contained \ CMAKE_RC_ARCHIVE_APPEND \ CMAKE_RC_ARCHIVE_CREATE \ CMAKE_RC_ARCHIVE_FINISH + \ CMAKE_RC_BYTE_ORDER \ CMAKE_RC_CLANG_TIDY + \ CMAKE_RC_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_RC_COMPILER \ CMAKE_RC_COMPILER_ABI \ CMAKE_RC_COMPILER_AR \ CMAKE_RC_COMPILER_ARCHITECTURE_ID \ CMAKE_RC_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_RC_COMPILER_FRONTEND_VARIANT \ CMAKE_RC_COMPILER_ID \ CMAKE_RC_COMPILER_LAUNCHER \ CMAKE_RC_COMPILER_LOADED @@ -1317,6 +1581,8 @@ syn keyword cmakeVariable contained \ CMAKE_RC_CREATE_SHARED_LIBRARY \ CMAKE_RC_CREATE_SHARED_MODULE \ CMAKE_RC_CREATE_STATIC_LIBRARY + \ CMAKE_RC_EXTENSIONS + \ CMAKE_RC_EXTENSIONS_DEFAULT \ CMAKE_RC_FLAGS \ CMAKE_RC_FLAGS_DEBUG \ CMAKE_RC_FLAGS_DEBUG_INIT @@ -1335,6 +1601,7 @@ syn keyword cmakeVariable contained \ CMAKE_RC_INCLUDE_WHAT_YOU_USE \ CMAKE_RC_INIT \ CMAKE_RC_LIBRARY_ARCHITECTURE + \ CMAKE_RC_LINKER_LAUNCHER \ CMAKE_RC_LINKER_PREFERENCE \ CMAKE_RC_LINKER_PREFERENCE_PROPAGATES \ CMAKE_RC_LINKER_WRAPPER_FLAG @@ -1343,19 +1610,25 @@ syn keyword cmakeVariable contained \ CMAKE_RC_LINK_LIBRARY_FILE_FLAG \ CMAKE_RC_LINK_LIBRARY_FLAG \ CMAKE_RC_LINK_LIBRARY_SUFFIX + \ CMAKE_RC_LINK_WHAT_YOU_USE_FLAG \ CMAKE_RC_OUTPUT_EXTENSION \ CMAKE_RC_PLATFORM_ID \ CMAKE_RC_SIMULATE_ID \ CMAKE_RC_SIMULATE_VERSION \ CMAKE_RC_SIZEOF_DATA_PTR \ CMAKE_RC_SOURCE_FILE_EXTENSIONS + \ CMAKE_RC_STANDARD + \ CMAKE_RC_STANDARD_DEFAULT \ CMAKE_RC_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_RC_STANDARD_LIBRARIES + \ CMAKE_RC_STANDARD_REQUIRED + \ CMAKE_RC_SUPPORTED \ CMAKE_RC_VISIBILITY_PRESET \ CMAKE_ROOT \ CMAKE_RULE_MESSAGES \ CMAKE_RUNTIME_OUTPUT_DIRECTORY \ CMAKE_SCRIPT_MODE_FILE + \ CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS \ CMAKE_SHARED_LIBRARY_PREFIX \ CMAKE_SHARED_LIBRARY_SUFFIX \ CMAKE_SHARED_LINKER_FLAGS @@ -1384,6 +1657,7 @@ syn keyword cmakeVariable contained \ CMAKE_SYSTEM_APPBUNDLE_PATH \ CMAKE_SYSTEM_FRAMEWORK_PATH \ CMAKE_SYSTEM_IGNORE_PATH + \ CMAKE_SYSTEM_IGNORE_PREFIX_PATH \ CMAKE_SYSTEM_INCLUDE_PATH \ CMAKE_SYSTEM_LIBRARY_PATH \ CMAKE_SYSTEM_NAME @@ -1398,12 +1672,15 @@ syn keyword cmakeVariable contained \ CMAKE_Swift_ARCHIVE_APPEND \ CMAKE_Swift_ARCHIVE_CREATE \ CMAKE_Swift_ARCHIVE_FINISH + \ CMAKE_Swift_BYTE_ORDER \ CMAKE_Swift_CLANG_TIDY + \ CMAKE_Swift_CLANG_TIDY_EXPORT_FIXES_DIR \ CMAKE_Swift_COMPILER \ CMAKE_Swift_COMPILER_ABI \ CMAKE_Swift_COMPILER_AR \ CMAKE_Swift_COMPILER_ARCHITECTURE_ID \ CMAKE_Swift_COMPILER_EXTERNAL_TOOLCHAIN + \ CMAKE_Swift_COMPILER_FRONTEND_VARIANT \ CMAKE_Swift_COMPILER_ID \ CMAKE_Swift_COMPILER_LAUNCHER \ CMAKE_Swift_COMPILER_LOADED @@ -1418,6 +1695,8 @@ syn keyword cmakeVariable contained \ CMAKE_Swift_CREATE_SHARED_LIBRARY \ CMAKE_Swift_CREATE_SHARED_MODULE \ CMAKE_Swift_CREATE_STATIC_LIBRARY + \ CMAKE_Swift_EXTENSIONS + \ CMAKE_Swift_EXTENSIONS_DEFAULT \ CMAKE_Swift_FLAGS \ CMAKE_Swift_FLAGS_DEBUG \ CMAKE_Swift_FLAGS_DEBUG_INIT @@ -1437,6 +1716,7 @@ syn keyword cmakeVariable contained \ CMAKE_Swift_INIT \ CMAKE_Swift_LANGUAGE_VERSION \ CMAKE_Swift_LIBRARY_ARCHITECTURE + \ CMAKE_Swift_LINKER_LAUNCHER \ CMAKE_Swift_LINKER_PREFERENCE \ CMAKE_Swift_LINKER_PREFERENCE_PROPAGATES \ CMAKE_Swift_LINKER_WRAPPER_FLAG @@ -1445,6 +1725,7 @@ syn keyword cmakeVariable contained \ CMAKE_Swift_LINK_LIBRARY_FILE_FLAG \ CMAKE_Swift_LINK_LIBRARY_FLAG \ CMAKE_Swift_LINK_LIBRARY_SUFFIX + \ CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG \ CMAKE_Swift_MODULE_DIRECTORY \ CMAKE_Swift_NUM_THREADS \ CMAKE_Swift_OUTPUT_EXTENSION @@ -1453,16 +1734,25 @@ syn keyword cmakeVariable contained \ CMAKE_Swift_SIMULATE_VERSION \ CMAKE_Swift_SIZEOF_DATA_PTR \ CMAKE_Swift_SOURCE_FILE_EXTENSIONS + \ CMAKE_Swift_STANDARD + \ CMAKE_Swift_STANDARD_DEFAULT \ CMAKE_Swift_STANDARD_INCLUDE_DIRECTORIES \ CMAKE_Swift_STANDARD_LIBRARIES + \ CMAKE_Swift_STANDARD_REQUIRED + \ CMAKE_Swift_SUPPORTED \ CMAKE_Swift_VISIBILITY_PRESET + \ CMAKE_TASKING_TOOLSET + \ CMAKE_TLS_CAINFO + \ CMAKE_TLS_VERIFY \ CMAKE_TOOLCHAIN_FILE \ CMAKE_TRY_COMPILE_CONFIGURATION + \ CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES \ CMAKE_TRY_COMPILE_PLATFORM_VARIABLES \ CMAKE_TRY_COMPILE_TARGET_TYPE \ CMAKE_TWEAK_VERSION \ CMAKE_UNITY_BUILD \ CMAKE_UNITY_BUILD_BATCH_SIZE + \ CMAKE_UNITY_BUILD_UNIQUE_ID \ CMAKE_USER_MAKE_RULES_OVERRIDE \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM_MASM @@ -1472,13 +1762,19 @@ syn keyword cmakeVariable contained \ CMAKE_USER_MAKE_RULES_OVERRIDE_CUDA \ CMAKE_USER_MAKE_RULES_OVERRIDE_CXX \ CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran + \ CMAKE_USER_MAKE_RULES_OVERRIDE_HIP \ CMAKE_USER_MAKE_RULES_OVERRIDE_Java \ CMAKE_USER_MAKE_RULES_OVERRIDE_RC \ CMAKE_USER_MAKE_RULES_OVERRIDE_Swift \ CMAKE_USE_RELATIVE_PATHS \ CMAKE_VERBOSE_MAKEFILE + \ CMAKE_VERIFY_INTERFACE_HEADER_SETS \ CMAKE_VERSION \ CMAKE_VISIBILITY_INLINES_HIDDEN + \ CMAKE_VS_DEBUGGER_COMMAND + \ CMAKE_VS_DEBUGGER_COMMAND_ARGUMENTS + \ CMAKE_VS_DEBUGGER_ENVIRONMENT + \ CMAKE_VS_DEBUGGER_WORKING_DIRECTORY \ CMAKE_VS_DEVENV_COMMAND \ CMAKE_VS_GLOBALS \ CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD @@ -1486,6 +1782,8 @@ syn keyword cmakeVariable contained \ CMAKE_VS_INTEL_Fortran_PROJECT_VERSION \ CMAKE_VS_JUST_MY_CODE_DEBUGGING \ CMAKE_VS_MSBUILD_COMMAND + \ CMAKE_VS_NO_COMPILE_BATCHING + \ CMAKE_VS_NUGET_PACKAGE_RESTORE \ CMAKE_VS_NsightTegra_VERSION \ CMAKE_VS_PLATFORM_NAME \ CMAKE_VS_PLATFORM_NAME_DEFAULT @@ -1501,11 +1799,17 @@ syn keyword cmakeVariable contained \ CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES \ CMAKE_VS_SDK_REFERENCE_DIRECTORIES \ CMAKE_VS_SDK_SOURCE_DIRECTORIES + \ CMAKE_VS_TARGET_FRAMEWORK_IDENTIFIER + \ CMAKE_VS_TARGET_FRAMEWORK_TARGETS_VERSION + \ CMAKE_VS_TARGET_FRAMEWORK_VERSION + \ CMAKE_VS_VERSION_BUILD_NUMBER + \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM \ CMAKE_VS_WINRT_BY_DEFAULT \ CMAKE_WARN_DEPRECATED \ CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION + \ CMAKE_WATCOM_RUNTIME_LIBRARY \ CMAKE_WIN32_EXECUTABLE \ CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS \ CMAKE_XCODE_BUILD_SYSTEM @@ -1519,8 +1823,13 @@ syn keyword cmakeVariable contained \ CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER \ CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS \ CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE + \ CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION + \ CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE + \ CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION \ CMAKE_XCODE_SCHEME_ENVIRONMENT \ CMAKE_XCODE_SCHEME_GUARD_MALLOC + \ CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION + \ CMAKE_XCODE_SCHEME_LAUNCH_MODE \ CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP \ CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES \ CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE @@ -1531,8 +1840,10 @@ syn keyword cmakeVariable contained \ CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP \ CMAKE_XCODE_SCHEME_WORKING_DIRECTORY \ CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS + \ CMAKE_XCODE_XCCONFIG \ CPACK_ABSOLUTE_DESTINATION_FILES \ CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY + \ CPACK_CUSTOM_INSTALL_VARIABLES \ CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION \ CPACK_INCLUDE_TOPLEVEL_DIRECTORY \ CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS @@ -1566,6 +1877,7 @@ syn keyword cmakeVariable contained \ CTEST_CUSTOM_PRE_MEMCHECK \ CTEST_CUSTOM_PRE_TEST \ CTEST_CUSTOM_TESTS_IGNORE + \ CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION \ CTEST_CUSTOM_WARNING_EXCEPTION \ CTEST_CUSTOM_WARNING_MATCH \ CTEST_CVS_CHECKOUT @@ -1598,8 +1910,10 @@ syn keyword cmakeVariable contained \ CTEST_RESOURCE_SPEC_FILE \ CTEST_RUN_CURRENT_SCRIPT \ CTEST_SCP_COMMAND + \ CTEST_SCRIPT_DIRECTORY \ CTEST_SITE \ CTEST_SOURCE_DIRECTORY + \ CTEST_SUBMIT_INACTIVITY_TIMEOUT \ CTEST_SUBMIT_URL \ CTEST_SVN_COMMAND \ CTEST_SVN_OPTIONS @@ -1892,9 +2206,10 @@ syn keyword cmakeVariable contained \ DOXYGEN_XML_PROGRAMLISTING \ ENV \ EXECUTABLE_OUTPUT_PATH - \ GHS-MULTI + \ GHSMULTI \ IOS \ LIBRARY_OUTPUT_PATH + \ LINUX \ MINGW \ MSVC \ MSVC10 @@ -1913,6 +2228,7 @@ syn keyword cmakeVariable contained \ PROJECT_BINARY_DIR \ PROJECT_DESCRIPTION \ PROJECT_HOMEPAGE_URL + \ PROJECT_IS_TOP_LEVEL \ PROJECT_NAME \ PROJECT_SOURCE_DIR \ PROJECT_VERSION @@ -1930,6 +2246,7 @@ syn keyword cmakeVariable contained syn keyword cmakeModule contained \ ExternalProject + \ FetchContent syn keyword cmakeKWExternalProject contained \ AWS @@ -1943,10 +2260,10 @@ syn keyword cmakeKWExternalProject contained \ CMAKE_CACHE_ARGS \ CMAKE_CACHE_DEFAULT_ARGS \ CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY - \ CMAKE_TLS_CAINFO - \ CMAKE_TLS_VERIFY + \ CMAKE_INSTALL_MODE \ COMMENT \ CONFIGURE_COMMAND + \ CONFIGURE_HANDLED_BY_BUILD \ CVS \ CVSROOT \ CVS_MODULE @@ -1958,6 +2275,7 @@ syn keyword cmakeKWExternalProject contained \ DOWNLOADED_FILE \ DOWNLOAD_COMMAND \ DOWNLOAD_DIR + \ DOWNLOAD_EXTRACT_TIMESTAMP \ DOWNLOAD_NAME \ DOWNLOAD_NO_EXTRACT \ DOWNLOAD_NO_PROGRESS @@ -1987,6 +2305,7 @@ syn keyword cmakeKWExternalProject contained \ IGNORED \ INACTIVITY_TIMEOUT \ INDEPENDENT_STEP_TARGETS + \ INSTALL_BYPRODUCTS \ INSTALL_COMMAND \ INSTALL_DIR \ JOB_POOLS @@ -2042,30 +2361,98 @@ syn keyword cmakeKWExternalProject contained \ USES_TERMINAL_CONFIGURE \ USES_TERMINAL_DOWNLOAD \ USES_TERMINAL_INSTALL + \ USES_TERMINAL_PATCH \ USES_TERMINAL_TEST \ USES_TERMINAL_UPDATE \ WORKING_DIRECTORY +syn keyword cmakeKWFetchContent contained + \ ALWAYS + \ BINARY_DIR + \ BUILD_COMMAND + \ BYPASS_PROVIDER + \ CMAKE_PROJECT_ + \ CONFIGURE_COMMAND + \ COPY + \ CORRECT + \ DCMAKE_TOOLCHAIN_FILE + \ DESTINATION + \ DOWNLOAD_NO_EXTRACT + \ EXISTS + \ FETCHCONTENT_BASE_DIR + \ FETCHCONTENT_FULLY_DISCONNECTED + \ FETCHCONTENT_MAKEAVAILABLE_SERIAL + \ FETCHCONTENT_QUIET + \ FETCHCONTENT_SOURCE_DIR_ + \ FETCHCONTENT_TRY_FIND_PACKAGE_MODE + \ FETCHCONTENT_UPDATES_DISCONNECTED + \ FETCHCONTENT_UPDATES_DISCONNECTED_ + \ FIND_PACKAGE_ARGS + \ GIT_REPOSITORY + \ GIT_TAG + \ GLOBAL + \ GTEST_BOTH_LIBRARIES + \ GTEST_LIBRARIES + \ GTEST_MAIN_LIBRARIES + \ INSTALL_COMMAND + \ INTERNAL + \ NAME + \ NAMES + \ NEVER + \ NOTE + \ OFF + \ OPTIONAL + \ OPT_IN + \ OVERRIDE_FIND_PACKAGE + \ PACKAGE_VERSION_COMPATIBLE + \ PACKAGE_VERSION_EXACT + \ QUIET + \ SOURCE_SUBDIR + \ STREQUAL + \ SUBBUILD_DIR + \ SVN_REPOSITORY + \ SVN_REVISION + \ SYSTEM + \ TARGET + \ TEST_COMMAND + \ TRUE + \ URL + \ URL_HASH + \ VERIFY_INTERFACE_HEADER_SETS + \ WRITE + \ WRONG + \ _BINARY_DIR + \ _INCLUDE + \ _POPULATED + \ _SOURCE_DIR + syn keyword cmakeKWadd_compile_definitions contained \ COMPILE_DEFINITIONS \ VAR syn keyword cmakeKWadd_compile_options contained + \ CMAKE_ + \ COMPILE_LANGUAGE \ COMPILE_OPTIONS + \ CONFIG \ SHELL \ UNIX_COMMAND - \ WX + \ _FLAGS + \ _FLAGS_ syn keyword cmakeKWadd_custom_command contained \ APPEND \ ARGS + \ BNF \ BYPRODUCTS \ CC \ COMMAND \ COMMAND_EXPAND_LISTS \ COMMENT + \ CONFIG \ CROSSCOMPILING_EMULATOR \ DEPENDS + \ DEPENDS_EXPLICIT_ONLY \ DEPFILE \ GENERATED \ IMPLICIT_DEPENDS @@ -2074,6 +2461,7 @@ syn keyword cmakeKWadd_custom_command contained \ JOB_POOLS \ JOIN \ MAIN_DEPENDENCY + \ MODULE \ NOT \ OUTPUT \ PATH @@ -2149,17 +2537,21 @@ syn keyword cmakeKWadd_library contained \ FRAMEWORK \ GLOBAL \ HEADER_FILE_ONLY + \ HEADER_SETS \ IMPORTED \ IMPORTED_ \ IMPORTED_IMPLIB \ IMPORTED_IMPLIB_ \ IMPORTED_LOCATION \ IMPORTED_LOCATION_ + \ IMPORTED_NO_SONAME \ IMPORTED_OBJECTS \ IMPORTED_OBJECTS_ + \ IMPORTED_SONAME \ INTERFACE \ INTERFACE_ \ INTERFACE_SOURCES + \ LC_ID_DYLIB \ LIBRARY_OUTPUT_DIRECTORY \ MODULE \ OBJECT @@ -2169,22 +2561,25 @@ syn keyword cmakeKWadd_library contained \ POST_BUILD \ PRE_BUILD \ PRE_LINK - \ PRIVATE - \ PUBLIC + \ PRIVATE_HEADER + \ PUBLIC_HEADER \ RUNTIME_OUTPUT_DIRECTORY \ SHARED + \ SONAME \ SOURCES \ STATIC + \ TARGETS \ TARGET_OBJECTS + \ TARGET_RUNTIME_DLLS \ UNKNOWN syn keyword cmakeKWadd_link_options contained \ CMAKE_ + \ CONFIG \ CUDA_RESOLVE_DEVICE_SYMBOLS \ CUDA_SEPARABLE_COMPILATION \ DEVICE_LINK \ GCC - \ GNU \ HOST_LINK \ LANG \ LINKER @@ -2192,11 +2587,14 @@ syn keyword cmakeKWadd_link_options contained \ SHELL \ STATIC_LIBRARY_OPTIONS \ UNIX_COMMAND + \ _FLAGS + \ _FLAGS_ \ _LINKER_WRAPPER_FLAG \ _LINKER_WRAPPER_FLAG_SEP syn keyword cmakeKWadd_subdirectory contained \ EXCLUDE_FROM_ALL + \ SYSTEM syn keyword cmakeKWadd_test contained \ BUILD_TESTING @@ -2210,15 +2608,64 @@ syn keyword cmakeKWadd_test contained \ SKIP_REGULAR_EXPRESSION \ TARGET_FILE \ WILL_FAIL + \ WILL_FALL \ WORKING_DIRECTORY +syn keyword cmakeKWblock contained + \ PARENT_SCOPE + \ POLICIES + \ PROPAGATE + \ PUSH + \ SCOPE_FOR + \ TRUE + \ VARIABLES + syn keyword cmakeKWbuild_command contained \ CONFIGURATION + \ PARALLEL_LEVEL \ TARGET +syn keyword cmakeKWcmake_file_api contained + \ API + \ API_VERSION + \ BUILD_DIR + \ CMAKEFILES + \ CODEMODEL + \ COMMAND + \ CONFIG + \ QUERY + \ TOOLCHAINS + syn keyword cmakeKWcmake_host_system_information contained + \ APPEND \ AVAILABLE_PHYSICAL_MEMORY \ AVAILABLE_VIRTUAL_MEMORY + \ BOTH + \ CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_PRETTY_NAME + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION + \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID + \ CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS + \ DISTRIB_INFO + \ DISTRIB_PRETTY_NAME + \ DISTRO + \ DISTRO_BUG_REPORT_URL + \ DISTRO_HOME_URL + \ DISTRO_ID + \ DISTRO_ID_LIKE + \ DISTRO_NAME + \ DISTRO_PRETTY_NAME + \ DISTRO_PRIVACY_POLICY_URL + \ DISTRO_SUPPORT_URL + \ DISTRO_UBUNTU_CODENAME + \ DISTRO_VERSION + \ DISTRO_VERSION_CODENAME + \ DISTRO_VERSION_ID + \ ERROR_VARIABLE + \ EXISTS \ FQDN \ HAS_FPU \ HAS_MMX @@ -2227,38 +2674,101 @@ syn keyword cmakeKWcmake_host_system_information contained \ HAS_SSE \ HAS_SSE_FP \ HAS_SSE_MMX + \ HKCC + \ HKCR + \ HKCU + \ HKEY_CLASSES_ROOT + \ HKEY_CURRENT_CONFIG + \ HKEY_CURRENT_USER + \ HKEY_LOCAL_MACHINE + \ HKEY_USERS + \ HKLM + \ HKU \ HOSTNAME \ ID + \ LIMIT_COUNT + \ LISTS + \ LTS + \ MATCHES + \ NNN + \ NOT \ NUMBER_OF_LOGICAL_CORES \ NUMBER_OF_PHYSICAL_CORES \ OS_NAME \ OS_PLATFORM \ OS_RELEASE \ OS_VERSION + \ PRETTY_NAME \ PROCESSOR_DESCRIPTION \ PROCESSOR_NAME \ PROCESSOR_SERIAL_NUMBER \ QUERY + \ REG_DWORD + \ REG_EXPAND_SZ + \ REG_MULTI_SZ + \ REG_QWORD + \ REG_SZ \ RESULT + \ SEPARATOR + \ SOFTWARE + \ STATUS + \ STRINGS + \ SUBKEYS + \ TARGET \ TOTAL_PHYSICAL_MEMORY \ TOTAL_VIRTUAL_MEMORY + \ VALUE_NAMES + \ VAR + \ VIEW + \ WINDOWS_REGISTRY syn keyword cmakeKWcmake_language contained \ AND + \ ANY + \ APPEND + \ ARGN + \ BINARY_DIR + \ BYPASS_PROVIDER \ CALL \ CANCEL_CALL \ CODE + \ COMMAND + \ COMMAND_ERROR_IS_FATAL + \ DCMAKE_PROJECT_TOP_LEVEL_INCLUDES \ DEFER \ DIRECTORY \ EVAL \ FALSE + \ FETCHCONTENT_MAKEAVAILABE_SERIAL + \ FETCHCONTENT_MAKEAVAILABLE_SERIAL + \ FETCHCONTENT_SOURCE_DIR_ + \ FETCHCONTENT_TRY_FIND_PACKAGE_MODE + \ FIND_PACKAGE + \ FIND_PACKAGE_ARGS \ GET_CALL_IDS - \ ID + \ GET_MESSAGE_LOG_LEVEL + \ GIT_REPOSITORY + \ GIT_SUBMODULES + \ GIT_TAG \ ID_VAR - \ OR + \ MATCHES + \ MYCOMP_PROVIDER_INSTALL_DIR + \ NEVER + \ NOT + \ OVERRIDE_FIND_PACKAGE + \ PATH + \ POP_BACK + \ QUIET + \ SET_DEPENDENCY_PROVIDER + \ SOURCE_DIR \ STATUS + \ STREQUAL + \ SUPPORTED_METHODS \ TRUE + \ VERSION \ WRITE + \ _FOUND + \ _PATH syn keyword cmakeKWcmake_minimum_required contained \ FATAL_ERROR @@ -2293,22 +2803,21 @@ syn keyword cmakeKWcmake_path contained \ ABSOLUTE_PATH \ AND \ APPEND + \ APPEND_STRING \ BASE_DIRECTORY - \ CMAKE_PATH \ COMPARE - \ CONCAT \ CONVERT - \ ELSEIF - \ ENDIF + \ EQUAL \ EXTENSION \ EXTENSION_DEF \ FALSE + \ FILENAME \ FILENAME_DEF \ GET \ GET_EXTENSION \ GET_FILENAME \ GET_PARENT_PATH - \ GET_RELATIVE_PATH + \ GET_RELATIVE_PART \ GET_ROOT_DIRECTORY \ GET_ROOT_NAME \ GET_ROOT_PATH @@ -2317,12 +2826,11 @@ syn keyword cmakeKWcmake_path contained \ HAS_EXTENSION \ HAS_FILENAME \ HAS_PARENT_PATH - \ HAS_RELATIVE_PATH + \ HAS_RELATIVE_PART \ HAS_ROOT_DIRECTORY \ HAS_ROOT_NAME \ HAS_ROOT_PATH \ HAS_STEM - \ IF \ IS_ABSOLUTE \ IS_PREFIX \ IS_RELATIVE @@ -2331,23 +2839,21 @@ syn keyword cmakeKWcmake_path contained \ NATIVE_PATH \ NORMALIZE \ NORMAL_PATH - \ NOT \ NOT_EQUAL \ OP - \ OS \ OUTPUT_VARIABLE \ PARENT_PATH - \ PROXIMATE_PATH \ REAL_PATH + \ RELATIVE_PART \ RELATIVE_PATH \ REMOVE_EXTENSION \ REMOVE_FILENAME \ REPLACE_EXTENSION \ REPLACE_FILENAME - \ RETURN \ ROOT_DIRECTORY \ ROOT_NAME \ ROOT_PATH + \ SET \ STEM \ STREQUAL \ TO_CMAKE_PATH_LIST @@ -2362,8 +2868,10 @@ syn keyword cmakeKWcmake_policy contained \ NNNN \ NO_POLICY_SCOPE \ OLD + \ POLICIES \ POP \ PUSH + \ SCOPE_FOR \ SET \ VERSION @@ -2375,9 +2883,14 @@ syn keyword cmakeKWconfigure_file contained \ FILE_PERMISSIONS \ FOO_ENABLE \ FOO_STRING + \ GENERATE + \ INTERFACE \ LF \ NEWLINE_STYLE \ NO_SOURCE_PERMISSIONS + \ PRIVATE + \ PUBLIC + \ SYSTEM \ USE_SOURCE_PERMISSIONS \ VAR @@ -2392,6 +2905,7 @@ syn keyword cmakeKWctest_build contained \ APPEND \ BUILD \ CAPTURE_CMAKE_ERROR + \ CMAKE_BUILD_PARALLEL_LEVEL \ CONFIGURATION \ CTEST_BUILD_CONFIGURATION \ CTEST_BUILD_FLAGS @@ -2399,6 +2913,7 @@ syn keyword cmakeKWctest_build contained \ FLAGS \ NUMBER_ERRORS \ NUMBER_WARNINGS + \ PARALLEL_LEVEL \ QUIET \ RETURN_VALUE \ TARGET @@ -2423,6 +2938,7 @@ syn keyword cmakeKWctest_coverage contained syn keyword cmakeKWctest_memcheck contained \ APPEND \ BUILD + \ CAPTURE_CMAKE_ERROR \ DEFECT_COUNT \ EXCLUDE \ EXCLUDE_FIXTURE @@ -2433,11 +2949,15 @@ syn keyword cmakeKWctest_memcheck contained \ INCLUDE_LABEL \ OFF \ ON + \ OUTPUT_JUNIT \ PARALLEL_LEVEL \ QUIET + \ REPEAT + \ RESOURCE_SPEC_FILE \ RETURN_VALUE \ SCHEDULE_RANDOM \ START + \ STOP_ON_FAILURE \ STOP_TIME \ STRIDE \ TEST_LOAD @@ -2473,6 +2993,8 @@ syn keyword cmakeKWctest_submit contained syn keyword cmakeKWctest_test contained \ AFTER_TIMEOUT \ APPEND + \ ATTACHED_FILES + \ ATTACHED_FILES_ON_FAIL \ BUILD \ CAPTURE_CMAKE_ERROR \ CPU @@ -2483,8 +3005,10 @@ syn keyword cmakeKWctest_test contained \ EXCLUDE_LABEL \ INCLUDE \ INCLUDE_LABEL + \ LABELS \ OFF \ ON + \ OUTPUT_JUNIT \ PARALLEL_LEVEL \ QUIET \ REPEAT @@ -2498,6 +3022,8 @@ syn keyword cmakeKWctest_test contained \ TEST_LOAD \ UNTIL_FAIL \ UNTIL_PASS + \ URL + \ XML syn keyword cmakeKWctest_update contained \ CAPTURE_CMAKE_ERROR @@ -2515,15 +3041,18 @@ syn keyword cmakeKWdefine_property contained \ APPEND_STRING \ BRIEF_DOCS \ CACHED_VARIABLE + \ CMAKE_ \ DIRECTORY \ FULL_DOCS \ GLOBAL \ INHERITED + \ INITIALIZE_FROM_VARIABLE \ PROPERTY \ SOURCE \ TARGET \ TEST \ VARIABLE + \ _CMAKE_ syn keyword cmakeKWdoxygen_add_docs contained \ ALL @@ -2533,7 +3062,12 @@ syn keyword cmakeKWdoxygen_add_docs contained syn keyword cmakeKWenable_language contained \ ASM + \ ASM_MARMASM + \ ASM_MASM + \ ASM_NASM + \ ATT \ CUDA + \ HIP \ ISPC \ OBJC \ OBJCXX @@ -2569,6 +3103,7 @@ syn keyword cmakeKWexecute_process contained \ OUTPUT_QUIET \ OUTPUT_STRIP_TRAILING_WHITESPACE \ OUTPUT_VARIABLE + \ POSIX \ RESULTS_VARIABLE \ RESULT_VARIABLE \ RFC @@ -2576,17 +3111,17 @@ syn keyword cmakeKWexecute_process contained \ STDOUT \ TIMEOUT \ UTF - \ VERBATIM \ WORKING_DIRECTORY syn keyword cmakeKWexport contained \ ANDROID_MK \ APPEND + \ CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API \ CONFIG + \ CXX_MODULES_DIRECTORY \ EXPORT \ EXPORT_LINK_INTERFACE_LIBRARIES \ FILE - \ IMPORTED \ IMPORTED_ \ NAMESPACE \ NDK @@ -2602,7 +3137,6 @@ syn keyword cmakeKWexport_library_dependencies contained \ SET syn keyword cmakeKWfile contained - \ ALGO \ APPEND \ ARCHIVE_CREATE \ ARCHIVE_EXTRACT @@ -2614,9 +3148,8 @@ syn keyword cmakeKWfile contained \ CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND \ CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM \ CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL + \ CMAKE_INSTALL_MODE \ CMAKE_OBJDUMP - \ CMAKE_TLS_CAINFO - \ CMAKE_TLS_VERIFY \ CODE \ COMPILE_FEATURES \ COMPRESSION @@ -2627,7 +3160,8 @@ syn keyword cmakeKWfile contained \ CONFLICTING_DEPENDENCIES_PREFIX \ CONTENT \ CONVERT - \ COPY + \ COPYONLY + \ COPY_FILE \ COPY_ON_ERROR \ CREATE_LINK \ CRLF @@ -2640,6 +3174,7 @@ syn keyword cmakeKWfile contained \ ENCODING \ ESCAPE_QUOTES \ EXECUTABLES + \ EXPAND_TILDE \ EXPECTED_HASH \ FILES_MATCHING \ FILE_PERMISSIONS @@ -2657,10 +3192,12 @@ syn keyword cmakeKWfile contained \ GUARD \ HASH \ HEX + \ HOME \ HTTPHEADER \ IGNORED \ INACTIVITY_TIMEOUT \ INPUT + \ INPUT_MAY_BE_RECENT \ INSTALL \ IS_ABSOLUTE \ LENGTH_MAXIMUM @@ -2685,9 +3222,11 @@ syn keyword cmakeKWfile contained \ NEWLINE_STYLE \ NOT \ NO_HEX_CONVERSION + \ NO_REPLACE \ NO_SOURCE_PERMISSIONS \ OFFSET \ ONLY + \ ONLY_IF_DIFFERENT \ OPTIONAL \ OUTPUT \ OWNER_EXECUTE @@ -2697,11 +3236,15 @@ syn keyword cmakeKWfile contained \ PATTERN \ PATTERNS \ PERMISSIONS + \ POST_EXCLUDE_FILES \ POST_EXCLUDE_REGEXES + \ POST_INCLUDE_FILES \ POST_INCLUDE_REGEXES \ PRE_EXCLUDE_REGEXES \ PRE_INCLUDE_REGEXES \ PROCESS + \ RANGE_END + \ RANGE_START \ READ \ READ_SYMLINK \ REAL_PATH @@ -2717,7 +3260,10 @@ syn keyword cmakeKWfile contained \ RESULT_VARIABLE \ RPATH \ RUNPATH + \ RUNTIME_DEPENDENCY_SET \ SCRIPT + \ SETGID + \ SETUID \ SHARED \ SHOW_PROGRESS \ SIZE @@ -2740,6 +3286,7 @@ syn keyword cmakeKWfile contained \ UNRESOLVED_DEPENDENCIES_VAR \ UPLOAD \ URL + \ USERPROFILE \ USERPWD \ USE_SOURCE_PERMISSIONS \ UTC @@ -2753,53 +3300,86 @@ syn keyword cmakeKWfile contained \ _FILENAMES syn keyword cmakeKWfind_file contained + \ BOTH + \ CATEGORY \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ \ DOC \ DVAR \ FALSE + \ FIND_XXX_REGISTRY_VIEW \ HINTS + \ HOST \ INCLUDE + \ MATCHES \ NAMES + \ NOT + \ NO_CACHE \ NO_CMAKE_ENVIRONMENT_PATH \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX \ NO_CMAKE_PATH \ NO_CMAKE_SYSTEM_PATH \ NO_DEFAULT_PATH \ NO_PACKAGE_ROOT_PATH \ NO_SYSTEM_ENVIRONMENT_PATH \ ONLY_CMAKE_FIND_ROOT_PATH + \ PACKAGENAME + \ PARENT_SCOPE \ PATHS \ PATH_SUFFIXES + \ REGISTRY_VIEW \ REQUIRED + \ TARGET + \ VALIDATOR \ VAR syn keyword cmakeKWfind_library contained + \ BOTH + \ CATEGORY \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ \ DOC \ DVAR \ FALSE + \ FIND_XXX_REGISTRY_VIEW \ HINTS - \ INCLUDE + \ HOST + \ LIB + \ MATCHES \ NAMES \ NAMES_PER_DIR + \ NOT + \ NO_CACHE \ NO_CMAKE_ENVIRONMENT_PATH \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX \ NO_CMAKE_PATH \ NO_CMAKE_SYSTEM_PATH \ NO_DEFAULT_PATH \ NO_PACKAGE_ROOT_PATH \ NO_SYSTEM_ENVIRONMENT_PATH \ ONLY_CMAKE_FIND_ROOT_PATH + \ PACKAGENAME + \ PARENT_SCOPE \ PATHS \ PATH_SUFFIXES + \ REGISTRY_VIEW \ REQUIRED + \ TARGET + \ VALIDATOR \ VAR syn keyword cmakeKWfind_package contained \ ABI + \ BOTH \ BUNDLE + \ BYPASS_PROVIDER + \ CATEGORY \ CMAKE_DISABLE_FIND_PACKAGE_ \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ + \ CMAKE_REQUIRE_FIND_PACKAGE_ \ COMPONENTS \ CONFIG \ CONFIGS @@ -2810,7 +3390,9 @@ syn keyword cmakeKWfind_package contained \ FALSE \ FIND_PACKAGE_VERSION_FORMAT \ FRAMEWORK + \ GLOBAL \ HINTS + \ HOST \ INCLUDE \ MODULE \ NAMES @@ -2818,6 +3400,7 @@ syn keyword cmakeKWfind_package contained \ NO_CMAKE_BUILDS_PATH \ NO_CMAKE_ENVIRONMENT_PATH \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX \ NO_CMAKE_PACKAGE_REGISTRY \ NO_CMAKE_PATH \ NO_CMAKE_SYSTEM_PACKAGE_REGISTRY @@ -2827,8 +3410,10 @@ syn keyword cmakeKWfind_package contained \ NO_PACKAGE_ROOT_PATH \ NO_POLICY_SCOPE \ NO_SYSTEM_ENVIRONMENT_PATH + \ OLD \ ONLY_CMAKE_FIND_ROOT_PATH \ OPTIONAL_COMPONENTS + \ PACKAGENAME \ PACKAGE_FIND_NAME \ PACKAGE_FIND_VERSION \ PACKAGE_FIND_VERSION_COMPLETE @@ -2857,60 +3442,92 @@ syn keyword cmakeKWfind_package contained \ PATHS \ PATH_SUFFIXES \ QUIET + \ REGISTRY_VIEW \ REQUIRED \ SET + \ TARGET \ TRUE + \ VALUE \ _CONFIG \ _CONSIDERED_CONFIGS \ _CONSIDERED_VERSIONS \ _DIR \ _FIND_COMPONENTS \ _FIND_QUIETLY + \ _FIND_REGISTRY_VIEW \ _FIND_REQUIRED \ _FIND_REQUIRED_ \ _FIND_VERSION_EXACT \ _FOUND syn keyword cmakeKWfind_path contained + \ BOTH + \ CATEGORY \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ \ DOC \ DVAR \ FALSE + \ FIND_XXX_REGISTRY_VIEW \ HINTS + \ HOST \ INCLUDE + \ MATCHES \ NAMES + \ NOT + \ NO_CACHE \ NO_CMAKE_ENVIRONMENT_PATH \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX \ NO_CMAKE_PATH \ NO_CMAKE_SYSTEM_PATH \ NO_DEFAULT_PATH \ NO_PACKAGE_ROOT_PATH \ NO_SYSTEM_ENVIRONMENT_PATH \ ONLY_CMAKE_FIND_ROOT_PATH + \ PACKAGENAME + \ PARENT_SCOPE \ PATHS \ PATH_SUFFIXES + \ REGISTRY_VIEW \ REQUIRED + \ TARGET + \ VALIDATOR \ VAR syn keyword cmakeKWfind_program contained + \ BOTH + \ CATEGORY \ CMAKE_FIND_ROOT_PATH_BOTH + \ CMAKE_FIND_USE_ \ DOC \ DVAR \ FALSE + \ FIND_XXX_REGISTRY_VIEW \ HINTS + \ HOST + \ MATCHES \ NAMES \ NAMES_PER_DIR + \ NOT + \ NO_CACHE \ NO_CMAKE_ENVIRONMENT_PATH \ NO_CMAKE_FIND_ROOT_PATH + \ NO_CMAKE_INSTALL_PREFIX \ NO_CMAKE_PATH \ NO_CMAKE_SYSTEM_PATH \ NO_DEFAULT_PATH \ NO_PACKAGE_ROOT_PATH \ NO_SYSTEM_ENVIRONMENT_PATH \ ONLY_CMAKE_FIND_ROOT_PATH + \ PACKAGENAME + \ PARENT_SCOPE \ PATHS \ PATH_SUFFIXES + \ REGISTRY_VIEW \ REQUIRED + \ TARGET + \ VALIDATOR \ VAR syn keyword cmakeKWfltk_wrap_ui contained @@ -2953,17 +3570,19 @@ syn keyword cmakeKWget_filename_component contained \ NAME \ NAME_WE \ NAME_WLE - \ PATH \ PROGRAM \ PROGRAM_ARGS + \ QUERY \ REALPATH \ REAL_PATH + \ WINDOWS_REGISTRY syn keyword cmakeKWget_property contained \ BRIEF_DOCS \ DEFINED \ DIRECTORY \ FULL_DOCS + \ GENERATED \ GLOBAL \ INSTALL \ PROPERTY @@ -2976,6 +3595,7 @@ syn keyword cmakeKWget_property contained syn keyword cmakeKWget_source_file_property contained \ DIRECTORY + \ GENERATED \ INHERITED \ LOCATION \ TARGET_DIRECTORY @@ -2992,6 +3612,7 @@ syn keyword cmakeKWif contained \ CMAKE_MATCH_ \ CMP \ COMMAND + \ COMPARE \ DEFINED \ EQUAL \ EXISTS @@ -3011,6 +3632,7 @@ syn keyword cmakeKWif contained \ NOT \ OFF \ OR + \ PATH_EQUAL \ POLICY \ STREQUAL \ STRGREATER @@ -3055,11 +3677,14 @@ syn keyword cmakeKWinclude_guard contained syn keyword cmakeKWinstall contained \ AFTER \ AIX + \ ALL_COMPONENTS \ APT \ ARCHIVE \ BEFORE \ BUILD_TYPE \ BUNDLE + \ BUNDLE_EXECUTABLE + \ CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API \ CMAKE_INSTALL_BINDIR \ CMAKE_INSTALL_DATADIR \ CMAKE_INSTALL_DATAROOTDIR @@ -3070,6 +3695,7 @@ syn keyword cmakeKWinstall contained \ CMAKE_INSTALL_LOCALEDIR \ CMAKE_INSTALL_LOCALSTATEDIR \ CMAKE_INSTALL_MANDIR + \ CMAKE_INSTALL_MODE \ CMAKE_INSTALL_RUNSTATEDIR \ CMAKE_INSTALL_SBINDIR \ CMAKE_INSTALL_SHARESTATEDIR @@ -3078,6 +3704,8 @@ syn keyword cmakeKWinstall contained \ COMPONENT \ CONFIGURATIONS \ CVS + \ CXX_MODULES_BMI + \ CXX_MODULES_DIRECTORY \ DATA \ DATAROOT \ DBUILD_TYPE @@ -3090,6 +3718,7 @@ syn keyword cmakeKWinstall contained \ DOC \ ENABLE_EXPORTS \ EXCLUDE_FROM_ALL + \ EXECUTABLES \ EXPORT \ EXPORT_ANDROID_MK \ EXPORT_LINK_INTERFACE_LIBRARIES @@ -3097,14 +3726,18 @@ syn keyword cmakeKWinstall contained \ FILES \ FILES_MATCHING \ FILE_PERMISSIONS + \ FILE_SET \ FRAMEWORK + \ GET_RUNTIME_DEPENDENCIES \ GROUP_EXECUTE \ GROUP_READ \ GROUP_WRITE - \ IMPORTED_ + \ HEADERS + \ IMPORTED_RUNTIME_ARTIFACTS \ INCLUDES \ INFO \ INSTALL_PREFIX + \ INTERFACE \ INTERFACE_INCLUDE_DIRECTORIES \ LIBRARY \ LOCALE @@ -3124,18 +3757,24 @@ syn keyword cmakeKWinstall contained \ OWNER_WRITE \ PATTERN \ PERMISSIONS + \ POST_EXCLUDE_FILES + \ POST_EXCLUDE_REGEXES + \ POST_INCLUDE_FILES + \ POST_INCLUDE_REGEXES \ POST_INSTALL_SCRIPT + \ PRE_EXCLUDE_REGEXES + \ PRE_INCLUDE_REGEXES \ PRE_INSTALL_SCRIPT \ PRIVATE_HEADER \ PROGRAMS \ PROPERTIES \ PUBLIC_HEADER - \ REGEX \ RENAME \ RESOURCE \ RPM \ RUNSTATE - \ RUNTIME + \ RUNTIME_DEPENDENCIES + \ RUNTIME_DEPENDENCY_SET \ SBIN \ SCRIPT \ SETGID @@ -3216,6 +3855,11 @@ syn keyword cmakeKWlist contained \ TOLOWER \ TOUPPER \ TRANSFORM + \ TRANSFORM_APPEND + \ TRANSFORM_GENEX_STRIP + \ TRANSFORM_REPLACE + \ TRANSFORM_STRIP + \ TRANSFORM_TOLOWER syn keyword cmakeKWload_cache contained \ EXCLUDE @@ -3253,10 +3897,15 @@ syn keyword cmakeKWmessage contained \ CHECK_FAIL \ CHECK_PASS \ CHECK_START + \ CONFIGURE_LOG \ DEBUG + \ DEFINED \ DEPRECATION \ FATAL_ERROR + \ GET_MESSAGE_LOG_LEVEL \ GUI + \ INTERNAL + \ MY_CHECK_RESULT \ NOTICE \ POP_BACK \ SEND_ERROR @@ -3267,13 +3916,17 @@ syn keyword cmakeKWmessage contained syn keyword cmakeKWoption contained \ OFF - \ ON syn keyword cmakeKWproject contained \ ASM + \ ASM_MARMASM + \ ASM_MASM + \ ASM_NASM + \ ATT \ CMAKE_PROJECT_ \ CUDA \ DESCRIPTION + \ HIP \ HOMEPAGE_URL \ ISPC \ LANGUAGES @@ -3287,6 +3940,7 @@ syn keyword cmakeKWproject contained \ _DESCRIPTION \ _HOMEPAGE_URL \ _INCLUDE_BEFORE + \ _IS_TOP_LEVEL \ _SOURCE_DIR \ _VERSION \ _VERSION_MAJOR @@ -3306,6 +3960,11 @@ syn keyword cmakeKWremove contained syn keyword cmakeKWreturn contained \ DEFER + \ PARENT_SCOPE + \ PROPAGATE + \ SCOPE_FOR + \ VARIABLES + \ VERSION syn keyword cmakeKWseparate_arguments contained \ MSDN @@ -3321,10 +3980,13 @@ syn keyword cmakeKWset contained \ FORCE \ INTERNAL \ OFF + \ OLD \ ON \ PARENT_SCOPE + \ PROPAGATE \ STRING \ STRINGS + \ VAR syn keyword cmakeKWset_directory_properties contained \ DIRECTORY @@ -3334,9 +3996,11 @@ syn keyword cmakeKWset_property contained \ APPEND \ APPEND_STRING \ DIRECTORY + \ GENERATED \ GLOBAL \ INHERITED \ INSTALL + \ NAME \ PROPERTY \ SOURCE \ TARGET @@ -3346,17 +4010,17 @@ syn keyword cmakeKWset_property contained syn keyword cmakeKWset_source_files_properties contained \ DIRECTORY + \ GENERATED \ PROPERTIES \ SOURCE \ TARGET_DIRECTORY syn keyword cmakeKWset_target_properties contained \ PROPERTIES - \ TARGET syn keyword cmakeKWset_tests_properties contained + \ NAME \ PROPERTIES - \ TEST syn keyword cmakeKWsite_name contained \ HOSTNAME @@ -3388,9 +4052,9 @@ syn keyword cmakeKWstring contained \ GUID \ HASH \ HEX + \ ISO \ JOIN \ JSON - \ JSONLENGTH \ LENGTH \ LESS \ LESS_EQUAL @@ -3455,7 +4119,10 @@ syn keyword cmakeKWtarget_compile_features contained syn keyword cmakeKWtarget_compile_options contained \ ALIAS \ BEFORE + \ CMAKE_ + \ COMPILE_LANGUAGE \ COMPILE_OPTIONS + \ CONFIG \ IMPORTED \ INTERFACE \ INTERFACE_COMPILE_OPTIONS @@ -3463,8 +4130,11 @@ syn keyword cmakeKWtarget_compile_options contained \ PUBLIC \ SHELL \ UNIX_COMMAND + \ _FLAGS + \ _FLAGS_ syn keyword cmakeKWtarget_include_directories contained + \ AFTER \ ALIAS \ BEFORE \ BUILD_INTERFACE @@ -3501,6 +4171,7 @@ syn keyword cmakeKWtarget_link_libraries contained \ IMPORTED_NO_SONAME \ INTERFACE \ INTERFACE_LINK_LIBRARIES + \ LINK_FLAGS \ LINK_INTERFACE_LIBRARIES \ LINK_INTERFACE_LIBRARIES_DEBUG \ LINK_INTERFACE_MULTIPLICITY @@ -3513,16 +4184,17 @@ syn keyword cmakeKWtarget_link_libraries contained \ PUBLIC \ SHARED \ STATIC + \ TARGET_OBJECTS syn keyword cmakeKWtarget_link_options contained \ ALIAS \ BEFORE \ CMAKE_ + \ CONFIG \ CUDA_RESOLVE_DEVICE_SYMBOLS \ CUDA_SEPARABLE_COMPILATION \ DEVICE_LINK \ GCC - \ GNU \ HOST_LINK \ IMPORTED \ INTERFACE @@ -3535,6 +4207,8 @@ syn keyword cmakeKWtarget_link_options contained \ SHELL \ STATIC_LIBRARY_OPTIONS \ UNIX_COMMAND + \ _FLAGS + \ _FLAGS_ \ _LINKER_WRAPPER_FLAG \ _LINKER_WRAPPER_FLAG_SEP @@ -3559,15 +4233,46 @@ syn keyword cmakeKWtarget_precompile_headers contained syn keyword cmakeKWtarget_sources contained \ ALIAS + \ BASE_DIRS + \ BUILD_INTERFACE + \ CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API + \ CONFIG + \ CORRECT + \ CXX_MODULES + \ CXX_MODULE_DIRS + \ CXX_MODULE_DIRS_ + \ CXX_MODULE_SETS + \ CXX_MODULE_SET_ + \ EXPORT + \ FILES + \ FILE_SET + \ FRAMEWORK + \ HEADERS + \ HEADER_DIRS + \ HEADER_DIRS_ + \ HEADER_FILE_ONLY + \ HEADER_SETS + \ HEADER_SET_ \ IMPORTED + \ INCLUDE_DIRECTORIES \ INTERFACE + \ INTERFACE_CXX_MODULE_SETS + \ INTERFACE_HEADER_SETS + \ INTERFACE_INCLUDE_DIRECTORIES \ INTERFACE_SOURCES + \ NAME \ PRIVATE \ PUBLIC \ SOURCES + \ SOURCE_DIR + \ TARGETS + \ TRUE + \ TYPE + \ WRONG syn keyword cmakeKWtry_compile contained \ ALL_BUILD + \ BINARY_DIR \ CMAKE_FLAGS \ COMPILE_DEFINITIONS \ COPY_FILE @@ -3592,8 +4297,11 @@ syn keyword cmakeKWtry_compile contained \ LINK_DIRECTORIES \ LINK_LIBRARIES \ LINK_OPTIONS + \ LOG_DESCRIPTION \ MULTI \ NOT + \ NO_CACHE + \ NO_LOG \ OBJCXX_EXTENSIONS \ OBJCXX_STANDARD \ OBJCXX_STANDARD_REQUIRED @@ -3602,9 +4310,16 @@ syn keyword cmakeKWtry_compile contained \ OBJC_STANDARD_REQUIRED \ OUTPUT_VARIABLE \ PRIVATE + \ PROJECT + \ RESULTVAR \ SOURCES + \ SOURCE_DIR + \ SOURCE_FROM_CONTENT + \ SOURCE_FROM_FILE + \ SOURCE_FROM_VAR \ STATIC_LIBRARY \ STATIC_LIBRARY_OPTIONS + \ TARGET \ TRUE \ TYPE \ VALUE @@ -3617,18 +4332,28 @@ syn keyword cmakeKWtry_run contained \ CMAKE_FLAGS \ COMPILE_DEFINITIONS \ COMPILE_OUTPUT_VARIABLE - \ DLINK_LIBRARIES - \ DVAR + \ COPY_FILE + \ COPY_FILE_ERROR \ FAILED_TO_RUN \ FALSE - \ INCLUDE_DIRECTORIES - \ LINK_DIRECTORIES + \ LANG \ LINK_LIBRARIES \ LINK_OPTIONS + \ LOG_DESCRIPTION + \ NO_CACHE + \ NO_LOG + \ RUN_OUTPUT_STDERR_VARIABLE + \ RUN_OUTPUT_STDOUT_VARIABLE \ RUN_OUTPUT_VARIABLE + \ SOURCES + \ SOURCE_FROM_CONTENT + \ SOURCE_FROM_FILE + \ SOURCE_FROM_VAR \ TRUE - \ TYPE - \ VALUE + \ WORKING_DIRECTORY + \ _EXTENSIONS + \ _STANDARD + \ _STANDARD_REQUIRED \ __TRYRUN_OUTPUT syn keyword cmakeKWunset contained @@ -3662,26 +4387,38 @@ syn keyword cmakeKWwrite_file contained syn keyword cmakeGeneratorExpressions contained - \ AND + \ ABSOLUTE_PATH + \ ACTION + \ AIX \ ANGLE + \ APPEND \ ARCHIVE_OUTPUT_NAME \ ARCHIVE_OUTPUT_NAME_ + \ ASCENDING \ BAR \ BOOL \ BUILD_INTERFACE - \ CMAKE_ - \ COMMA - \ COMMAND + \ BUILD_LOCAL_INTERFACE + \ CMAKE_LINK_GROUP_USING_ + \ CMAKE_LINK_LIBRARY_USING_ + \ CMAKE_PATH + \ CODE + \ COMMAND_CONFIG + \ COMMAND_EXPAND_LISTS + \ COMPARE \ COMPILE_DEFINITIONS \ COMPILE_FEATURES \ COMPILE_LANGUAGE \ COMPILE_LANG_AND_ID + \ COMPILE_ONLY \ COMPILING_CUDA + \ COMPILING_CXX \ COMPILING_CXX_WITH_CLANG \ COMPILING_CXX_WITH_INTEL \ COMPILING_C_WITH_CLANG \ CONFIG \ CONFIGURATION + \ CONTENT \ CUDA_COMPILER_ID \ CUDA_COMPILER_VERSION \ CUDA_RESOLVE_DEVICE_SYMBOLS @@ -3696,70 +4433,148 @@ syn keyword cmakeGeneratorExpressions contained \ C_STANDARD \ DEBUG_MODE \ DEBUG_POSTFIX + \ DENABLE_SOME_FEATURE + \ DESCENDING \ DEVICE_LINK \ DLL + \ ENABLE_EXPORTS \ EXCLUDE \ EXPORT + \ EXTENSION_DEF \ FALSE + \ FILENAME_DEF + \ FILE_BASENAME \ FILTER + \ FIND \ FOO_EXTRA_THINGS \ GENERATE \ GENEX_EVAL - \ GNU + \ GET_EXTENSION + \ GET_FILENAME + \ GET_PARENT_PATH + \ GET_RELATIVE_PART + \ GET_ROOT_DIRECTORY + \ GET_ROOT_NAME + \ GET_ROOT_PATH + \ GET_STEM + \ HAS_ + \ HAS_EXTENSION + \ HAS_FILENAME + \ HAS_PARENT_PATH + \ HAS_RELATIVE_PART + \ HAS_ROOT_DIRECTORY + \ HAS_ROOT_NAME + \ HAS_ROOT_PATH + \ HAS_STEM + \ HAVE_SOME_FEATURE + \ HIP_COMPILER_ID + \ HIP_COMPILER_VERSION \ HOST_LINK \ IF \ IGNORE + \ IMPORTED_LOCATION \ IMPORT_PREFIX \ IMPORT_SUFFIX \ INCLUDE_DIRECTORIES + \ INSENSITIVE + \ INSERT \ INSTALL_INTERFACE \ INSTALL_NAME_DIR \ INSTALL_PREFIX - \ INTERFACE + \ INSTALL_RPATH \ INTERFACE_LINK_LIBRARIES + \ INTERFACE_LINK_LIBRARIES_DIRECT \ IN_LIST \ ISPC_COMPILER_ID \ ISPC_COMPILER_VERSION + \ IS_ABSOLUTE + \ IS_PREFIX + \ IS_RELATIVE \ JOIN \ LANG \ LANG_COMPILER_ID + \ LAST_ONLY + \ LENGTH \ LIBRARY_OUTPUT_NAME \ LIBRARY_OUTPUT_NAME_ + \ LINK_GROUP + \ LINK_GROUP_PREDEFINED_FEATURES \ LINK_LANGUAGE \ LINK_LANG_AND_ID \ LINK_LIBRARIES + \ LINK_LIBRARY + \ LINK_LIBRARY_OVERRIDE + \ LINK_LIBRARY_OVERRIDE_ + \ LINK_LIBRARY_PREDEFINED_FEATURES \ LINK_ONLY \ LOWER_CASE \ MAKE_C_IDENTIFIER \ MAP_IMPORTED_CONFIG_ + \ MODULE + \ NATURAL \ NO + \ NORMALIZE + \ NORMAL_PATH \ NOT \ OBJCXX_COMPILER_ID \ OBJCXX_COMPILER_VERSION \ OBJC_COMPILER_ID \ OBJC_COMPILER_VERSION + \ OBJECT \ OFF \ OLD_COMPILER + \ ORDER + \ OUTPUT + \ OUTPUT_CONFIG \ OUTPUT_NAME \ OUTPUT_NAME_ + \ PATH + \ PATH_EQUAL \ PDB_NAME \ PDB_NAME_ \ PDB_OUTPUT_DIRECTORY \ PDB_OUTPUT_DIRECTORY_ \ PLATFORM_ID + \ POP_BACK + \ POP_FRONT \ POSIX + \ POST_BUILD + \ PREPEND \ PRIVATE \ PUBLIC + \ REGEX + \ RELATIVE_PATH + \ REMOVE_AT \ REMOVE_DUPLICATES + \ REMOVE_EXTENSION + \ REMOVE_FILENAME + \ REMOVE_ITEM + \ REPLACE + \ REPLACE_EXTENSION + \ REPLACE_FILENAME + \ REQUIRED + \ RESCAN + \ REVERSE + \ RPATH + \ RUNTIME_DEPENDENCY_SET \ RUNTIME_OUTPUT_NAME \ RUNTIME_OUTPUT_NAME_ + \ SCRIPT \ SDK + \ SELECTOR \ SEMICOLON + \ SENSITIVE + \ SHARED \ SHELL_PATH + \ SORT \ STATIC \ STREQUAL + \ STRING + \ STRIP + \ SUBLIST \ TARGET_BUNDLE_CONTENT_DIR \ TARGET_BUNDLE_DIR + \ TARGET_BUNDLE_DIR_NAME \ TARGET_EXISTS \ TARGET_FILE \ TARGET_FILE_BASE_NAME @@ -3768,12 +4583,30 @@ syn keyword cmakeGeneratorExpressions contained \ TARGET_FILE_PREFIX \ TARGET_FILE_SUFFIX \ TARGET_GENEX_EVAL + \ TARGET_IMPORT_FILE + \ TARGET_IMPORT_FILE_BASE_NAME + \ TARGET_IMPORT_FILE_DIR + \ TARGET_IMPORT_FILE_NAME + \ TARGET_IMPORT_FILE_PREFIX + \ TARGET_IMPORT_FILE_SUFFIX \ TARGET_LINKER_FILE \ TARGET_LINKER_FILE_BASE_NAME \ TARGET_LINKER_FILE_DIR \ TARGET_LINKER_FILE_NAME \ TARGET_LINKER_FILE_PREFIX \ TARGET_LINKER_FILE_SUFFIX + \ TARGET_LINKER_IMPORT_FILE + \ TARGET_LINKER_IMPORT_FILE_BASE_NAME + \ TARGET_LINKER_IMPORT_FILE_DIR + \ TARGET_LINKER_IMPORT_FILE_NAME + \ TARGET_LINKER_IMPORT_FILE_PREFIX + \ TARGET_LINKER_IMPORT_FILE_SUFFIX + \ TARGET_LINKER_LIBRARY_FILE + \ TARGET_LINKER_LIBRARY_FILE_BASE_NAME + \ TARGET_LINKER_LIBRARY_FILE_DIR + \ TARGET_LINKER_LIBRARY_FILE_NAME + \ TARGET_LINKER_LIBRARY_FILE_PREFIX + \ TARGET_LINKER_LIBRARY_FILE_SUFFIX \ TARGET_NAME_IF_EXISTS \ TARGET_OBJECTS \ TARGET_PDB_FILE @@ -3782,16 +4615,34 @@ syn keyword cmakeGeneratorExpressions contained \ TARGET_PDB_FILE_NAME \ TARGET_POLICY \ TARGET_PROPERTY + \ TARGET_RUNTIME_DLLS + \ TARGET_RUNTIME_DLL_DIRS \ TARGET_SONAME_FILE \ TARGET_SONAME_FILE_DIR \ TARGET_SONAME_FILE_NAME + \ TARGET_SONAME_IMPORT_FILE + \ TARGET_SONAME_IMPORT_FILE_DIR + \ TARGET_SONAME_IMPORT_FILE_NAME + \ TOLOWER + \ TOUPPER + \ TRANSFORM + \ TRANSFORM_APPEND + \ TRANSFORM_REPLACE + \ TRANSFORM_STRIP + \ TRANSFORM_TOLOWER + \ UNKNOWN \ UPPER_CASE + \ VERBATIM \ VERSION_EQUAL - \ VERSION_GREATER \ VERSION_GREATER_EQUAL \ VERSION_LESS \ VERSION_LESS_EQUAL + \ WHOLE_ARCHIVE + \ WRONG + \ _LINK_GROUP_USING_ + \ _LINK_LIBRARY_USING_ \ _POSTFIX + \ _SUPPORTED syn case ignore @@ -3808,8 +4659,10 @@ syn keyword cmakeCommand \ add_subdirectory \ add_test \ aux_source_directory + \ block \ break \ build_command + \ cmake_file_api \ cmake_host_system_information \ cmake_language \ cmake_minimum_required @@ -3835,6 +4688,7 @@ syn keyword cmakeCommand \ define_property \ enable_language \ enable_testing + \ endblock \ endfunction \ endmacro \ execute_process @@ -3958,6 +4812,7 @@ hi def link cmakeVariableValue Type hi def link cmakeVariable Identifier hi def link cmakeKWExternalProject ModeMsg +hi def link cmakeKWFetchContent ModeMsg hi def link cmakeKWadd_compile_definitions ModeMsg hi def link cmakeKWadd_compile_options ModeMsg hi def link cmakeKWadd_custom_command ModeMsg @@ -3969,7 +4824,9 @@ hi def link cmakeKWadd_library ModeMsg hi def link cmakeKWadd_link_options ModeMsg hi def link cmakeKWadd_subdirectory ModeMsg hi def link cmakeKWadd_test ModeMsg +hi def link cmakeKWblock ModeMsg hi def link cmakeKWbuild_command ModeMsg +hi def link cmakeKWcmake_file_api ModeMsg hi def link cmakeKWcmake_host_system_information ModeMsg hi def link cmakeKWcmake_language ModeMsg hi def link cmakeKWcmake_minimum_required ModeMsg From f60e92126296c0d87130ea20b9d4680d51fca62d Mon Sep 17 00:00:00 2001 From: Thomas Schenker Date: Fri, 7 Jul 2023 19:42:28 +0200 Subject: [PATCH 098/627] find_library: Improve regex readability in --debug-find output If there is only one possible library prefix/suffix, omit the capture group around it in the debug output. --- Source/cmFindLibraryCommand.cxx | 10 ++++++++-- .../find_library/FromScriptMode-stderr-darwin.txt | 2 +- Tests/RunCMake/find_library/FromScriptMode-stderr.txt | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 9eb060357aa..6a571b42910 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -251,8 +251,14 @@ struct cmFindLibraryHelper void DebugLibraryFailed(std::string const& name, std::string const& path) { if (this->DebugMode) { - auto regexName = - cmStrCat(this->PrefixRegexStr, name, this->SuffixRegexStr); + // To improve readability of the debug output, if there is only one + // prefix/suffix, use the plain prefix/suffix instead of the regex. + const auto& prefix = (this->Prefixes.size() == 1) ? this->Prefixes[0] + : this->PrefixRegexStr; + const auto& suffix = (this->Suffixes.size() == 1) ? this->Suffixes[0] + : this->SuffixRegexStr; + + auto regexName = cmStrCat(prefix, name, suffix); this->DebugSearches.FailedAt(path, regexName); } } diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt index 185720bbb4c..b0bf4609037 100644 --- a/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr-darwin.txt @@ -1,4 +1,4 @@ .*find_library considered the following locations.* -.*\(lib\)library_no_exist\(\\.tbd\|\\.dylib\|\\.so\|\\.a\).* +.*liblibrary_no_exist\(\\.tbd\|\\.dylib\|\\.so\|\\.a\).* .*The item was found at.* .*lib/libcreated.a.* diff --git a/Tests/RunCMake/find_library/FromScriptMode-stderr.txt b/Tests/RunCMake/find_library/FromScriptMode-stderr.txt index 046f680766b..6f251848d0e 100644 --- a/Tests/RunCMake/find_library/FromScriptMode-stderr.txt +++ b/Tests/RunCMake/find_library/FromScriptMode-stderr.txt @@ -1,4 +1,4 @@ .*find_library considered the following locations.* -.*\(lib\)library_no_exist\(\\.so\|\\.a\).* +.*liblibrary_no_exist\(\\.so\|\\.a\).* .*The item was found at.* .*lib/libcreated.a.* From 3087b3dbac09f0a206bdc31fd9db2fba7821d0e4 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 14 Jul 2023 00:01:11 -0400 Subject: [PATCH 099/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 24daf135554..6c766486030 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230713) +set(CMake_VERSION_PATCH 20230714) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 2a68ba31175f4a908fd0a64386623e05153a0e08 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 15 Jul 2023 00:01:14 -0400 Subject: [PATCH 100/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6c766486030..5c230c3672c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230714) +set(CMake_VERSION_PATCH 20230715) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From d747bc18e1010e71482478b4a9bc60c49f7e2044 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 16 Jul 2023 00:01:09 -0400 Subject: [PATCH 101/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5c230c3672c..d8724f27110 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230715) +set(CMake_VERSION_PATCH 20230716) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From a28217eb8c3c8fd6287661dc3b4bc56a14e0d019 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 17 Jul 2023 00:01:50 -0400 Subject: [PATCH 102/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d8724f27110..9722c76b8a0 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230716) +set(CMake_VERSION_PATCH 20230717) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 3c685a578a44063bb027787426d2c8b7202a7979 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Sat, 1 Jul 2023 14:20:15 +0200 Subject: [PATCH 103/627] LINK_OPTIONS: ensure correct dollar escaping Ensure correct escaping for Ninja and Makefile generators. Fixes: #25049 --- Source/cmGlobalGenerator.h | 2 ++ Source/cmGlobalNinjaGenerator.cxx | 12 ++++++------ Source/cmGlobalNinjaGenerator.h | 4 ++-- Source/cmLocalGenerator.cxx | 11 +++++++++++ Source/cmMakefileTargetGenerator.cxx | 6 ++++++ Source/cmNinjaNormalTargetGenerator.cxx | 4 ---- .../LINK_OPTIONS-dollar-option-check.cmake | 4 ++++ .../LINK_OPTIONS-dollar-option-result.txt | 1 + .../RunCMake/target_link_options/LINK_OPTIONS.cmake | 4 ++++ .../RunCMake/target_link_options/RunCMakeTest.cmake | 2 +- 10 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-check.cmake create mode 100644 Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-result.txt diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index bc59514fb54..735c4baf7c1 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -637,6 +637,8 @@ class cmGlobalGenerator }; StripCommandStyle GetStripCommandStyle(std::string const& strip); + virtual std::string& EncodeLiteral(std::string& lit) { return lit; } + protected: // for a project collect all its targets by following depend // information, and also collect all the targets diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index e405909edcc..71084ccbdfb 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -181,14 +181,13 @@ std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name) return encoded; } -std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string& lit) +std::string cmGlobalNinjaGenerator::GetEncodedLiteral(const std::string& lit) { std::string result = lit; - EncodeLiteralInplace(result); - return result; + return this->EncodeLiteral(result); } -void cmGlobalNinjaGenerator::EncodeLiteralInplace(std::string& lit) +std::string& cmGlobalNinjaGenerator::EncodeLiteral(std::string& lit) { cmSystemTools::ReplaceString(lit, "$", "$$"); cmSystemTools::ReplaceString(lit, "\n", "$\n"); @@ -196,6 +195,7 @@ void cmGlobalNinjaGenerator::EncodeLiteralInplace(std::string& lit) cmSystemTools::ReplaceString(lit, cmStrCat('$', this->GetCMakeCFGIntDir()), this->GetCMakeCFGIntDir()); } + return lit; } std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path) @@ -207,7 +207,7 @@ std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path) else std::replace(result.begin(), result.end(), '/', '\\'); #endif - this->EncodeLiteralInplace(result); + this->EncodeLiteral(result); cmSystemTools::ReplaceString(result, " ", "$ "); cmSystemTools::ReplaceString(result, ":", "$:"); return result; @@ -394,7 +394,7 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild( #endif vars["COMMAND"] = std::move(cmd); } - vars["DESC"] = this->EncodeLiteral(description); + vars["DESC"] = this->GetEncodedLiteral(description); if (restat) { vars["restat"] = "1"; } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 95d64e3a3a4..4b026eb49bd 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -77,8 +77,8 @@ class cmGlobalNinjaGenerator : public cmGlobalCommonGenerator static void WriteDivider(std::ostream& os); static std::string EncodeRuleName(std::string const& name); - std::string EncodeLiteral(const std::string& lit); - void EncodeLiteralInplace(std::string& lit); + std::string& EncodeLiteral(std::string& lit) override; + std::string GetEncodedLiteral(const std::string& lit); std::string EncodePath(const std::string& path); std::unique_ptr CreateLinkLineComputer( diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7ad4023de55..cf1eb967969 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1431,11 +1431,14 @@ void cmLocalGenerator::GetDeviceLinkFlags( } this->AddVisibilityPresetFlags(linkFlags, target, "CUDA"); + this->GetGlobalGenerator()->EncodeLiteral(linkFlags); std::vector linkOpts; target->GetLinkOptions(linkOpts, config, "CUDA"); + this->SetLinkScriptShell(this->GetGlobalGenerator()->GetUseLinkScript()); // LINK_OPTIONS are escaped. this->AppendCompileOptions(linkFlags, linkOpts); + this->SetLinkScriptShell(false); } void cmLocalGenerator::GetTargetFlags( @@ -1501,13 +1504,17 @@ void cmLocalGenerator::GetTargetFlags( } if (!sharedLibFlags.empty()) { + this->GetGlobalGenerator()->EncodeLiteral(sharedLibFlags); linkFlags.emplace_back(std::move(sharedLibFlags)); } std::vector> linkOpts = target->GetLinkOptions(config, linkLanguage); + this->SetLinkScriptShell(this->GetGlobalGenerator()->GetUseLinkScript()); // LINK_OPTIONS are escaped. this->AppendCompileOptions(linkFlags, linkOpts); + this->SetLinkScriptShell(false); + if (pcli) { this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, frameworkPath, linkPath); @@ -1581,13 +1588,16 @@ void cmLocalGenerator::GetTargetFlags( } if (!exeFlags.empty()) { + this->GetGlobalGenerator()->EncodeLiteral(exeFlags); linkFlags.emplace_back(std::move(exeFlags)); } std::vector> linkOpts = target->GetLinkOptions(config, linkLanguage); + this->SetLinkScriptShell(this->GetGlobalGenerator()->GetUseLinkScript()); // LINK_OPTIONS are escaped. this->AppendCompileOptions(linkFlags, linkOpts); + this->SetLinkScriptShell(false); } break; default: break; @@ -1603,6 +1613,7 @@ void cmLocalGenerator::GetTargetFlags( config); if (!extraLinkFlags.empty()) { + this->GetGlobalGenerator()->EncodeLiteral(extraLinkFlags); linkFlags.emplace_back(std::move(extraLinkFlags)); } } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 1dd48b3b715..5e3bf61e388 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -126,8 +126,11 @@ void cmMakefileTargetGenerator::GetDeviceLinkFlags( std::vector linkOpts; this->GeneratorTarget->GetLinkOptions(linkOpts, this->GetConfigName(), linkLanguage); + this->LocalGenerator->SetLinkScriptShell( + this->GlobalGenerator->GetUseLinkScript()); // LINK_OPTIONS are escaped. this->LocalGenerator->AppendCompileOptions(linkFlags, linkOpts); + this->LocalGenerator->SetLinkScriptShell(false); } void cmMakefileTargetGenerator::GetTargetLinkFlags( @@ -144,8 +147,11 @@ void cmMakefileTargetGenerator::GetTargetLinkFlags( std::vector opts; this->GeneratorTarget->GetLinkOptions(opts, this->GetConfigName(), linkLanguage); + this->LocalGenerator->SetLinkScriptShell( + this->GlobalGenerator->GetUseLinkScript()); // LINK_OPTIONS are escaped. this->LocalGenerator->AppendCompileOptions(flags, opts); + this->LocalGenerator->SetLinkScriptShell(false); this->LocalGenerator->AppendPositionIndependentLinkerFlags( flags, this->GeneratorTarget, this->GetConfigName(), linkLanguage); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 063ca6ba6a8..a5280fb54db 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -952,8 +952,6 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement( this->addPoolNinjaVariable("JOB_POOL_LINK", genTarget, vars); - vars["LINK_FLAGS"] = globalGen->EncodeLiteral(vars["LINK_FLAGS"]); - vars["MANIFESTS"] = this->GetManifests(config); vars["LINK_PATH"] = frameworkPath + linkPath; @@ -1271,8 +1269,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement( vars["LINK_FLAGS"], this->GetGeneratorTarget(), this->TargetLinkLanguage(config)); - vars["LINK_FLAGS"] = globalGen->EncodeLiteral(vars["LINK_FLAGS"]); - vars["MANIFESTS"] = this->GetManifests(config); vars["AIX_EXPORTS"] = this->GetAIXExports(config); diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-check.cmake new file mode 100644 index 00000000000..0f897feb50a --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_\\$dollar") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_$dollar'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-result.txt new file mode 100644 index 00000000000..8d98f9debde --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-dollar-option-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake index bb048412e8a..879151b228a 100644 --- a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake @@ -53,3 +53,7 @@ target_link_options(LinkOptions_mod PRIVATE $<$:${pre}BADFLAG_RE # executable with generator expression add_executable(LinkOptions_exe LinkOptionsExe.c) target_link_options(LinkOptions_exe PRIVATE $<$:${pre}BADFLAG_RELEASE${obj}>) + +# executable with dollar character +add_executable(LinkOptions_dollar_exe LinkOptionsExe.c) +target_link_options(LinkOptions_dollar_exe PRIVATE "${pre}BADFLAG_$dollar${obj}") diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake index 1a29ecfa3bb..ff0c5a82586 100644 --- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -30,7 +30,7 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release) run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release) run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release) - + run_cmake_target(LINK_OPTIONS dollar-option LinkOptions_dollar_exe --config Release) run_cmake(genex_LINK_LANGUAGE) From c65e01a9796e5c54e9b193375261e11f26042311 Mon Sep 17 00:00:00 2001 From: Chris Mahoney Date: Fri, 23 Jun 2023 10:46:28 -0400 Subject: [PATCH 104/627] Tutorial: Clarify Step 3 --- ...dding Usage Requirements for a Library.rst | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/Help/guide/tutorial/Adding Usage Requirements for a Library.rst b/Help/guide/tutorial/Adding Usage Requirements for a Library.rst index 227306393e4..5e803f5b16a 100644 --- a/Help/guide/tutorial/Adding Usage Requirements for a Library.rst +++ b/Help/guide/tutorial/Adding Usage Requirements for a Library.rst @@ -127,7 +127,7 @@ Remove this line:
-And the lines: +And remove ``EXTRA_INCLUDES`` from ``target_include_directories``: .. raw:: html @@ -143,23 +143,6 @@ And the lines: -The remaining code looks like: - -.. raw:: html - -
Click to show/hide the resulting code - -.. literalinclude:: Step4/CMakeLists.txt - :caption: Remaining code after removing EXTRA_INCLUDES - :name: CMakeLists.txt-after-removing-EXTRA_INCLUDES - :language: cmake - :start-after: add_subdirectory(MathFunctions) - -.. raw:: html - -
- - Notice that with this technique, the only thing our executable target does to use our library is call :command:`target_link_libraries` with the name of the library target. In larger projects, the classic method of specifying @@ -309,8 +292,8 @@ and this: :caption: TODO 7: MathFunctions/CMakeLists.txt :name: MathFunctions-SqrtLibrary-target_link_libraries-step4 :language: cmake - :start-after: target_link_libraries(SqrtLibrary - :end-before: endif() + :start-after: # link our compiler flags interface library + :end-before: target_link_libraries(MathFunctions PUBLIC SqrtLibrary) .. raw:: html From 93289830eaac4ddbf6039f8e46316c2de9105bbf Mon Sep 17 00:00:00 2001 From: Chris Mahoney Date: Fri, 23 Jun 2023 10:46:47 -0400 Subject: [PATCH 105/627] Tutorial: Clarify Step 4 TODO 4 --- Help/guide/tutorial/Adding Generator Expressions.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Help/guide/tutorial/Adding Generator Expressions.rst b/Help/guide/tutorial/Adding Generator Expressions.rst index 3dab97ff048..910eacb4caa 100644 --- a/Help/guide/tutorial/Adding Generator Expressions.rst +++ b/Help/guide/tutorial/Adding Generator Expressions.rst @@ -149,8 +149,8 @@ interface library. Lastly, we only want these warning flags to be used during builds. Consumers of our installed project should not inherit our warning flags. To specify -this, we wrap our flags in a generator expression using the ``BUILD_INTERFACE`` -condition. The resulting full code looks like the following: +this, we wrap our flags from TODO 3 in a generator expression using the +``BUILD_INTERFACE`` condition. The resulting full code looks like the following: .. raw:: html From 5e56300742c2f5232c4a7f8cc67bf34e27a3722a Mon Sep 17 00:00:00 2001 From: Chris Mahoney Date: Fri, 23 Jun 2023 10:48:56 -0400 Subject: [PATCH 106/627] Tutorial: Refactor Step 10 --- .../Selecting Static or Shared Libraries.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Help/guide/tutorial/Selecting Static or Shared Libraries.rst b/Help/guide/tutorial/Selecting Static or Shared Libraries.rst index 504e42fd58d..a2f5e2a4a59 100644 --- a/Help/guide/tutorial/Selecting Static or Shared Libraries.rst +++ b/Help/guide/tutorial/Selecting Static or Shared Libraries.rst @@ -44,7 +44,18 @@ SqrtLibrary to be ``True`` when building shared libraries. :caption: MathFunctions/CMakeLists.txt :name: MathFunctions/CMakeLists.txt-POSITION_INDEPENDENT_CODE :language: cmake - :lines: 37-42 + :start-at: # state that SqrtLibrary need PIC when the default is shared libraries + :end-at: ) + +Define ``EXPORTING_MYMATH`` stating we are using ``declspec(dllexport)`` when +building on Windows. + +.. literalinclude:: Step11/MathFunctions/CMakeLists.txt + :caption: MathFunctions/CMakeLists.txt + :name: MathFunctions/CMakeLists.txt-dll-export + :language: cmake + :start-at: # define the symbol stating we are using the declspec(dllexport) when + :end-at: target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH") **Exercise**: We modified ``MathFunctions.h`` to use dll export defines. Using CMake documentation can you find a helper module to simplify this? From 051cea7b7ecb2dd84199407165843006765588cf Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 17 Jul 2023 14:12:10 -0400 Subject: [PATCH 107/627] cmExperimental: Expose feature data API --- Source/cmExperimental.cxx | 18 ++++++++---------- Source/cmExperimental.h | 11 +++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx index 0a746a9f33a..8dc2b72fab3 100644 --- a/Source/cmExperimental.cxx +++ b/Source/cmExperimental.cxx @@ -18,14 +18,7 @@ namespace { * Search for other instances to keep the documentation and test suite * up-to-date. */ - -struct FeatureData -{ - std::string const Uuid; - std::string const Variable; - std::string const Description; - bool Warned; -} LookupTable[] = { +cmExperimental::FeatureData LookupTable[] = { // CxxModuleCMakeApi { "bf70d4b0-9fb7-465c-9803-34014e70d112", "CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API", @@ -37,17 +30,22 @@ static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) == static_cast(cmExperimental::Feature::Sentinel), "Experimental feature lookup table mismatch"); -FeatureData& DataForFeature(cmExperimental::Feature f) +cmExperimental::FeatureData& DataForFeature(cmExperimental::Feature f) { assert(f != cmExperimental::Feature::Sentinel); return LookupTable[static_cast(f)]; } } +const cmExperimental::FeatureData& cmExperimental::DataForFeature(Feature f) +{ + return ::DataForFeature(f); +} + bool cmExperimental::HasSupportEnabled(cmMakefile const& mf, Feature f) { bool enabled = false; - auto& data = DataForFeature(f); + auto& data = ::DataForFeature(f); auto value = mf.GetDefinition(data.Variable); if (value == data.Uuid) { diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h index 26e0d17dbea..97eb5867cb8 100644 --- a/Source/cmExperimental.h +++ b/Source/cmExperimental.h @@ -5,6 +5,8 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include + class cmMakefile; class cmExperimental @@ -17,5 +19,14 @@ class cmExperimental Sentinel, }; + struct FeatureData + { + std::string const Uuid; + std::string const Variable; + std::string const Description; + bool Warned; + }; + + static const FeatureData& DataForFeature(Feature f); static bool HasSupportEnabled(cmMakefile const& mf, Feature f); }; From 1ca82e7a04b16159721c44385c3b5b8a2762f735 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 17 Jul 2023 11:05:38 -0400 Subject: [PATCH 108/627] cmake_language(): Add undocumented GET_EXPERIMENTAL_FEATURE_ENABLED mode --- Source/cmCMakeLanguageCommand.cxx | 46 +++++++++++++++++++++++++++++++ Source/cmExperimental.cxx | 2 +- Source/cmExperimental.h | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx index c7e9209d406..d65543a8c6b 100644 --- a/Source/cmCMakeLanguageCommand.cxx +++ b/Source/cmCMakeLanguageCommand.cxx @@ -17,6 +17,7 @@ #include "cmArgumentParserTypes.h" #include "cmDependencyProvider.h" #include "cmExecutionStatus.h" +#include "cmExperimental.h" #include "cmGlobalGenerator.h" #include "cmListFileCache.h" #include "cmMakefile.h" @@ -328,6 +329,46 @@ bool cmCMakeLanguageCommandGET_MESSAGE_LOG_LEVEL( makefile.AddDefinition(outputVariable, outputValue); return true; } + +bool cmCMakeLanguageCommandGET_EXPERIMENTAL_FEATURE_ENABLED( + std::vector const& args, cmExecutionStatus& status) +{ + cmMakefile& makefile = status.GetMakefile(); + std::vector expandedArgs; + makefile.ExpandArguments(args, expandedArgs); + + if (expandedArgs.size() != 3) { + return FatalError(status, + "sub-command GET_EXPERIMENTAL_FEATURE_ENABLED expects " + "exactly two arguments"); + } + + auto const& featureName = expandedArgs[1]; + auto const& variableName = expandedArgs[2]; + + auto feature = cmExperimental::Feature::Sentinel; + for (std::size_t i = 0; + i < static_cast(cmExperimental::Feature::Sentinel); i++) { + if (cmExperimental::DataForFeature(static_cast(i)) + .Name == featureName) { + feature = static_cast(i); + break; + } + } + if (feature == cmExperimental::Feature::Sentinel) { + return FatalError(status, + cmStrCat("Experimental feature name \"", featureName, + "\" does not exist.")); + } + + if (cmExperimental::HasSupportEnabled(makefile, feature)) { + makefile.AddDefinition(variableName, "TRUE"); + } else { + makefile.AddDefinition(variableName, "FALSE"); + } + + return true; +} } bool cmCMakeLanguageCommand(std::vector const& args, @@ -480,5 +521,10 @@ bool cmCMakeLanguageCommand(std::vector const& args, return cmCMakeLanguageCommandGET_MESSAGE_LOG_LEVEL(args, status); } + if (expArgs[expArg] == "GET_EXPERIMENTAL_FEATURE_ENABLED") { + return cmCMakeLanguageCommandGET_EXPERIMENTAL_FEATURE_ENABLED(args, + status); + } + return FatalError(status, "called with unknown meta-operation"); } diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx index 8dc2b72fab3..bdbd353fd8c 100644 --- a/Source/cmExperimental.cxx +++ b/Source/cmExperimental.cxx @@ -20,7 +20,7 @@ namespace { */ cmExperimental::FeatureData LookupTable[] = { // CxxModuleCMakeApi - { "bf70d4b0-9fb7-465c-9803-34014e70d112", + { "CxxModuleCMakeApi", "bf70d4b0-9fb7-465c-9803-34014e70d112", "CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API", "CMake's C++ module support is experimental. It is meant only for " "experimentation and feedback to CMake developers.", diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h index 97eb5867cb8..46c5fb73a24 100644 --- a/Source/cmExperimental.h +++ b/Source/cmExperimental.h @@ -21,6 +21,7 @@ class cmExperimental struct FeatureData { + std::string const Name; std::string const Uuid; std::string const Variable; std::string const Description; From d84681d8f068225f786453a5a77791a1eb8e5459 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 17 Jul 2023 14:02:33 -0400 Subject: [PATCH 109/627] try_compile(): Pass down CMAKE_EXPERIMENTAL_* feature flags --- Source/cmCoreTryCompile.cxx | 12 ++++++++++++ Source/cmExperimental.cxx | 1 + Source/cmExperimental.h | 1 + 3 files changed, 14 insertions(+) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 7d4ab509675..586db1b4725 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -18,6 +18,7 @@ #include "cmArgumentParser.h" #include "cmConfigureLog.h" +#include "cmExperimental.h" #include "cmExportTryCompileFileGenerator.h" #include "cmGlobalGenerator.h" #include "cmList.h" @@ -1068,6 +1069,17 @@ cm::optional cmCoreTryCompile::TryCompileCode( cmakeVariables.emplace("CMAKE_OSX_ARCHITECTURES", *tcArchs); } + // Pass down CMAKE_EXPERIMENTAL_* feature flags + for (std::size_t i = 0; + i < static_cast(cmExperimental::Feature::Sentinel); + i++) { + auto const& data = cmExperimental::DataForFeature( + static_cast(i)); + if (data.ForwardThroughTryCompile) { + vars.insert(data.Variable); + } + } + for (std::string const& var : vars) { if (cmValue val = this->Makefile->GetDefinition(var)) { std::string flag = "-D" + var + "=" + *val; diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx index bdbd353fd8c..5d25f6674fd 100644 --- a/Source/cmExperimental.cxx +++ b/Source/cmExperimental.cxx @@ -24,6 +24,7 @@ cmExperimental::FeatureData LookupTable[] = { "CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API", "CMake's C++ module support is experimental. It is meant only for " "experimentation and feedback to CMake developers.", + false, // https://gitlab.kitware.com/cmake/cmake/-/issues/25097 false }, }; static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) == diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h index 46c5fb73a24..bd84bb32304 100644 --- a/Source/cmExperimental.h +++ b/Source/cmExperimental.h @@ -25,6 +25,7 @@ class cmExperimental std::string const Uuid; std::string const Variable; std::string const Description; + bool const ForwardThroughTryCompile; bool Warned; }; From b01f5eb079ad2cb2ac4a114132f6bd12daa712d9 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 13 Mar 2023 13:54:37 -0700 Subject: [PATCH 110/627] Windows: Add experimental WindowsKernelModeDriver platform --- Modules/Platform/Windows-MSVC.cmake | 24 +++++++++++++++++-- Modules/Platform/Windows.cmake | 6 ++++- .../WindowsKernelModeDriver-Initialize.cmake | 11 +++++++++ .../WindowsKernelModeDriver-MSVC-C.cmake | 1 + .../WindowsKernelModeDriver-MSVC-CXX.cmake | 1 + .../Platform/WindowsKernelModeDriver.cmake | 1 + Source/cmExperimental.cxx | 6 +++++ Source/cmExperimental.h | 1 + 8 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 Modules/Platform/WindowsKernelModeDriver-Initialize.cmake create mode 100644 Modules/Platform/WindowsKernelModeDriver-MSVC-C.cmake create mode 100644 Modules/Platform/WindowsKernelModeDriver-MSVC-CXX.cmake create mode 100644 Modules/Platform/WindowsKernelModeDriver.cmake diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 8e96bf4499e..829ab9bea2a 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -28,6 +28,8 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce") +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") + set(_PLATFORM_LINK_FLAGS " -subsystem:native -kernel -MANIFEST:NO") else() set(_PLATFORM_LINK_FLAGS "") endif() @@ -223,6 +225,18 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE) else() set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "") + set(_FLAGS_C " -kernel") + set(_FLAGS_CXX " -kernel") + foreach(t EXE SHARED MODULE) + string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " -NODEFAULTLIB") + endforeach() + if((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "x64") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "x64")) + set(_PLATFORM_DEFINES "${_PLATFORM_DEFINES} -D_AMD64_ -DAMD64") + elseif((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64")) + set(_PLATFORM_DEFINES "${_PLATFORM_DEFINES} -D_ARM64_ -DARM64") + endif() else() set(_PLATFORM_DEFINES "/DWIN32") if((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64EC")) @@ -294,7 +308,7 @@ endif() # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype # on versions that support it set( MSVC_INCREMENTAL_YES_FLAG "") -if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE) +if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") if(NOT MSVC_INCREMENTAL_DEFAULT) set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") else() @@ -353,8 +367,14 @@ macro(__windows_compiler_msvc lang) set(_CMAKE_VS_LINK_DLL " -E vs_link_dll --intdir= --rc= --mt= --manifests -- ") set(_CMAKE_VS_LINK_EXE " -E vs_link_exe --intdir= --rc= --mt= --manifests -- ") endif() + if(CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") + set(_DLL_DRIVER "-driver") + else() + set(_DLL_DRIVER "/dll") + endif() set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") + "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: ${_DLL_DRIVER} /version:.${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") + unset(_DLL_DRIVER) set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " ${CMAKE_CL_NOLOGO} /out: ") diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake index 8697e7a7fa7..1bf39cfa6d5 100644 --- a/Modules/Platform/Windows.cmake +++ b/Modules/Platform/Windows.cmake @@ -1,7 +1,11 @@ set(CMAKE_STATIC_LIBRARY_PREFIX "") set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib -set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsKernelModeDriver") + set(CMAKE_SHARED_LIBRARY_SUFFIX ".sys") # .so +else() + set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so +endif() set(CMAKE_IMPORT_LIBRARY_PREFIX "") set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib") set(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe diff --git a/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake b/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake new file mode 100644 index 00000000000..6f0ef331be0 --- /dev/null +++ b/Modules/Platform/WindowsKernelModeDriver-Initialize.cmake @@ -0,0 +1,11 @@ +# undocumented, do not use outside of CMake +cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED "WindowsKernelModeDriver" _cmake_windows_kernel_mode_driver_enabled) +if(NOT _cmake_windows_kernel_mode_driver_enabled) + message(FATAL_ERROR "Windows kernel-mode driver experimental support is not enabled.") +endif() + +if(CMAKE_GENERATOR MATCHES "Visual Studio") + message(FATAL_ERROR "Visual Studio generators do not yet support CMAKE_SYSTEM_NAME=WindowsKernelModeDriver.") +endif() + +set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY) diff --git a/Modules/Platform/WindowsKernelModeDriver-MSVC-C.cmake b/Modules/Platform/WindowsKernelModeDriver-MSVC-C.cmake new file mode 100644 index 00000000000..ce8060bed54 --- /dev/null +++ b/Modules/Platform/WindowsKernelModeDriver-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsKernelModeDriver-MSVC-CXX.cmake b/Modules/Platform/WindowsKernelModeDriver-MSVC-CXX.cmake new file mode 100644 index 00000000000..281eadc1043 --- /dev/null +++ b/Modules/Platform/WindowsKernelModeDriver-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsKernelModeDriver.cmake b/Modules/Platform/WindowsKernelModeDriver.cmake new file mode 100644 index 00000000000..65b2eaed4d4 --- /dev/null +++ b/Modules/Platform/WindowsKernelModeDriver.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx index 5d25f6674fd..51c174e173b 100644 --- a/Source/cmExperimental.cxx +++ b/Source/cmExperimental.cxx @@ -26,6 +26,12 @@ cmExperimental::FeatureData LookupTable[] = { "experimentation and feedback to CMake developers.", false, // https://gitlab.kitware.com/cmake/cmake/-/issues/25097 false }, + // WindowsKernelModeDriver + { "WindowsKernelModeDriver", "5c2d848d-4efa-4529-a768-efd57171bf68", + "CMAKE_EXPERIMENTAL_WINDOWS_KERNEL_MODE_DRIVER", + "CMake's Windows kernel-mode driver support is experimental. It is meant " + "only for experimentation and feedback to CMake developers.", + true, false }, }; static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) == static_cast(cmExperimental::Feature::Sentinel), diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h index bd84bb32304..3374ba8f69a 100644 --- a/Source/cmExperimental.h +++ b/Source/cmExperimental.h @@ -15,6 +15,7 @@ class cmExperimental enum class Feature { CxxModuleCMakeApi, + WindowsKernelModeDriver, Sentinel, }; From e21ea927982d51202a86b2caf9c4ca4daf84d239 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 18 Jul 2023 00:01:09 -0400 Subject: [PATCH 111/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9722c76b8a0..b629f67bda6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230717) +set(CMake_VERSION_PATCH 20230718) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 945b9b8132e9d9eead61e2874bc0e00e9ae23270 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Mon, 17 Jul 2023 13:03:50 +0200 Subject: [PATCH 112/627] cmCMakePath: workarounds for Sunpro/sparc compiler --- Source/cmCMakePath.cxx | 2 + Source/cmCMakePath.h | 213 ++++++++++++++- Tests/CMakeLib/CMakeLists.txt | 1 + Tests/CMakeLib/testCMakePath.cxx | 441 +++++++++++++++++++++++++++++++ 4 files changed, 650 insertions(+), 7 deletions(-) create mode 100644 Tests/CMakeLib/testCMakePath.cxx diff --git a/Source/cmCMakePath.cxx b/Source/cmCMakePath.cxx index 73321c68c01..5080f58d779 100644 --- a/Source/cmCMakePath.cxx +++ b/Source/cmCMakePath.cxx @@ -15,6 +15,8 @@ #include #if defined(_WIN32) +# include + # include "cmStringAlgorithms.h" #endif diff --git a/Source/cmCMakePath.h b/Source/cmCMakePath.h index 15aa30cddf7..a42ac984141 100644 --- a/Source/cmCMakePath.h +++ b/Source/cmCMakePath.h @@ -12,7 +12,10 @@ #include #include #include -#include + +namespace cm { +class static_string_view; +} namespace detail { #if defined(__SUNPRO_CC) && defined(__sparc) @@ -123,11 +126,29 @@ class cmCMakePath : Path(FormatPath(source, fmt)) { } + cmCMakePath(const char* source, format fmt = generic_format) noexcept + : Path(FormatPath(cm::string_view{ source }, fmt)) + { + } +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath(const std::string& source, format fmt = generic_format) + : Path(FormatPath(source, fmt)) + { + } + cmCMakePath(std::string&& source, format fmt = generic_format) + : Path(FormatPath(std::move(source), fmt)) + { + } +#else template > cmCMakePath(Source source, format fmt = generic_format) : Path(FormatPath(std::move(source), fmt)) { } +#endif template > cmCMakePath& Assign(Source&& source) @@ -156,6 +177,41 @@ class cmCMakePath } return *this; } +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath& operator=(cm::filesystem::path&& source) + { + this->Assign(std::forward(source)); + return *this; + } + cmCMakePath& operator=(std::string&& source) + { + this->Assign(std::forward(source)); + return *this; + } + cmCMakePath& operator=(const cm::filesystem::path& source) + { + this->Assign(source); + return *this; + } + cmCMakePath& operator=(const std::string& source) + { + this->Assign(source); + return *this; + } + cmCMakePath& operator=(const cm::string_view source) + { + this->Assign(source); + return *this; + } + cmCMakePath& operator=(const char* source) + { + this->Assign(cm::string_view{ source }); + return *this; + } +#else template > cmCMakePath& operator=(Source&& source) { @@ -168,6 +224,7 @@ class cmCMakePath this->Assign(source); return *this; } +#endif // Concatenation cmCMakePath& Append(const cmCMakePath& path) @@ -182,12 +239,29 @@ class cmCMakePath this->Path = this->Path.generic_string(); return *this; } - +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath& Append(const std::string& source) + { + return this->Append(cm::filesystem::path(source)); + } + cmCMakePath& Append(cm::string_view source) + { + return this->Append(cm::filesystem::path(source)); + } + cmCMakePath& Append(const char* source) + { + return this->Append(cm::filesystem::path(cm::string_view{ source })); + } +#else template > cmCMakePath& Append(const Source& source) { return this->Append(cm::filesystem::path(source)); } +#endif cmCMakePath& operator/=(const cmCMakePath& path) { @@ -204,17 +278,38 @@ class cmCMakePath this->Path += path.Path; return *this; } - cmCMakePath& Concat(cm::static_string_view source) + cmCMakePath& Concat(cm::string_view source) { - this->Path.concat(std::string(source)); + this->Path.operator+=(std::string(source)); return *this; } +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath& Concat(const cm::filesystem::path& source) + { + this->Path.operator+=(source); + return *this; + } + cmCMakePath& Concat(const std::string& source) + { + this->Path.operator+=(source); + return *this; + } + cmCMakePath& Concat(const char* source) + { + this->Path.operator+=(source); + return *this; + } +#else template > cmCMakePath& Concat(const Source& source) { - this->Path.concat(source); + this->Path.operator+=(source); return *this; } +#endif cmCMakePath& operator+=(const cmCMakePath& path) { @@ -242,6 +337,32 @@ class cmCMakePath } return *this; } +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath& ReplaceFileName(const cm::filesystem::path& filename) + { + if (this->Path.has_filename()) { + this->Path.replace_filename(filename); + } + return *this; + } + cmCMakePath& ReplaceFileName(const std::string& filename) + { + if (this->Path.has_filename()) { + this->Path.replace_filename(filename); + } + return *this; + } + cmCMakePath& ReplaceFileName(cm::string_view filename) + { + if (this->Path.has_filename()) { + this->Path.replace_filename(filename); + } + return *this; + } +#else template > cmCMakePath& ReplaceFileName(const Source& filename) { @@ -250,18 +371,40 @@ class cmCMakePath } return *this; } +#endif cmCMakePath& ReplaceExtension(const cmCMakePath& extension = cmCMakePath()) { this->Path.replace_extension(extension.Path); return *this; } +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath& ReplaceExtension(const cm::filesystem::path& extension) + { + this->Path.replace_extension(extension); + return *this; + } + cmCMakePath& ReplaceExtension(const std::string& extension) + { + this->Path.replace_extension(extension); + return *this; + } + cmCMakePath& ReplaceExtension(const cm::string_view extension) + { + this->Path.replace_extension(extension); + return *this; + } +#else template > cmCMakePath& ReplaceExtension(const Source& extension) { this->Path.replace_extension(extension); return *this; } +#endif cmCMakePath& ReplaceWideExtension( const cmCMakePath& extension = cmCMakePath()) @@ -269,11 +412,26 @@ class cmCMakePath return this->ReplaceWideExtension( static_cast(extension.Path.string())); } + cmCMakePath& ReplaceWideExtension(const cm::filesystem::path& extension) + { + return this->ReplaceWideExtension( + static_cast(extension.string())); + } +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath& ReplaceWideExtension(const std::string& extension) + { + return this->ReplaceWideExtension(cm::string_view{ extension }); + } +#else template > cmCMakePath& ReplaceWideExtension(const Source& extension) { - return this->ReplaceWideExtension(cm::string_view(extension)); + return this->ReplaceWideExtension(extension); } +#endif cmCMakePath& ReplaceWideExtension(cm::string_view extension); cmCMakePath& RemoveExtension() @@ -355,12 +513,25 @@ class cmCMakePath // Windows) so convert back to '/' return path.generic_string(); } +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath Relative(const std::string& base) const + { + return this->Relative(cm::filesystem::path(base)); + } + cmCMakePath Relative(cm::string_view base) const + { + return this->Relative(cm::filesystem::path(base)); + } +#else template > cmCMakePath Relative(const Source& base) const { return this->Relative(cm::filesystem::path(base)); } - +#endif cmCMakePath Proximate(const cmCMakePath& base) const { return this->Proximate(base.Path); @@ -372,21 +543,49 @@ class cmCMakePath // Windows) so convert back to '/' return path.generic_string(); } +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath Proximate(const std::string& base) const + { + return this->Proximate(cm::filesystem::path(base)); + } + cmCMakePath Proximate(cm::string_view base) const + { + return this->Proximate(cm::filesystem::path(base)); + } +#else template > cmCMakePath Proximate(const Source& base) const { return this->Proximate(cm::filesystem::path(base)); } +#endif cmCMakePath Absolute(const cmCMakePath& base) const { return this->Absolute(base.Path); } +#if defined(__SUNPRO_CC) && defined(__sparc) + // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when + // standard methods and templates use the same name. The template is selected + // rather than the standard one regardless the arguments of the method. + cmCMakePath Absolute(const std::string& base) const + { + return this->Absolute(cm::filesystem::path(base)); + } + cmCMakePath Absolute(cm::string_view base) const + { + return this->Absolute(cm::filesystem::path(base)); + } +#else template > cmCMakePath Absolute(const Source& base) const { return this->Absolute(cm::filesystem::path(base)); } +#endif cmCMakePath Absolute(const cm::filesystem::path& base) const; // Comparison diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 8ce8f67ca03..4454f494275 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -31,6 +31,7 @@ set(CMakeLib_TESTS testCMExtAlgorithm.cxx testCMExtEnumSet.cxx testList.cxx + testCMakePath.cxx ) if(CMake_ENABLE_DEBUGGER) list(APPEND CMakeLib_TESTS diff --git a/Tests/CMakeLib/testCMakePath.cxx b/Tests/CMakeLib/testCMakePath.cxx new file mode 100644 index 00000000000..aa17e5043d7 --- /dev/null +++ b/Tests/CMakeLib/testCMakePath.cxx @@ -0,0 +1,441 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include "cmConfigure.h" // IWYU pragma: keep + +#include +#include +#include + +#include +#include + +#include "cmCMakePath.h" + +namespace { + +void checkResult(bool success) +{ + if (!success) { + std::cout << " => failed"; + } + std::cout << std::endl; +} + +bool testConstructors() +{ + std::cout << "testConstructors()"; + + bool result = true; + + { + cmCMakePath path; + if (!path.String().empty() || path != cmCMakePath{}) { + result = false; + } + } + { + cmCMakePath path{ "aa/bb" }; + if (path.String() != "aa/bb") { + result = false; + } + } + { + std::string s{ "aa/bb" }; + cmCMakePath path{ s }; + if (path.String() != "aa/bb") { + result = false; + } + } + { + cmCMakePath path{ "aa/bb"_s }; + if (path.String() != "aa/bb") { + result = false; + } + } + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2("aa/bb"_s); + + if (path1 != path2) { + result = false; + } + if (path1.String() != "aa/bb") { + result = false; + } + if (path1.String() != path2.String()) { + result = false; + } + } + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2{ path1 }; + + if (path1 != path2) { + result = false; + } + if (path1.String() != "aa/bb") { + result = false; + } + if (path1.String() != path2.String()) { + result = false; + } + } + + checkResult(result); + + return result; +} + +bool testAssign() +{ + std::cout << "testAssign()"; + + bool result = true; + + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 = path1; + if (path1 != path2) { + result = false; + } + if (path1.String() != "aa/bb") { + result = false; + } + if (path1.String() != path2.String()) { + result = false; + } + } + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 = std::move(path1); + if (path2.String() != "aa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 = path1; + if (path2.String() != "aa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 = std::move(path1); + if (path2.String() != "aa/bb") { + result = false; + } + } + { + cm::string_view path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 = path1; + if (path2.String() != "aa/bb") { + result = false; + } + } + { + char path1[] = "aa/bb"; + cmCMakePath path2{ "cc/dd" }; + + path2 = path1; + if (path2.String() != "aa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Assign(path1); + if (path2.String() != path1) { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Assign(std::move(path1)); + if (path2.String() != "aa/bb") { + result = false; + } + } + { + cm::string_view path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Assign(path1); + if (path2.String() != path1) { + result = false; + } + } + { + char path1[] = "aa/bb"; + cmCMakePath path2{ "cc/dd" }; + + path2.Assign(path1); + if (path2.String() != path1) { + result = false; + } + } + + checkResult(result); + + return result; +} + +bool testConcat() +{ + std::cout << "testConcat()"; + + bool result = true; + + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 += path1; + + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 += std::move(path1); + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 += path1; + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 += std::move(path1); + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + cm::string_view path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 += path1; + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + char path1[] = "aa/bb"; + cmCMakePath path2{ "cc/dd" }; + + path2 += path1; + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Concat(path1); + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Concat(path1); + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Concat(std::move(path1)); + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + cm::string_view path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Concat(path1); + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + { + char path1[] = "aa/bb"; + cmCMakePath path2{ "cc/dd" }; + + path2.Concat(path1); + if (path2.String() != "cc/ddaa/bb") { + result = false; + } + } + + checkResult(result); + + return result; +} + +bool testAppend() +{ + std::cout << "testAppend()"; + + bool result = true; + + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 /= path1; + + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 /= std::move(path1); + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 /= path1; + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 /= std::move(path1); + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + cm::string_view path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2 /= path1; + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + char path1[] = "aa/bb"; + cmCMakePath path2{ "cc/dd" }; + + path2 /= path1; + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + cmCMakePath path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Append(path1); + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Append(path1); + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + std::string path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Append(std::move(path1)); + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + cm::string_view path1{ "aa/bb" }; + cmCMakePath path2{ "cc/dd" }; + + path2.Append(path1); + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + { + char path1[] = "aa/bb"; + cmCMakePath path2{ "cc/dd" }; + + path2.Append(path1); + if (path2.String() != "cc/dd/aa/bb") { + result = false; + } + } + + checkResult(result); + + return result; +} +} + +int testCMakePath(int /*unused*/, char* /*unused*/[]) +{ + int result = 0; + + if (!testConstructors()) { + result = 1; + } + if (!testAssign()) { + result = 1; + } + if (!testConcat()) { + result = 1; + } + if (!testAppend()) { + result = 1; + } + + return result; +} From 83574a47726b8824d58b65a262c289573fb69bb0 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 17 Jul 2023 17:39:03 -0400 Subject: [PATCH 113/627] GeneratorExpression: Expand testing of imported location resolution --- Tests/GeneratorExpression/CMakeLists.txt | 18 ++++++++++++++++++ Tests/GeneratorExpression/check-part3.cmake | 3 +++ 2 files changed, 21 insertions(+) diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 38ae6d8ad28..39454edd132 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -216,6 +216,21 @@ set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_DEBUG SPECIAL set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_RELEASE SPECIAL "") set_property(TARGET importedFallback2 PROPERTY MAP_IMPORTED_CONFIG_RELWITHDEBINFO SPECIAL "") +add_library(importedFallback3 SHARED IMPORTED) +set_property(TARGET importedFallback3 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc) +set_property(TARGET importedFallback3 PROPERTY IMPORTED_LOCATION_RELEASE release_loc) +set_property(TARGET importedFallback3 PROPERTY IMPORTED_LOCATION fallback_loc) +set_property(TARGET importedFallback3 PROPERTY IMPORTED_IMPLIB imp_loc) +set_property(TARGET importedFallback3 PROPERTY MAP_IMPORTED_CONFIG_DEBUG "" DEBUG) +set_property(TARGET importedFallback3 PROPERTY MAP_IMPORTED_CONFIG_RELEASE "") + +add_library(importedFallback4 SHARED IMPORTED) +set_property(TARGET importedFallback4 PROPERTY IMPORTED_LOCATION fallback_loc) +set_property(TARGET importedFallback4 PROPERTY IMPORTED_IMPLIB imp_loc) + +add_library(importedFallback5 SHARED IMPORTED) +set_property(TARGET importedFallback5 PROPERTY IMPORTED_IMPLIB imp_loc) + add_library(importedFallback_genex STATIC IMPORTED) set_property(TARGET importedFallback_genex PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET importedFallback_genex PROPERTY IMPORTED_LOCATION_RELEASE release_loc) @@ -234,6 +249,9 @@ add_custom_target(check-part3 ALL -Dtest_imported_includes=$ -Dtest_imported_fallback=$,fallback_loc> -Dtest_imported_fallback2=$,$,$>>,$,special_imp>,$,fallback_loc>> + -Dtest_imported_fallback3=$,$,imp_loc>,$,fallback_loc>> + -Dtest_imported_fallback4=$,$,imp_loc>,$,fallback_loc>> + -Dtest_imported_fallback5=$,imp_loc> -Dtest_imported_fallback_genex=$,FOOBAR=1> -Dtest_alias_file_exe=$,$> -Dtest_alias_file_lib=$,$> diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 7bb0d85ad22..eda3bc10afa 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -20,6 +20,9 @@ endif() check(test_imported_fallback "1") check(test_imported_fallback2 "1") +check(test_imported_fallback3 "1") +check(test_imported_fallback4 "1") +check(test_imported_fallback5 "1") check(test_imported_fallback_genex "1") check(test_alias_file_exe "1") From 7351d590ee6a846ed0f2bd4793384a33bf49ea0d Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 17 Jul 2023 17:44:26 -0400 Subject: [PATCH 114/627] cmTarget: Add a way to represent imported shared library stubs Shared library stubs can be used for linking, but not at runtime. Their role is similar to import libraries on Windows, so represent their location with the `IMPORTED_IMPLIB` target property. Fixes: #24940 --- Help/prop_tgt/IMPORTED_IMPLIB.rst | 6 +++++ Help/release/dev/imported-implib-only.rst | 7 +++++ Source/cmComputeLinkInformation.cxx | 18 ++++++++----- Source/cmGeneratorTarget.h | 1 + Source/cmTarget.cxx | 26 ++++++++++++++----- Tests/Cuda/CMakeLists.txt | 1 + Tests/Cuda/StubRPATH/CMakeLists.txt | 21 +++++++++++++++ Tests/Cuda/StubRPATH/main.cxx | 17 ++++++++++++ Tests/GeneratorExpression/CMakeLists.txt | 2 +- Tests/RunCMake/CMP0111/CMP0111-Common.cmake | 3 --- Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt | 6 +++-- .../RunCMake/CMP0111/CMP0111-WARN-stderr.txt | 5 ++-- .../AliasTargets.cmake | 8 +++++- .../ImportedTargetStub.cmake | 2 ++ .../target_link_libraries/RunCMakeTest.cmake | 1 + 15 files changed, 102 insertions(+), 22 deletions(-) create mode 100644 Help/release/dev/imported-implib-only.rst create mode 100644 Tests/Cuda/StubRPATH/CMakeLists.txt create mode 100644 Tests/Cuda/StubRPATH/main.cxx create mode 100644 Tests/RunCMake/target_link_libraries/ImportedTargetStub.cmake diff --git a/Help/prop_tgt/IMPORTED_IMPLIB.rst b/Help/prop_tgt/IMPORTED_IMPLIB.rst index e67acbaa546..27601d2efec 100644 --- a/Help/prop_tgt/IMPORTED_IMPLIB.rst +++ b/Help/prop_tgt/IMPORTED_IMPLIB.rst @@ -11,6 +11,12 @@ This property may be set: * On macOS, to an import file (e.g. ``.tbd``) created for shared libraries (see the :prop_tgt:`ENABLE_EXPORTS` target property). For frameworks this is the location of the ``.tbd`` file symlink just inside the framework folder. +* .. versionadded:: 3.28 + On non-DLL platforms, to the location of a shared library. + When set without also specifying an :prop_tgt:`IMPORTED_LOCATION`, + the library is considered to be a stub, and its location will not + be added as a runtime search path to dependents that link it. + The ``IMPORTED_IMPLIB`` target property may be overridden for a given configuration ```` by the configuration-specific diff --git a/Help/release/dev/imported-implib-only.rst b/Help/release/dev/imported-implib-only.rst new file mode 100644 index 00000000000..aa817b72912 --- /dev/null +++ b/Help/release/dev/imported-implib-only.rst @@ -0,0 +1,7 @@ +imported-implib-only +-------------------- + +* On imported shared libraries, the :prop_tgt:`IMPORTED_IMPLIB` target + property may now be used without :prop_tgt:`IMPORTED_LOCATION`. + This can be used to represent a stub library whose location should not + be added as a runtime search path to dependents that link it. diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 04e4fc768fb..f4bb8b1585a 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -2241,16 +2241,20 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo( if (target->GetType() != cmStateEnums::SHARED_LIBRARY) { return; } + auto const* info = target->GetImportInfo(this->Config); // Try to get the soname of the library. Only files with this name // could possibly conflict. - std::string soName = target->GetSOName(this->Config); - const char* soname = soName.empty() ? nullptr : soName.c_str(); - - // Include this library in the runtime path ordering. - this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath, soname); - if (this->LinkWithRuntimePath) { - this->OrderLinkerSearchPath->AddRuntimeLibrary(fullPath, soname); + const char* soname = + (!info || info->SOName.empty()) ? nullptr : info->SOName.c_str(); + + // If this shared library has a known runtime artifact (IMPORTED_LOCATION), + // include its location in the runtime path ordering. + if (!info || !info->Location.empty()) { + this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath, soname); + if (this->LinkWithRuntimePath) { + this->OrderLinkerSearchPath->AddRuntimeLibrary(fullPath, soname); + } } } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 03452a1e916..a03513d3f7e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1076,6 +1076,7 @@ class cmGeneratorTarget std::string SharedDeps; }; + friend cmComputeLinkInformation; using ImportInfoMapType = std::map; mutable ImportInfoMapType ImportInfoMap; void ComputeImportInfo(std::string const& desired_config, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 15f45f5d223..b81eec5577a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2779,6 +2779,8 @@ std::string cmTarget::ImportedGetFullPath( case cmStateEnums::RuntimeBinaryArtifact: if (loc) { result = *loc; + } else if (imp) { + result = *imp; } else { std::string impProp = cmStrCat("IMPORTED_LOCATION", suffix); if (cmValue config_location = this->GetProperty(impProp)) { @@ -2787,6 +2789,16 @@ std::string cmTarget::ImportedGetFullPath( this->GetProperty("IMPORTED_LOCATION")) { result = *location; } + if (result.empty() && + (this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->IsExecutableWithExports())) { + impProp = cmStrCat("IMPORTED_IMPLIB", suffix); + if (cmValue config_implib = this->GetProperty(impProp)) { + result = *config_implib; + } else if (cmValue implib = this->GetProperty("IMPORTED_IMPLIB")) { + result = *implib; + } + } } break; @@ -2812,7 +2824,10 @@ std::string cmTarget::ImportedGetFullPath( std::string unset; std::string configuration; - if (artifact == cmStateEnums::RuntimeBinaryArtifact) { + if (this->GetType() == cmStateEnums::SHARED_LIBRARY && + artifact == cmStateEnums::RuntimeBinaryArtifact) { + unset = "IMPORTED_LOCATION or IMPORTED_IMPLIB"; + } else if (artifact == cmStateEnums::RuntimeBinaryArtifact) { unset = "IMPORTED_LOCATION"; } else if (artifact == cmStateEnums::ImportLibraryArtifact) { unset = "IMPORTED_IMPLIB"; @@ -2985,11 +3000,10 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, cmValue& loc, } // If we needed to find one of the mapped configurations but did not - // On a DLL platform there may be only IMPORTED_IMPLIB for a shared - // library or an executable with exports. - bool allowImp = (this->IsDLLPlatform() && - (this->GetType() == cmStateEnums::SHARED_LIBRARY || - this->IsExecutableWithExports())) || + // There may be only IMPORTED_IMPLIB for a shared library or an executable + // with exports. + bool allowImp = (this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->IsExecutableWithExports()) || (this->IsAIX() && this->IsExecutableWithExports()) || (this->GetMakefile()->PlatformSupportsAppleTextStubs() && this->IsSharedLibraryWithExports()); diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt index 0041b074ad4..c737bcc2162 100644 --- a/Tests/Cuda/CMakeLists.txt +++ b/Tests/Cuda/CMakeLists.txt @@ -13,6 +13,7 @@ add_cuda_test_macro(Cuda.MixedStandardLevels4 MixedStandardLevels4) add_cuda_test_macro(Cuda.MixedStandardLevels5 MixedStandardLevels5) add_cuda_test_macro(Cuda.NotEnabled CudaNotEnabled) add_cuda_test_macro(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly) +add_cuda_test_macro(Cuda.StubRPATH StubRPATH) add_cuda_test_macro(Cuda.Toolkit Toolkit) add_cuda_test_macro(Cuda.IncludePathNoToolkit IncludePathNoToolkit) add_cuda_test_macro(Cuda.SharedRuntimePlusToolkit SharedRuntimePlusToolkit) diff --git a/Tests/Cuda/StubRPATH/CMakeLists.txt b/Tests/Cuda/StubRPATH/CMakeLists.txt new file mode 100644 index 00000000000..93643c5c63f --- /dev/null +++ b/Tests/Cuda/StubRPATH/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.18) +project(StubRPATH CXX) + +#Verify that linking to a stub library doesn't cause an `-rpath` entry + +# Needed for `CUDAToolkit_LIBRARY_SEARCH_DIRS` +find_package(CUDAToolkit REQUIRED) + +find_library(CUDA_DRIVER_STUB_LIBRARY + NAMES cuda + HINTS ${CUDAToolkit_LIBRARY_SEARCH_DIRS} + ENV CUDA_PATH + PATH_SUFFIXES lib64/stubs lib/x64/stubs lib/stubs stubs +) +add_library(imported_stub IMPORTED SHARED) +set_target_properties(imported_stub PROPERTIES IMPORTED_IMPLIB "${CUDA_DRIVER_STUB_LIBRARY}") +set_target_properties(imported_stub PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CUDAToolkit_INCLUDE_DIRS}") + +set(CMAKE_CXX_STANDARD 11) +add_executable(StubRPATH main.cxx) +target_link_libraries(StubRPATH PRIVATE imported_stub) diff --git a/Tests/Cuda/StubRPATH/main.cxx b/Tests/Cuda/StubRPATH/main.cxx new file mode 100644 index 00000000000..877856ea024 --- /dev/null +++ b/Tests/Cuda/StubRPATH/main.cxx @@ -0,0 +1,17 @@ + +#include + +#include + +int main(int argc, char** argv) +{ + int nDevices = 0; + cuInit(0); + auto err = cuDeviceGetCount(&nDevices); + if (err != CUDA_SUCCESS) { + std::cerr << "Failed to retrieve the number of CUDA enabled devices " + << err << std::endl; + return 1; + } + return 0; +} diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 39454edd132..df7cda0c4ae 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -248,7 +248,7 @@ add_custom_target(check-part3 ALL -Dconfig=$ -Dtest_imported_includes=$ -Dtest_imported_fallback=$,fallback_loc> - -Dtest_imported_fallback2=$,$,$>>,$,special_imp>,$,fallback_loc>> + -Dtest_imported_fallback2=$,special_imp> -Dtest_imported_fallback3=$,$,imp_loc>,$,fallback_loc>> -Dtest_imported_fallback4=$,$,imp_loc>,$,fallback_loc>> -Dtest_imported_fallback5=$,imp_loc> diff --git a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake index c31e4ba03be..ab9e405086e 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake +++ b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake @@ -1,6 +1,3 @@ -# Prevent duplicate errors on some platforms. -set(CMAKE_IMPORT_LIBRARY_SUFFIX "placeholder") - add_library(unknown_lib UNKNOWN IMPORTED) add_library(static_lib STATIC IMPORTED) add_library(shared_lib SHARED IMPORTED) diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt index e5eb4bfbbf4..c6439e27f66 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt @@ -1,4 +1,6 @@ ^(CMake Error in CMakeLists.txt: - IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration + IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static)_lib"( configuration "[^"]+")?. -+)+CMake Generate step failed. Build files cannot be regenerated correctly.$ +)+ +.*(IMPORTED_LOCATION or )?IMPORTED_IMPLIB not set for imported target.*"shared_lib".* +CMake Generate step failed. Build files cannot be regenerated correctly.$ diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt index 52861349c84..7a46c41a12b 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt @@ -4,7 +4,7 @@ details. Use the cmake_policy command to set the policy and suppress this warning. - IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration + IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static)_lib"( configuration "[^"]+")?. This warning is for project developers. Use -Wno-dev to suppress it. +)+CMake Warning \(dev\) in CMakeLists.txt: @@ -13,6 +13,7 @@ This warning is for project developers. Use -Wno-dev to suppress it. details. Use the cmake_policy command to set the policy and suppress this warning. - IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration + IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static)_lib"( configuration "[^"]+")?. +.*(IMPORTED_LOCATION or )?IMPORTED_IMPLIB not set for imported target.*"shared_lib".* This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake index 4a0f0686053..65c708c631d 100644 --- a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake +++ b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake @@ -14,8 +14,14 @@ set_property(TARGET import-local PROPERTY IMPORTED_LOCATION "${binary_dir}/${CMA set_property(TARGET import-local PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_IMPORT_LIBRARY_SUFFIX}") add_library(alias::local ALIAS import-local) +if(NOT DEFINED CMAKE_IMPORT_LIBRARY_SUFFIX) + add_library(import-local-stub SHARED IMPORTED) + set_property(TARGET import-local-stub PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_SHARED_LIBRARY_SUFFIX}") + add_library(alias::local-stub ALIAS import-local-stub) +endif() + add_library (lib-local SHARED lib.c) -target_link_libraries (lib-local PRIVATE alias::local) +target_link_libraries (lib-local PRIVATE alias::local $) add_executable (main-local main.c) target_link_libraries (main-local PRIVATE alias::local) diff --git a/Tests/RunCMake/target_link_libraries/ImportedTargetStub.cmake b/Tests/RunCMake/target_link_libraries/ImportedTargetStub.cmake new file mode 100644 index 00000000000..04f9cfb8f1e --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetStub.cmake @@ -0,0 +1,2 @@ +add_library(SharedStubImportedGlobal SHARED IMPORTED GLOBAL) +set_target_properties(SharedStubImportedGlobal PROPERTIES IMPORTED_IMPLIB z) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 7c5d77d74f5..0e3877aa58a 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -23,6 +23,7 @@ run_cmake(CMP0079-link-NEW-bogus) run_cmake(CMP0108-OLD-self-link) run_cmake(CMP0108-NEW-self-link) run_cmake(ImportedTarget) +run_cmake(ImportedTargetStub) run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) From a594748cdf61146279cfd88f6c21e340e85af8c1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 19 Jul 2023 00:01:15 -0400 Subject: [PATCH 115/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b629f67bda6..3236afbc4a3 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230718) +set(CMake_VERSION_PATCH 20230719) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 95941fd99020bb2345869ed393abde1a44529837 Mon Sep 17 00:00:00 2001 From: Chris Mahoney Date: Mon, 5 Jun 2023 15:59:13 -0400 Subject: [PATCH 116/627] add_custom_{target,command}: Add argument JOB_SERVER_AWARE Issue: #16273 --- Help/command/add_custom_command.rst | 14 ++ Help/command/add_custom_target.rst | 14 ++ Help/release/dev/command-job-server-aware.rst | 5 + Source/cmAddCustomCommandCommand.cxx | 19 ++ Source/cmAddCustomTargetCommand.cxx | 17 ++ Source/cmGlobalBorlandMakefileGenerator.h | 2 + Source/cmGlobalGenerator.h | 2 + Source/cmGlobalJOMMakefileGenerator.h | 2 + Source/cmGlobalNMakeMakefileGenerator.h | 2 + Source/cmGlobalUnixMakefileGenerator3.h | 2 + Source/cmGlobalWatcomWMakeGenerator.h | 2 + Tests/RunCMake/CMakeLists.txt | 3 +- ...JobServer-absent-parallel-build-stderr.txt | 1 + .../Make/DetectJobServer-absent.cmake | 13 ++ .../Make/DetectJobServer-present.cmake | 13 ++ .../Make/GNUMakeJobServerAware-check.cmake | 12 ++ .../RunCMake/Make/GNUMakeJobServerAware.cmake | 12 ++ Tests/RunCMake/Make/RunCMakeTest.cmake | 40 ++++ Tests/RunCMake/detect_jobserver.c | 204 ++++++++++++++++++ 19 files changed, 378 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/command-job-server-aware.rst create mode 100644 Tests/RunCMake/Make/DetectJobServer-absent-parallel-build-stderr.txt create mode 100644 Tests/RunCMake/Make/DetectJobServer-absent.cmake create mode 100644 Tests/RunCMake/Make/DetectJobServer-present.cmake create mode 100644 Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake create mode 100644 Tests/RunCMake/Make/GNUMakeJobServerAware.cmake create mode 100644 Tests/RunCMake/detect_jobserver.c diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index 6dc68321cc1..d523ba88432 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -24,6 +24,7 @@ The first signature is for adding a custom command to produce an output: [COMMENT comment] [DEPFILE depfile] [JOB_POOL job_pool] + [JOB_SERVER_AWARE ] [VERBATIM] [APPEND] [USES_TERMINAL] [COMMAND_EXPAND_LISTS] [DEPENDS_EXPLICIT_ONLY]) @@ -221,6 +222,19 @@ The options are: Using a pool that is not defined by :prop_gbl:`JOB_POOLS` causes an error by ninja at build time. +``JOB_SERVER_AWARE`` + .. versionadded:: 3.28 + + Specify that the command is GNU Make job server aware. + + For the :generator:`Unix Makefiles`, :generator:`MSYS Makefiles`, and + :generator:`MinGW Makefiles` generators this will add the ``+`` prefix to the + recipe line. See the `GNU Make Documentation`_ for more information. + + This option is silently ignored by other generators. + +.. _`GNU Make Documentation`: https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html + ``MAIN_DEPENDENCY`` Specify the primary input source file to the command. This is treated just like any value given to the ``DEPENDS`` option diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst index 545b9a5ae3c..ef0c8d90f7f 100644 --- a/Help/command/add_custom_target.rst +++ b/Help/command/add_custom_target.rst @@ -12,6 +12,7 @@ Add a target with no output so it will always be built. [WORKING_DIRECTORY dir] [COMMENT comment] [JOB_POOL job_pool] + [JOB_SERVER_AWARE ] [VERBATIM] [USES_TERMINAL] [COMMAND_EXPAND_LISTS] [SOURCES src1 [src2...]]) @@ -146,6 +147,19 @@ The options are: Using a pool that is not defined by :prop_gbl:`JOB_POOLS` causes an error by ninja at build time. +``JOB_SERVER_AWARE`` + .. versionadded:: 3.28 + + Specify that the command is GNU Make job server aware. + + For the :generator:`Unix Makefiles`, :generator:`MSYS Makefiles`, and + :generator:`MinGW Makefiles` generators this will add the ``+`` prefix to the + recipe line. See the `GNU Make Documentation`_ for more information. + + This option is silently ignored by other generators. + +.. _`GNU Make Documentation`: https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html + ``SOURCES`` Specify additional source files to be included in the custom target. Specified source files will be added to IDE project files for diff --git a/Help/release/dev/command-job-server-aware.rst b/Help/release/dev/command-job-server-aware.rst new file mode 100644 index 00000000000..224c739295c --- /dev/null +++ b/Help/release/dev/command-job-server-aware.rst @@ -0,0 +1,5 @@ +command-job-server-aware +------------------------ + +* The :command:`add_custom_command` and :command:`add_custom_target` + commands gained a ``JOB_SERVER_AWARE`` option. diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index b1398db142b..044b5df3f86 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -19,6 +19,7 @@ #include "cmPolicies.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmValue.h" bool cmAddCustomCommandCommand(std::vector const& args, cmExecutionStatus& status) @@ -39,6 +40,7 @@ bool cmAddCustomCommandCommand(std::vector const& args, std::string working; std::string depfile; std::string job_pool; + std::string job_server_aware; std::string comment_buffer; const char* comment = nullptr; std::vector depends; @@ -78,6 +80,7 @@ bool cmAddCustomCommandCommand(std::vector const& args, doing_working_directory, doing_depfile, doing_job_pool, + doing_job_server_aware, doing_nothing }; @@ -95,6 +98,7 @@ bool cmAddCustomCommandCommand(std::vector const& args, MAKE_STATIC_KEYWORD(DEPFILE); MAKE_STATIC_KEYWORD(IMPLICIT_DEPENDS); MAKE_STATIC_KEYWORD(JOB_POOL); + MAKE_STATIC_KEYWORD(JOB_SERVER_AWARE); MAKE_STATIC_KEYWORD(MAIN_DEPENDENCY); MAKE_STATIC_KEYWORD(OUTPUT); MAKE_STATIC_KEYWORD(OUTPUTS); @@ -126,6 +130,7 @@ bool cmAddCustomCommandCommand(std::vector const& args, keyPRE_BUILD, keyPRE_LINK, keySOURCE, + keyJOB_SERVER_AWARE, keyTARGET, keyUSES_TERMINAL, keyVERBATIM, @@ -190,6 +195,8 @@ bool cmAddCustomCommandCommand(std::vector const& args, } } else if (copy == keyJOB_POOL) { doing = doing_job_pool; + } else if (copy == keyJOB_SERVER_AWARE) { + doing = doing_job_server_aware; } } else { std::string filename; @@ -226,6 +233,9 @@ bool cmAddCustomCommandCommand(std::vector const& args, case doing_job_pool: job_pool = copy; break; + case doing_job_server_aware: + job_server_aware = copy; + break; case doing_working_directory: working = copy; break; @@ -324,6 +334,15 @@ bool cmAddCustomCommandCommand(std::vector const& args, return false; } + // If using a GNU Make generator and `JOB_SERVER_AWARE` is set then + // prefix all commands with '+'. + if (cmIsOn(job_server_aware) && + mf.GetGlobalGenerator()->IsGNUMakeJobServerAware()) { + for (auto& commandLine : commandLines) { + commandLine.insert(commandLine.begin(), "+"); + } + } + // Choose which mode of the command to use. auto cc = cm::make_unique(); cc->SetByproducts(byproducts); diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index a246d0650b8..63390621b4d 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -17,6 +17,7 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cmValue.h" bool cmAddCustomTargetCommand(std::vector const& args, cmExecutionStatus& status) @@ -54,6 +55,7 @@ bool cmAddCustomTargetCommand(std::vector const& args, const char* comment = nullptr; std::vector sources; std::string job_pool; + std::string JOB_SERVER_AWARE; // Keep track of parser state. enum tdoing @@ -65,6 +67,7 @@ bool cmAddCustomTargetCommand(std::vector const& args, doing_comment, doing_source, doing_job_pool, + doing_JOB_SERVER_AWARE, doing_nothing }; tdoing doing = doing_command; @@ -102,6 +105,8 @@ bool cmAddCustomTargetCommand(std::vector const& args, doing = doing_comment; } else if (copy == "JOB_POOL") { doing = doing_job_pool; + } else if (copy == "JOB_SERVER_AWARE") { + doing = doing_JOB_SERVER_AWARE; } else if (copy == "COMMAND") { doing = doing_command; @@ -148,6 +153,9 @@ bool cmAddCustomTargetCommand(std::vector const& args, case doing_job_pool: job_pool = copy; break; + case doing_JOB_SERVER_AWARE: + JOB_SERVER_AWARE = copy; + break; default: status.SetError("Wrong syntax. Unknown type of argument."); return false; @@ -212,6 +220,15 @@ bool cmAddCustomTargetCommand(std::vector const& args, return false; } + // If using a GNU Make generator and `JOB_SERVER_AWARE` is set then + // prefix all commands with '+'. + if (cmIsOn(JOB_SERVER_AWARE) && + mf.GetGlobalGenerator()->IsGNUMakeJobServerAware()) { + for (auto& commandLine : commandLines) { + commandLine.insert(commandLine.begin(), "+"); + } + } + // Add the utility target to the makefile. auto cc = cm::make_unique(); cc->SetWorkingDirectory(working_directory.c_str()); diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 049d6ba8072..a2adbd0f8b7 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -54,6 +54,8 @@ class cmGlobalBorlandMakefileGenerator : public cmGlobalUnixMakefileGenerator3 bool AllowDeleteOnError() const override { return false; } bool CanEscapeOctothorpe() const override { return true; } + bool IsGNUMakeJobServerAware() const override { return false; } + protected: std::vector GenerateBuildCommand( const std::string& makeProgram, const std::string& projectName, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 9aefaff0bc4..0e40813569f 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -161,6 +161,8 @@ class cmGlobalGenerator virtual bool CheckCxxModuleSupport() { return false; } + virtual bool IsGNUMakeJobServerAware() const { return false; } + bool Compute(); virtual void AddExtraIDETargets() {} diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 5e74875e287..cd3ed33b57a 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -47,6 +47,8 @@ class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3 void EnableLanguage(std::vector const& languages, cmMakefile*, bool optional) override; + bool IsGNUMakeJobServerAware() const override { return false; } + protected: std::vector GenerateBuildCommand( const std::string& makeProgram, const std::string& projectName, diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index 436ebcac1c1..167889cb220 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -53,6 +53,8 @@ class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3 void EnableLanguage(std::vector const& languages, cmMakefile*, bool optional) override; + bool IsGNUMakeJobServerAware() const override { return false; } + protected: std::vector GenerateBuildCommand( const std::string& makeProgram, const std::string& projectName, diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 760679a0518..ee783513b5a 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -120,6 +120,8 @@ class cmGlobalUnixMakefileGenerator3 : public cmGlobalCommonGenerator void Configure() override; + bool IsGNUMakeJobServerAware() const override { return true; } + /** * Generate the all required files for building this project/tree. This * basically creates a series of LocalGenerators for each directory and diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index 5579120ba1d..8b246794a7f 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -53,6 +53,8 @@ class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3 bool AllowNotParallel() const override { return false; } bool AllowDeleteOnError() const override { return false; } + bool IsGNUMakeJobServerAware() const override { return false; } + protected: std::vector GenerateBuildCommand( const std::string& makeProgram, const std::string& projectName, diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 8baa98f815c..584edd789b3 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -171,8 +171,9 @@ endif() if(NOT CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") add_RunCMake_test(CMP0065 -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) endif() +add_executable(detect_jobserver detect_jobserver.c) if(CMAKE_GENERATOR MATCHES "Make") - add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU}) + add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU} -DDETECT_JOBSERVER=$) endif() unset(ninja_test_with_qt_version) unset(ninja_qt_args) diff --git a/Tests/RunCMake/Make/DetectJobServer-absent-parallel-build-stderr.txt b/Tests/RunCMake/Make/DetectJobServer-absent-parallel-build-stderr.txt new file mode 100644 index 00000000000..c63bde3b3d1 --- /dev/null +++ b/Tests/RunCMake/Make/DetectJobServer-absent-parallel-build-stderr.txt @@ -0,0 +1 @@ +^(Warning: (Borland's make|NMake|Watcom's WMake) does not support parallel builds\. Ignoring parallel build command line option\.)?$ diff --git a/Tests/RunCMake/Make/DetectJobServer-absent.cmake b/Tests/RunCMake/Make/DetectJobServer-absent.cmake new file mode 100644 index 00000000000..e3dddc0ea6c --- /dev/null +++ b/Tests/RunCMake/Make/DetectJobServer-absent.cmake @@ -0,0 +1,13 @@ +# Verifies that the jobserver connection is absent +add_custom_command(OUTPUT custom_command.txt + JOB_SERVER_AWARE OFF + COMMENT "Should not detect jobserver" + COMMAND ${DETECT_JOBSERVER} --absent "custom_command.txt" +) + +# trigger the custom command to run +add_custom_target(dummy ALL + JOB_SERVER_AWARE OFF + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/custom_command.txt + COMMAND ${DETECT_JOBSERVER} --absent "custom_target.txt" +) diff --git a/Tests/RunCMake/Make/DetectJobServer-present.cmake b/Tests/RunCMake/Make/DetectJobServer-present.cmake new file mode 100644 index 00000000000..a33658f7b65 --- /dev/null +++ b/Tests/RunCMake/Make/DetectJobServer-present.cmake @@ -0,0 +1,13 @@ +# Verifies that the jobserver is present +add_custom_command(OUTPUT custom_command.txt + JOB_SERVER_AWARE ON + COMMENT "Should detect jobserver support" + COMMAND ${DETECT_JOBSERVER} --present "custom_command.txt" +) + +# trigger the custom command to run +add_custom_target(dummy ALL + JOB_SERVER_AWARE ON + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/custom_command.txt + COMMAND ${DETECT_JOBSERVER} --present "custom_target.txt" +) diff --git a/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake b/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake new file mode 100644 index 00000000000..7c5c2960ed2 --- /dev/null +++ b/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake @@ -0,0 +1,12 @@ +# This test verifies that the commands in the generated Makefiles contain the +# `+` prefix +function(check_for_plus_prefix target) + set(file "${RunCMake_BINARY_DIR}/GNUMakeJobServerAware-build/${target}") + file(READ "${file}" build_file) + if(NOT "${build_file}" MATCHES [[\+]]) + message(FATAL_ERROR "The file ${file} does not contain the expected prefix in the custom command.") + endif() +endfunction() + +check_for_plus_prefix("CMakeFiles/dummy.dir/build.make") +check_for_plus_prefix("CMakeFiles/dummy2.dir/build.make") diff --git a/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake b/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake new file mode 100644 index 00000000000..951c2d7b5d6 --- /dev/null +++ b/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake @@ -0,0 +1,12 @@ +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/custom-command" + JOB_SERVER_AWARE ON + COMMAND $(CMAKE_COMMAND) -E touch "${CMAKE_CURRENT_BINARY_DIR}/custom-command" +) +add_custom_target(dummy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/custom-command") + +add_custom_target( + dummy2 ALL + JOB_SERVER_AWARE ON + COMMAND ${CMAKE_COMMAND} -E true +) diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake index c7717ec1d6b..12904c86688 100644 --- a/Tests/RunCMake/Make/RunCMakeTest.cmake +++ b/Tests/RunCMake/Make/RunCMakeTest.cmake @@ -70,3 +70,43 @@ if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") run_CMP0113(OLD) run_CMP0113(NEW) endif() + +function(detect_jobserver_present is_parallel) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DetectJobServer-present-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DDETECT_JOBSERVER=${DETECT_JOBSERVER}") + run_cmake(DetectJobServer-present) + if (is_parallel) + run_cmake_command(DetectJobServer-present-parallel-build ${CMAKE_COMMAND} --build . -j4) + else() + run_cmake_command(DetectJobServer-present-build ${CMAKE_COMMAND} --build .) + endif() +endfunction() + +function(detect_jobserver_absent is_parallel) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DetectJobServer-absent-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS "-DDETECT_JOBSERVER=${DETECT_JOBSERVER}") + run_cmake(DetectJobServer-absent) + if (is_parallel) + run_cmake_command(DetectJobServer-absent-parallel-build ${CMAKE_COMMAND} --build . -j4) + else() + run_cmake_command(DetectJobServer-absent-build ${CMAKE_COMMAND} --build .) + endif() +endfunction() + +# Jobservers are currently only supported by GNU makes, except MSYS2 make +if(MAKE_IS_GNU AND NOT RunCMake_GENERATOR MATCHES "MSYS Makefiles") + detect_jobserver_present(ON) +else() + detect_jobserver_absent(ON) +endif() +# No matter which generator is used, the jobserver should not be present if a +# parallel build is not requested +detect_jobserver_absent(OFF) + +if(MAKE_IS_GNU) + # In GNU makes, `JOB_SERVER_AWARE` support is implemented by prefixing + # commands with the '+' operator. + run_cmake(GNUMakeJobServerAware) +endif() diff --git a/Tests/RunCMake/detect_jobserver.c b/Tests/RunCMake/detect_jobserver.c new file mode 100644 index 00000000000..a6c1a7c4581 --- /dev/null +++ b/Tests/RunCMake/detect_jobserver.c @@ -0,0 +1,204 @@ +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1928 +# pragma warning(disable : 5105) /* macro expansion warning in windows.h */ +#endif + +#include +#include +#include + +#define MAX_MESSAGE_LENGTH 1023 +#define USAGE "Usage: %s [--present|--absent] \n" + +// Extracts --jobserver-auth= or --jobserver-fds= from +// MAKEFLAGS. The returned pointer points to the start of Returns NULL +// if MAKEFLAGS is not set or does not contain --jobserver-auth or +// --jobserver-fds +char* jobserver_auth(char* message) +{ + const char* jobserver_auth = "--jobserver-auth="; + const char* jobserver_fds = "--jobserver-fds="; + char* auth; + char* fds; + char* start; + char* end; + char* result; + size_t len; + + char* makeflags = getenv("MAKEFLAGS"); + if (makeflags == NULL) { + strncpy(message, "MAKEFLAGS not set", MAX_MESSAGE_LENGTH); + return NULL; + } + + // write MAKEFLAGS to stdout for debugging + fprintf(stdout, "MAKEFLAGS: %s\n", makeflags); + + auth = strstr(makeflags, jobserver_auth); + fds = strstr(makeflags, jobserver_fds); + if (auth == NULL && fds == NULL) { + strncpy(message, "No jobserver found", MAX_MESSAGE_LENGTH); + return NULL; + } else if (auth != NULL) { + start = auth + strlen(jobserver_auth); + } else { + start = fds + strlen(jobserver_fds); + } + + end = strchr(start, ' '); + if (end == NULL) { + end = start + strlen(start); + } + len = (size_t)(end - start); + result = (char*)malloc(len + 1); + strncpy(result, start, len); + result[len] = '\0'; + + return result; +} + +#if defined(_WIN32) +# include + +int windows_semaphore(const char* semaphore, char* message) +{ + // Open the semaphore + HANDLE hSemaphore = OpenSemaphoreA(SEMAPHORE_ALL_ACCESS, FALSE, semaphore); + + if (hSemaphore == NULL) { +# if defined(_MSC_VER) && _MSC_VER < 1900 + sprintf(message, "Error opening semaphore: %s (%ld)\n", semaphore, + GetLastError()); +# else + snprintf(message, MAX_MESSAGE_LENGTH, + "Error opening semaphore: %s (%ld)\n", semaphore, GetLastError()); +# endif + return 1; + } + + strncpy(message, "Success", MAX_MESSAGE_LENGTH); + return 0; +} +#else +# include +# include + +int test_fd(int read_fd, int write_fd, char* message) +{ + // Detect if the file descriptors are valid + int read_good = fcntl(read_fd, F_GETFD) != -1; + int read_error = errno; + + int write_good = fcntl(write_fd, F_GETFD) != -1; + int write_error = errno; + + if (!read_good || !write_good) { + snprintf(message, MAX_MESSAGE_LENGTH, + "Error opening file descriptors: %d (%s), %d (%s)\n", read_fd, + strerror(read_error), write_fd, strerror(write_error)); + return 1; + } + + snprintf(message, MAX_MESSAGE_LENGTH, "Success\n"); + return 0; +} + +int posix(const char* jobserver, char* message) +{ + int read_fd; + int write_fd; + const char* path; + + // First try to parse as "R,W" file descriptors + if (sscanf(jobserver, "%d,%d", &read_fd, &write_fd) == 2) { + return test_fd(read_fd, write_fd, message); + } + + // Then try to parse as "fifo:PATH" + if (strncmp(jobserver, "fifo:", 5) == 0) { + path = jobserver + 5; + read_fd = open(path, O_RDONLY); + write_fd = open(path, O_WRONLY); + return test_fd(read_fd, write_fd, message); + } + + // We don't understand the format + snprintf(message, MAX_MESSAGE_LENGTH, "Unrecognized jobserver format: %s\n", + jobserver); + return 1; +} +#endif + +// Takes 2 arguments: +// Either --present or --absent to indicate we expect the jobserver to be +// "present and valid", or "absent or invalid" +// +// if `--present` is passed, the exit code will be 0 if the jobserver is +// present, 1 if it is absent if `--absent` is passed, the exit code will be 0 +// if the jobserver is absent, 1 if it is present in either case, if there is +// some fatal error (e.g the output file cannot be opened), the exit code will +// be 2 +int main(int argc, char** argv) +{ + char message[MAX_MESSAGE_LENGTH + 1]; + char* output_file; + FILE* fp; + int expecting_present; + int expecting_absent; + char* jobserver; + int result; + + if (argc != 3) { + fprintf(stderr, USAGE, argv[0]); + return 2; + } + + expecting_present = strcmp(argv[1], "--present") == 0; + expecting_absent = strcmp(argv[1], "--absent") == 0; + if (!expecting_present && !expecting_absent) { + fprintf(stderr, USAGE, argv[0]); + return 2; + } + + output_file = argv[2]; + fp = fopen(output_file, "w"); + if (fp == NULL) { + fprintf(stderr, "Error opening output file: %s\n", output_file); + return 2; + } + + jobserver = jobserver_auth(message); + if (jobserver == NULL) { + if (expecting_absent) { + fprintf(stdout, "Success\n"); + return 0; + } + + fprintf(stderr, "%s\n", message); + return 1; + } + +#if defined(_WIN32) + result = windows_semaphore(jobserver, message); +#else + result = posix(jobserver, message); +#endif + free(jobserver); + message[MAX_MESSAGE_LENGTH] = 0; + + if (result == 0 && expecting_present) { + fprintf(stdout, "Success\n"); + return 0; + } + + if (result == 1 && expecting_absent) { + fprintf(stdout, "Success\n"); + return 0; + } + + fprintf(stderr, "%s\n", message); + return 1; +} From 0b74471d62944a25423e9e09c778fd604daea0f8 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:29:45 -0400 Subject: [PATCH 117/627] cmCoreTryCompile: use `cmStrCat` where possible --- Source/cmCoreTryCompile.cxx | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 586db1b4725..adbcaddeffb 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -479,11 +479,11 @@ cm::optional cmCoreTryCompile::TryCompileCode( std::map cmakeVariables; - std::string outFileName = this->BinaryDirectory + "/CMakeLists.txt"; + std::string outFileName = cmStrCat(this->BinaryDirectory, "/CMakeLists.txt"); // which signature are we using? If we are using var srcfile bindir if (this->SrcFileSignature) { // remove any CMakeCache.txt files so we will have a clean test - std::string ccFile = this->BinaryDirectory + "/CMakeCache.txt"; + std::string ccFile = cmStrCat(this->BinaryDirectory, "/CMakeCache.txt"); cmSystemTools::RemoveFile(ccFile); // Choose sources. @@ -655,7 +655,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( std::string projectLangs; for (std::string const& li : testLangs) { - projectLangs += " " + li; + projectLangs += cmStrCat(" ", li); std::string rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE"; std::string rulesOverrideLang = cmStrCat(rulesOverrideBase, "_", li); if (cmValue rulesOverridePath = @@ -690,7 +690,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( } fprintf(fout, "set(CMAKE_VERBOSE_MAKEFILE 1)\n"); for (std::string const& li : testLangs) { - std::string langFlags = "CMAKE_" + li + "_FLAGS"; + std::string langFlags = cmStrCat("CMAKE_", li, "_FLAGS"); cmValue flags = this->Makefile->GetDefinition(langFlags); fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li.c_str(), cmOutputConverter::EscapeForCMake(*flags).c_str()); @@ -794,10 +794,10 @@ cm::optional cmCoreTryCompile::TryCompileCode( } if (!targets.empty()) { - std::string fname = "/" + std::string(targetName) + "Targets.cmake"; + std::string fname = cmStrCat("/", targetName, "Targets.cmake"); cmExportTryCompileFileGenerator tcfg(gg, targets, this->Makefile, testLangs); - tcfg.SetExportFile((this->BinaryDirectory + fname).c_str()); + tcfg.SetExportFile(cmStrCat(this->BinaryDirectory, fname).c_str()); tcfg.SetConfig(tcConfig); if (!tcfg.GenerateImportFile()) { @@ -965,7 +965,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( if (arguments.LinkLibraries) { std::string libsToLink = " "; for (std::string const& i : *arguments.LinkLibraries) { - libsToLink += "\"" + cmTrimWhitespace(i) + "\" "; + libsToLink += cmStrCat("\"", cmTrimWhitespace(i), "\" "); } fprintf(fout, "target_link_libraries(%s %s)\n", targetName.c_str(), libsToLink.c_str()); @@ -1064,7 +1064,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( if (cmValue tcArchs = this->Makefile->GetDefinition( kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES)) { vars.erase(kCMAKE_OSX_ARCHITECTURES); - std::string flag = "-DCMAKE_OSX_ARCHITECTURES=" + *tcArchs; + std::string flag = cmStrCat("-DCMAKE_OSX_ARCHITECTURES=", *tcArchs); arguments.CMakeFlags.emplace_back(std::move(flag)); cmakeVariables.emplace("CMAKE_OSX_ARCHITECTURES", *tcArchs); } @@ -1082,7 +1082,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( for (std::string const& var : vars) { if (cmValue val = this->Makefile->GetDefinition(var)) { - std::string flag = "-D" + var + "=" + *val; + std::string flag = cmStrCat("-D", var, "=", *val); arguments.CMakeFlags.emplace_back(std::move(flag)); cmakeVariables.emplace(var, *val); } @@ -1093,7 +1093,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( // Forward the GHS variables to the inner project cache. for (std::string const& var : ghs_platform_vars) { if (cmValue val = this->Makefile->GetDefinition(var)) { - std::string flag = "-D" + var + "=" + "'" + *val + "'"; + std::string flag = cmStrCat("-D", var, "=", "'", *val, "'"); arguments.CMakeFlags.emplace_back(std::move(flag)); cmakeVariables.emplace(var, *val); } @@ -1204,10 +1204,10 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir) } if (!IsTemporary(binDir)) { - cmSystemTools::Error( + cmSystemTools::Error(cmStrCat( "TRY_COMPILE attempt to remove -rf directory that does not contain " - "CMakeTmp or CMakeScratch: \"" + - binDir + "\""); + "CMakeTmp or CMakeScratch: \"", + binDir, "\"")); return; } @@ -1220,8 +1220,7 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir) // Do not delete NFS temporary files. !cmHasPrefix(fileName, ".nfs")) { if (deletedFiles.insert(fileName).second) { - std::string const fullPath = - std::string(binDir).append("/").append(fileName); + std::string const fullPath = cmStrCat(binDir, "/", fileName); if (cmSystemTools::FileIsSymlink(fullPath)) { cmSystemTools::RemoveFile(fullPath); } else if (cmSystemTools::FileIsDirectory(fullPath)) { From b8fd1cc8d9286d1045a86d138fb24544e359ede6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:27:26 -0400 Subject: [PATCH 118/627] cmCoreTryCompile: use single characters where possible --- Source/cmCoreTryCompile.cxx | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index adbcaddeffb..9b67d7f4b88 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -232,7 +232,7 @@ Arguments cmCoreTryCompile::ParseArgs( !unparsedArguments.empty()) { std::string m = "Unknown arguments:"; for (const auto& i : unparsedArguments) { - m = cmStrCat(m, "\n \"", i, "\""); + m = cmStrCat(m, "\n \"", i, '"'); } this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, m); } @@ -346,7 +346,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( this->Makefile->IssueMessage( MessageType::FATAL_ERROR, cmStrCat(" is not an absolute path:\n '", - *arguments.BinaryDirectory, "'")); + *arguments.BinaryDirectory, '\'')); return cm::nullopt; } this->BinaryDirectory = *arguments.BinaryDirectory; @@ -378,7 +378,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( cmStrCat("Only libraries may be used as try_compile or try_run " "IMPORTED LINK_LIBRARIES. Got ", tgt->GetName(), " of type ", - cmState::GetTargetTypeName(tgt->GetType()), ".")); + cmState::GetTargetTypeName(tgt->GetType()), '.')); return cm::nullopt; } if (tgt->IsImported()) { @@ -526,12 +526,12 @@ cm::optional cmCoreTryCompile::TryCompileCode( if (!cmSystemTools::GetFilenamePath(dst).empty()) { const auto& msg = - cmStrCat("SOURCE_FROM_FILE given invalid filename \"", dst, "\""); + cmStrCat("SOURCE_FROM_FILE given invalid filename \"", dst, '"'); this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg); return cm::nullopt; } - auto dstPath = cmStrCat(this->BinaryDirectory, "/", dst); + auto dstPath = cmStrCat(this->BinaryDirectory, '/', dst); auto const result = cmSystemTools::CopyFileAlways(src, dstPath); if (!result.IsSuccess()) { const auto& msg = cmStrCat("SOURCE_FROM_FILE failed to copy \"", src, @@ -655,9 +655,9 @@ cm::optional cmCoreTryCompile::TryCompileCode( std::string projectLangs; for (std::string const& li : testLangs) { - projectLangs += cmStrCat(" ", li); + projectLangs += cmStrCat(' ', li); std::string rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE"; - std::string rulesOverrideLang = cmStrCat(rulesOverrideBase, "_", li); + std::string rulesOverrideLang = cmStrCat(rulesOverrideBase, '_', li); if (cmValue rulesOverridePath = this->Makefile->GetDefinition(rulesOverrideLang)) { fprintf(fout, "set(%s \"%s\")\n", rulesOverrideLang.c_str(), @@ -794,7 +794,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( } if (!targets.empty()) { - std::string fname = cmStrCat("/", targetName, "Targets.cmake"); + std::string fname = cmStrCat('/', targetName, "Targets.cmake"); cmExportTryCompileFileGenerator tcfg(gg, targets, this->Makefile, testLangs); tcfg.SetExportFile(cmStrCat(this->BinaryDirectory, fname).c_str()); @@ -965,7 +965,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( if (arguments.LinkLibraries) { std::string libsToLink = " "; for (std::string const& i : *arguments.LinkLibraries) { - libsToLink += cmStrCat("\"", cmTrimWhitespace(i), "\" "); + libsToLink += cmStrCat('"', cmTrimWhitespace(i), "\" "); } fprintf(fout, "target_link_libraries(%s %s)\n", targetName.c_str(), libsToLink.c_str()); @@ -1082,7 +1082,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( for (std::string const& var : vars) { if (cmValue val = this->Makefile->GetDefinition(var)) { - std::string flag = cmStrCat("-D", var, "=", *val); + std::string flag = cmStrCat("-D", var, '=', *val); arguments.CMakeFlags.emplace_back(std::move(flag)); cmakeVariables.emplace(var, *val); } @@ -1093,7 +1093,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( // Forward the GHS variables to the inner project cache. for (std::string const& var : ghs_platform_vars) { if (cmValue val = this->Makefile->GetDefinition(var)) { - std::string flag = cmStrCat("-D", var, "=", "'", *val, "'"); + std::string flag = cmStrCat("-D", var, '=', '\'', *val, '\''); arguments.CMakeFlags.emplace_back(std::move(flag)); cmakeVariables.emplace(var, *val); } @@ -1207,7 +1207,7 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir) cmSystemTools::Error(cmStrCat( "TRY_COMPILE attempt to remove -rf directory that does not contain " "CMakeTmp or CMakeScratch: \"", - binDir, "\"")); + binDir, '"')); return; } @@ -1220,7 +1220,7 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir) // Do not delete NFS temporary files. !cmHasPrefix(fileName, ".nfs")) { if (deletedFiles.insert(fileName).second) { - std::string const fullPath = cmStrCat(binDir, "/", fileName); + std::string const fullPath = cmStrCat(binDir, '/', fileName); if (cmSystemTools::FileIsSymlink(fullPath)) { cmSystemTools::RemoveFile(fullPath); } else if (cmSystemTools::FileIsDirectory(fullPath)) { @@ -1304,12 +1304,12 @@ std::string cmCoreTryCompile::WriteSource(std::string const& filename, { if (!cmSystemTools::GetFilenamePath(filename).empty()) { const auto& msg = - cmStrCat(command, " given invalid filename \"", filename, "\""); + cmStrCat(command, " given invalid filename \"", filename, '"'); this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg); return {}; } - auto filepath = cmStrCat(this->BinaryDirectory, "/", filename); + auto filepath = cmStrCat(this->BinaryDirectory, '/', filename); cmsys::ofstream file{ filepath.c_str(), std::ios::out }; if (!file) { const auto& msg = @@ -1320,7 +1320,7 @@ std::string cmCoreTryCompile::WriteSource(std::string const& filename, file << content; if (!file) { - const auto& msg = cmStrCat(command, " failed to write \"", filename, "\""); + const auto& msg = cmStrCat(command, " failed to write \"", filename, '"'); this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg); return {}; } From 884c47754543c8462e097093925da5b4c142a819 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:30:48 -0400 Subject: [PATCH 119/627] cmCoreTryCompile: combine strings where possible --- Source/cmCoreTryCompile.cxx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 9b67d7f4b88..0a1ed303ccc 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -555,10 +555,13 @@ cm::optional cmCoreTryCompile::TryCompileCode( testLangs.insert(lang); } else { std::ostringstream err; - err << "Unknown extension \"" << ext << "\" for file\n" - << " " << si << "\n" - << "try_compile() works only for enabled languages. " - << "Currently these are:\n "; + err << "Unknown extension \"" << ext + << "\" for file\n" + " " + << si + << "\n" + "try_compile() works only for enabled languages. " + "Currently these are:\n "; std::vector langs; gg->GetEnabledLanguages(langs); err << cmJoin(langs, " "); @@ -587,7 +590,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( std::ostringstream e; /* clang-format off */ e << "Failed to open\n" - << " " << outFileName << "\n" + " " << outFileName << "\n" << cmSystemTools::GetLastSystemError(); /* clang-format on */ this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); @@ -1093,7 +1096,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( // Forward the GHS variables to the inner project cache. for (std::string const& var : ghs_platform_vars) { if (cmValue val = this->Makefile->GetDefinition(var)) { - std::string flag = cmStrCat("-D", var, '=', '\'', *val, '\''); + std::string flag = cmStrCat("-D", var, "=\'", *val, '\''); arguments.CMakeFlags.emplace_back(std::move(flag)); cmakeVariables.emplace(var, *val); } @@ -1155,11 +1158,11 @@ cm::optional cmCoreTryCompile::TryCompileCode( } /* clang-format off */ err = cmStrCat( - "Cannot copy output executable\n", - " '", this->OutputFile, "'\n", - "to destination specified by COPY_FILE:\n", - " '", copyFile, "'\n", - "because:\n", + "Cannot copy output executable\n" + " '", this->OutputFile, "'\n" + "to destination specified by COPY_FILE:\n" + " '", copyFile, "'\n" + "because:\n" " ", err, "\n", this->FindErrorMessage); /* clang-format on */ From cfdb5c970c45b9e98d34ef72a036842f033d2cf8 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:32:25 -0400 Subject: [PATCH 120/627] cmGlobalGenerator: use `cmStrCat` where possible --- Source/cmGlobalGenerator.cxx | 81 +++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 3d7d5a7a2e9..97cb737981c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -239,7 +239,8 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang, if (!mf->GetDefinition(langComp)) { if (!optional) { - cmSystemTools::Error(langComp + " not set, after EnableLanguage"); + cmSystemTools::Error( + cmStrCat(langComp, " not set, after EnableLanguage")); } return; } @@ -636,11 +637,10 @@ void cmGlobalGenerator::EnableLanguage( #if defined(_WIN32) && !defined(__CYGWIN__) cmSystemTools::WindowsVersion windowsVersion = cmSystemTools::GetWindowsVersion(); - std::ostringstream windowsVersionString; - windowsVersionString << windowsVersion.dwMajorVersion << "." - << windowsVersion.dwMinorVersion << "." - << windowsVersion.dwBuildNumber; - mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION", windowsVersionString.str()); + auto windowsVersionString = cmStrCat(windowsVersion.dwMajorVersion, '.', + windowsVersion.dwMinorVersion, '.', + windowsVersion.dwBuildNumber); + mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION", windowsVersionString); #endif // Read the DetermineSystem file std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake"); @@ -695,22 +695,22 @@ void cmGlobalGenerator::EnableLanguage( setupFile, mf->GetCurrentSourceDirectory()); if (!cmSystemTools::FileExists(absSetupFile)) { cmSystemTools::Error( - "CMAKE_PROJECT_TOP_LEVEL_INCLUDES file does not exist: " + - setupFile); + cmStrCat("CMAKE_PROJECT_TOP_LEVEL_INCLUDES file does not exist: ", + setupFile)); mf->GetState()->SetInTopLevelIncludes(false); return; } if (cmSystemTools::FileIsDirectory(absSetupFile)) { cmSystemTools::Error( - "CMAKE_PROJECT_TOP_LEVEL_INCLUDES file is a directory: " + - setupFile); + cmStrCat("CMAKE_PROJECT_TOP_LEVEL_INCLUDES file is a directory: ", + setupFile)); mf->GetState()->SetInTopLevelIncludes(false); return; } if (!mf->ReadListFile(absSetupFile)) { cmSystemTools::Error( - "Failed reading CMAKE_PROJECT_TOP_LEVEL_INCLUDES file: " + - setupFile); + cmStrCat("Failed reading CMAKE_PROJECT_TOP_LEVEL_INCLUDES file: ", + setupFile)); mf->GetState()->SetInTopLevelIncludes(false); return; } @@ -754,7 +754,8 @@ void cmGlobalGenerator::EnableLanguage( // to avoid duplicate compiler tests. if (cmSystemTools::FileExists(fpath)) { if (!mf->ReadListFile(fpath)) { - cmSystemTools::Error("Could not find cmake module file: " + fpath); + cmSystemTools::Error( + cmStrCat("Could not find cmake module file: ", fpath)); } // if this file was found then the language was already determined // to be working @@ -778,8 +779,8 @@ void cmGlobalGenerator::EnableLanguage( cmStrCat("CMakeDetermine", lang, "Compiler.cmake"); std::string determineFile = mf->GetModulesFile(determineCompiler); if (!mf->ReadListFile(determineFile)) { - cmSystemTools::Error("Could not find cmake module file: " + - determineCompiler); + cmSystemTools::Error( + cmStrCat("Could not find cmake module file: ", determineCompiler)); } if (cmSystemTools::GetFatalErrorOccurred()) { return; @@ -807,7 +808,8 @@ void cmGlobalGenerator::EnableLanguage( // configures CMake(LANG)Compiler.cmake fpath = cmStrCat(rootBin, "/CMake", lang, "Compiler.cmake"); if (!mf->ReadListFile(fpath)) { - cmSystemTools::Error("Could not find cmake module file: " + fpath); + cmSystemTools::Error( + cmStrCat("Could not find cmake module file: ", fpath)); } this->SetLanguageEnabledFlag(lang, mf); needSetLanguageEnabledMaps[lang] = true; @@ -890,10 +892,11 @@ void cmGlobalGenerator::EnableLanguage( fpath = cmStrCat("CMake", lang, "Information.cmake"); std::string informationFile = mf->GetModulesFile(fpath); if (informationFile.empty()) { - cmSystemTools::Error("Could not find cmake module file: " + fpath); + cmSystemTools::Error( + cmStrCat("Could not find cmake module file: ", fpath)); } else if (!mf->ReadListFile(informationFile)) { - cmSystemTools::Error("Could not process cmake module file: " + - informationFile); + cmSystemTools::Error( + cmStrCat("Could not process cmake module file: ", informationFile)); } } if (needSetLanguageEnabledMaps[lang]) { @@ -911,8 +914,8 @@ void cmGlobalGenerator::EnableLanguage( std::string testLang = cmStrCat("CMakeTest", lang, "Compiler.cmake"); std::string ifpath = mf->GetModulesFile(testLang); if (!mf->ReadListFile(ifpath)) { - cmSystemTools::Error("Could not find cmake module file: " + - testLang); + cmSystemTools::Error( + cmStrCat("Could not find cmake module file: ", testLang)); } std::string compilerWorks = cmStrCat("CMAKE_", lang, "_COMPILER_WORKS"); @@ -977,7 +980,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os, void cmGlobalGenerator::CheckCompilerIdCompatibility( cmMakefile* mf, std::string const& lang) const { - std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID"; + std::string compilerIdVar = cmStrCat("CMAKE_", lang, "_COMPILER_ID"); std::string const compilerId = mf->GetSafeDefinition(compilerIdVar); if (compilerId == "AppleClang") { @@ -1105,9 +1108,9 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility( } { // Fix compiler versions. - std::string version = "CMAKE_" + lang + "_COMPILER_VERSION"; - std::string emulated = "CMAKE_" + lang + "_SIMULATE_VERSION"; - std::string emulatedId = "CMAKE_" + lang + "_SIMULATE_ID"; + std::string version = cmStrCat("CMAKE_", lang, "_COMPILER_VERSION"); + std::string emulated = cmStrCat("CMAKE_", lang, "_SIMULATE_VERSION"); + std::string emulatedId = cmStrCat("CMAKE_", lang, "_SIMULATE_ID"); std::string const& actual = mf->GetRequiredDefinition(emulated); mf->AddDefinition(version, actual); mf->RemoveDefinition(emulatedId); @@ -1208,7 +1211,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, return; } - std::string linkerPrefVar = "CMAKE_" + l + "_LINKER_PREFERENCE"; + std::string linkerPrefVar = cmStrCat("CMAKE_", l, "_LINKER_PREFERENCE"); cmValue linkerPref = mf->GetDefinition(linkerPrefVar); int preference = 0; if (cmNonempty(linkerPref)) { @@ -1234,7 +1237,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, this->LanguageToLinkerPreference[l] = preference; - std::string outputExtensionVar = "CMAKE_" + l + "_OUTPUT_EXTENSION"; + std::string outputExtensionVar = cmStrCat("CMAKE_", l, "_OUTPUT_EXTENSION"); if (cmValue p = mf->GetDefinition(outputExtensionVar)) { std::string outputExtension = *p; this->LanguageToOutputExtension[l] = outputExtension; @@ -1251,7 +1254,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, this->FillExtensionToLanguageMap(l, mf); std::string ignoreExtensionsVar = - std::string("CMAKE_") + std::string(l) + std::string("_IGNORE_EXTENSIONS"); + cmStrCat("CMAKE_", l, "_IGNORE_EXTENSIONS"); std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar); cmList extensionList{ ignoreExts }; for (std::string const& i : extensionList) { @@ -1262,8 +1265,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf) { - std::string extensionsVar = std::string("CMAKE_") + std::string(l) + - std::string("_SOURCE_FILE_EXTENSIONS"); + std::string extensionsVar = cmStrCat("CMAKE_", l, "_SOURCE_FILE_EXTENSIONS"); const std::string& exts = mf->GetSafeDefinition(extensionsVar); cmList extensionList{ exts }; for (std::string const& i : extensionList) { @@ -1886,7 +1888,7 @@ void cmGlobalGenerator::FinalizeTargetConfiguration() std::set standardIncludesSet; for (std::string const& li : langs) { std::string const standardIncludesVar = - "CMAKE_" + li + "_STANDARD_INCLUDE_DIRECTORIES"; + cmStrCat("CMAKE_", li, "_STANDARD_INCLUDE_DIRECTORIES"); std::string const& standardIncludesStr = mf->GetSafeDefinition(standardIncludesVar); cmList standardIncludesList{ standardIncludesStr }; @@ -2019,11 +2021,12 @@ void cmGlobalGenerator::CheckTargetProperties() notFoundVars += notFound.second; notFoundVars += "\n"; } - cmSystemTools::Error("The following variables are used in this project, " - "but they are set to NOTFOUND.\n" - "Please set them or make sure they are set and " - "tested correctly in the CMake files:\n" + - notFoundVars); + cmSystemTools::Error( + cmStrCat("The following variables are used in this project, " + "but they are set to NOTFOUND.\n" + "Please set them or make sure they are set and " + "tested correctly in the CMake files:\n", + notFoundVars)); } } @@ -2181,8 +2184,8 @@ int cmGlobalGenerator::Build( outputflag, timeout)) { cmSystemTools::SetRunCommandHideConsole(hideconsole); cmSystemTools::Error( - "Generator: execution of make failed. Make command was: " + - makeCommandStr); + cmStrCat("Generator: execution of make failed. Make command was: ", + makeCommandStr)); ostr << *outputPtr << "\nGenerator: execution of make failed. Make command was: " << outputMakeCommandStr << std::endl; @@ -3342,7 +3345,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target) // Place the labels file in a per-target support directory. std::string dir = target->GetSupportDirectory(); std::string file = cmStrCat(dir, "/Labels.txt"); - std::string json_file = dir + "/Labels.json"; + std::string json_file = cmStrCat(dir, "/Labels.json"); #ifndef CMAKE_BOOTSTRAP // Check whether labels are enabled for this target. From 2a74f641dbb6edb2468d836d9c0152e87f44957a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:32:33 -0400 Subject: [PATCH 121/627] cmGlobalGenerator: use single chars where possible --- Source/cmGlobalGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 97cb737981c..2ee56f17ef4 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2019,7 +2019,7 @@ void cmGlobalGenerator::CheckTargetProperties() for (auto const& notFound : notFoundMap) { notFoundVars += notFound.first; notFoundVars += notFound.second; - notFoundVars += "\n"; + notFoundVars += '\n'; } cmSystemTools::Error( cmStrCat("The following variables are used in this project, " From e41ff26735dc03f2e34f414c59182c088dedca4b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:32:50 -0400 Subject: [PATCH 122/627] cmMakefile: use `cmStrCat` where possible --- Source/cmMakefile.cxx | 47 ++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e1841b6e7b1..5483c2fa6c9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -515,7 +515,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, if (!hadNestedError) { // The command invocation requested that we report an error. std::string const error = - std::string(lff.OriginalName()) + " " + status.GetError(); + cmStrCat(lff.OriginalName(), " ", status.GetError()); this->IssueMessage(MessageType::FATAL_ERROR, error); } result = false; @@ -1860,7 +1860,8 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf) cmSystemTools::Message(msg); } - std::string const currentStartFile = currentStart + "/CMakeLists.txt"; + std::string const currentStartFile = + cmStrCat(currentStart, "/CMakeLists.txt"); if (!cmSystemTools::FileExists(currentStartFile, true)) { // The file is missing. Check policy CMP0014. std::ostringstream e; @@ -2571,7 +2572,7 @@ cmMakefile::AppleSDK cmMakefile::GetAppleSDKType() const for (auto const& entry : sdkDatabase) { if (cmHasPrefix(sdkRoot, entry.name) || - sdkRoot.find(std::string("/") + entry.name) != std::string::npos) { + sdkRoot.find(cmStrCat("/", entry.name)) != std::string::npos) { return entry.sdk; } } @@ -3238,9 +3239,9 @@ MessageType cmMakefile::ExpandVariablesInStringNew( errorstr += "Invalid character (\'"; errorstr += inc; result.append(last, in - last); - errorstr += "\') in a variable name: " - "'" + - result.substr(openstack.back().loc) + "'"; + errorstr += cmStrCat("\') in a variable name: " + "'", + result.substr(openstack.back().loc), "'"); mtype = MessageType::FATAL_ERROR; error = true; } @@ -3649,11 +3650,12 @@ void cmMakefile::EnableLanguage(std::vector const& languages, if (!duplicate_languages.empty()) { auto quantity = duplicate_languages.size() == 1 ? std::string(" has") : std::string("s have"); - this->IssueMessage(MessageType::AUTHOR_WARNING, - "Languages to be enabled may not be specified more " - "than once at the same time. The following language" + - quantity + " been specified multiple times: " + - cmJoin(duplicate_languages, ", ")); + this->IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat("Languages to be enabled may not be specified more " + "than once at the same time. The following language", + quantity, " been specified multiple times: ", + cmJoin(duplicate_languages, ", "))); } } @@ -3698,8 +3700,9 @@ int cmMakefile::TryCompile(const std::string& srcdir, cmWorkingDirectory workdir(bindir); if (workdir.Failed()) { this->IssueMessage(MessageType::FATAL_ERROR, - "Failed to set working directory to " + bindir + " : " + - std::strerror(workdir.GetLastResult())); + cmStrCat("Failed to set working directory to ", bindir, + " : ", + std::strerror(workdir.GetLastResult()))); cmSystemTools::SetFatalErrorOccurred(); this->IsSourceFileTryCompile = false; return 1; @@ -3927,7 +3930,7 @@ std::string cmMakefile::GetModulesFile(const std::string& filename, if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty()) { cmValue currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE"); - std::string mods = cmSystemTools::GetCMakeRoot() + "/Modules/"; + std::string mods = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/"); if (currentFile && cmSystemTools::IsSubDirectory(*currentFile, mods)) { switch (this->GetPolicyStatus(cmPolicies::CMP0017)) { case cmPolicies::WARN: { @@ -3986,8 +3989,9 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output, cmValue def = this->GetDefinition(this->cmDefineRegex.match(2)); if (!cmIsOff(def)) { const std::string indentation = this->cmDefineRegex.match(1); - cmSystemTools::ReplaceString(line, "#" + indentation + "cmakedefine", - "#" + indentation + "define"); + cmSystemTools::ReplaceString(line, + cmStrCat("#", indentation, "cmakedefine"), + cmStrCat("#", indentation, "define")); output += line; } else { output += "/* #undef "; @@ -3997,8 +4001,9 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output, } else if (this->cmDefine01Regex.find(line)) { const std::string indentation = this->cmDefine01Regex.match(1); cmValue def = this->GetDefinition(this->cmDefine01Regex.match(2)); - cmSystemTools::ReplaceString(line, "#" + indentation + "cmakedefine01", - "#" + indentation + "define"); + cmSystemTools::ReplaceString(line, + cmStrCat("#", indentation, "cmakedefine01"), + cmStrCat("#", indentation, "define")); output += line; if (!cmIsOff(def)) { output += " 1"; @@ -4036,12 +4041,12 @@ int cmMakefile::ConfigureFile(const std::string& infile, { int res = 1; if (!this->CanIWriteThisFile(outfile)) { - cmSystemTools::Error("Attempt to write file: " + outfile + - " into a source directory."); + cmSystemTools::Error(cmStrCat("Attempt to write file: ", outfile, + " into a source directory.")); return 0; } if (!cmSystemTools::FileExists(infile)) { - cmSystemTools::Error("File " + infile + " does not exist."); + cmSystemTools::Error(cmStrCat("File ", infile, " does not exist.")); return 0; } std::string soutfile = outfile; From 4fd80d54196cdf4538d8620fb7b27b33d77d3374 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:33:00 -0400 Subject: [PATCH 123/627] cmMakefile: use static string views in some locations --- Source/cmMakefile.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5483c2fa6c9..b29eca22bf0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1756,7 +1756,7 @@ void cmMakefile::Configure() bool hasVersion = false; // search for the right policy command for (cmListFileFunction const& func : listFile.Functions) { - if (func.LowerCaseName() == "cmake_minimum_required") { + if (func.LowerCaseName() == "cmake_minimum_required"_s) { hasVersion = true; break; } @@ -1803,7 +1803,7 @@ void cmMakefile::Configure() bool hasProject = false; // search for a project command for (cmListFileFunction const& func : listFile.Functions) { - if (func.LowerCaseName() == "project") { + if (func.LowerCaseName() == "project"_s) { hasProject = true; break; } @@ -2150,11 +2150,11 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target) for (auto j = linkLibs.begin(); j != linkLibs.end(); ++j) { std::string libraryName = *j; cmTargetLinkLibraryType libType = GENERAL_LibraryType; - if (libraryName == "optimized") { + if (libraryName == "optimized"_s) { libType = OPTIMIZED_LibraryType; ++j; libraryName = *j; - } else if (libraryName == "debug") { + } else if (libraryName == "debug"_s) { libType = DEBUG_LibraryType; ++j; libraryName = *j; @@ -2521,7 +2521,7 @@ bool cmMakefile::IsSet(const std::string& name) const bool cmMakefile::PlatformIs32Bit() const { if (cmValue plat_abi = this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) { - if (*plat_abi == "ELF X32") { + if (*plat_abi == "ELF X32"_s) { return false; } } @@ -2542,7 +2542,7 @@ bool cmMakefile::PlatformIs64Bit() const bool cmMakefile::PlatformIsx32() const { if (cmValue plat_abi = this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) { - if (*plat_abi == "ELF X32") { + if (*plat_abi == "ELF X32"_s) { return true; } } @@ -3648,8 +3648,7 @@ void cmMakefile::EnableLanguage(std::vector const& languages, } } if (!duplicate_languages.empty()) { - auto quantity = duplicate_languages.size() == 1 ? std::string(" has") - : std::string("s have"); + auto quantity = duplicate_languages.size() == 1 ? " has"_s : "s have"_s; this->IssueMessage( MessageType::AUTHOR_WARNING, cmStrCat("Languages to be enabled may not be specified more " @@ -3666,7 +3665,7 @@ void cmMakefile::EnableLanguage(std::vector const& languages, std::vector languages_for_RC; languages_without_RC.reserve(unique_languages.size()); for (std::string const& language : unique_languages) { - if (language == "RC") { + if (language == "RC"_s) { languages_for_RC.push_back(language); } else { languages_without_RC.push_back(language); @@ -4159,7 +4158,7 @@ cmValue cmMakefile::GetProperty(const std::string& prop) const { // Check for computed properties. static std::string output; - if (prop == "TESTS") { + if (prop == "TESTS"_s) { std::vector keys; // get list of keys const auto* t = this; From faf36e65b9f8a35ac54eb082e8f371c2b5a1bbba Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 Jul 2023 16:38:34 -0400 Subject: [PATCH 124/627] cmMakefile: use single characters where possible --- Source/cmMakefile.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b29eca22bf0..16a51888f76 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -515,7 +515,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, if (!hadNestedError) { // The command invocation requested that we report an error. std::string const error = - cmStrCat(lff.OriginalName(), " ", status.GetError()); + cmStrCat(lff.OriginalName(), ' ', status.GetError()); this->IssueMessage(MessageType::FATAL_ERROR, error); } result = false; @@ -2572,7 +2572,7 @@ cmMakefile::AppleSDK cmMakefile::GetAppleSDKType() const for (auto const& entry : sdkDatabase) { if (cmHasPrefix(sdkRoot, entry.name) || - sdkRoot.find(cmStrCat("/", entry.name)) != std::string::npos) { + sdkRoot.find(cmStrCat('/', entry.name)) != std::string::npos) { return entry.sdk; } } @@ -3154,15 +3154,15 @@ MessageType cmMakefile::ExpandVariablesInStringNew( char nextc = *next; if (nextc == 't') { result.append(last, in - last); - result.append("\t"); + result.push_back('\t'); last = next + 1; } else if (nextc == 'n') { result.append(last, in - last); - result.append("\n"); + result.push_back('\n'); last = next + 1; } else if (nextc == 'r') { result.append(last, in - last); - result.append("\r"); + result.push_back('\r'); last = next + 1; } else if (nextc == ';' && openstack.empty()) { // Handled in ExpandListArgument; pass the backslash literally. @@ -3241,7 +3241,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew( result.append(last, in - last); errorstr += cmStrCat("\') in a variable name: " "'", - result.substr(openstack.back().loc), "'"); + result.substr(openstack.back().loc), '\''); mtype = MessageType::FATAL_ERROR; error = true; } From e0ed4d7a6f9a2c9fe35360b2d9fb208eca5311f0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 20 Jul 2023 00:01:16 -0400 Subject: [PATCH 125/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3236afbc4a3..a5df18fc643 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230719) +set(CMake_VERSION_PATCH 20230720) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 7d3eede9232033040da62c577f5e0d4b842b89c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Marczell?= Date: Thu, 20 Jul 2023 14:57:12 +0200 Subject: [PATCH 126/627] Help: Document IOS_INSTALL_COMBINED as deprecated The approach has not made sense since the introduction of Apple Silicon and macOS arm64. Issue: #24957 --- Help/prop_tgt/IOS_INSTALL_COMBINED.rst | 17 +++++++++++++---- Help/release/dev/deprecate-install-combined.rst | 6 ++++++ Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst | 3 +++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 Help/release/dev/deprecate-install-combined.rst diff --git a/Help/prop_tgt/IOS_INSTALL_COMBINED.rst b/Help/prop_tgt/IOS_INSTALL_COMBINED.rst index 92d60dcf705..c296691e0b1 100644 --- a/Help/prop_tgt/IOS_INSTALL_COMBINED.rst +++ b/Help/prop_tgt/IOS_INSTALL_COMBINED.rst @@ -2,18 +2,27 @@ IOS_INSTALL_COMBINED -------------------- .. versionadded:: 3.5 +.. deprecated:: 3.28 + + :prop_tgt:`IOS_INSTALL_COMBINED` was designed to make universal binaries + containing iOS/arm* device code paired with iOS Simulator/x86_64 code + (or similar for other Apple embedded platforms). Universal binaries can only + differentiate code based on CPU type, so this only made sense before the + days of arm64 macOS machines (i.e. iOS Simulator/arm64). Apple now + recommends xcframeworks, which contain multiple binaries for different + platforms, for this use case. Build a combined (device and simulator) target when installing. -When this property is set to set to false (which is the default) then it will +When this property is set to false, which is the default, then it will either be built with the device SDK or the simulator SDK depending on the SDK set. But if this property is set to true then the target will at install time -also be built for the corresponding SDK and combined into one library. +also be built for the other SDK and combined into one library. .. note:: - If a selected architecture is available for both: device SDK and simulator + If a selected architecture is available for both device SDK and simulator SDK it will be built for the SDK selected by :variable:`CMAKE_OSX_SYSROOT` - and removed from the corresponding SDK. + and removed from the other SDK. This feature requires at least Xcode version 6. diff --git a/Help/release/dev/deprecate-install-combined.rst b/Help/release/dev/deprecate-install-combined.rst new file mode 100644 index 00000000000..12a0a43cb6c --- /dev/null +++ b/Help/release/dev/deprecate-install-combined.rst @@ -0,0 +1,6 @@ +deprecate-install-combined +-------------------------- + +* The :prop_tgt:`IOS_INSTALL_COMBINED` target property and corresponding + :variable:`CMAKE_IOS_INSTALL_COMBINED` variable have been deprecated. + Their functionality does not make sense on Apple Silicon hosts. diff --git a/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst b/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst index cd7fd8dcea2..0024ba94302 100644 --- a/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst +++ b/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst @@ -2,6 +2,9 @@ CMAKE_IOS_INSTALL_COMBINED -------------------------- .. versionadded:: 3.5 +.. deprecated:: 3.28 + + This is deprecated because :prop_tgt:`IOS_INSTALL_COMBINED` is deprecated. Default value for :prop_tgt:`IOS_INSTALL_COMBINED` of targets. From 6b5f2dbbfe453f9bafe46ee420e657735ff16fb0 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 29 Jun 2023 15:24:49 -0400 Subject: [PATCH 127/627] file(REAL_PATH): resolve symlinks before '..' components Previously REAL_PATH would collapse paths before resolving any symlinks so if `..` crossed a symlink the output from `REAL_PATH` would be wrong. It looked like REAL_PATH did this by mistake since it was a side-effect of ensuring we had an absolute path before resolving symlinks. --- Help/command/file.rst | 5 ++ Help/manual/cmake-policies.7.rst | 8 +++ Help/policy/CMP0152.rst | 20 +++++++ Modules/FindCUDAToolkit.cmake | 15 +++-- Source/cmFileCommand.cxx | 56 ++++++++++++++++++- Source/cmPolicies.h | 6 +- Tests/RunCMake/CMP0152/CMP0152-Common.cmake | 5 ++ Tests/RunCMake/CMP0152/CMP0152-NEW-stdout.txt | 0 Tests/RunCMake/CMP0152/CMP0152-NEW.cmake | 2 + Tests/RunCMake/CMP0152/CMP0152-OLD-stderr.txt | 0 Tests/RunCMake/CMP0152/CMP0152-OLD.cmake | 2 + .../RunCMake/CMP0152/CMP0152-WARN-stderr.txt | 27 +++++++++ Tests/RunCMake/CMP0152/CMP0152-WARN.cmake | 2 + Tests/RunCMake/CMP0152/CMakeLists.txt | 3 + Tests/RunCMake/CMP0152/RunCMakeTest.cmake | 7 +++ Tests/RunCMake/CMakeLists.txt | 4 ++ Tests/RunCMake/file/REAL_PATH.cmake | 37 ++++++++++++ 17 files changed, 189 insertions(+), 10 deletions(-) create mode 100644 Help/policy/CMP0152.rst create mode 100644 Tests/RunCMake/CMP0152/CMP0152-Common.cmake create mode 100644 Tests/RunCMake/CMP0152/CMP0152-NEW-stdout.txt create mode 100644 Tests/RunCMake/CMP0152/CMP0152-NEW.cmake create mode 100644 Tests/RunCMake/CMP0152/CMP0152-OLD-stderr.txt create mode 100644 Tests/RunCMake/CMP0152/CMP0152-OLD.cmake create mode 100644 Tests/RunCMake/CMP0152/CMP0152-WARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0152/CMP0152-WARN.cmake create mode 100644 Tests/RunCMake/CMP0152/CMakeLists.txt create mode 100644 Tests/RunCMake/CMP0152/RunCMakeTest.cmake diff --git a/Help/command/file.rst b/Help/command/file.rst index 30a7f4de7b1..f9d1a79872f 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -981,6 +981,11 @@ Path Conversion if ``USERPROFILE`` is not defined. On all other platforms, only ``HOME`` is used. + .. versionchanged:: 3.28 + + All symlinks are resolved before collapsing ``../`` components. + See policy :policy:`CMP0152`. + .. signature:: file(RELATIVE_PATH ) diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 7c488060b9d..89b7924fd4e 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions. +Policies Introduced by CMake 3.28 +================================= + +.. toctree:: + :maxdepth: 1 + + CMP0152: file(REAL_PATH) resolves symlinks before collapsing ../ components. + Policies Introduced by CMake 3.27 ================================= diff --git a/Help/policy/CMP0152.rst b/Help/policy/CMP0152.rst new file mode 100644 index 00000000000..d7e8692f8cc --- /dev/null +++ b/Help/policy/CMP0152.rst @@ -0,0 +1,20 @@ +CMP0152 +------- + +.. versionadded:: 3.28 + +:command:`file(REAL_PATH)` resolves symlinks before collapsing ../ components. + +In CMake 3.27 and below, :command:`file(REAL_PATH)` collapsed any ``../`` +components in a path before resolving symlinks. This produced incorrect +results when the ``../`` collapsed away a symlink. + +The ``OLD`` behavior for this policy is to collapse ``../`` components before +resolving symlinks. +The ``NEW`` behavior for this policy is to resolve all symlinks before +collapsing ``../`` components. + +This policy was introduced in CMake version 3.28. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. + +.. include:: DEPRECATED.txt diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 9cf7e29304e..7fd0401b109 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -965,12 +965,15 @@ if(CUDAToolkit_FOUND) # search paths without symlinks if(CUDAToolkit_LIBRARY_DIR MATCHES ".*/cuda/${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}/lib64$") # Search location for math_libs/ - file(REAL_PATH "${CUDAToolkit_LIBRARY_DIR}/../../../" _cmake_search_dir) - list(APPEND CUDAToolkit_LIBRARY_SEARCH_DIRS "${_cmake_search_dir}") - - # Search location for extras like cupti - file(REAL_PATH "${CUDAToolkit_LIBRARY_DIR}/../" _cmake_search_dir) - list(APPEND CUDAToolkit_LIBRARY_SEARCH_DIRS "${_cmake_search_dir}") + block(SCOPE_FOR POLICIES) + cmake_policy(SET CMP0152 NEW) + file(REAL_PATH "${CUDAToolkit_LIBRARY_DIR}/../../../../../" _cmake_search_dir) + list(APPEND CUDAToolkit_LIBRARY_SEARCH_DIRS "${_cmake_search_dir}") + + # Search location for extras like cupti + file(REAL_PATH "${CUDAToolkit_LIBRARY_DIR}/../../../" _cmake_search_dir) + list(APPEND CUDAToolkit_LIBRARY_SEARCH_DIRS "${_cmake_search_dir}") + endblock() endif() # If no `CUDAToolkit_LIBRARY_ROOT` exists set it based on CUDAToolkit_LIBRARY_DIR diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index def09feed40..f4fbf75b8cd 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -30,6 +30,7 @@ #include "cmArgumentParser.h" #include "cmArgumentParserTypes.h" +#include "cmCMakePath.h" #include "cmCryptoHash.h" #include "cmELF.h" #include "cmExecutionStatus.h" @@ -1278,9 +1279,58 @@ bool HandleRealPathCommand(std::vector const& args, } } - auto realPath = - cmSystemTools::CollapseFullPath(input, *arguments.BaseDirectory); - realPath = cmSystemTools::GetRealPath(realPath); + bool warnAbout152 = false; + bool use152New = true; + cmPolicies::PolicyStatus policyStatus = + status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0152); + switch (policyStatus) { + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + break; + case cmPolicies::WARN: + use152New = false; + warnAbout152 = true; + break; + case cmPolicies::OLD: + use152New = false; + warnAbout152 = false; + break; + } + + auto computeNewPath = [=](std::string const& in, std::string& result) { + auto path = cmCMakePath{ in }; + if (path.IsRelative()) { + auto basePath = cmCMakePath{ *arguments.BaseDirectory }; + path = basePath.Append(path); + } + result = cmSystemTools::GetActualCaseForPath( + cmSystemTools::GetRealPath(path.String())); + }; + + std::string realPath; + if (use152New) { + computeNewPath(input, realPath); + } else { + std::string oldPolicyPath = + cmSystemTools::CollapseFullPath(input, *arguments.BaseDirectory); + oldPolicyPath = cmSystemTools::GetRealPath(oldPolicyPath); + if (warnAbout152) { + computeNewPath(input, realPath); + if (oldPolicyPath != realPath) { + status.GetMakefile().IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat( + cmPolicies::GetPolicyWarning(cmPolicies::CMP0152), '\n', + "From input path:\n ", input, + "\nthe policy OLD behavior produces path:\n ", oldPolicyPath, + "\nbut the policy NEW behavior produces path:\n ", realPath, + "\nSince the policy is not set, CMake is using the OLD " + "behavior for compatibility.")); + } + } + realPath = oldPolicyPath; + } status.GetMakefile().AddDefinition(args[2], realPath); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a0030d3dc12..25af6a8a89d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -459,7 +459,11 @@ class cmMakefile; SELECT(POLICY, CMP0151, \ "AUTOMOC include directory is a system include directory by " \ "default.", \ - 3, 27, 0, cmPolicies::WARN) + 3, 27, 0, cmPolicies::WARN) \ + SELECT( \ + POLICY, CMP0152, \ + "file(REAL_PATH) resolves symlinks before collapsing ../ components.", 3, \ + 28, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Tests/RunCMake/CMP0152/CMP0152-Common.cmake b/Tests/RunCMake/CMP0152/CMP0152-Common.cmake new file mode 100644 index 00000000000..6429cca0373 --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-Common.cmake @@ -0,0 +1,5 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin/") +file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin" "${CMAKE_CURRENT_BINARY_DIR}/dir/bin" SYMBOLIC) +file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/../" real_path) diff --git a/Tests/RunCMake/CMP0152/CMP0152-NEW-stdout.txt b/Tests/RunCMake/CMP0152/CMP0152-NEW-stdout.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Tests/RunCMake/CMP0152/CMP0152-NEW.cmake b/Tests/RunCMake/CMP0152/CMP0152-NEW.cmake new file mode 100644 index 00000000000..86a3b55c84e --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0152 NEW) +include(CMP0152-Common.cmake) diff --git a/Tests/RunCMake/CMP0152/CMP0152-OLD-stderr.txt b/Tests/RunCMake/CMP0152/CMP0152-OLD-stderr.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Tests/RunCMake/CMP0152/CMP0152-OLD.cmake b/Tests/RunCMake/CMP0152/CMP0152-OLD.cmake new file mode 100644 index 00000000000..62ac3002dea --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0152 OLD) +include(CMP0152-Common.cmake) diff --git a/Tests/RunCMake/CMP0152/CMP0152-WARN-stderr.txt b/Tests/RunCMake/CMP0152/CMP0152-WARN-stderr.txt new file mode 100644 index 00000000000..8d631686cd7 --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-WARN-stderr.txt @@ -0,0 +1,27 @@ +^CMake Warning \(dev\) at CMP0152-Common\.cmake:[0-9]+ \(file\): + Policy CMP0152 is not set: file\(REAL_PATH\) resolves symlinks before + collapsing \.\./ components\. Run "cmake --help-policy CMP0152" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. + + From input path: + + [^ +]*/Tests/RunCMake/CMP0152/CMP0152-WARN-build/dir/bin/\.\./ + + the policy OLD behavior produces path: + + [^ +]*/Tests/RunCMake/CMP0152/CMP0152-WARN-build/dir + + but the policy NEW behavior produces path: + + [^ +]*/Tests/RunCMake/CMP0152/CMP0152-WARN-build/dir/nested + + Since the policy is not set, CMake is using the OLD behavior for + compatibility. +Call Stack \(most recent call first\): + CMP0152-WARN\.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/CMP0152/CMP0152-WARN.cmake b/Tests/RunCMake/CMP0152/CMP0152-WARN.cmake new file mode 100644 index 00000000000..e85589e25f0 --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMP0152-WARN.cmake @@ -0,0 +1,2 @@ + +include(CMP0152-Common.cmake) diff --git a/Tests/RunCMake/CMP0152/CMakeLists.txt b/Tests/RunCMake/CMP0152/CMakeLists.txt new file mode 100644 index 00000000000..5ff8d3e0ffc --- /dev/null +++ b/Tests/RunCMake/CMP0152/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.23) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0152/RunCMakeTest.cmake b/Tests/RunCMake/CMP0152/RunCMakeTest.cmake new file mode 100644 index 00000000000..7a9bab35362 --- /dev/null +++ b/Tests/RunCMake/CMP0152/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +if(NOT CMAKE_GENERATOR_NO_COMPILER_ENV) + run_cmake(CMP0152-WARN) + run_cmake(CMP0152-OLD) + run_cmake(CMP0152-NEW) +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index a62995aebbe..6c3146909a2 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -165,6 +165,10 @@ if(GIT_EXECUTABLE) add_RunCMake_test(CMP0150) endif() +if(NOT WIN32 OR CYGWIN) + add_RunCMake_test(CMP0152) +endif() + # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode # generators ignore. The policy will have no effect on those generators. diff --git a/Tests/RunCMake/file/REAL_PATH.cmake b/Tests/RunCMake/file/REAL_PATH.cmake index 9c5d4ea0ee6..08d400d3695 100644 --- a/Tests/RunCMake/file/REAL_PATH.cmake +++ b/Tests/RunCMake/file/REAL_PATH.cmake @@ -13,6 +13,43 @@ if (NOT WIN32 OR CYGWIN) if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt") message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"") endif() + + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/") + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/") + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin/") + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin" "${CMAKE_CURRENT_BINARY_DIR}/dir/bin" SYMBOLIC) + + cmake_policy(SET CMP0152 NEW) + file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/../" real_path) + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir/nested") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested\"") + endif() + + file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/../bin" real_path) + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin\"") + endif() + + file(REAL_PATH "dir/bin/../bin" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin\"") + endif() + + file(REAL_PATH "../bin" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/" ) + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested/bin\"") + endif() + + cmake_policy(SET CMP0152 OLD) + file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/../" real_path) + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir/nested\"") + endif() + file(REAL_PATH "../" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dir/bin/") + if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/dir") + message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/dir\"") + endif() + endif() From 6bbe6cdc3303e1263d681e12ca913665a31a7053 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 21 Jul 2023 00:01:13 -0400 Subject: [PATCH 128/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a5df18fc643..e100f2e0052 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230720) +set(CMake_VERSION_PATCH 20230721) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 199e1664ac9eb143f89741838943f5126e92e072 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 22 Jul 2023 00:01:11 -0400 Subject: [PATCH 129/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e100f2e0052..35409b99b2b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230721) +set(CMake_VERSION_PATCH 20230722) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From a3953247282e187a40a04773d18f0bc42e7d1f77 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 23 Jul 2023 00:01:11 -0400 Subject: [PATCH 130/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 35409b99b2b..9d303484318 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230722) +set(CMake_VERSION_PATCH 20230723) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From ee9908df397faf6b02e29a0516f931d913440101 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 24 Jul 2023 00:01:46 -0400 Subject: [PATCH 131/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9d303484318..f281a11fb36 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230723) +set(CMake_VERSION_PATCH 20230724) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 0cb4f08ddfd6612d3f7a31608519f9a8dcd85b4b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Jul 2023 13:46:20 -0400 Subject: [PATCH 132/627] cmPolicies: combine string literals where possible --- Source/cmPolicies.cxx | 50 ++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index d5e5725bf3c..ae07b89f84c 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -129,10 +129,10 @@ static void DiagnoseAncientPolicies( e << " " << idToString(i) << ": " << idToShortDescription(i) << "\n"; } e << "However, this version of CMake no longer supports the OLD " - << "behavior for these policies. " - << "Please either update your CMakeLists.txt files to conform to " - << "the new behavior or use an older version of CMake that still " - << "supports the old behavior."; + "behavior for these policies. " + "Please either update your CMakeLists.txt files to conform to " + "the new behavior or use an older version of CMake that still " + "supports the old behavior."; mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); } @@ -171,8 +171,9 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, if (sscanf(version_min.c_str(), "%u.%u.%u.%u", &minMajor, &minMinor, &minPatch, &minTweak) < 2) { std::ostringstream e; - e << "Invalid policy version value \"" << version_min << "\". " - << "A numeric major.minor[.patch[.tweak]] must be given."; + e << "Invalid policy version value \"" << version_min + << "\". " + "A numeric major.minor[.patch[.tweak]] must be given."; mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -201,10 +202,11 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, minTweak > cmVersion::GetTweakVersion())) { std::ostringstream e; e << "An attempt was made to set the policy version of CMake to \"" - << version_min << "\" which is greater than this version of CMake. " - << "This is not allowed because the greater version may have new " - << "policies not known to this CMake. " - << "You may need a newer CMake version to build this project."; + << version_min + << "\" which is greater than this version of CMake. " + "This is not allowed because the greater version may have new " + "policies not known to this CMake. " + "You may need a newer CMake version to build this project."; mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -222,8 +224,9 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, if (sscanf(version_max.c_str(), "%u.%u.%u.%u", &maxMajor, &maxMinor, &maxPatch, &maxTweak) < 2) { std::ostringstream e; - e << "Invalid policy max version value \"" << version_max << "\". " - << "A numeric major.minor[.patch[.tweak]] must be given."; + e << "Invalid policy max version value \"" << version_max + << "\". " + "A numeric major.minor[.patch[.tweak]] must be given."; mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -237,7 +240,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, std::ostringstream e; e << "Policy VERSION range \"" << version_min << "..." << version_max << "\"" - << " specifies a larger minimum than maximum."; + " specifies a larger minimum than maximum."; mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -396,16 +399,19 @@ std::string cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) { std::string pid = idToString(id); std::ostringstream e; - e << "Policy " << pid << " may not be set to OLD behavior because this " - << "version of CMake no longer supports it. " - << "The policy was introduced in " - << "CMake version " << idToVersion(id) + e << "Policy " << pid + << " may not be set to OLD behavior because this " + "version of CMake no longer supports it. " + "The policy was introduced in " + "CMake version " + << idToVersion(id) << ", and use of NEW behavior is now required." - << "\n" - << "Please either update your CMakeLists.txt files to conform to " - << "the new behavior or use an older version of CMake that still " - << "supports the old behavior. " - << "Run cmake --help-policy " << pid << " for more information."; + "\n" + "Please either update your CMakeLists.txt files to conform to " + "the new behavior or use an older version of CMake that still " + "supports the old behavior. " + "Run cmake --help-policy " + << pid << " for more information."; return e.str(); } From 0c8a2c4a86afdd1e196318b7cd7c8635b6158871 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Jul 2023 13:46:33 -0400 Subject: [PATCH 133/627] cmPolicies: use character literals where possible --- Source/cmPolicies.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index ae07b89f84c..119d9080083 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -123,10 +123,10 @@ static void DiagnoseAncientPolicies( { std::ostringstream e; e << "The project requests behavior compatible with CMake version \"" - << majorVer << "." << minorVer << "." << patchVer + << majorVer << '.' << minorVer << '.' << patchVer << "\", which requires the OLD behavior for some policies:\n"; for (cmPolicies::PolicyID i : ancient) { - e << " " << idToString(i) << ": " << idToShortDescription(i) << "\n"; + e << " " << idToString(i) << ": " << idToShortDescription(i) << '\n'; } e << "However, this version of CMake no longer supports the OLD " "behavior for these policies. " From 59eda7fa0abf2a39980ee35f35a5e6ffac31891b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Jul 2023 13:53:29 -0400 Subject: [PATCH 134/627] cmPolicies: use `cmStrCat` for string additions --- Source/cmPolicies.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 119d9080083..c2d5f6dfd6c 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -139,7 +139,7 @@ static void DiagnoseAncientPolicies( static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, cmPolicies::PolicyStatus* defaultSetting) { - std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy; + std::string defaultVar = cmStrCat("CMAKE_POLICY_DEFAULT_", policy); std::string const& defaultValue = mf->GetSafeDefinition(defaultVar); if (defaultValue == "NEW") { *defaultSetting = cmPolicies::NEW; From 0744c02e24c04e4a9ec559816a2cc90c453203a0 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 24 Jul 2023 14:56:28 -0400 Subject: [PATCH 135/627] FindCUDAToolkit: targets pointing to stubs now use IMPORTED_IMPLIB This ensures that we don't add rpath entries to the stubs directory which would cause runtime loading of the wrong libraries. --- Modules/FindCUDAToolkit.cmake | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index e9b7ae4435b..12aca8d5fea 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -1012,17 +1012,26 @@ if(CUDAToolkit_FOUND) ) # Don't try any stub directories until we have exhausted all other # search locations. - find_library(CUDA_${lib_name}_LIBRARY - NAMES ${search_names} - HINTS ${CUDAToolkit_LIBRARY_SEARCH_DIRS} - ENV CUDA_PATH - PATH_SUFFIXES lib64/stubs lib/x64/stubs lib/stubs stubs - ) + set(CUDA_IMPORT_PROPERTY IMPORTED_LOCATION) + set(CUDA_IMPORT_TYPE UNKNOWN) + if(NOT CUDA_${lib_name}_LIBRARY) + find_library(CUDA_${lib_name}_LIBRARY + NAMES ${search_names} + HINTS ${CUDAToolkit_LIBRARY_SEARCH_DIRS} + ENV CUDA_PATH + PATH_SUFFIXES lib64/stubs lib/x64/stubs lib/stubs stubs + ) + if(CUDA_${lib_name}_LIBRARY AND NOT WIN32) + # Use `IMPORTED_IMPLIB` so that we don't add a `-rpath` entry for stub directories + set(CUDA_IMPORT_PROPERTY IMPORTED_IMPLIB) + set(CUDA_IMPORT_TYPE SHARED) + endif() + endif() mark_as_advanced(CUDA_${lib_name}_LIBRARY) if (NOT TARGET CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY) - add_library(CUDA::${lib_name} UNKNOWN IMPORTED) + add_library(CUDA::${lib_name} ${CUDA_IMPORT_TYPE} IMPORTED) target_include_directories(CUDA::${lib_name} SYSTEM INTERFACE "${CUDAToolkit_INCLUDE_DIRS}") if(DEFINED CUDAToolkit_MATH_INCLUDE_DIR) string(FIND ${CUDA_${lib_name}_LIBRARY} "math_libs" math_libs) @@ -1030,7 +1039,7 @@ if(CUDAToolkit_FOUND) target_include_directories(CUDA::${lib_name} SYSTEM INTERFACE "${CUDAToolkit_MATH_INCLUDE_DIR}") endif() endif() - set_property(TARGET CUDA::${lib_name} PROPERTY IMPORTED_LOCATION "${CUDA_${lib_name}_LIBRARY}") + set_property(TARGET CUDA::${lib_name} PROPERTY ${CUDA_IMPORT_PROPERTY} "${CUDA_${lib_name}_LIBRARY}") foreach(dep ${arg_DEPS}) if(TARGET CUDA::${dep}) target_link_libraries(CUDA::${lib_name} INTERFACE CUDA::${dep}) From c4bb7fd4f3957c06ba373352421d87b6c7d53e52 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Jul 2023 13:53:46 -0400 Subject: [PATCH 136/627] cmPolicies: use `cmStrCat` for error message building --- Source/cmPolicies.cxx | 152 +++++++++++++++++++----------------------- 1 file changed, 68 insertions(+), 84 deletions(-) diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index c2d5f6dfd6c..d89c8c8cc22 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -148,10 +148,10 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, } else if (defaultValue.empty()) { *defaultSetting = cmPolicies::WARN; } else { - std::ostringstream e; - e << defaultVar << " has value \"" << defaultValue - << R"(" but must be "OLD", "NEW", or "" (empty).)"; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat(defaultVar, " has value \"", defaultValue, + R"(" but must be "OLD", "NEW", or "" (empty).)")); return false; } @@ -170,11 +170,11 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int minTweak = 0; if (sscanf(version_min.c_str(), "%u.%u.%u.%u", &minMajor, &minMinor, &minPatch, &minTweak) < 2) { - std::ostringstream e; - e << "Invalid policy version value \"" << version_min - << "\". " - "A numeric major.minor[.patch[.tweak]] must be given."; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Invalid policy version value \"", version_min, + "\". " + "A numeric major.minor[.patch[.tweak]] must be given.")); return false; } @@ -200,14 +200,14 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, minMinor == cmVersion::GetMinorVersion() && minPatch == cmVersion::GetPatchVersion() && minTweak > cmVersion::GetTweakVersion())) { - std::ostringstream e; - e << "An attempt was made to set the policy version of CMake to \"" - << version_min - << "\" which is greater than this version of CMake. " - "This is not allowed because the greater version may have new " - "policies not known to this CMake. " - "You may need a newer CMake version to build this project."; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("An attempt was made to set the policy version of CMake to \"", + version_min, + "\" which is greater than this version of CMake. ", + "This is not allowed because the greater version may have new " + "policies not known to this CMake. " + "You may need a newer CMake version to build this project.")); return false; } @@ -223,11 +223,11 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int maxTweak = 0; if (sscanf(version_max.c_str(), "%u.%u.%u.%u", &maxMajor, &maxMinor, &maxPatch, &maxTweak) < 2) { - std::ostringstream e; - e << "Invalid policy max version value \"" << version_max - << "\". " - "A numeric major.minor[.patch[.tweak]] must be given."; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Invalid policy max version value \"", version_max, + "\". " + "A numeric major.minor[.patch[.tweak]] must be given.")); return false; } @@ -237,11 +237,10 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, minPatch > maxPatch) || (minMajor == maxMajor && minMinor == maxMinor && minPatch == maxPatch && minTweak > maxTweak)) { - std::ostringstream e; - e << "Policy VERSION range \"" << version_min << "..." << version_max - << "\"" - " specifies a larger minimum than maximum."; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Policy VERSION range \"", version_min, "...", version_max, + "\" specifies a larger minimum than maximum.")); return false; } @@ -331,61 +330,49 @@ bool cmPolicies::GetPolicyID(const char* id, cmPolicies::PolicyID& pid) //! return a warning string for a given policy std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) { - std::ostringstream msg; - msg << "Policy " << idToString(id) - << " is not set: " - "" - << idToShortDescription(id) - << " " - "Run \"cmake --help-policy " - << idToString(id) - << "\" for " - "policy details. " - "Use the cmake_policy command to set the policy " - "and suppress this warning."; - return msg.str(); + return cmStrCat("Policy ", idToString(id), + " is not set: ", idToShortDescription(id), + " " + "Run \"cmake --help-policy ", + idToString(id), + "\" for " + "policy details. " + "Use the cmake_policy command to set the policy " + "and suppress this warning."); } std::string cmPolicies::GetPolicyDeprecatedWarning(cmPolicies::PolicyID id) { - std::ostringstream msg; - /* clang-format off */ - msg << - "The OLD behavior for policy " << idToString(id) << " " + return cmStrCat( + "The OLD behavior for policy ", idToString(id), + " " "will be removed from a future version of CMake.\n" "The cmake-policies(7) manual explains that the OLD behaviors of all " "policies are deprecated and that a policy should be set to OLD only " "under specific short-term circumstances. Projects should be ported " - "to the NEW behavior and not rely on setting a policy to OLD." - ; - /* clang-format on */ - return msg.str(); + "to the NEW behavior and not rely on setting a policy to OLD."); } //! return an error string for when a required policy is unspecified std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) { - std::ostringstream error; - error << "Policy " << idToString(id) - << " is not set to NEW: " - "" - << idToShortDescription(id) - << " " - "Run \"cmake --help-policy " - << idToString(id) - << "\" for " - "policy details. " - "CMake now requires this policy to be set to NEW by the project. " - "The policy may be set explicitly using the code\n" - " cmake_policy(SET " - << idToString(id) - << " NEW)\n" - "or by upgrading all policies with the code\n" - " cmake_policy(VERSION " - << idToVersion(id) - << ") # or later\n" - "Run \"cmake --help-command cmake_policy\" for more information."; - return error.str(); + return cmStrCat( + "Policy ", idToString(id), + " is not set to NEW: ", idToShortDescription(id), + " " + "Run \"cmake --help-policy ", + idToString(id), + "\" for policy details. " + "CMake now requires this policy to be set to NEW by the project. " + "The policy may be set explicitly using the code\n" + " cmake_policy(SET ", + idToString(id), + " NEW)\n" + "or by upgrading all policies with the code\n" + " cmake_policy(VERSION ", + idToVersion(id), + ") # or later\n" + "Run \"cmake --help-command cmake_policy\" for more information."); } //! Get the default status for a policy @@ -398,21 +385,18 @@ cmPolicies::PolicyStatus cmPolicies::GetPolicyStatus( std::string cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id) { std::string pid = idToString(id); - std::ostringstream e; - e << "Policy " << pid - << " may not be set to OLD behavior because this " - "version of CMake no longer supports it. " - "The policy was introduced in " - "CMake version " - << idToVersion(id) - << ", and use of NEW behavior is now required." - "\n" - "Please either update your CMakeLists.txt files to conform to " - "the new behavior or use an older version of CMake that still " - "supports the old behavior. " - "Run cmake --help-policy " - << pid << " for more information."; - return e.str(); + return cmStrCat( + "Policy ", pid, + " may not be set to OLD behavior because this " + "version of CMake no longer supports it. " + "The policy was introduced in CMake version ", + idToVersion(id), + ", and use of NEW behavior is now required." + "\n" + "Please either update your CMakeLists.txt files to conform to " + "the new behavior or use an older version of CMake that still " + "supports the old behavior. Run cmake --help-policy ", + pid, " for more information."); } cmPolicies::PolicyStatus cmPolicies::PolicyMap::Get( From ec155433ed3d719afb52752d63e868b1b23b96fc Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:01:51 -0400 Subject: [PATCH 137/627] FindFLTK: Replace exec_program() with execute_process() --- Modules/FindFLTK.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index d54d2f68b7c..a245c6c95d2 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -232,7 +232,7 @@ else() find_program(FLTK_CONFIG_SCRIPT fltk-config PATHS ${FLTK_BIN_DIR}) if(FLTK_CONFIG_SCRIPT) if(NOT FLTK_INCLUDE_DIR) - exec_program(${FLTK_CONFIG_SCRIPT} ARGS --cxxflags OUTPUT_VARIABLE FLTK_CXXFLAGS) + execute_process(COMMAND ${FLTK_CONFIG_SCRIPT} --cxxflags OUTPUT_VARIABLE FLTK_CXXFLAGS) if(FLTK_CXXFLAGS) string(REGEX MATCHALL "-I[^ ]*" _fltk_temp_dirs ${FLTK_CXXFLAGS}) string(REPLACE "-I" "" _fltk_temp_dirs "${_fltk_temp_dirs}") @@ -256,7 +256,7 @@ else() # Try to find FLTK library if(UNIX) if(FLTK_CONFIG_SCRIPT) - exec_program(${FLTK_CONFIG_SCRIPT} ARGS --libs OUTPUT_VARIABLE _FLTK_POSSIBLE_LIBS) + execute_process(COMMAND ${FLTK_CONFIG_SCRIPT} --libs OUTPUT_VARIABLE _FLTK_POSSIBLE_LIBS) if(_FLTK_POSSIBLE_LIBS) get_filename_component(_FLTK_POSSIBLE_LIBRARY_DIR ${_FLTK_POSSIBLE_LIBS} PATH) endif() @@ -292,12 +292,12 @@ else() # Find the extra libraries needed for the fltk_images library. if(UNIX) if(FLTK_CONFIG_SCRIPT) - exec_program(${FLTK_CONFIG_SCRIPT} ARGS --use-images --ldflags + execute_process(COMMAND ${FLTK_CONFIG_SCRIPT} --use-images --ldflags OUTPUT_VARIABLE FLTK_IMAGES_LDFLAGS) set(FLTK_LIBS_EXTRACT_REGEX ".*-lfltk_images (.*) -lfltk.*") if("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}") string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${CMAKE_MATCH_1}") - # The EXEC_PROGRAM will not be inherited into subdirectories from + # The execute_process() will not be inherited into subdirectories from # the file that originally included this module. Save the answer. set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL "Extra libraries for fltk_images library.") From 31cab35bb648b8b3a36192d42c56ba10f5247245 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:02:19 -0400 Subject: [PATCH 138/627] FindFLTK2: Replace exec_program() with execute_process() --- Modules/FindFLTK2.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index a43f7a47553..2f6e41d39ac 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -191,12 +191,12 @@ if(FLTK2_DIR) if(UNIX) find_program(FLTK2_CONFIG_SCRIPT fltk2-config PATHS ${FLTK2_BIN_DIR}) if(FLTK2_CONFIG_SCRIPT) - exec_program(${FLTK2_CONFIG_SCRIPT} ARGS --use-images --ldflags + execute_process(COMMAND ${FLTK2_CONFIG_SCRIPT} --use-images --ldflags OUTPUT_VARIABLE FLTK2_IMAGES_LDFLAGS) set(FLTK2_LIBS_EXTRACT_REGEX ".*-lfltk2_images (.*) -lfltk2.*") if("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}") string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${CMAKE_MATCH_1}") - # The EXEC_PROGRAM will not be inherited into subdirectories from + # The execute_process() will not be inherited into subdirectories from # the file that originally included this module. Save the answer. set(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL "Extra libraries for fltk_images library.") From 13f7ae287820836a16f6a1f70617b3d494b232d7 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:03:16 -0400 Subject: [PATCH 139/627] FindQt: Replace exec_program() with execute_process() --- Modules/FindQt.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 44a1f414c57..604f8e3adb0 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -91,7 +91,7 @@ endif () # now find qmake find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin") if(QT_QMAKE_EXECUTABLE_FINDQT) - exec_program(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION" + execute_process(COMMAND ${QT_QMAKE_EXECUTABLE_FINDQT} -query QT_VERSION OUTPUT_VARIABLE QTVERSION) if(QTVERSION MATCHES "4") set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "Qt4 qmake program.") @@ -103,8 +103,8 @@ if(QT_QMAKE_EXECUTABLE_FINDQT) endif() if(QT_QMAKE_EXECUTABLE_FINDQT) - exec_program( ${QT_QMAKE_EXECUTABLE_FINDQT} - ARGS "-query QT_INSTALL_HEADERS" + execute_process(COMMAND ${QT_QMAKE_EXECUTABLE_FINDQT} + -query QT_INSTALL_HEADERS OUTPUT_VARIABLE qt_headers ) endif() From 17bab9e7090cb804f86fc0d62d100e25745232c4 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:08:31 -0400 Subject: [PATCH 140/627] FindwxWindows: Replace exec_program() with execute_process() --- Modules/FindwxWindows.cmake | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 6e4be91b72c..d1b25e1637c 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -635,14 +635,14 @@ else() # remember: always link shared to use systems GL etc. libs (no static # linking, just link *against* static .a libs) if(WXWINDOWS_USE_SHARED_LIBS) - set(WX_CONFIG_ARGS_LIBS "--libs") + set(WX_CONFIG_ARGS_LIBS --libs) else() - set(WX_CONFIG_ARGS_LIBS "--static --libs") + set(WX_CONFIG_ARGS_LIBS --static --libs) endif() # do we need additionial wx GL stuff like GLCanvas ? if(WXWINDOWS_USE_GL) - string(APPEND WX_CONFIG_ARGS_LIBS " --gl-libs" ) + list(APPEND WX_CONFIG_ARGS_LIBS --gl-libs) endif() ##message("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===") @@ -662,14 +662,15 @@ else() ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===") # keep the back-quoted string for clarity - set(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`") + string(REPLACE ";" " " _wx_config_args_libs "${WX_CONFIG_ARGS_LIBS}") + set(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${_wx_config_args_libs}`") ##message("DBG2: for linking: ##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===") # evaluate wx-config output to separate linker flags and linkdirs for # rpath: - exec_program(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} - ARGS ${WX_CONFIG_ARGS_LIBS} + execute_process(COMMAND ${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} + ${WX_CONFIG_ARGS_LIBS} OUTPUT_VARIABLE WX_CONFIG_LIBS ) ## extract linkdirs (-L) for rpath From f73a5bfaa9e75abb74e24d823847ba6fd57fc5f5 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:10:28 -0400 Subject: [PATCH 141/627] UsePkgConfig: Replace exec_program() with execute_process() --- Modules/UsePkgConfig.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/UsePkgConfig.cmake b/Modules/UsePkgConfig.cmake index 32d228dabcb..b0202595c36 100644 --- a/Modules/UsePkgConfig.cmake +++ b/Modules/UsePkgConfig.cmake @@ -35,25 +35,25 @@ macro(PKGCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) # if pkg-config has been found if(PKGCONFIG_EXECUTABLE) - exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull ) + execute_process(COMMAND ${PKGCONFIG_EXECUTABLE} ${_package} --exists RESULT_VARIABLE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull ) # and if the package of interest also exists for pkg-config, then get the information if(NOT _return_VALUE) - exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=includedir + execute_process(COMMAND ${PKGCONFIG_EXECUTABLE} ${_package} --variable=includedir OUTPUT_VARIABLE ${_include_DIR} ) string(REGEX REPLACE "[\r\n]" " " ${_include_DIR} "${${_include_DIR}}") - exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=libdir + execute_process(COMMAND ${PKGCONFIG_EXECUTABLE} ${_package} --variable=libdir OUTPUT_VARIABLE ${_link_DIR} ) string(REGEX REPLACE "[\r\n]" " " ${_link_DIR} "${${_link_DIR}}") - exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --libs + execute_process(COMMAND ${PKGCONFIG_EXECUTABLE} ${_package} --libs OUTPUT_VARIABLE ${_link_FLAGS} ) string(REGEX REPLACE "[\r\n]" " " ${_link_FLAGS} "${${_link_FLAGS}}") - exec_program(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --cflags + execute_process(COMMAND ${PKGCONFIG_EXECUTABLE} ${_package} --cflags OUTPUT_VARIABLE ${_cflags} ) string(REGEX REPLACE "[\r\n]" " " ${_cflags} "${${_cflags}}") From 6463263ffa6f45b95756a81df8ba48885861c072 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:11:47 -0400 Subject: [PATCH 142/627] Tests/CMakeOnly: Replace exec_program() with execute_process() --- Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt index e6ed5598d11..0f3bd4cb87b 100644 --- a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt @@ -20,7 +20,7 @@ macro(TEST_PASS value msg) endmacro() if(CMAKE_COMPILER_IS_GNUCXX) - exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info) + execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE _gcc_version_info) string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}") # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the # patch level, handle this here: @@ -30,12 +30,12 @@ if(CMAKE_COMPILER_IS_GNUCXX) endif() if(CMAKE_CXX_COMPILER_ID MATCHES Clang) - exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE _clang_version_info) + execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE _clang_version_info) string (REGEX REPLACE ".*version ([0-9]\\.[0-9]).*" "\\1" _clang_version "${_clang_version_info}") endif() if(CMAKE_CXX_COMPILER_ID MATCHES Intel) - exec_program(${CMAKE_CXX_COMPILER} ARGS -V OUTPUT_VARIABLE _intel_version_info) + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -V OUTPUT_VARIABLE _intel_version_info) string (REGEX REPLACE ".*Version ([0-9]+(\\.[0-9]+)+).*" "\\1" _intel_version "${_intel_version_info}") endif() From e43d97cb29cb6c4c4b949ec167c345069ecc7910 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:19:58 -0400 Subject: [PATCH 143/627] Tests/CommandLineTest: Replace exec_program() with execute_process() --- Tests/CommandLineTest/CMakeLists.txt | 68 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Tests/CommandLineTest/CMakeLists.txt b/Tests/CommandLineTest/CMakeLists.txt index 96aac104c28..a44fb3995eb 100644 --- a/Tests/CommandLineTest/CMakeLists.txt +++ b/Tests/CommandLineTest/CMakeLists.txt @@ -2,58 +2,58 @@ cmake_minimum_required (VERSION 2.6) project(CommandLineTest) get_filename_component(CMAKE_BIN_DIR ${CMAKE_COMMAND} PATH) -macro(EXEC_CMAKE_COMMAND CMAKE_ARGS) - exec_program("${CMAKE_COMMAND}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET) +macro(EXEC_CMAKE_COMMAND) + execute_process(COMMAND "${CMAKE_COMMAND}" ${ARGN} RESULT_VARIABLE RET) if(${RET}) - message(SEND_ERROR "CMake command failed with arguments \"${CMAKE_ARGS}\"") + message(SEND_ERROR "CMake command failed with arguments \"${ARGN}\"") endif() endmacro() -EXEC_CMAKE_COMMAND("-E chdir \"${CMAKE_CURRENT_SOURCE_DIR}\" \"${CMAKE_COMMAND}\" -E echo \"Hello World\"") -EXEC_CMAKE_COMMAND("-E time \"${CMAKE_COMMAND} -N -L ${CommandLineTest_SOURCE_DIR}\"") -EXEC_CMAKE_COMMAND("-E time \"${CMAKE_COMMAND} -N -LA ${CommandLineTest_SOURCE_DIR}\"") -EXEC_CMAKE_COMMAND("-E time \"${CMAKE_COMMAND} -N -LH ${CommandLineTest_SOURCE_DIR}\"") -EXEC_CMAKE_COMMAND("-E time \"${CMAKE_COMMAND} -N -LAH ${CommandLineTest_SOURCE_DIR}\"") -EXEC_CMAKE_COMMAND("--help") -EXEC_CMAKE_COMMAND("--help-command-list") -EXEC_CMAKE_COMMAND("--help add_executable") -EXEC_CMAKE_COMMAND("--help-command add_executable") -EXEC_CMAKE_COMMAND("--help-full \"${CMAKE_CURRENT_BINARY_DIR}/cmake.txt\"") -EXEC_CMAKE_COMMAND("--help-man \"${CMAKE_CURRENT_BINARY_DIR}/cmake.man\"") -EXEC_CMAKE_COMMAND("--help-html \"${CMAKE_CURRENT_BINARY_DIR}/cmake.html\"") -EXEC_CMAKE_COMMAND("--copyright \"${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt\"") -EXEC_CMAKE_COMMAND("--version \"${CMAKE_CURRENT_BINARY_DIR}/version.txt\"") +EXEC_CMAKE_COMMAND(-E chdir "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_COMMAND}" -E echo "Hello World") +EXEC_CMAKE_COMMAND(-E time "${CMAKE_COMMAND} -N -L ${CommandLineTest_SOURCE_DIR}") +EXEC_CMAKE_COMMAND(-E time "${CMAKE_COMMAND} -N -LA ${CommandLineTest_SOURCE_DIR}") +EXEC_CMAKE_COMMAND(-E time "${CMAKE_COMMAND} -N -LH ${CommandLineTest_SOURCE_DIR}") +EXEC_CMAKE_COMMAND(-E time "${CMAKE_COMMAND} -N -LAH ${CommandLineTest_SOURCE_DIR}") +EXEC_CMAKE_COMMAND(--help) +EXEC_CMAKE_COMMAND(--help-command-list) +EXEC_CMAKE_COMMAND(--help add_executable) +EXEC_CMAKE_COMMAND(--help-command add_executable) +EXEC_CMAKE_COMMAND(--help-full "${CMAKE_CURRENT_BINARY_DIR}/cmake.txt") +EXEC_CMAKE_COMMAND(--help-man "${CMAKE_CURRENT_BINARY_DIR}/cmake.man") +EXEC_CMAKE_COMMAND(--help-html "${CMAKE_CURRENT_BINARY_DIR}/cmake.html") +EXEC_CMAKE_COMMAND(--copyright "${CMAKE_CURRENT_BINARY_DIR}/Copyright.txt") +EXEC_CMAKE_COMMAND(--version "${CMAKE_CURRENT_BINARY_DIR}/version.txt") add_executable(CommandLineTest CommandLineTest.cxx) get_filename_component(CMAKE_COMMAND_PATH "${CMAKE_COMMAND}" PATH) set(CTEST_COMMAND "${CMAKE_COMMAND_PATH}/ctest") -macro(EXEC_CTEST_COMMAND CMAKE_ARGS) - exec_program("${CTEST_COMMAND}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET) +macro(EXEC_CTEST_COMMAND) + execute_process(COMMAND "${CTEST_COMMAND}" ${ARGN} RESULT_VARIABLE RET) if(${RET}) message(SEND_ERROR "CTest command failed with arguments \"${CMAKE_ARGS}\"") endif() endmacro() -macro(EXEC_CTEST_COMMAND_WITH_DIR DIR CMAKE_ARGS) - exec_program("${CTEST_COMMAND}" "${DIR}" ARGS "${CMAKE_ARGS}" RETURN_VALUE RET) +macro(EXEC_CTEST_COMMAND_WITH_DIR DIR) + execute_process(COMMAND "${CTEST_COMMAND}" ${ARGN} WORKING_DIRECTORY "${DIR}" RESULT_VARIABLE RET) if(${RET}) message(SEND_ERROR "CTest command failed with arguments \"${CMAKE_ARGS}\"") endif() endmacro() -EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-N") -EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-R complex -N") -EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-E Simple -N") -EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-E Simple -N") -EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-N -I -10") -EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-N -I 10-") -EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." "-N -I 3,4") -EXEC_CTEST_COMMAND("--help") -EXEC_CTEST_COMMAND("--copyright") -EXEC_CTEST_COMMAND("--help-full \"${CMAKE_CURRENT_BINARY_DIR}/ctest.txt\"") -EXEC_CTEST_COMMAND("--help-man \"${CMAKE_CURRENT_BINARY_DIR}/ctest.man\"") -EXEC_CTEST_COMMAND("--help-html \"${CMAKE_CURRENT_BINARY_DIR}/ctest.html\"") -EXEC_CTEST_COMMAND("--version") +EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -N) +EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -R complex -N) +EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -E Simple -N) +EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -E Simple -N) +EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -N -I -10) +EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -N -I 10-) +EXEC_CTEST_COMMAND_WITH_DIR("${CMAKE_CURRENT_BINARY_DIR}/../.." -N -I 3,4) +EXEC_CTEST_COMMAND(--help) +EXEC_CTEST_COMMAND(--copyright) +EXEC_CTEST_COMMAND(--help-full "${CMAKE_CURRENT_BINARY_DIR}/ctest.txt") +EXEC_CTEST_COMMAND(--help-man "${CMAKE_CURRENT_BINARY_DIR}/ctest.man") +EXEC_CTEST_COMMAND(--help-html "${CMAKE_CURRENT_BINARY_DIR}/ctest.html") +EXEC_CTEST_COMMAND(--version) if(THIS_SHOULD_BE_SET) message(STATUS "***************************") From 13e674b61b895266afb49c444621516411852b77 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:26:18 -0400 Subject: [PATCH 144/627] Tests/Complex: Replace exec_program() with execute_process() --- Tests/Complex/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 9493a2fa4ef..d3a184d937b 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -327,12 +327,12 @@ if (WIN32) ${Complex_SOURCE_DIR}/Library/dummy "${dir}/${file}" COPYONLY) - exec_program(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"") + execute_process(COMMAND ${CMAKE_COMMAND} -E write_regv "${hkey}" "${dir}") find_path(REGISTRY_TEST_PATH ${file} "[${hkey}]" DOC "Registry_Test_Path") - exec_program(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"") - exec_program(${CMAKE_COMMAND} ARGS "-E rm -f \"${dir}/${file}\"") + execute_process(COMMAND ${CMAKE_COMMAND} -E delete_regv "${hkey}") + execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f "${dir}/${file}") endif () endif () From 54a68b221a3ac4b56ba014f224f4f37fa3dda85c Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:28:04 -0400 Subject: [PATCH 145/627] Tests/ComplexOneConfig: Replace exec_program() with execute_process() --- Tests/ComplexOneConfig/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index e4fdc68331e..dd996e153e6 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -284,12 +284,12 @@ if (WIN32) ${Complex_SOURCE_DIR}/Library/dummy "${dir}/${file}" COPYONLY) - exec_program(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"") + execute_process(COMMAND ${CMAKE_COMMAND} -E write_regv "${hkey}" "${dir}") find_path(REGISTRY_TEST_PATH ${file} "[${hkey}]" DOC "Registry_Test_Path") - exec_program(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"") - exec_program(${CMAKE_COMMAND} ARGS "-E rm -f \"${dir}/${file}\"") + execute_process(COMMAND ${CMAKE_COMMAND} -E delete_regv "${hkey}") + execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f "${dir}/${file}") endif () endif () From 8776236161f0c9691cf5d63ddd39eb1d86180cba Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:30:53 -0400 Subject: [PATCH 146/627] Tests/ExternalOBJ: Replace exec_program() with execute_process() --- Tests/ExternalOBJ/CMakeLists.txt | 2 +- Tests/ExternalOBJ/Object/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/ExternalOBJ/CMakeLists.txt b/Tests/ExternalOBJ/CMakeLists.txt index 4ff75b8cc89..141977c8155 100644 --- a/Tests/ExternalOBJ/CMakeLists.txt +++ b/Tests/ExternalOBJ/CMakeLists.txt @@ -3,7 +3,7 @@ project (ExternalOBJ) if(APPLE) # set _CMAKE_OSX_MACHINE to umame -m - exec_program(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) + execute_process(COMMAND uname -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE OUTPUT_STRIP_TRAILING_WHITESPACE) # check for Power PC and change to ppc if("${_CMAKE_OSX_MACHINE}" MATCHES "Power") set(_CMAKE_OSX_MACHINE ppc) diff --git a/Tests/ExternalOBJ/Object/CMakeLists.txt b/Tests/ExternalOBJ/Object/CMakeLists.txt index dbfe09ee69c..a886da0184d 100644 --- a/Tests/ExternalOBJ/Object/CMakeLists.txt +++ b/Tests/ExternalOBJ/Object/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project(Object) if(APPLE) # set _CMAKE_OSX_MACHINE to umame -m - exec_program(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) + execute_process(COMMAND uname -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE OUTPUT_STRIP_TRAILING_WHITESPACE) # check for Power PC and change to ppc if("${_CMAKE_OSX_MACHINE}" MATCHES "Power") set(_CMAKE_OSX_MACHINE ppc) From edfa4d762d138753a3b4e47c567b0d819313c770 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 17:32:29 -0400 Subject: [PATCH 147/627] cmake_uninstall.cmake.in: Replace exec_program() with execute_process() --- cmake_uninstall.cmake.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in index b5fc700928e..9e61b00c745 100644 --- a/cmake_uninstall.cmake.in +++ b/cmake_uninstall.cmake.in @@ -7,10 +7,10 @@ string(REPLACE "\n" ";" files "${files}") foreach(file ${files}) message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") if(EXISTS "$ENV{DESTDIR}${file}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E rm -f \"$ENV{DESTDIR}${file}\"" + execute_process( + COMMAND "@CMAKE_COMMAND@" -E rm -f "$ENV{DESTDIR}${file}" OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval + RESULT_VARIABLE rm_retval ) if("${rm_retval}" STREQUAL 0) else() From 58ebb156916c8cc6b3cf2d80385a3633dd544085 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 25 Jul 2023 00:01:10 -0400 Subject: [PATCH 148/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f281a11fb36..35d6d178f41 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230724) +set(CMake_VERSION_PATCH 20230725) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From ff12a57d5e459fac4cf2b11f90a681bc165c4a42 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 24 Jul 2023 16:59:28 -0400 Subject: [PATCH 149/627] exec_program(): Remove by policy CMP0153 --- Help/command/exec_program.rst | 4 ++++ Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0153.rst | 12 ++++++++++++ Help/release/dev/exec_program-policy.rst | 6 ++++++ Source/cmCommands.cxx | 4 +++- Source/cmPolicies.h | 4 +++- Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt | 1 + Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt | 3 +++ Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt | 1 + Tests/RunCMake/CMP0153/CMP0153-NEW.cmake | 2 ++ Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt | 1 + Tests/RunCMake/CMP0153/CMP0153-OLD.cmake | 2 ++ Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt | 6 ++++++ Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt | 1 + Tests/RunCMake/CMP0153/CMP0153-WARN.cmake | 1 + Tests/RunCMake/CMP0153/CMakeLists.txt | 3 +++ Tests/RunCMake/CMP0153/RunCMakeTest.cmake | 9 +++++++++ Tests/RunCMake/CMakeLists.txt | 2 ++ 18 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 Help/policy/CMP0153.rst create mode 100644 Help/release/dev/exec_program-policy.rst create mode 100644 Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt create mode 100644 Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt create mode 100644 Tests/RunCMake/CMP0153/CMP0153-NEW.cmake create mode 100644 Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt create mode 100644 Tests/RunCMake/CMP0153/CMP0153-OLD.cmake create mode 100644 Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt create mode 100644 Tests/RunCMake/CMP0153/CMP0153-WARN.cmake create mode 100644 Tests/RunCMake/CMP0153/CMakeLists.txt create mode 100644 Tests/RunCMake/CMP0153/RunCMakeTest.cmake diff --git a/Help/command/exec_program.rst b/Help/command/exec_program.rst index 983a6df9e53..60101764117 100644 --- a/Help/command/exec_program.rst +++ b/Help/command/exec_program.rst @@ -1,6 +1,10 @@ exec_program ------------ +.. versionchanged:: 3.28 + This command is available only if policy :policy:`CMP0153` is not set to ``NEW``. + Port projects to the :command:`execute_process` command. + .. deprecated:: 3.0 Use the :command:`execute_process` command instead. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 89b7924fd4e..a018affb00f 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.28 .. toctree:: :maxdepth: 1 + CMP0153: The exec_program command should not be called. CMP0152: file(REAL_PATH) resolves symlinks before collapsing ../ components. Policies Introduced by CMake 3.27 diff --git a/Help/policy/CMP0153.rst b/Help/policy/CMP0153.rst new file mode 100644 index 00000000000..4c9f3dcd773 --- /dev/null +++ b/Help/policy/CMP0153.rst @@ -0,0 +1,12 @@ +CMP0153 +------- + +The :command:`exec_program` command should not be called. + +This command has long been superseded by the :command:`execute_process` +command and has been deprecated since CMake 3.0. + +.. |disallowed_version| replace:: 3.28 +.. include:: DISALLOWED_COMMAND.txt + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/exec_program-policy.rst b/Help/release/dev/exec_program-policy.rst new file mode 100644 index 00000000000..8ddae5b7497 --- /dev/null +++ b/Help/release/dev/exec_program-policy.rst @@ -0,0 +1,6 @@ +exec_program-policy +------------------- + +* The :command:`exec_program` command, which has been deprecated since CMake + 3.0, has been removed by policy :policy:`CMP0153`. Use the + :command:`execute_process` command instead. diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index ae83b2e496d..2ee4f474971 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -135,7 +135,6 @@ void GetScriptingCommands(cmState* state) state->AddBuiltinCommand("cmake_path", cmCMakePathCommand); state->AddBuiltinCommand("cmake_policy", cmCMakePolicyCommand); state->AddBuiltinCommand("configure_file", cmConfigureFileCommand); - state->AddBuiltinCommand("exec_program", cmExecProgramCommand); state->AddBuiltinCommand("execute_process", cmExecuteProcessCommand); state->AddBuiltinCommand("file", cmFileCommand); state->AddBuiltinCommand("find_file", cmFindFile); @@ -220,6 +219,9 @@ void GetScriptingCommands(cmState* state) state->AddDisallowedCommand( "use_mangled_mesa", cmUseMangledMesaCommand, cmPolicies::CMP0030, "The use_mangled_mesa command should not be called; see CMP0030."); + state->AddDisallowedCommand( + "exec_program", cmExecProgramCommand, cmPolicies::CMP0153, + "The exec_program command should not be called; see CMP0153."); #endif } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 25af6a8a89d..26c141d57a3 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -463,7 +463,9 @@ class cmMakefile; SELECT( \ POLICY, CMP0152, \ "file(REAL_PATH) resolves symlinks before collapsing ../ components.", 3, \ - 28, 0, cmPolicies::WARN) + 28, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0153, "The exec_program command should not be called.", \ + 3, 28, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt new file mode 100644 index 00000000000..e24eee7ed08 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at [^ +]*/Tests/RunCMake/CMP0153/CMP0153-NEW\.cmake:[0-9]+ \(exec_program\): + The exec_program command should not be called; see CMP0153\.$ diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt new file mode 100644 index 00000000000..10f32932ee8 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW.cmake b/Tests/RunCMake/CMP0153/CMP0153-NEW.cmake new file mode 100644 index 00000000000..d252b46b8d4 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0153 NEW) +exec_program("${CMAKE_COMMAND}" ARGS "-E echo \"exec_program() called\"") diff --git a/Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt b/Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt new file mode 100644 index 00000000000..1aa5183fe17 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt @@ -0,0 +1 @@ +exec_program\(\) called diff --git a/Tests/RunCMake/CMP0153/CMP0153-OLD.cmake b/Tests/RunCMake/CMP0153/CMP0153-OLD.cmake new file mode 100644 index 00000000000..d3c47a7ac92 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0153 OLD) +exec_program("${CMAKE_COMMAND}" ARGS "-E echo \"exec_program() called\"") diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt b/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt new file mode 100644 index 00000000000..8f22d4e0e98 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt @@ -0,0 +1,6 @@ +^CMake Warning \(dev\) at [^ +]*/Tests/RunCMake/CMP0153/CMP0153-WARN\.cmake:[0-9]+ \(exec_program\): + Policy CMP0153 is not set: The exec_program command should not be called\. + Run "cmake --help-policy CMP0153" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt b/Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt new file mode 100644 index 00000000000..1aa5183fe17 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt @@ -0,0 +1 @@ +exec_program\(\) called diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN.cmake b/Tests/RunCMake/CMP0153/CMP0153-WARN.cmake new file mode 100644 index 00000000000..ba815018f1a --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMP0153-WARN.cmake @@ -0,0 +1 @@ +exec_program("${CMAKE_COMMAND}" ARGS "-E echo \"exec_program() called\"") diff --git a/Tests/RunCMake/CMP0153/CMakeLists.txt b/Tests/RunCMake/CMP0153/CMakeLists.txt new file mode 100644 index 00000000000..922aad60593 --- /dev/null +++ b/Tests/RunCMake/CMP0153/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.27) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0153/RunCMakeTest.cmake b/Tests/RunCMake/CMP0153/RunCMakeTest.cmake new file mode 100644 index 00000000000..3d01dbfdc70 --- /dev/null +++ b/Tests/RunCMake/CMP0153/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +function(run_cmp0153 name) + run_cmake_command(${name} ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/${name}.cmake") +endfunction() + +run_cmp0153(CMP0153-WARN) +run_cmp0153(CMP0153-OLD) +run_cmp0153(CMP0153-NEW) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 608a4d9674a..d20af290949 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -169,6 +169,8 @@ if(NOT WIN32 OR CYGWIN) add_RunCMake_test(CMP0152) endif() +add_RunCMake_test(CMP0153) + # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode # generators ignore. The policy will have no effect on those generators. From 3825d6ec981d20ee55b12aed8cc8f94ab1afc88f Mon Sep 17 00:00:00 2001 From: Chris Mahoney Date: Fri, 21 Jul 2023 11:24:14 -0400 Subject: [PATCH 150/627] add_custom_{command,target}: Teach JOB_SERVER_AWARE about WORKING_DIRECTORY Issue: #16273 --- Source/cmAddCustomCommandCommand.cxx | 10 +----- Source/cmAddCustomTargetCommand.cxx | 20 ++++-------- Source/cmCustomCommand.cxx | 10 ++++++ Source/cmCustomCommand.h | 6 ++++ Source/cmLocalUnixMakefileGenerator3.cxx | 9 ++++++ Tests/RunCMake/Make/Foo/CMakeLists.txt | 4 +++ .../Make/GNUMakeJobServerAware-check.cmake | 32 +++++++++++++------ .../RunCMake/Make/GNUMakeJobServerAware.cmake | 27 +++++++++++++--- 8 files changed, 82 insertions(+), 36 deletions(-) create mode 100644 Tests/RunCMake/Make/Foo/CMakeLists.txt diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 044b5df3f86..b1589ff3aa9 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -334,15 +334,6 @@ bool cmAddCustomCommandCommand(std::vector const& args, return false; } - // If using a GNU Make generator and `JOB_SERVER_AWARE` is set then - // prefix all commands with '+'. - if (cmIsOn(job_server_aware) && - mf.GetGlobalGenerator()->IsGNUMakeJobServerAware()) { - for (auto& commandLine : commandLines) { - commandLine.insert(commandLine.begin(), "+"); - } - } - // Choose which mode of the command to use. auto cc = cm::make_unique(); cc->SetByproducts(byproducts); @@ -353,6 +344,7 @@ bool cmAddCustomCommandCommand(std::vector const& args, cc->SetUsesTerminal(uses_terminal); cc->SetDepfile(depfile); cc->SetJobPool(job_pool); + cc->SetJobserverAware(cmIsOn(job_server_aware)); cc->SetCommandExpandLists(command_expand_lists); cc->SetDependsExplicitOnly(depends_explicit_only); if (source.empty() && output.empty()) { diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 63390621b4d..711eaa53d82 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -55,7 +55,7 @@ bool cmAddCustomTargetCommand(std::vector const& args, const char* comment = nullptr; std::vector sources; std::string job_pool; - std::string JOB_SERVER_AWARE; + std::string job_server_aware; // Keep track of parser state. enum tdoing @@ -67,7 +67,7 @@ bool cmAddCustomTargetCommand(std::vector const& args, doing_comment, doing_source, doing_job_pool, - doing_JOB_SERVER_AWARE, + doing_job_server_aware, doing_nothing }; tdoing doing = doing_command; @@ -106,7 +106,7 @@ bool cmAddCustomTargetCommand(std::vector const& args, } else if (copy == "JOB_POOL") { doing = doing_job_pool; } else if (copy == "JOB_SERVER_AWARE") { - doing = doing_JOB_SERVER_AWARE; + doing = doing_job_server_aware; } else if (copy == "COMMAND") { doing = doing_command; @@ -153,8 +153,8 @@ bool cmAddCustomTargetCommand(std::vector const& args, case doing_job_pool: job_pool = copy; break; - case doing_JOB_SERVER_AWARE: - JOB_SERVER_AWARE = copy; + case doing_job_server_aware: + job_server_aware = copy; break; default: status.SetError("Wrong syntax. Unknown type of argument."); @@ -220,15 +220,6 @@ bool cmAddCustomTargetCommand(std::vector const& args, return false; } - // If using a GNU Make generator and `JOB_SERVER_AWARE` is set then - // prefix all commands with '+'. - if (cmIsOn(JOB_SERVER_AWARE) && - mf.GetGlobalGenerator()->IsGNUMakeJobServerAware()) { - for (auto& commandLine : commandLines) { - commandLine.insert(commandLine.begin(), "+"); - } - } - // Add the utility target to the makefile. auto cc = cm::make_unique(); cc->SetWorkingDirectory(working_directory.c_str()); @@ -240,6 +231,7 @@ bool cmAddCustomTargetCommand(std::vector const& args, cc->SetUsesTerminal(uses_terminal); cc->SetCommandExpandLists(command_expand_lists); cc->SetJobPool(job_pool); + cc->SetJobserverAware(cmIsOn(job_server_aware)); cmTarget* target = mf.AddUtilityCommand(targetName, excludeFromAll, std::move(cc)); diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index e12cf708e17..9958e4d25d6 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -194,6 +194,16 @@ void cmCustomCommand::SetJobPool(const std::string& job_pool) this->JobPool = job_pool; } +bool cmCustomCommand::GetJobserverAware() const +{ + return this->JobserverAware; +} + +void cmCustomCommand::SetJobserverAware(bool b) +{ + this->JobserverAware = b; +} + #define DEFINE_CC_POLICY_ACCESSOR(P) \ cmPolicies::PolicyStatus cmCustomCommand::Get##P##Status() const \ { \ diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 1e68dbfdda2..167e601e739 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -115,6 +115,11 @@ class cmCustomCommand const std::string& GetJobPool() const; void SetJobPool(const std::string& job_pool); + /** Set/Get whether this custom command should be given access to the + jobserver (if possible). */ + bool GetJobserverAware() const; + void SetJobserverAware(bool b); + #define DECLARE_CC_POLICY_ACCESSOR(P) \ cmPolicies::PolicyStatus Get##P##Status() const; CM_FOR_EACH_CUSTOM_COMMAND_POLICY(DECLARE_CC_POLICY_ACCESSOR) @@ -139,6 +144,7 @@ class cmCustomCommand std::string WorkingDirectory; std::string Depfile; std::string JobPool; + bool JobserverAware = false; bool HaveComment = false; bool EscapeAllowMakeVars = false; bool EscapeOldStyle = true; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3c6b303881f..e26a6ea1ce5 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1080,6 +1080,15 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( // Setup the proper working directory for the commands. this->CreateCDCommand(commands1, dir, relative); + cmGlobalUnixMakefileGenerator3* gg = + static_cast(this->GlobalGenerator); + + // Prefix the commands with the jobserver prefix "+" + if (ccg.GetCC().GetJobserverAware() && gg->IsGNUMakeJobServerAware()) { + std::transform(commands1.begin(), commands1.end(), commands1.begin(), + [](std::string const& cmd) { return cmStrCat("+", cmd); }); + } + // push back the custom commands cm::append(commands, commands1); } diff --git a/Tests/RunCMake/Make/Foo/CMakeLists.txt b/Tests/RunCMake/Make/Foo/CMakeLists.txt new file mode 100644 index 00000000000..baa66341f5e --- /dev/null +++ b/Tests/RunCMake/Make/Foo/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.26) +project(Foo NONE) + +add_custom_target(drive ALL COMMAND ${CMAKE_COMMAND} -E true) diff --git a/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake b/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake index 7c5c2960ed2..da18f005ac5 100644 --- a/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake +++ b/Tests/RunCMake/Make/GNUMakeJobServerAware-check.cmake @@ -1,12 +1,26 @@ -# This test verifies that the commands in the generated Makefiles contain the -# `+` prefix -function(check_for_plus_prefix target) - set(file "${RunCMake_BINARY_DIR}/GNUMakeJobServerAware-build/${target}") - file(READ "${file}" build_file) - if(NOT "${build_file}" MATCHES [[\+]]) - message(FATAL_ERROR "The file ${file} does not contain the expected prefix in the custom command.") +set(BUILD_DIR "${RunCMake_BINARY_DIR}/GNUMakeJobServerAware-build") + +function(check target line) + # Read the file and split it into a list of lines + file(READ ${BUILD_DIR}/${target} contents) + STRING(REGEX REPLACE ";" "\\\\;" contents "${contents}") + STRING(REGEX REPLACE "\n" ";" contents "${contents}") + + set(found FALSE) + foreach(entry ${contents}) + if("${entry}" MATCHES "${line}") + set(found TRUE) + break() + endif() + endforeach() + + if(NOT found) + message(FATAL_ERROR "Could not find '${line}' in ${BUILD_DIR}/${target}\n${contents}") endif() endfunction() -check_for_plus_prefix("CMakeFiles/dummy.dir/build.make") -check_for_plus_prefix("CMakeFiles/dummy2.dir/build.make") +check("CMakeFiles/dummy.dir/build.make" [[\+\$\(CMAKE_COMMAND\) -E true]]) +check("CMakeFiles/dummy2.dir/build.make" [[\+\$\(CMAKE_COMMAND\) -E true]]) + +check("CMakeFiles/dummy3.dir/build.make" [[\+cd (/d )?"?.*"? && \$\(CMAKE_COMMAND\) -E true]]) +check("CMakeFiles/dummy4.dir/build.make" [[\+cd (/d )?"?.*"? && \$\(CMAKE_COMMAND\) -E true]]) diff --git a/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake b/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake index 951c2d7b5d6..d92e8427199 100644 --- a/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake +++ b/Tests/RunCMake/Make/GNUMakeJobServerAware.cmake @@ -1,12 +1,31 @@ +# Test JOB_SERVER_AWARE with custom commands add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/custom-command" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/missing" JOB_SERVER_AWARE ON - COMMAND $(CMAKE_COMMAND) -E touch "${CMAKE_CURRENT_BINARY_DIR}/custom-command" + COMMAND $(CMAKE_COMMAND) -E true ) -add_custom_target(dummy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/custom-command") +add_custom_target(dummy ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/missing") +# Test JOB_SERVER_AWARE with custom targets add_custom_target( dummy2 ALL JOB_SERVER_AWARE ON - COMMAND ${CMAKE_COMMAND} -E true + COMMAND $(CMAKE_COMMAND) -E true +) + +# Test JOB_SERVER_AWARE with custom commands with WORKING_DIRECTORY +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/missing2" + JOB_SERVER_AWARE ON + COMMAND $(CMAKE_COMMAND) -E true + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Foo" +) +add_custom_target(dummy3 ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/missing2") + +# Test JOB_SERVER_AWARE with custom targets with WORKING_DIRECTORY +add_custom_target( + dummy4 ALL + JOB_SERVER_AWARE ON + COMMAND $(CMAKE_COMMAND) -E true + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Foo" ) From fe55a0ebf4383091731cd07e6663aeead605e33a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Jul 2023 09:22:22 -0400 Subject: [PATCH 151/627] ci: enable more tests to better match nightly dashboards --- .gitlab/ci/configure_common.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab/ci/configure_common.cmake b/.gitlab/ci/configure_common.cmake index c207a741985..f03c4b8396d 100644 --- a/.gitlab/ci/configure_common.cmake +++ b/.gitlab/ci/configure_common.cmake @@ -13,6 +13,10 @@ set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY "ON" CACHE BOOL "") set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "") set(CMake_TEST_INSTALL "OFF" CACHE BOOL "") +set(CTEST_TEST_CTEST ON CACHE BOOL "") +set(CMAKE_RUN_LONG_TESTS ON CACHE BOOL "") +set(CMAKE_TESTS_CDASH_SERVER "NOTFOUND" CACHE STRING "") + if (NOT "$ENV{CMAKE_CI_BUILD_TYPE}" STREQUAL "") set(CMAKE_BUILD_TYPE "$ENV{CMAKE_CI_BUILD_TYPE}" CACHE STRING "") endif () From 077678d3f9a3bc6953d6f50dc1708ce164ab5a56 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Jul 2023 10:00:15 -0400 Subject: [PATCH 152/627] ci: test CDash submission tests on some nightly dashboards One from each platform, and a mix of architectures and generators. --- .gitlab/ci/configure_debian10_ninja.cmake | 4 ++++ .gitlab/ci/configure_fedora38_makefiles_clang.cmake | 4 ++++ .gitlab/ci/configure_macos_arm64_ninja_multi.cmake | 1 + .gitlab/ci/configure_windows_vs2019_x64.cmake | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake index eca92bc74f3..0576d1137de 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian10_ninja.cmake @@ -107,4 +107,8 @@ if (NOT "$ENV{SWIFTC}" STREQUAL "") set(CMAKE_Swift_COMPILER "$ENV{SWIFTC}" CACHE FILEPATH "") endif() +if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "") + set(CMAKE_TESTS_CDASH_SERVER "https://open.cdash.org" CACHE STRING "") +endif() + include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/.gitlab/ci/configure_fedora38_makefiles_clang.cmake b/.gitlab/ci/configure_fedora38_makefiles_clang.cmake index ff30ad95a46..3ac23bebb9a 100644 --- a/.gitlab/ci/configure_fedora38_makefiles_clang.cmake +++ b/.gitlab/ci/configure_fedora38_makefiles_clang.cmake @@ -1 +1,5 @@ +if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "") + set(CMAKE_TESTS_CDASH_SERVER "https://open.cdash.org" CACHE STRING "") +endif() + include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora38_common_clang.cmake") diff --git a/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake b/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake index d81bd300547..5b19c60c1bc 100644 --- a/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake +++ b/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake @@ -1,5 +1,6 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "") set(CMake_TEST_ISPC "ON" CACHE STRING "") + set(CMAKE_TESTS_CDASH_SERVER "https://open.cdash.org" CACHE STRING "") endif() # FIXME: sccache sometimes fails with "Compiler killed by signal 9". diff --git a/.gitlab/ci/configure_windows_vs2019_x64.cmake b/.gitlab/ci/configure_windows_vs2019_x64.cmake index c7d41ea1d43..b859525eb66 100644 --- a/.gitlab/ci/configure_windows_vs2019_x64.cmake +++ b/.gitlab/ci/configure_windows_vs2019_x64.cmake @@ -1 +1,5 @@ +if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "") + set(CMAKE_TESTS_CDASH_SERVER "https://open.cdash.org" CACHE STRING "") +endif() + include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_vs_common.cmake") From 59218dcf2626d108ed3c098c4897edee9ed9c0cc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 26 Jul 2023 00:01:13 -0400 Subject: [PATCH 153/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 35d6d178f41..38046aba170 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230725) +set(CMake_VERSION_PATCH 20230726) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 93ed53790cb1e2d5f25f26156ee5c6590b0d3150 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 21 Jul 2023 12:01:01 -0400 Subject: [PATCH 154/627] bootstrap: Unconditionally build libjsoncpp --- Source/cmJSONHelpers.h | 4 --- bootstrap | 55 ++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 35 deletions(-) diff --git a/Source/cmJSONHelpers.h b/Source/cmJSONHelpers.h index 94641deab02..5dfb154863c 100644 --- a/Source/cmJSONHelpers.h +++ b/Source/cmJSONHelpers.h @@ -38,7 +38,6 @@ using ObjectErrorGenerator = std::function; const auto EXPECTED_TYPE = [](const std::string& type) { return [type](const Json::Value* value, cmJSONState* state) -> void { -#if !defined(CMAKE_BOOTSTRAP) if (state->key().empty()) { state->AddErrorAtValue(cmStrCat("Expected ", type), value); return; @@ -48,7 +47,6 @@ const auto EXPECTED_TYPE = [](const std::string& type) { errMsg = cmStrCat(errMsg, ", got: ", value->asString()); } state->AddErrorAtValue(errMsg, value); -#endif }; }; const auto INVALID_STRING = [](const Json::Value* value, @@ -75,7 +73,6 @@ const auto INVALID_NAMED_OBJECT = const Json::Value::Members& extraFields) -> ErrorGenerator { return [nameGenerator, errorType, extraFields]( const Json::Value* value, cmJSONState* state) -> void { -#if !defined(CMAKE_BOOTSTRAP) std::string name = nameGenerator(value, state); switch (errorType) { case ObjectError::RequiredMissing: @@ -102,7 +99,6 @@ const auto INVALID_NAMED_OBJECT = value); break; } -#endif }; }; }; diff --git a/bootstrap b/bootstrap index cc604256d8f..82c59578b3c 100755 --- a/bootstrap +++ b/bootstrap @@ -414,6 +414,7 @@ CMAKE_CXX_SOURCES="\ cmInstallTargetGenerator \ cmInstallTargetsCommand \ cmInstalledFile \ + cmJSONState \ cmLDConfigLDConfigTool \ cmLDConfigTool \ cmLinkDirectoriesCommand \ @@ -588,6 +589,12 @@ LIBRHASH_C_SOURCES="\ librhash/sha512.c \ " +JSONCPP_CXX_SOURCES="\ + src/lib_json/json_reader.cpp \ + src/lib_json/json_value.cpp \ + src/lib_json/json_writer.cpp \ + " + if ${cmake_system_mingw}; then LIBUV_C_SOURCES="\ src/fs-poll.c \ @@ -1091,12 +1098,6 @@ if test "${cmake_bootstrap_generator}" = "Ninja"; then cmFortranLexer \ cmFortranParser \ " - - JSONCPP_CXX_SOURCES="\ - src/lib_json/json_reader.cpp \ - src/lib_json/json_value.cpp \ - src/lib_json/json_writer.cpp \ - " else CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES} \ cmDepends \ @@ -1110,8 +1111,6 @@ else cmMakefileUtilityTargetGenerator \ cmProcessTools \ " - - JSONCPP_CXX_SOURCES= fi # Add Cygwin-specific flags @@ -1725,12 +1724,10 @@ if test "x${bootstrap_system_librhash}" = "x"; then objs="${objs} rhash-`cmake_obj ${a}`" done fi -if test "${cmake_bootstrap_generator}" = "Ninja"; then - if test "x${bootstrap_system_jsoncpp}" = "x"; then - for a in ${JSONCPP_CXX_SOURCES}; do - objs="${objs} jsoncpp-`cmake_obj ${a}`" - done - fi +if test "x${bootstrap_system_jsoncpp}" = "x"; then + for a in ${JSONCPP_CXX_SOURCES}; do + objs="${objs} jsoncpp-`cmake_obj ${a}`" + done fi libs="" @@ -1799,17 +1796,15 @@ if test "x${bootstrap_system_librhash}" != "x"; then libs="${libs} -lrhash" fi -if test "${cmake_bootstrap_generator}" = "Ninja"; then - jsoncpp_cxx_flags= - if test "x${bootstrap_system_jsoncpp}" = "x"; then - jsoncpp_cxx_flags="${jsoncpp_cxx_flags} `cmake_escape_shell "-I${cmake_source_dir}/Utilities/cmjsoncpp/include"`" - else - if test `which pkg-config`; then - use_jsoncpp_flags="`pkg-config --cflags jsoncpp`" - cmake_cxx_flags="${cmake_cxx_flags} ${use_jsoncpp_flags}" - fi - libs="${libs} -ljsoncpp" +jsoncpp_cxx_flags= +if test "x${bootstrap_system_jsoncpp}" = "x"; then + jsoncpp_cxx_flags="${jsoncpp_cxx_flags} `cmake_escape_shell "-I${cmake_source_dir}/Utilities/cmjsoncpp/include"`" +else + if test `which pkg-config`; then + use_jsoncpp_flags="`pkg-config --cflags jsoncpp`" + cmake_cxx_flags="${cmake_cxx_flags} ${use_jsoncpp_flags}" fi + libs="${libs} -ljsoncpp" fi if test "x${cmake_ansi_cxx_flags}" != "x"; then @@ -1949,13 +1944,11 @@ if test "x${bootstrap_system_librhash}" = "x"; then write_source_rule "c" "rhash-`cmake_obj ${a}`" "${src}" "" done fi -if test "${cmake_bootstrap_generator}" = "Ninja"; then - if test "x${bootstrap_system_jsoncpp}" = "x"; then - for a in ${JSONCPP_CXX_SOURCES}; do - src=`cmake_escape_artifact "${cmake_source_dir}/Utilities/cmjsoncpp/${a}"` - write_source_rule "cxx" "jsoncpp-`cmake_obj ${a}`" "${src}" "${jsoncpp_cxx_flags}" - done - fi +if test "x${bootstrap_system_jsoncpp}" = "x"; then + for a in ${JSONCPP_CXX_SOURCES}; do + src=`cmake_escape_artifact "${cmake_source_dir}/Utilities/cmjsoncpp/${a}"` + write_source_rule "cxx" "jsoncpp-`cmake_obj ${a}`" "${src}" "${jsoncpp_cxx_flags}" + done fi if test "${cmake_bootstrap_generator}" = "Ninja"; then echo " From 830a4b37aa3e301761dbf94407ce5896a2cf6c88 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Wed, 26 Jul 2023 13:08:27 -0400 Subject: [PATCH 155/627] cmUVProcessChain::Wait(): Treat timeout of 0 as no timeout --- Source/cmUVProcessChain.cxx | 4 ++-- Source/cmUVProcessChain.h | 2 +- Tests/CMakeLib/testUVProcessChain.cxx | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index 3de7ae5621e..119851c32fe 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -393,12 +393,12 @@ bool cmUVProcessChain::Valid() const return this->Data->Valid; } -bool cmUVProcessChain::Wait(int64_t milliseconds) +bool cmUVProcessChain::Wait(uint64_t milliseconds) { bool timeout = false; cm::uv_timer_ptr timer; - if (milliseconds >= 0) { + if (milliseconds > 0) { timer.init(*this->Data->Loop, &timeout); timer.start( [](uv_timer_t* handle) { diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h index d7a4a0e74e6..5ba1bf9cdbf 100644 --- a/Source/cmUVProcessChain.h +++ b/Source/cmUVProcessChain.h @@ -102,7 +102,7 @@ class cmUVProcessChain int ErrorStream(); bool Valid() const; - bool Wait(int64_t milliseconds = -1); + bool Wait(uint64_t milliseconds = 0); std::vector GetStatus() const; const Status& GetStatus(std::size_t index) const; bool Finished() const; diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index 7630aa0de20..22373ef52fa 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -652,6 +652,20 @@ bool testUVProcessChainInputFile(const char* helperCommand) return true; } +bool testUVProcessChainWait0(const char* helperCommand) +{ + cmUVProcessChainBuilder builder; + builder.AddCommand({ helperCommand, "echo" }); + + auto chain = builder.Start(); + if (!chain.Wait(0)) { + std::cout << "Wait(0) returned false, should be true" << std::endl; + return false; + } + + return true; +} + int testUVProcessChain(int argc, char** const argv) { if (argc < 2) { @@ -699,5 +713,10 @@ int testUVProcessChain(int argc, char** const argv) return -1; } + if (!testUVProcessChainWait0(argv[1])) { + std::cout << "While executing testUVProcessChainWait0().\n"; + return -1; + } + return 0; } From b11e8afbfafde5ab70b796b664d82b2684dd272e Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Mon, 17 Jul 2023 22:47:53 +0200 Subject: [PATCH 156/627] ctest: export test labels to junit xml With this patch, the junit files written by ctest also contain the test labels as testcase properties, see https://github.com/testmoapp/junitxml#properties The name for the property is "cmake_labels", where "cmake_" is used namespace-like. This could be done the same way if we export more properties to junit. Also this makes it clear to consumers that this is coming from cmake, and the list is a cmake-formatted string. --- Source/CTest/cmCTestTestHandler.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6b02a5e99fc..5ac696b86e9 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2617,6 +2617,21 @@ bool cmCTestTestHandler::WriteJUnitXML() xml.EndElement(); // } + xml.StartElement("properties"); + if ((result.Properties) && (!result.Properties->Labels.empty())) { + xml.StartElement("property"); + xml.Attribute("name", "cmake_labels"); + // Pass the property as a cmake-formatted list, consumers will know + // anyway that this information is coming from cmake, so it should + // be ok to put it here as a cmake-list. + xml.Attribute("value", cmList::to_string(result.Properties->Labels)); + // if we export more properties, this should be done the same way, + // i.e. prefix the property name with "cmake_", and it it can be + // a list, write it cmake-formatted. + xml.EndElement(); // + } + xml.EndElement(); // + // Note: compressed test output is unconditionally disabled when // --output-junit is specified. xml.Element("system-out", result.Output); From 2b99e64413ba6750deda892d7398906ade7b3737 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Tue, 18 Jul 2023 23:23:47 +0200 Subject: [PATCH 157/627] set_test_properties: link to the test properties in the documentation It was linking to the target properties, this was probably an oversight. --- Help/command/set_tests_properties.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/command/set_tests_properties.rst b/Help/command/set_tests_properties.rst index 125e4607e46..1df9d73b913 100644 --- a/Help/command/set_tests_properties.rst +++ b/Help/command/set_tests_properties.rst @@ -20,4 +20,4 @@ See Also * :command:`add_test` * :command:`define_property` * the more general :command:`set_property` command -* :ref:`Target Properties` for the list of properties known to CMake +* :ref:`Test Properties` for the list of properties known to CMake From 7050ac56a11768c90f55654aa3f63d02bb549243 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Wed, 17 May 2023 13:50:32 -0400 Subject: [PATCH 158/627] macOS: Add support for linking against .xcframework folders Issue: #21752 --- Help/command/target_link_libraries.rst | 6 + Help/prop_tgt/IMPORTED_LOCATION.rst | 6 + .../dev/xcframework-target-link-libraries.rst | 7 + Source/CMakeLists.txt | 4 + Source/cmComputeLinkInformation.cxx | 88 +++++++++ Source/cmComputeLinkInformation.h | 5 + Source/cmGeneratorTarget.cxx | 41 +++++ Source/cmGeneratorTarget.h | 2 + Source/cmGlobalXCodeGenerator.cxx | 63 ++++++- Source/cmLocalGenerator.cxx | 39 ++++ Source/cmLocalGenerator.h | 3 + Source/cmPlistParser.cxx | 33 ++++ Source/cmPlistParser.h | 13 ++ Source/cmSystemTools.cxx | 6 + Source/cmSystemTools.h | 3 + Source/cmTarget.cxx | 20 ++ Source/cmXcFramework.cxx | 174 ++++++++++++++++++ Source/cmXcFramework.h | 44 +++++ Tests/RunCMake/CMakeLists.txt | 17 ++ Tests/RunCMake/XcFramework/CMakeLists.txt | 3 + Tests/RunCMake/XcFramework/RunCMakeTest.cmake | 83 +++++++++ .../create-executable-framework-ios.cmake | 1 + ...-executable-framework-link-phase-ios.cmake | 1 + ...xecutable-framework-link-phase-macos.cmake | 1 + ...executable-framework-link-phase-tvos.cmake | 1 + ...utable-framework-link-phase-visionos.cmake | 1 + ...cutable-framework-link-phase-watchos.cmake | 1 + .../create-executable-framework-macos.cmake | 1 + .../create-executable-framework-tvos.cmake | 1 + ...create-executable-framework-visionos.cmake | 1 + .../create-executable-framework-watchos.cmake | 1 + ...xecutable-incomplete-link-phase-result.txt | 1 + ...xecutable-incomplete-link-phase-stderr.txt | 11 ++ ...ate-executable-incomplete-link-phase.cmake | 1 + .../create-executable-incomplete-result.txt | 1 + .../create-executable-incomplete-stderr.txt | 10 + .../create-executable-incomplete.cmake | 1 + .../create-executable-library-ios.cmake | 1 + ...te-executable-library-link-phase-ios.cmake | 1 + ...-executable-library-link-phase-macos.cmake | 1 + ...e-executable-library-link-phase-tvos.cmake | 1 + ...ecutable-library-link-phase-visionos.cmake | 1 + ...xecutable-library-link-phase-watchos.cmake | 1 + .../create-executable-library-macos.cmake | 1 + .../create-executable-library-tvos.cmake | 1 + .../create-executable-library-visionos.cmake | 1 + .../create-executable-library-watchos.cmake | 1 + .../create-executable-link-phase.cmake | 2 + ...eate-executable-target-framework-ios.cmake | 1 + ...able-target-framework-link-phase-ios.cmake | 1 + ...le-target-framework-link-phase-macos.cmake | 1 + ...ble-target-framework-link-phase-tvos.cmake | 1 + ...target-framework-link-phase-visionos.cmake | 1 + ...-target-framework-link-phase-watchos.cmake | 1 + ...te-executable-target-framework-macos.cmake | 1 + ...ate-executable-target-framework-tvos.cmake | 1 + ...executable-target-framework-visionos.cmake | 1 + ...-executable-target-framework-watchos.cmake | 1 + ...le-target-incomplete-link-phase-result.txt | 1 + ...le-target-incomplete-link-phase-stderr.txt | 11 ++ ...cutable-target-incomplete-link-phase.cmake | 1 + ...te-executable-target-incomplete-result.txt | 1 + ...te-executable-target-incomplete-stderr.txt | 10 + .../create-executable-target-incomplete.cmake | 1 + ...create-executable-target-library-ios.cmake | 1 + ...utable-target-library-link-phase-ios.cmake | 1 + ...able-target-library-link-phase-macos.cmake | 1 + ...table-target-library-link-phase-tvos.cmake | 1 + ...e-target-library-link-phase-visionos.cmake | 1 + ...le-target-library-link-phase-watchos.cmake | 1 + ...eate-executable-target-library-macos.cmake | 1 + ...reate-executable-target-library-tvos.cmake | 1 + ...e-executable-target-library-visionos.cmake | 1 + ...te-executable-target-library-watchos.cmake | 1 + .../create-executable-target-link-phase.cmake | 2 + .../create-executable-target.cmake | 21 +++ .../XcFramework/create-executable.cmake | 18 ++ .../XcFramework/create-framework-ios.cmake | 1 + .../XcFramework/create-framework-macos.cmake | 1 + .../XcFramework/create-framework-tvos.cmake | 1 + .../create-framework-visionos.cmake | 1 + .../create-framework-watchos.cmake | 1 + .../XcFramework/create-framework.cmake | 3 + .../XcFramework/create-library-common.cmake | 12 ++ .../XcFramework/create-library-ios.cmake | 1 + .../XcFramework/create-library-macos.cmake | 1 + .../XcFramework/create-library-tvos.cmake | 1 + .../XcFramework/create-library-visionos.cmake | 1 + .../XcFramework/create-library-watchos.cmake | 1 + .../RunCMake/XcFramework/create-library.cmake | 1 + Tests/RunCMake/XcFramework/myexe/myexe.c | 7 + .../XcFramework/mylib/include/mylib/mylib.h | 3 + Tests/RunCMake/XcFramework/mylib/mylib.c | 3 + bootstrap | 2 + 94 files changed, 828 insertions(+), 6 deletions(-) create mode 100644 Help/release/dev/xcframework-target-link-libraries.rst create mode 100644 Source/cmPlistParser.cxx create mode 100644 Source/cmPlistParser.h create mode 100644 Source/cmXcFramework.cxx create mode 100644 Source/cmXcFramework.h create mode 100644 Tests/RunCMake/XcFramework/CMakeLists.txt create mode 100644 Tests/RunCMake/XcFramework/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt create mode 100644 Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt create mode 100644 Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt create mode 100644 Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt create mode 100644 Tests/RunCMake/XcFramework/create-executable-incomplete.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-link-phase.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable-target.cmake create mode 100644 Tests/RunCMake/XcFramework/create-executable.cmake create mode 100644 Tests/RunCMake/XcFramework/create-framework-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-framework-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-framework-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-framework-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-framework-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-framework.cmake create mode 100644 Tests/RunCMake/XcFramework/create-library-common.cmake create mode 100644 Tests/RunCMake/XcFramework/create-library-ios.cmake create mode 100644 Tests/RunCMake/XcFramework/create-library-macos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-library-tvos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-library-visionos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-library-watchos.cmake create mode 100644 Tests/RunCMake/XcFramework/create-library.cmake create mode 100644 Tests/RunCMake/XcFramework/myexe/myexe.c create mode 100644 Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h create mode 100644 Tests/RunCMake/XcFramework/mylib/mylib.c diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index 1d276606f99..cc6bc0fdd30 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -66,6 +66,12 @@ Each ```` may be: :ref:`usage requirement `. This has the same effect as passing the framework directory as an include directory. + .. versionadded:: 3.28 + + The library file may point to a ``.xcframework`` folder on macOS. If it + does, the target will get the selected library's ``Headers`` directory as + a usage requirement. + .. versionadded:: 3.8 On :ref:`Visual Studio Generators` for VS 2010 and above, library files ending in ``.targets`` will be treated as MSBuild targets files and diff --git a/Help/prop_tgt/IMPORTED_LOCATION.rst b/Help/prop_tgt/IMPORTED_LOCATION.rst index 50c3658e460..915085b0f6c 100644 --- a/Help/prop_tgt/IMPORTED_LOCATION.rst +++ b/Help/prop_tgt/IMPORTED_LOCATION.rst @@ -20,6 +20,12 @@ non-imported targets. For frameworks on macOS, this may be the location of the framework folder itself. +.. versionadded:: 3.28 + + This may be the location of a ``.xcframework`` folder on macOS. If it is, + any target that links against it will get the selected library's ``Headers`` + directory as a usage requirement. + The ``IMPORTED_LOCATION`` target property may be overridden for a given configuration ```` by the configuration-specific :prop_tgt:`IMPORTED_LOCATION_` target property. Furthermore, diff --git a/Help/release/dev/xcframework-target-link-libraries.rst b/Help/release/dev/xcframework-target-link-libraries.rst new file mode 100644 index 00000000000..7edded5ae2e --- /dev/null +++ b/Help/release/dev/xcframework-target-link-libraries.rst @@ -0,0 +1,7 @@ +xcframework-target-link-libraries +--------------------------------- + +* Targets may now link against an ``.xcframework`` folder in + :command:`target_link_libraries`. +* The :prop_tgt:`IMPORTED_LOCATION` property of a target may now be an + ``.xcframework`` folder. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 708aec7fa17..a067766b0af 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -371,6 +371,8 @@ add_library( cmNewLineStyle.cxx cmOrderDirectories.cxx cmOrderDirectories.h + cmPlistParser.cxx + cmPlistParser.h cmPolicies.h cmPolicies.cxx cmProcessOutput.cxx @@ -451,6 +453,8 @@ add_library( cmWorkerPool.h cmWorkingDirectory.cxx cmWorkingDirectory.h + cmXcFramework.cxx + cmXcFramework.h cmXMLParser.cxx cmXMLParser.h cmXMLSafe.cxx diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index a50ce11701e..be73fa3e83f 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -29,6 +29,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmValue.h" +#include "cmXcFramework.h" #include "cmake.h" // #define CM_COMPUTE_LINK_INFO_DEBUG @@ -373,6 +374,10 @@ cmComputeLinkInformation::cmComputeLinkInformation( this->LibraryFeatureDescriptors.emplace( "__CMAKE_LINK_FRAMEWORK", LibraryFeatureDescriptor{ "__CMAKE_LINK_FRAMEWORK", "" }); + // To link xcframework using a full path + this->LibraryFeatureDescriptors.emplace( + "__CMAKE_LINK_XCFRAMEWORK", + LibraryFeatureDescriptor{ "__CMAKE_LINK_XCFRAMEWORK", "" }); // Check the platform policy for missing soname case. this->NoSONameUsesPath = @@ -519,6 +524,12 @@ cmComputeLinkInformation::GetFrameworkPathsEmitted() const return this->FrameworkPathsEmitted; } +std::vector const& +cmComputeLinkInformation::GetXcFrameworkHeaderPaths() const +{ + return this->XcFrameworkHeaderPaths; +} + const std::set& cmComputeLinkInformation::GetSharedLibrariesLinked() const { @@ -1159,6 +1170,13 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) } else { this->ObjectLibrariesLinked.push_back(entry.Target); } + } else if (this->GlobalGenerator->IsXcode() && + !tgt->GetImportedXcFrameworkPath(config).empty()) { + this->Items.emplace_back( + tgt->GetImportedXcFrameworkPath(config), ItemIsPath::Yes, tgt, + this->FindLibraryFeature(entry.Feature == DEFAULT + ? "__CMAKE_LINK_XCFRAMEWORK" + : entry.Feature)); } else { // Decide whether to use an import library. cmStateEnums::ArtifactType artifact = tgt->HasImportLibrary(config) @@ -1198,6 +1216,25 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) this->AddRuntimeDLL(tgt); } } + + auto xcFrameworkPath = tgt->GetImportedXcFrameworkPath(config); + if (!xcFrameworkPath.empty()) { + auto plist = cmParseXcFrameworkPlist(xcFrameworkPath, *this->Makefile, + item.Backtrace); + if (!plist) { + return; + } + if (auto const* library = + plist->SelectSuitableLibrary(*this->Makefile, item.Backtrace)) { + if (!library->HeadersPath.empty()) { + this->AddXcFrameworkHeaderPath(cmStrCat(xcFrameworkPath, '/', + library->LibraryIdentifier, + '/', library->HeadersPath)); + } + } else { + return; + } + } } else { // This is not a CMake target. Use the name given. if (cmHasSuffix(entry.Feature, "FRAMEWORK"_s) || @@ -1206,6 +1243,12 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) this->Target->IsApple())) { // This is a framework. this->AddFrameworkItem(entry); + } else if (cmHasSuffix(entry.Feature, "XCFRAMEWORK"_s) || + (entry.Feature == DEFAULT && + cmSystemTools::IsPathToXcFramework(item.Value) && + this->Target->IsApple())) { + // This is a framework. + this->AddXcFrameworkItem(entry); } else if (cmSystemTools::FileIsFullPath(item.Value)) { if (cmSystemTools::FileIsDirectory(item.Value)) { // This is a directory. @@ -1945,6 +1988,46 @@ void cmComputeLinkInformation::AddFrameworkItem(LinkEntry const& entry) } } +void cmComputeLinkInformation::AddXcFrameworkItem(LinkEntry const& entry) +{ + auto plist = cmParseXcFrameworkPlist(entry.Item.Value, *this->Makefile, + entry.Item.Backtrace); + if (!plist) { + return; + } + + if (auto const* lib = + plist->SelectSuitableLibrary(*this->Makefile, entry.Item.Backtrace)) { + if (this->GlobalGenerator->IsXcode()) { + this->Items.emplace_back( + entry.Item.Value, ItemIsPath::Yes, nullptr, + this->FindLibraryFeature(entry.Feature == DEFAULT + ? "__CMAKE_LINK_XCFRAMEWORK" + : entry.Feature)); + } else { + auto libraryPath = cmStrCat( + entry.Item.Value, '/', lib->LibraryIdentifier, '/', lib->LibraryPath); + LinkEntry libraryEntry( + BT(libraryPath, entry.Item.Backtrace), entry.Target); + + if (cmSystemTools::IsPathToFramework(libraryPath) && + this->Target->IsApple()) { + // This is a framework. + this->AddFrameworkItem(libraryEntry); + } else { + this->Depends.push_back(libraryPath); + this->AddFullItem(libraryEntry); + this->AddLibraryRuntimeInfo(libraryPath); + if (!lib->HeadersPath.empty()) { + this->AddXcFrameworkHeaderPath(cmStrCat(entry.Item.Value, '/', + lib->LibraryIdentifier, '/', + lib->HeadersPath)); + } + } + } + } +} + void cmComputeLinkInformation::DropDirectoryItem(BT const& item) { // A full path to a directory was found as a link item. Warn the @@ -1982,6 +2065,11 @@ void cmComputeLinkInformation::AddFrameworkPath(std::string const& p) } } +void cmComputeLinkInformation::AddXcFrameworkHeaderPath(std::string const& p) +{ + this->XcFrameworkHeaderPaths.push_back(p); +} + bool cmComputeLinkInformation::CheckSharedLibNoSOName(LinkEntry const& entry) { // This platform will use the path to a library as its soname if the diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 8393a29f716..e75423ff5f1 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -88,6 +88,7 @@ class cmComputeLinkInformation std::vector const& GetDepends() const; std::vector const& GetFrameworkPaths() const; std::set const& GetFrameworkPathsEmitted() const; + std::vector const& GetXcFrameworkHeaderPaths() const; std::string GetLinkLanguage() const { return this->LinkLanguage; } std::vector const& GetRuntimeSearchPath() const; std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; } @@ -132,6 +133,7 @@ class cmComputeLinkInformation std::vector Directories; std::vector Depends; std::vector FrameworkPaths; + std::vector XcFrameworkHeaderPaths; std::vector RuntimeSearchPath; std::set SharedLibrariesLinked; std::vector ObjectLibrariesLinked; @@ -204,6 +206,7 @@ class cmComputeLinkInformation bool CheckImplicitDirItem(LinkEntry const& entry); void AddUserItem(LinkEntry const& entry, bool pathNotKnown); void AddFrameworkItem(LinkEntry const& entry); + void AddXcFrameworkItem(LinkEntry const& entry); void DropDirectoryItem(BT const& item); bool CheckSharedLibNoSOName(LinkEntry const& entry); void AddSharedLibNoSOName(LinkEntry const& entry); @@ -214,6 +217,8 @@ class cmComputeLinkInformation void AddFrameworkPath(std::string const& p); std::set FrameworkPathsEmitted; + void AddXcFrameworkHeaderPath(std::string const& p); + // Linker search path computation. std::unique_ptr OrderLinkerSearchPath; bool FinishLinkerSearchDirectories(); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 42be082a29a..cff15745698 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8874,6 +8874,47 @@ std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile( return filename; } +std::string cmGeneratorTarget::GetImportedXcFrameworkPath( + const std::string& config) const +{ + if (!(this->IsApple() && this->IsImported() && + (this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GetType() == cmStateEnums::UNKNOWN_LIBRARY))) { + return {}; + } + + std::string desiredConfig = config; + if (config.empty()) { + desiredConfig = "NOCONFIG"; + } + + std::string result; + + cmValue loc = nullptr; + cmValue imp = nullptr; + std::string suffix; + + if (this->Target->GetMappedConfig(desiredConfig, loc, imp, suffix)) { + if (loc) { + result = *loc; + } else { + std::string impProp = cmStrCat("IMPORTED_LOCATION", suffix); + if (cmValue configLocation = this->GetProperty(impProp)) { + result = *configLocation; + } else if (cmValue location = this->GetProperty("IMPORTED_LOCATION")) { + result = *location; + } + } + + if (cmSystemTools::IsPathToXcFramework(result)) { + return result; + } + } + + return {}; +} + bool cmGeneratorTarget::HaveFortranSources(std::string const& config) const { auto sources = cmGeneratorTarget::GetSourceFiles(config); diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index a03513d3f7e..753d6f342cf 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -926,6 +926,8 @@ class cmGeneratorTarget cmSourceFile& source, const std::string& dir, cm::optional>& languages) const; + std::string GetImportedXcFrameworkPath(const std::string& config) const; + private: void AddSourceCommon(const std::string& src, bool before = false); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0472631ed04..247d4fca627 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -53,6 +53,7 @@ #include "cmXCodeObject.h" #include "cmXCodeScheme.h" #include "cmXMLWriter.h" +#include "cmXcFramework.h" #include "cmake.h" #if !defined(CMAKE_BOOTSTRAP) && defined(__APPLE__) @@ -1061,12 +1062,14 @@ bool IsLinkPhaseLibraryExtension(const std::string& fileExt) { // Empty file extension is a special case for paths to framework's // internal binary which could be MyFw.framework/Versions/*/MyFw - return (fileExt == ".framework" || fileExt == ".a" || fileExt == ".o" || - fileExt == ".dylib" || fileExt == ".tbd" || fileExt.empty()); + return (fileExt == ".framework" || fileExt == ".xcframework" || + fileExt == ".a" || fileExt == ".o" || fileExt == ".dylib" || + fileExt == ".tbd" || fileExt.empty()); } bool IsLibraryType(const std::string& fileType) { - return (fileType == "wrapper.framework" || fileType == "archive.ar" || + return (fileType == "wrapper.framework" || + fileType == "wrapper.xcframework" || fileType == "archive.ar" || fileType == "compiled.mach-o.objfile" || fileType == "compiled.mach-o.dylib" || fileType == "compiled.mach-o.executable" || @@ -1079,6 +1082,9 @@ std::string GetDirectoryValueFromFileExtension(const std::string& dirExt) if (ext == "framework") { return "wrapper.framework"; } + if (ext == "xcframework") { + return "wrapper.xcframework"; + } if (ext == "xcassets") { return "folder.assetcatalog"; } @@ -3607,6 +3613,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) bool canUseLinkPhase = !libItem.HasFeature() || libItem.GetFeatureName() == "__CMAKE_LINK_FRAMEWORK"_s || libItem.GetFeatureName() == "FRAMEWORK"_s || + libItem.GetFeatureName() == "__CMAKE_LINK_XCFRAMEWORK"_s || + libItem.GetFeatureName() == "XCFRAMEWORK"_s || libItem.GetFeatureName() == "WEAK_FRAMEWORK"_s || libItem.GetFeatureName() == "WEAK_LIBRARY"_s; if (canUseLinkPhase) { @@ -3917,12 +3925,14 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) if (cmSystemTools::FileIsFullPath(cleanPath)) { cleanPath = cmSystemTools::CollapseFullPath(cleanPath); } - bool isFramework = + bool isXcFramework = + cmHasSuffix(libName.GetFeatureName(), "XCFRAMEWORK"_s); + bool isFramework = !isXcFramework && cmHasSuffix(libName.GetFeatureName(), "FRAMEWORK"_s); if (isFramework) { const auto fwDescriptor = this->SplitFrameworkPath( cleanPath, cmGlobalGenerator::FrameworkFormat::Extended); - if (!fwDescriptor->Directory.empty() && + if (isFramework && !fwDescriptor->Directory.empty() && emitted.insert(fwDescriptor->Directory).second) { // This is a search path we had not added before and it isn't // an implicit search path, so we need it @@ -3940,13 +3950,54 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) fwDescriptor->GetLinkName())) .Value); } + } else if (isXcFramework) { + auto plist = cmParseXcFrameworkPlist( + cleanPath, *this->Makefiles.front(), libName.Value.Backtrace); + if (!plist) { + return; + } + if (auto const* library = plist->SelectSuitableLibrary( + *this->Makefiles.front(), libName.Value.Backtrace)) { + auto libraryPath = + cmStrCat(cleanPath, '/', library->LibraryIdentifier, '/', + library->LibraryPath); + if (auto const fwDescriptor = this->SplitFrameworkPath( + libraryPath, + cmGlobalGenerator::FrameworkFormat::Relaxed)) { + if (!fwDescriptor->Directory.empty() && + emitted.insert(fwDescriptor->Directory).second) { + // This is a search path we had not added before and it + // isn't an implicit search path, so we need it + fwSearchPaths.Add( + this->XCodeEscapePath(fwDescriptor->Directory)); + } + libPaths.Add(cmStrCat( + "-framework ", + this->XCodeEscapePath(fwDescriptor->GetLinkName()))); + } else { + libPaths.Add( + libName.GetFormattedItem(this->XCodeEscapePath(libraryPath)) + .Value); + if (!library->HeadersPath.empty()) { + this->AppendBuildSettingAttribute( + target, "HEADER_SEARCH_PATHS", + this->CreateString(this->XCodeEscapePath( + cmStrCat(cleanPath, '/', library->LibraryIdentifier, '/', + library->HeadersPath))), + configName); + } + } + } else { + return; + } } else { libPaths.Add( libName.GetFormattedItem(this->XCodeEscapePath(cleanPath)) .Value); } if ((!libName.Target || libName.Target->IsImported()) && - (isFramework || IsLinkPhaseLibraryExtension(cleanPath))) { + (isFramework || isXcFramework || + IsLinkPhaseLibraryExtension(cleanPath))) { // Create file reference for embedding auto it = this->ExternalLibRefs.find(cleanPath); if (it == this->ExternalLibRefs.end()) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cf1eb967969..acefedceebf 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1659,6 +1659,8 @@ std::vector> cmLocalGenerator::GetTargetCompileFlags( this->AppendFlags(compileFlags, mf->GetDefineFlags()); this->AppendFlags(compileFlags, this->GetFrameworkFlags(lang, config, target)); + this->AppendFlags(compileFlags, + this->GetXcFrameworkFlags(lang, config, target)); if (!compileFlags.empty()) { flags.emplace_back(std::move(compileFlags)); @@ -1724,6 +1726,43 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& lang, return flags; } +std::string cmLocalGenerator::GetXcFrameworkFlags(std::string const& lang, + std::string const& config, + cmGeneratorTarget* target) +{ + cmLocalGenerator* lg = target->GetLocalGenerator(); + cmMakefile* mf = lg->GetMakefile(); + + if (!target->IsApple()) { + return std::string(); + } + + cmValue includeSearchFlag = + mf->GetDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_", lang)); + cmValue sysIncludeSearchFlag = + mf->GetDefinition(cmStrCat("CMAKE_INCLUDE_SYSTEM_FLAG_", lang)); + + if (!includeSearchFlag && !sysIncludeSearchFlag) { + return std::string{}; + } + + std::string flags; + if (cmComputeLinkInformation* cli = target->GetLinkInformation(config)) { + std::vector const& paths = cli->GetXcFrameworkHeaderPaths(); + for (std::string const& path : paths) { + if (sysIncludeSearchFlag && + target->IsSystemIncludeDirectory(path, config, lang)) { + flags += *sysIncludeSearchFlag; + } else { + flags += *includeSearchFlag; + } + flags += lg->ConvertToOutputFormat(path, cmOutputConverter::SHELL); + flags += " "; + } + } + return flags; +} + void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target, std::string const& config, std::string const& lang, diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index c8114081384..7734cbe33c2 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -520,6 +520,9 @@ class cmLocalGenerator : public cmOutputConverter std::string GetFrameworkFlags(std::string const& l, std::string const& config, cmGeneratorTarget* target); + std::string GetXcFrameworkFlags(std::string const& l, + std::string const& config, + cmGeneratorTarget* target); virtual std::string GetTargetFortranFlags(cmGeneratorTarget const* target, std::string const& config); diff --git a/Source/cmPlistParser.cxx b/Source/cmPlistParser.cxx new file mode 100644 index 00000000000..ce3c1713a2e --- /dev/null +++ b/Source/cmPlistParser.cxx @@ -0,0 +1,33 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmPlistParser.h" + +#include +#include + +#include "cmUVProcessChain.h" +#include "cmUVStream.h" + +cm::optional cmParsePlist(const std::string& filename) +{ + cmUVProcessChainBuilder builder; + builder.AddCommand( + { "/usr/bin/plutil", "-convert", "json", "-o", "-", filename }); + builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT); + + auto chain = builder.Start(); + chain.Wait(); + + auto const& status = chain.GetStatus(0); + if (status.ExitStatus != 0) { + return cm::nullopt; + } + + Json::Reader reader; + Json::Value value; + cmUVPipeIStream outputStream(chain.GetLoop(), chain.OutputStream()); + if (!reader.parse(outputStream, value)) { + return cm::nullopt; + } + return cm::optional(value); +} diff --git a/Source/cmPlistParser.h b/Source/cmPlistParser.h new file mode 100644 index 00000000000..2ace254a8a3 --- /dev/null +++ b/Source/cmPlistParser.h @@ -0,0 +1,13 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include + +#include + +namespace Json { +class Value; +} + +cm::optional cmParsePlist(const std::string& filename); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 1fb0079103d..f014de9d7a5 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1900,6 +1900,12 @@ bool cmSystemTools::IsPathToFramework(const std::string& path) cmHasLiteralSuffix(path, ".framework")); } +bool cmSystemTools::IsPathToXcFramework(const std::string& path) +{ + return (cmSystemTools::FileIsFullPath(path) && + cmHasLiteralSuffix(path, ".xcframework")); +} + bool cmSystemTools::IsPathToMacOSSharedLibrary(const std::string& path) { return (cmSystemTools::FileIsFullPath(path) && diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 7d55d4b15b0..6592f84eb3b 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -111,6 +111,9 @@ class cmSystemTools : public cmsys::SystemTools //! Return true if the path is a framework static bool IsPathToFramework(const std::string& path); + //! Return true if the path is a xcframework + static bool IsPathToXcFramework(const std::string& path); + //! Return true if the path is a macOS non-framework shared library (aka //! .dylib) static bool IsPathToMacOSSharedLibrary(const std::string& path); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1281bc6eefb..76a14b8ba7b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -40,6 +40,7 @@ #include "cmSystemTools.h" #include "cmTargetPropertyComputer.h" #include "cmValue.h" +#include "cmXcFramework.h" #include "cmake.h" template <> @@ -2800,6 +2801,25 @@ std::string cmTarget::ImportedGetFullPath( } } } + if (this->IsApple() && + (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY || + this->impl->TargetType == cmStateEnums::STATIC_LIBRARY || + this->impl->TargetType == cmStateEnums::UNKNOWN_LIBRARY) && + cmSystemTools::IsPathToXcFramework(result)) { + auto plist = cmParseXcFrameworkPlist(result, *this->impl->Makefile, + this->impl->Backtrace); + if (!plist) { + return ""; + } + auto const* library = plist->SelectSuitableLibrary( + *this->impl->Makefile, this->impl->Backtrace); + if (library) { + result = cmStrCat(result, '/', library->LibraryIdentifier, '/', + library->LibraryPath); + } else { + return ""; + } + } break; case cmStateEnums::ImportLibraryArtifact: diff --git a/Source/cmXcFramework.cxx b/Source/cmXcFramework.cxx new file mode 100644 index 00000000000..c91e7f2ad70 --- /dev/null +++ b/Source/cmXcFramework.cxx @@ -0,0 +1,174 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmXcFramework.h" + +#include +#include + +#include + +#include + +#include "cmJSONHelpers.h" +#include "cmJSONState.h" +#include "cmMakefile.h" +#include "cmMessageType.h" +#include "cmPlistParser.h" +#include "cmStringAlgorithms.h" +#include "cmake.h" + +namespace { +struct PlistMetadata +{ + std::string CFBundlePackageType; + std::string XCFrameworkFormatVersion; +}; + +auto const PlistMetadataHelper = + cmJSONHelperBuilder::Object{} + .Bind("CFBundlePackageType"_s, &PlistMetadata::CFBundlePackageType, + cmJSONHelperBuilder::String()) + .Bind("XCFrameworkFormatVersion"_s, + &PlistMetadata::XCFrameworkFormatVersion, + cmJSONHelperBuilder::String()); + +bool PlistSupportedPlatformHelper( + cmXcFrameworkPlistSupportedPlatform& platform, const Json::Value* value, + cmJSONState* /*state*/) +{ + if (!value) { + return false; + } + + if (!value->isString()) { + return false; + } + + if (value->asString() == "macos") { + platform = cmXcFrameworkPlistSupportedPlatform::macOS; + return true; + } + if (value->asString() == "ios") { + platform = cmXcFrameworkPlistSupportedPlatform::iOS; + return true; + } + if (value->asString() == "tvos") { + platform = cmXcFrameworkPlistSupportedPlatform::tvOS; + return true; + } + if (value->asString() == "watchos") { + platform = cmXcFrameworkPlistSupportedPlatform::watchOS; + return true; + } + if (value->asString() == "xros") { + platform = cmXcFrameworkPlistSupportedPlatform::visionOS; + return true; + } + + return false; +} + +auto const PlistLibraryHelper = + cmJSONHelperBuilder::Object{} + .Bind("LibraryIdentifier"_s, &cmXcFrameworkPlistLibrary::LibraryIdentifier, + cmJSONHelperBuilder::String()) + .Bind("LibraryPath"_s, &cmXcFrameworkPlistLibrary::LibraryPath, + cmJSONHelperBuilder::String()) + .Bind("HeadersPath"_s, &cmXcFrameworkPlistLibrary::HeadersPath, + cmJSONHelperBuilder::String(), false) + .Bind("SupportedArchitectures"_s, + &cmXcFrameworkPlistLibrary::SupportedArchitectures, + cmJSONHelperBuilder::Vector( + JsonErrors::EXPECTED_TYPE("array"), cmJSONHelperBuilder::String())) + .Bind("SupportedPlatform"_s, &cmXcFrameworkPlistLibrary::SupportedPlatform, + PlistSupportedPlatformHelper); + +auto const PlistHelper = + cmJSONHelperBuilder::Object{}.Bind( + "AvailableLibraries"_s, &cmXcFrameworkPlist::AvailableLibraries, + cmJSONHelperBuilder::Vector( + JsonErrors::EXPECTED_TYPE("array"), PlistLibraryHelper)); +} + +cm::optional cmParseXcFrameworkPlist( + const std::string& xcframeworkPath, const cmMakefile& mf, + const cmListFileBacktrace& bt) +{ + std::string plistPath = cmStrCat(xcframeworkPath, "/Info.plist"); + + auto value = cmParsePlist(plistPath); + if (!value) { + mf.GetCMakeInstance()->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Unable to parse plist file:\n ", plistPath), bt); + return cm::nullopt; + } + + cmJSONState state; + + PlistMetadata metadata; + if (!PlistMetadataHelper(metadata, &*value, &state)) { + mf.GetCMakeInstance()->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Invalid xcframework .plist file:\n ", plistPath), bt); + return cm::nullopt; + } + if (metadata.CFBundlePackageType != "XFWK" || + metadata.XCFrameworkFormatVersion != "1.0") { + mf.GetCMakeInstance()->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Expected:\n ", plistPath, + "\nto have CFBundlePackageType \"XFWK\" and " + "XCFrameworkFormatVersion \"1.0\""), + bt); + return cm::nullopt; + } + + cmXcFrameworkPlist plist; + if (!PlistHelper(plist, &*value, &state)) { + mf.GetCMakeInstance()->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Invalid xcframework .plist file:\n ", plistPath), bt); + return cm::nullopt; + } + plist.Path = plistPath; + return cm::optional(plist); +} + +const cmXcFrameworkPlistLibrary* cmXcFrameworkPlist::SelectSuitableLibrary( + const cmMakefile& mf, const cmListFileBacktrace& bt) const +{ + auto systemName = mf.GetSafeDefinition("CMAKE_SYSTEM_NAME"); + + for (auto const& lib : this->AvailableLibraries) { + std::string supportedSystemName; + switch (lib.SupportedPlatform) { + case cmXcFrameworkPlistSupportedPlatform::macOS: + supportedSystemName = "Darwin"; + break; + case cmXcFrameworkPlistSupportedPlatform::iOS: + supportedSystemName = "iOS"; + break; + case cmXcFrameworkPlistSupportedPlatform::tvOS: + supportedSystemName = "tvOS"; + break; + case cmXcFrameworkPlistSupportedPlatform::watchOS: + supportedSystemName = "watchOS"; + break; + case cmXcFrameworkPlistSupportedPlatform::visionOS: + supportedSystemName = "visionOS"; + break; + } + + if (systemName == supportedSystemName) { + return &lib; + } + } + + mf.GetCMakeInstance()->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Unable to find suitable library in:\n ", this->Path, + "\nfor system name \"", systemName, '"'), + bt); + return nullptr; +} diff --git a/Source/cmXcFramework.h b/Source/cmXcFramework.h new file mode 100644 index 00000000000..c35df110167 --- /dev/null +++ b/Source/cmXcFramework.h @@ -0,0 +1,44 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include +#include + +#include + +#include "cmListFileCache.h" + +class cmMakefile; + +enum class cmXcFrameworkPlistSupportedPlatform +{ + macOS, + iOS, + tvOS, + watchOS, + visionOS, +}; + +struct cmXcFrameworkPlistLibrary +{ + std::string LibraryIdentifier; + std::string LibraryPath; + std::string HeadersPath; + std::vector SupportedArchitectures; + cmXcFrameworkPlistSupportedPlatform SupportedPlatform; +}; + +struct cmXcFrameworkPlist +{ + std::string Path; + std::vector AvailableLibraries; + + const cmXcFrameworkPlistLibrary* SelectSuitableLibrary( + const cmMakefile& mf, + const cmListFileBacktrace& bt = cmListFileBacktrace{}) const; +}; + +cm::optional cmParseXcFrameworkPlist( + const std::string& xcframeworkPath, const cmMakefile& mf, + const cmListFileBacktrace& bt = cmListFileBacktrace{}); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d20af290949..280b81e85c5 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -703,6 +703,23 @@ endif() if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) add_RunCMake_test(Framework) + if(NOT DEFINED CMake_TEST_XcFramework) + set(CMake_TEST_XcFramework ON) + endif() + if(CMake_TEST_XcFramework AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 11.0) + set(XcFramework_ARGS -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}) + add_RunCMake_test(XcFramework) + + # This test can take a very long time due to lots of combinations. + # Use a long default timeout and provide an option to customize it. + if(NOT DEFINED CMake_TEST_XcFramework_TIMEOUT) + set(CMake_TEST_XcFramework_TIMEOUT 3000) + endif() + set_tests_properties(RunCMake.XcFramework PROPERTIES + TIMEOUT "${CMake_TEST_XcFramework_TIMEOUT}" + RUN_SERIAL TRUE + ) + endif() endif() add_RunCMake_test(File_Archive) diff --git a/Tests/RunCMake/XcFramework/CMakeLists.txt b/Tests/RunCMake/XcFramework/CMakeLists.txt new file mode 100644 index 00000000000..54a4d626a24 --- /dev/null +++ b/Tests/RunCMake/XcFramework/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.26) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake new file mode 100644 index 00000000000..dcfaad4db01 --- /dev/null +++ b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake @@ -0,0 +1,83 @@ +include(RunCMake) + +function(create_library type platform system_name archs) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build) + run_cmake_with_options(create-${type}-${platform} -DCMAKE_SYSTEM_NAME=${system_name} -DCMAKE_OSX_ARCHITECTURES=${archs} -DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/install) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(create-${type}-${platform}-build ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(create-${type}-${platform}-install ${CMAKE_COMMAND} --install . --config Release) +endfunction() + +function(create_libraries type) + create_library(${type} macos Darwin "${macos_archs_2}") + create_library(${type} ios iOS "arm64") + create_library(${type} tvos tvOS "arm64") + create_library(${type} watchos watchOS "armv7k\\\\;arm64_32") + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + create_library(${type} visionos visionOS "arm64") + endif() +endfunction() + +function(create_xcframework name type platforms) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-xcframework-${name}-build) + set(args) + foreach(platform IN LISTS platforms) + if(type STREQUAL "framework") + list(APPEND args -framework ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/mylib.framework) + else() + list(APPEND args -library ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/libmylib.a -headers ${RunCMake_SOURCE_DIR}/mylib/include) + endif() + endforeach() + run_cmake_command(create-xcframework-${name} xcodebuild -create-xcframework ${args} -output ${RunCMake_TEST_BINARY_DIR}/mylib.xcframework) +endfunction() + +function(create_executable name xcfname system_name archs) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-executable-${name}-build) + run_cmake_with_options(create-executable-${name} -DCMAKE_SYSTEM_NAME=${system_name} -DCMAKE_OSX_ARCHITECTURES=${archs} -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-${xcfname}-build/mylib.xcframework) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(create-executable-${name}-build ${CMAKE_COMMAND} --build . --config Release) +endfunction() + +function(create_executables name type) + create_executable(${name}-macos ${type} Darwin "${macos_archs_2}") + create_executable(${name}-ios ${type} iOS "arm64") + create_executable(${name}-tvos ${type} tvOS "arm64") + create_executable(${name}-watchos ${type} watchOS "armv7k\\\\;arm64_32") + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + create_executable(${name}-visionos ${type} visionOS "arm64") + endif() +endfunction() + +set(xcframework_platforms macos ios tvos watchos) +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + list(APPEND xcframework_platforms visionos) +endif() +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + set(macos_archs_1 "x86_64\\;arm64") + set(macos_archs_2 "x86_64\\\\;arm64") +else() + set(macos_archs_1 "x86_64") + set(macos_archs_2 "x86_64") +endif() + +create_libraries(library) +create_libraries(framework) +create_xcframework(library library "${xcframework_platforms}") +create_xcframework(framework framework "${xcframework_platforms}") +create_xcframework(incomplete framework "tvos;watchos") +create_executables(library library) +create_executables(framework framework) +run_cmake_with_options(create-executable-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) +create_executables(target-library library) +create_executables(target-framework framework) +run_cmake_with_options(create-executable-target-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) +if(RunCMake_GENERATOR STREQUAL "Xcode" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + create_executables(library-link-phase library) + create_executables(framework-link-phase framework) + run_cmake_with_options(create-executable-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) + create_executables(target-library-link-phase library) + create_executables(target-framework-link-phase framework) + run_cmake_with_options(create-executable-target-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) +endif() diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-ios.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-macos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-tvos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-visionos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-framework-watchos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt new file mode 100644 index 00000000000..5b43e19306c --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at create-executable\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-link-phase\.cmake:[0-9]+ \(include\) + create-executable-incomplete-link-phase\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-link-phase.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt new file mode 100644 index 00000000000..66b7d629b9e --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at create-executable\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-incomplete\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-incomplete.cmake b/Tests/RunCMake/XcFramework/create-executable-incomplete.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-incomplete.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-library-ios.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-ios.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake new file mode 100644 index 00000000000..2888c854490 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-macos.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-macos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-tvos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-visionos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake new file mode 100644 index 00000000000..760d9d4c82b --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-library-watchos.cmake @@ -0,0 +1 @@ +include(create-executable.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-link-phase.cmake new file mode 100644 index 00000000000..9884781fde0 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-link-phase.cmake @@ -0,0 +1,2 @@ +include(create-executable.cmake) +set_property(TARGET myexe PROPERTY XCODE_LINK_BUILD_PHASE_MODE "KNOWN_LOCATION") diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-framework-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt new file mode 100644 index 00000000000..130893356e6 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at create-executable-target\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-target-link-phase\.cmake:[0-9]+ \(include\) + create-executable-target-incomplete-link-phase\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-link-phase.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt new file mode 100644 index 00000000000..716b17d73f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at create-executable-target\.cmake:[0-9]+ \(target_link_libraries\): + Unable to find suitable library in: + + [^ +]*/Tests/RunCMake/XcFramework/create-xcframework-incomplete-build/mylib\.xcframework/Info\.plist + + for system name "Darwin" +Call Stack \(most recent call first\): + create-executable-target-incomplete\.cmake:[0-9]+ \(include\) + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake b/Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-incomplete.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-ios.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake new file mode 100644 index 00000000000..dfeccb9cf41 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-link-phase-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target-link-phase.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-macos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-tvos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-visionos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake b/Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake new file mode 100644 index 00000000000..b2e346918f1 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-library-watchos.cmake @@ -0,0 +1 @@ +include(create-executable-target.cmake) diff --git a/Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake b/Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake new file mode 100644 index 00000000000..9c0b0d55a74 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target-link-phase.cmake @@ -0,0 +1,2 @@ +include(create-executable-target.cmake) +set_property(TARGET myexe PROPERTY XCODE_LINK_BUILD_PHASE_MODE "KNOWN_LOCATION") diff --git a/Tests/RunCMake/XcFramework/create-executable-target.cmake b/Tests/RunCMake/XcFramework/create-executable-target.cmake new file mode 100644 index 00000000000..0cc356c2a88 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable-target.cmake @@ -0,0 +1,21 @@ +enable_language(C) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_library(mylib IMPORTED STATIC) +set_property(TARGET mylib PROPERTY IMPORTED_LOCATION ${MYLIB_LIBRARY}) + +add_executable(myexe myexe/myexe.c) +target_link_libraries(myexe PRIVATE mylib) diff --git a/Tests/RunCMake/XcFramework/create-executable.cmake b/Tests/RunCMake/XcFramework/create-executable.cmake new file mode 100644 index 00000000000..6706b9f6bac --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-executable.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_executable(myexe myexe/myexe.c) +target_link_libraries(myexe PRIVATE ${MYLIB_LIBRARY}) diff --git a/Tests/RunCMake/XcFramework/create-framework-ios.cmake b/Tests/RunCMake/XcFramework/create-framework-ios.cmake new file mode 100644 index 00000000000..8b7df9b0dde --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-ios.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-macos.cmake b/Tests/RunCMake/XcFramework/create-framework-macos.cmake new file mode 100644 index 00000000000..8b7df9b0dde --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-macos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-tvos.cmake b/Tests/RunCMake/XcFramework/create-framework-tvos.cmake new file mode 100644 index 00000000000..8b7df9b0dde --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-tvos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-visionos.cmake b/Tests/RunCMake/XcFramework/create-framework-visionos.cmake new file mode 100644 index 00000000000..8b7df9b0dde --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-visionos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework-watchos.cmake b/Tests/RunCMake/XcFramework/create-framework-watchos.cmake new file mode 100644 index 00000000000..8b7df9b0dde --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework-watchos.cmake @@ -0,0 +1 @@ +include(create-framework.cmake) diff --git a/Tests/RunCMake/XcFramework/create-framework.cmake b/Tests/RunCMake/XcFramework/create-framework.cmake new file mode 100644 index 00000000000..f4406e645ea --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-framework.cmake @@ -0,0 +1,3 @@ +set(CMAKE_FRAMEWORK ON) +include(create-library-common.cmake) +install(FILES mylib/include/mylib/mylib.h DESTINATION lib/mylib.framework/Headers) diff --git a/Tests/RunCMake/XcFramework/create-library-common.cmake b/Tests/RunCMake/XcFramework/create-library-common.cmake new file mode 100644 index 00000000000..958660dbaea --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-common.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +endif() + +add_library(mylib STATIC mylib/mylib.c) +install(TARGETS mylib DESTINATION lib) diff --git a/Tests/RunCMake/XcFramework/create-library-ios.cmake b/Tests/RunCMake/XcFramework/create-library-ios.cmake new file mode 100644 index 00000000000..a9f5dee9c9f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-ios.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-macos.cmake b/Tests/RunCMake/XcFramework/create-library-macos.cmake new file mode 100644 index 00000000000..a9f5dee9c9f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-macos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-tvos.cmake b/Tests/RunCMake/XcFramework/create-library-tvos.cmake new file mode 100644 index 00000000000..a9f5dee9c9f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-tvos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-visionos.cmake b/Tests/RunCMake/XcFramework/create-library-visionos.cmake new file mode 100644 index 00000000000..a9f5dee9c9f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-visionos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library-watchos.cmake b/Tests/RunCMake/XcFramework/create-library-watchos.cmake new file mode 100644 index 00000000000..a9f5dee9c9f --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library-watchos.cmake @@ -0,0 +1 @@ +include(create-library.cmake) diff --git a/Tests/RunCMake/XcFramework/create-library.cmake b/Tests/RunCMake/XcFramework/create-library.cmake new file mode 100644 index 00000000000..f2a524981a9 --- /dev/null +++ b/Tests/RunCMake/XcFramework/create-library.cmake @@ -0,0 +1 @@ +include(create-library-common.cmake) diff --git a/Tests/RunCMake/XcFramework/myexe/myexe.c b/Tests/RunCMake/XcFramework/myexe/myexe.c new file mode 100644 index 00000000000..d04efbd5fa2 --- /dev/null +++ b/Tests/RunCMake/XcFramework/myexe/myexe.c @@ -0,0 +1,7 @@ +#include + +int main(void) +{ + mylib(); + return 0; +} diff --git a/Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h b/Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h new file mode 100644 index 00000000000..1de07aa792c --- /dev/null +++ b/Tests/RunCMake/XcFramework/mylib/include/mylib/mylib.h @@ -0,0 +1,3 @@ +#pragma once + +extern void mylib(void); diff --git a/Tests/RunCMake/XcFramework/mylib/mylib.c b/Tests/RunCMake/XcFramework/mylib/mylib.c new file mode 100644 index 00000000000..4489684f609 --- /dev/null +++ b/Tests/RunCMake/XcFramework/mylib/mylib.c @@ -0,0 +1,3 @@ +void mylib(void) +{ +} diff --git a/bootstrap b/bootstrap index 82c59578b3c..8b43d2092c8 100755 --- a/bootstrap +++ b/bootstrap @@ -451,6 +451,7 @@ CMAKE_CXX_SOURCES="\ cmGccDepfileReader \ cmReturnCommand \ cmPlaceholderExpander \ + cmPlistParser \ cmRulePlaceholderExpander \ cmRuntimeDependencyArchive \ cmScriptGenerator \ @@ -500,6 +501,7 @@ CMAKE_CXX_SOURCES="\ cmWhileCommand \ cmWindowsRegistry \ cmWorkingDirectory \ + cmXcFramework \ cmake \ cmakemain \ cmcmd \ From d68fa82d8d5bb14cb4e40c9b45f7afad408c3eaa Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 27 Jul 2023 00:01:11 -0400 Subject: [PATCH 159/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 38046aba170..d6546f240ad 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230726) +set(CMake_VERSION_PATCH 20230727) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 7e3b9af191b1ae596b228d8ac3d709eecf8d82d4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 09:35:27 -0400 Subject: [PATCH 160/627] clang-tidy: fix `readability-container-data-pointer` lints --- Source/cmMachO.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx index 4fcaedf370c..91a7b8404fd 100644 --- a/Source/cmMachO.cxx +++ b/Source/cmMachO.cxx @@ -69,7 +69,7 @@ bool read(cmsys::ifstream& fin, std::vector& v) return true; } return static_cast( - fin.read(reinterpret_cast(&v[0]), sizeof(T) * v.size())); + fin.read(reinterpret_cast(v.data()), sizeof(T) * v.size())); } } From 803a79dd693ea4001dc82b2646e93bcfa757cb81 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Jul 2023 10:11:39 -0400 Subject: [PATCH 161/627] README: Update bootstrap example to use 'build' directory under source When the example was first written, developers commonly placed their build trees as siblings of the source tree. Nowadays many developers use a `build/` directory under the top-level source directory instead. Update the example with the modern convention to avoid requiring the reader to understand that `cmake-source` is a placeholder for the path to the source tree. --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 64e2353dd2e..d8857407483 100644 --- a/README.rst +++ b/README.rst @@ -68,8 +68,8 @@ you can build directly in the source tree:: Or, if you plan to develop CMake or otherwise run the test suite, create a separate build tree:: - $ mkdir cmake-build && cd cmake-build - $ ../cmake-source/bootstrap && make + $ mkdir build && cd build + $ ../bootstrap && make Windows ^^^^^^^ From f5056d28c56155ca1ba137bff30255f42a74f70a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:35:52 -0400 Subject: [PATCH 162/627] clang-tidy: fix `modernize-use-auto` lints --- Source/cmGlobalXCodeGenerator.cxx | 58 +++++++++++++++---------------- Source/cmXCodeObject.cxx | 2 +- Source/cmXCodeObject.h | 2 +- Source/cmXCodeScheme.cxx | 2 +- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 247d4fca627..68955aeda78 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -703,7 +703,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( cmLocalGenerator* root, std::vector const& gens) { std::vector lfiles; - for (auto gen : gens) { + for (auto* gen : gens) { cm::append(lfiles, gen->GetMakefile()->GetListFiles()); } @@ -814,7 +814,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateObject( { auto obj = cm::make_unique(ptype, cmXCodeObject::OBJECT, this->GetObjectId(ptype, key)); - auto ptr = obj.get(); + auto* ptr = obj.get(); this->addObject(std::move(obj)); return ptr; } @@ -824,7 +824,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type) auto obj = cm::make_unique( cmXCodeObject::None, type, "Temporary cmake object, should not be referred to in Xcode file"); - auto ptr = obj.get(); + auto* ptr = obj.get(); this->addObject(std::move(obj)); return ptr; } @@ -1350,7 +1350,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( this->SetCurrentLocalGenerator(gen); std::vector gts = this->GetLocalGeneratorTargetsInOrder(gen); - for (auto gtgt : gts) { + for (auto* gtgt : gts) { if (!this->CreateXCodeTarget(gtgt, targets)) { return false; } @@ -1386,8 +1386,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( } auto& gtgt_visited = this->CommandsVisited[gtgt]; - auto& deps = this->GetTargetDirectDepends(gtgt); - for (auto& d : deps) { + auto const& deps = this->GetTargetDirectDepends(gtgt); + for (auto const& d : deps) { // Take the union of visited source files of custom commands so far. // ComputeTargetOrder ensures our dependencies already visited their // custom commands and updated CommandsVisited. @@ -1432,7 +1432,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( std::vector headerFiles; std::vector resourceFiles; std::vector sourceFiles; - for (auto sourceFile : commonSourceFiles) { + for (auto* sourceFile : commonSourceFiles) { cmXCodeObject* xsf = this->CreateXCodeSourceFile( this->CurrentLocalGenerator, sourceFile, gtgt); cmXCodeObject* fr = xsf->GetAttribute("fileRef"); @@ -1535,7 +1535,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( using mapOfVectorOfSourceFiles = std::map>; mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : commonSourceFiles) { + for (auto* sourceFile : commonSourceFiles) { cmGeneratorTarget::SourceFileFlags tsFlags = gtgt->GetTargetSourceFileFlags(sourceFile); if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { @@ -1568,7 +1568,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( this->CreateString("0")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { + for (auto* sourceFile : keySources.second) { cmXCodeObject* xsf = this->CreateXCodeSourceFile( this->CurrentLocalGenerator, sourceFile, gtgt); buildFiles->AddObject(xsf); @@ -1583,7 +1583,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( using mapOfVectorOfSourceFiles = std::map>; mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : commonSourceFiles) { + for (auto* sourceFile : commonSourceFiles) { cmGeneratorTarget::SourceFileFlags tsFlags = gtgt->GetTargetSourceFileFlags(sourceFile); if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { @@ -1604,7 +1604,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( this->CreateString("0")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { + for (auto* sourceFile : keySources.second) { cmXCodeObject* xsf = this->CreateXCodeSourceFile( this->CurrentLocalGenerator, sourceFile, gtgt); buildFiles->AddObject(xsf); @@ -1803,7 +1803,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( // add all the sources std::vector commands; auto& visited = this->CommandsVisited[gtgt]; - for (auto sourceFile : classes) { + for (auto* sourceFile : classes) { if (sourceFile->GetCustomCommand() && visited.insert(sourceFile).second) { commands.push_back(*sourceFile->GetCustomCommand()); @@ -1842,7 +1842,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( if (resourceBuildPhase) { buildPhases->AddObject(resourceBuildPhase); } - for (auto obj : contentBuildPhases) { + for (auto* obj : contentBuildPhases) { buildPhases->AddObject(obj); } if (sourceBuildPhase) { @@ -1871,7 +1871,7 @@ void cmGlobalXCodeGenerator::CreateRunScriptBuildPhases( return; } auto& visited = this->CommandsVisited[gt]; - for (auto sf : sources) { + for (auto* sf : sources) { this->CreateRunScriptBuildPhases(buildPhases, sf, gt, visited); } } @@ -3117,7 +3117,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget( // Add CMakeLists.txt file for user convenience. this->AddXCodeProjBuildRule(gtgt, sources); - for (auto sourceFile : sources) { + for (auto* sourceFile : sources) { if (!sourceFile->GetIsGenerated()) { this->CreateXCodeFileReference(sourceFile, gtgt); } @@ -3178,7 +3178,7 @@ void cmGlobalXCodeGenerator::CreateGlobalXCConfigSettings( return; } - auto sf = this->CurrentMakefile->GetSource(xcconfig); + auto* sf = this->CurrentMakefile->GetSource(xcconfig); if (!sf) { cmSystemTools::Error( cmStrCat("sources for ALL_BUILD do not contain xcconfig file: '", @@ -3210,7 +3210,7 @@ void cmGlobalXCodeGenerator::CreateTargetXCConfigSettings( return; } - auto sf = target->Makefile->GetSource(xcconfig); + auto* sf = target->Makefile->GetSource(xcconfig); if (!sf) { cmSystemTools::Error(cmStrCat("target sources for target ", target->Target->GetName(), @@ -3497,7 +3497,7 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute( target->GetAttribute("buildConfigurationList")->GetObject(); cmXCodeObject* buildConfigs = configurationList->GetAttribute("buildConfigurations"); - for (auto obj : buildConfigs->GetObjectList()) { + for (auto* obj : buildConfigs->GetObjectList()) { if (configName.empty() || obj->GetAttribute("name")->GetString() == configName) { cmXCodeObject* settings = obj->GetAttribute("buildSettings"); @@ -3513,7 +3513,7 @@ void cmGlobalXCodeGenerator::InheritBuildSettingAttribute( target->GetAttribute("buildConfigurationList")->GetObject(); cmXCodeObject* buildConfigs = configurationList->GetAttribute("buildConfigurations"); - for (auto obj : buildConfigs->GetObjectList()) { + for (auto* obj : buildConfigs->GetObjectList()) { cmXCodeObject* settings = obj->GetAttribute("buildSettings"); if (cmXCodeObject* attr = settings->GetAttribute(attribute)) { BuildObjectListOrString inherited(this, true); @@ -3835,7 +3835,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) BuildObjectListOrString libSearchPaths(this, true); std::vector objs; gt->GetExternalObjects(objs, configName); - for (auto sourceFile : objs) { + for (auto const* sourceFile : objs) { if (sourceFile->GetObjectLibrary().empty()) { continue; } @@ -4171,7 +4171,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( void cmGlobalXCodeGenerator::AddEmbeddedFrameworks(cmXCodeObject* target) { - static const auto dstSubfolderSpec = "10"; + static auto const* const dstSubfolderSpec = "10"; // Despite the name, by default Xcode uses "Embed Frameworks" build phase // for both frameworks and dynamic libraries @@ -4182,7 +4182,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedFrameworks(cmXCodeObject* target) void cmGlobalXCodeGenerator::AddEmbeddedPlugIns(cmXCodeObject* target) { - static const auto dstSubfolderSpec = "13"; + static auto const* const dstSubfolderSpec = "13"; this->AddEmbeddedObjects(target, "Embed PlugIns", "XCODE_EMBED_PLUGINS", dstSubfolderSpec, NoActionOnCopyByDefault); @@ -4190,7 +4190,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedPlugIns(cmXCodeObject* target) void cmGlobalXCodeGenerator::AddEmbeddedAppExtensions(cmXCodeObject* target) { - static const auto dstSubfolderSpec = "13"; + static auto const* const dstSubfolderSpec = "13"; this->AddEmbeddedObjects(target, "Embed App Extensions", "XCODE_EMBED_APP_EXTENSIONS", dstSubfolderSpec, @@ -4200,7 +4200,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedAppExtensions(cmXCodeObject* target) void cmGlobalXCodeGenerator::AddEmbeddedExtensionKitExtensions( cmXCodeObject* target) { - static const auto dstSubfolderSpec = "16"; + static auto const* const dstSubfolderSpec = "16"; this->AddEmbeddedObjects(target, "Embed App Extensions", "XCODE_EMBED_EXTENSIONKIT_EXTENSIONS", @@ -4594,7 +4594,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->CustomCommandRoots.clear(); } // loop over all targets and add link and depend info - for (auto t : targets) { + for (auto* t : targets) { this->AddDependAndLinkInformation(t); this->AddEmbeddedFrameworks(t); this->AddEmbeddedPlugIns(t); @@ -4620,7 +4620,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( } // now add all targets to the root object cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto t : targets) { + for (auto* t : targets) { allTargets->AddObject(t); cmXCodeObject* productRef = t->GetAttribute("productReference"); if (productRef) { @@ -4713,7 +4713,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( "# does not seem to check these dependencies itself.\n"; /* clang-format on */ for (const auto& configName : this->CurrentConfigurationTypes) { - for (auto target : targets) { + for (auto* target : targets) { cmGeneratorTarget* gt = target->GetTarget(); if (gt->GetType() == cmStateEnums::EXECUTABLE || @@ -4744,7 +4744,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( std::vector objlibs; gt->GetObjectLibrariesCMP0026(objlibs); - for (auto objLib : objlibs) { + for (auto* objLib : objlibs) { makefileStream << this->PostBuildMakeTarget(objLib->GetName(), configName) << ": " << trel << "\n"; @@ -4763,7 +4763,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( } } - for (auto objLib : objlibs) { + for (auto* objLib : objlibs) { const std::string objLibName = objLib->GetName(); std::string d = cmStrCat(this->GetTargetTempDir(gt, configName), diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index c817980fbd4..73f0992d376 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -180,7 +180,7 @@ void cmXCodeObject::PrintList(std::vector const& objs, { cmXCodeObject::Indent(1, out); out << "objects = {\n"; - for (auto obj : objs) { + for (auto* obj : objs) { if (obj->TypeValue == OBJECT) { obj->Print(out); } diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 389fb62a7d6..10a68619fde 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -129,7 +129,7 @@ class cmXCodeObject // search the attribute list for an object of the specified type cmXCodeObject* GetObject(cmXCodeObject::PBXType t) const { - for (auto o : this->List) { + for (auto* o : this->List) { if (o->IsA == t) { return o; } diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index 7f26fd8b235..217ac6100b2 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -121,7 +121,7 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout, xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES"); xout.StartElement("Testables"); - for (auto test : this->Tests) { + for (auto const* test : this->Tests) { xout.StartElement("TestableReference"); xout.BreakAttributes(); xout.Attribute("skipped", "NO"); From 3f1378fbcab72a849908bbc988254f392d04c41a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 12:23:22 -0400 Subject: [PATCH 163/627] strings: compare to static `string_view` instances in Windows-only code --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 17 +- .../WiX/cmWIXDirectoriesSourceWriter.cxx | 4 +- Source/CPack/WiX/cmWIXPatchParser.cxx | 11 +- Source/cmCallVisualStudioMacro.cxx | 4 +- Source/cmGlobalJOMMakefileGenerator.cxx | 3 +- Source/cmGlobalMSYSMakefileGenerator.cxx | 6 +- Source/cmGlobalNMakeMakefileGenerator.cxx | 3 +- Source/cmGlobalVisualStudio10Generator.cxx | 148 +++++++++--------- Source/cmGlobalVisualStudio11Generator.cxx | 8 +- Source/cmGlobalVisualStudio12Generator.cxx | 10 +- Source/cmGlobalVisualStudio14Generator.cxx | 7 +- Source/cmGlobalVisualStudio7Generator.cxx | 27 ++-- Source/cmGlobalVisualStudioGenerator.cxx | 7 +- ...cmGlobalVisualStudioVersionedGenerator.cxx | 8 +- Source/cmGlobalWatcomWMakeGenerator.cxx | 5 +- Source/cmLocalVisualStudio10Generator.cxx | 4 +- Source/cmLocalVisualStudioGenerator.cxx | 3 +- Source/cmVisualStudio10TargetGenerator.cxx | 144 ++++++++--------- Source/cmVisualStudioGeneratorOptions.cxx | 41 ++--- Source/cmVisualStudioSlnParser.cxx | 46 +++--- Source/cmVisualStudioWCEPlatformParser.cxx | 16 +- 21 files changed, 276 insertions(+), 246 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 1ea78fdc3d4..23309352964 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include "cmsys/Directory.hxx" #include "cmsys/Encoding.hxx" @@ -556,7 +557,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() bool emitUninstallShortcut = true; cmValue cpackWixProgramMenuFolder = GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER"); - if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder == ".") { + if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder == "."_s) { emitUninstallShortcut = false; } else if (emittedShortcutTypes.find(cmWIXShortcuts::START_MENU) == emittedShortcutTypes.end()) { @@ -613,7 +614,7 @@ std::string cmCPackWIXGenerator::GetRootFolderId() const result = *rootFolderId; } - if (GetArchitecture() == "x86") { + if (GetArchitecture() == "x86"_s) { cmSystemTools::ReplaceString(result, "<64>", ""); } else { cmSystemTools::ReplaceString(result, "<64>", "64"); @@ -757,7 +758,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( case cmWIXShortcuts::START_MENU: { cmValue cpackWixProgramMenuFolder = GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER"); - if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder == ".") { + if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder == "."_s) { directoryId = "ProgramMenuFolder"; } else { directoryId = "PROGRAM_MENU_FOLDER"; @@ -818,7 +819,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( if (type == cmWIXShortcuts::START_MENU) { cmValue cpackWixProgramMenuFolder = GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER"); - if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder != ".") { + if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder != "."_s) { fileDefinitions.EmitRemoveFolder("CM_REMOVE_PROGRAM_MENU_FOLDER" + idSuffix); } @@ -851,10 +852,10 @@ bool cmCPackWIXGenerator::CreateLicenseFile() std::string extension = GetRightmostExtension(licenseSourceFilename); - if (extension == ".rtf") { + if (extension == ".rtf"_s) { cmSystemTools::CopyAFile(licenseSourceFilename.c_str(), licenseDestinationFilename.c_str()); - } else if (extension == ".txt") { + } else if (extension == ".txt"_s) { cmWIXRichTextFormatWriter rtfWriter(licenseDestinationFilename); cmsys::ifstream licenseSource(licenseSourceFilename.c_str()); @@ -923,7 +924,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions( for (size_t i = 0; i < dir.GetNumberOfFiles(); ++i) { std::string fileName = dir.GetFile(static_cast(i)); - if (fileName == "." || fileName == "..") { + if (fileName == "."_s || fileName == ".."_s) { continue; } @@ -1001,7 +1002,7 @@ std::string cmCPackWIXGenerator::GetArchitecture() const std::string void_p_size; RequireOption("CPACK_WIX_SIZEOF_VOID_P", void_p_size); - if (void_p_size == "8") { + if (void_p_size == "8"_s) { return "x64"; } else { return "x86"; diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx index 0a83ca2c0f5..13bbf37975f 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmWIXDirectoriesSourceWriter.h" +#include + cmWIXDirectoriesSourceWriter::cmWIXDirectoriesSourceWriter( cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) : cmWIXSourceWriter(logger, filename, componentGuidType) @@ -14,7 +16,7 @@ void cmWIXDirectoriesSourceWriter::EmitStartMenuFolder( BeginElement("Directory"); AddAttribute("Id", "ProgramMenuFolder"); - if (startMenuFolder != ".") { + if (startMenuFolder != "."_s) { BeginElement("Directory"); AddAttribute("Id", "PROGRAM_MENU_FOLDER"); AddAttribute("Name", startMenuFolder); diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 8b26c4eec46..57539d3c4a8 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -5,6 +5,7 @@ #include #include +#include #include @@ -39,13 +40,13 @@ cmWIXPatchParser::cmWIXPatchParser(fragment_map_t& fragments, void cmWIXPatchParser::StartElement(const std::string& name, const char** atts) { if (State == BEGIN_DOCUMENT) { - if (name == "CPackWiXPatch") { + if (name == "CPackWiXPatch"_s) { State = BEGIN_FRAGMENTS; } else { ReportValidationError("Expected root element 'CPackWiXPatch'"); } } else if (State == BEGIN_FRAGMENTS) { - if (name == "CPackWiXFragment") { + if (name == "CPackWiXFragment"_s) { State = INSIDE_FRAGMENT; StartFragment(atts); } else { @@ -78,7 +79,7 @@ void cmWIXPatchParser::StartFragment(const char** attributes) const std::string key = attributes[i]; const std::string value = attributes[i + 1]; - if (key == "Id") { + if (key == "Id"_s) { if (Fragments.find(value) != Fragments.end()) { std::ostringstream tmp; tmp << "Invalid reuse of 'CPackWixFragment' 'Id': " << value; @@ -98,7 +99,7 @@ void cmWIXPatchParser::StartFragment(const char** attributes) const std::string key = attributes[i]; const std::string value = attributes[i + 1]; - if (key != "Id") { + if (key != "Id"_s) { new_element->attributes[key] = value; } } @@ -108,7 +109,7 @@ void cmWIXPatchParser::StartFragment(const char** attributes) void cmWIXPatchParser::EndElement(const std::string& name) { if (State == INSIDE_FRAGMENT) { - if (name == "CPackWiXFragment") { + if (name == "CPackWiXFragment"_s) { State = BEGIN_FRAGMENTS; ElementStack.clear(); } else { diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index 94b6e186a16..292b9a35f7a 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -4,6 +4,8 @@ #include +#include + #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -305,7 +307,7 @@ HRESULT GetRunningInstances(std::map& mrot) //! we perhaps looking for any and all solutions? bool FilesSameSolution(const std::string& slnFile, const std::string& slnName) { - if (slnFile == "ALL" || slnName == "ALL") { + if (slnFile == "ALL"_s || slnName == "ALL"_s) { return true; } diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index f1d4d090cd4..44980d64cde 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -5,6 +5,7 @@ #include #include +#include #include "cmGlobalGenerator.h" #include "cmMakefile.h" @@ -45,7 +46,7 @@ void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice(std::ostream& os, std::string const& lang, cmValue envVar) const { - if (lang == "CXX" || lang == "C") { + if (lang == "CXX"_s || lang == "C"_s) { /* clang-format off */ os << "To use the JOM generator with Visual C++, cmake must be run from a " diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index e543aea40f4..26b30fdfc8e 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGlobalMSYSMakefileGenerator.h" +#include + #include "cmsys/FStream.hxx" #include "cmMakefile.h" @@ -31,7 +33,7 @@ std::string cmGlobalMSYSMakefileGenerator::FindMinGW( while (fin) { fin >> path; fin >> mount; - if (mount == "/mingw") { + if (mount == "/mingw"_s) { mingwBin = cmStrCat(path, "/bin"); } } @@ -45,7 +47,7 @@ void cmGlobalMSYSMakefileGenerator::EnableLanguage( this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); if (!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile() && - !(1 == l.size() && l[0] == "NONE")) { + !(1 == l.size() && l[0] == "NONE"_s)) { cmSystemTools::Error( "CMAKE_AR was not found, please set to archive program. " + mf->GetSafeDefinition("CMAKE_AR")); diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index cb538502bd3..424c4bde885 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -5,6 +5,7 @@ #include #include +#include #include "cmsys/RegularExpression.hxx" @@ -88,7 +89,7 @@ cmDocumentationEntry cmGlobalNMakeMakefileGenerator::GetDocumentation() void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice( std::ostream& os, std::string const& lang, cmValue envVar) const { - if (lang == "CXX" || lang == "C") { + if (lang == "CXX"_s || lang == "C"_s) { /* clang-format off */ os << "To use the NMake generator with Visual C++, cmake must be run from a " diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index f1d04e56101..39ec1cd9d6c 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -187,7 +188,7 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( } if (!this->GeneratorToolsetVersion.empty() && - this->GeneratorToolsetVersion != "Test Toolset Version") { + this->GeneratorToolsetVersion != "Test Toolset Version"_s) { // If a specific minor version of the toolset was requested, verify that it // is compatible to the major version and that is exists on disk. // If not clear the value. @@ -370,7 +371,7 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset( bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField( std::string const& key, std::string const& value) { - if (key == "cuda") { + if (key == "cuda"_s) { /* test if cuda toolset is path to custom dir or cuda version */ auto pos = value.find_first_not_of("0123456789."); if (pos != std::string::npos) { @@ -395,16 +396,16 @@ bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField( } return true; } - if (key == "customFlagTableDir") { + if (key == "customFlagTableDir"_s) { this->CustomFlagTableDir = value; cmSystemTools::ConvertToUnixSlashes(this->CustomFlagTableDir); return true; } - if (key == "version") { + if (key == "version"_s) { this->GeneratorToolsetVersion = value; return true; } - if (key == "VCTargetsPath") { + if (key == "VCTargetsPath"_s) { this->CustomVCTargetsPath = value; ConvertToWindowsSlashes(this->CustomVCTargetsPath); return true; @@ -414,26 +415,26 @@ bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField( bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) { - if (this->SystemName == "Windows") { + if (this->SystemName == "Windows"_s) { if (!this->InitializeWindows(mf)) { return false; } - } else if (this->SystemName == "WindowsCE") { + } else if (this->SystemName == "WindowsCE"_s) { this->SystemIsWindowsCE = true; if (!this->InitializeWindowsCE(mf)) { return false; } - } else if (this->SystemName == "WindowsPhone") { + } else if (this->SystemName == "WindowsPhone"_s) { this->SystemIsWindowsPhone = true; if (!this->InitializeWindowsPhone(mf)) { return false; } - } else if (this->SystemName == "WindowsStore") { + } else if (this->SystemName == "WindowsStore"_s) { this->SystemIsWindowsStore = true; if (!this->InitializeWindowsStore(mf)) { return false; } - } else if (this->SystemName == "Android") { + } else if (this->SystemName == "Android"_s) { if (this->PlatformInGeneratorName) { std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR " @@ -441,7 +442,8 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } - if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") == "Tegra-Android") { + if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") == + "Tegra-Android"_s) { if (!this->InitializeTegraAndroid(mf)) { return false; } @@ -519,15 +521,15 @@ bool cmGlobalVisualStudio10Generator::InitializeTegraAndroid(cmMakefile* mf) bool cmGlobalVisualStudio10Generator::InitializeAndroid(cmMakefile* mf) { - std::ostringstream e; - e << this->GetName() << " does not support Android."; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat(this->GetName(), " does not support Android.")); return false; } bool cmGlobalVisualStudio10Generator::InitializePlatform(cmMakefile* mf) { - if (this->SystemName == "Windows" || this->SystemName == "WindowsStore") { + if (this->SystemName == "Windows"_s || + this->SystemName == "WindowsStore"_s) { if (!this->InitializePlatformWindows(mf)) { return false; } @@ -565,7 +567,7 @@ bool cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset( std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const { - if (this->SystemVersion == "8.0") { + if (this->SystemVersion == "8.0"_s) { return "CE800"; } return ""; @@ -641,10 +643,10 @@ void cmGlobalVisualStudio10Generator::EnableLanguage( std::vector const& lang, cmMakefile* mf, bool optional) { for (std::string const& it : lang) { - if (it == "ASM_NASM") { + if (it == "ASM_NASM"_s) { this->NasmEnabled = true; } - if (it == "CUDA") { + if (it == "CUDA"_s) { this->CudaEnabled = true; } } @@ -830,8 +832,8 @@ std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand() bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) { // Skip this in special cases within our own test suite. - if (this->GetPlatformName() == "Test Platform" || - this->GetPlatformToolsetString() == "Test Toolset") { + if (this->GetPlatformName() == "Test Platform"_s || + this->GetPlatformToolsetString() == "Test Toolset"_s) { return true; } @@ -899,19 +901,19 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) cmXMLElement(epg, "ProjectGuid") .Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}"); cmXMLElement(epg, "Keyword") - .Content(mf->GetSafeDefinition("CMAKE_SYSTEM_NAME") == "Android" + .Content(mf->GetSafeDefinition("CMAKE_SYSTEM_NAME") == "Android"_s ? "Android" : "Win32Proj"); cmXMLElement(epg, "Platform").Content(this->GetPlatformName()); - if (this->GetSystemName() == "WindowsPhone") { + if (this->GetSystemName() == "WindowsPhone"_s) { cmXMLElement(epg, "ApplicationType").Content("Windows Phone"); cmXMLElement(epg, "ApplicationTypeRevision") .Content(this->GetApplicationTypeRevision()); - } else if (this->GetSystemName() == "WindowsStore") { + } else if (this->GetSystemName() == "WindowsStore"_s) { cmXMLElement(epg, "ApplicationType").Content("Windows Store"); cmXMLElement(epg, "ApplicationTypeRevision") .Content(this->GetApplicationTypeRevision()); - } else if (this->GetSystemName() == "Android") { + } else if (this->GetSystemName() == "Android"_s) { cmXMLElement(epg, "ApplicationType").Content("Android"); cmXMLElement(epg, "ApplicationTypeRevision") .Content(this->GetApplicationTypeRevision()); @@ -920,10 +922,10 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) cmXMLElement(epg, "WindowsTargetPlatformVersion") .Content(this->WindowsTargetPlatformVersion); } - if (this->GetSystemName() != "Android") { - if (this->GetPlatformName() == "ARM64") { + if (this->GetSystemName() != "Android"_s) { + if (this->GetPlatformName() == "ARM64"_s) { cmXMLElement(epg, "WindowsSDKDesktopARM64Support").Content("true"); - } else if (this->GetPlatformName() == "ARM") { + } else if (this->GetPlatformName() == "ARM"_s) { cmXMLElement(epg, "WindowsSDKDesktopARMSupport").Content("true"); } } @@ -1049,7 +1051,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand( break; } std::string proj = project.GetRelativePath(); - if (proj.size() > 7 && proj.substr(proj.size() - 7) == ".vfproj") { + if (proj.size() > 7 && proj.substr(proj.size() - 7) == ".vfproj"_s) { useDevEnv = true; } } @@ -1080,7 +1082,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand( makeCommand.Add(makeProgramSelected); cm::optional proj = cm::nullopt; - if (tname == "clean") { + if (tname == "clean"_s) { makeCommand.Add(cmStrCat(projectName, ".sln")); makeCommand.Add("/t:Clean"); } else { @@ -1164,7 +1166,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::string extension = cmSystemTools::GetFilenameLastExtension(proj->GetRelativePath()); extension = cmSystemTools::LowerCase(extension); - if (extension == ".csproj") { + if (extension == ".csproj"_s) { // Use correct platform name platform = slnData.GetConfigurationTarget(tname, plainConfig, platform); @@ -1271,7 +1273,7 @@ std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion() std::string cmGlobalVisualStudio10Generator::GetApplicationTypeRevision() const { - if (this->GetSystemName() == "Android") { + if (this->GetSystemName() == "Android"_s) { return this->GetAndroidApplicationTypeRevision(); } @@ -1302,23 +1304,23 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry, if (specials.isArray()) { for (auto const& special : specials) { std::string s = special.asString(); - if (s == "UserValue") { + if (s == "UserValue"_s) { value |= cmIDEFlagTable::UserValue; - } else if (s == "UserIgnored") { + } else if (s == "UserIgnored"_s) { value |= cmIDEFlagTable::UserIgnored; - } else if (s == "UserRequired") { + } else if (s == "UserRequired"_s) { value |= cmIDEFlagTable::UserRequired; - } else if (s == "Continue") { + } else if (s == "Continue"_s) { value |= cmIDEFlagTable::Continue; - } else if (s == "SemicolonAppendable") { + } else if (s == "SemicolonAppendable"_s) { value |= cmIDEFlagTable::SemicolonAppendable; - } else if (s == "UserFollowing") { + } else if (s == "UserFollowing"_s) { value |= cmIDEFlagTable::UserFollowing; - } else if (s == "CaseInsensitive") { + } else if (s == "CaseInsensitive"_s) { value |= cmIDEFlagTable::CaseInsensitive; - } else if (s == "SpaceAppendable") { + } else if (s == "SpaceAppendable"_s) { value |= cmIDEFlagTable::SpaceAppendable; - } else if (s == "CommaAppendable") { + } else if (s == "CommaAppendable"_s) { value |= cmIDEFlagTable::CommaAppendable; } } @@ -1537,22 +1539,22 @@ std::string cmGlobalVisualStudio10Generator::GetClFlagTableName() const std::string const& toolset = this->GetPlatformToolsetString(); std::string const useToolset = this->CanonicalToolsetName(toolset); - if (toolset == "v142") { + if (toolset == "v142"_s) { return "v142"; } - if (toolset == "v141") { + if (toolset == "v141"_s) { return "v141"; } - if (useToolset == "v140") { + if (useToolset == "v140"_s) { return "v140"; } - if (useToolset == "v120") { + if (useToolset == "v120"_s) { return "v12"; } - if (useToolset == "v110") { + if (useToolset == "v110"_s) { return "v11"; } - if (useToolset == "v100") { + if (useToolset == "v100"_s) { return "v10"; } return ""; @@ -1563,22 +1565,22 @@ std::string cmGlobalVisualStudio10Generator::GetCSharpFlagTableName() const std::string const& toolset = this->GetPlatformToolsetString(); std::string const useToolset = this->CanonicalToolsetName(toolset); - if (useToolset == "v142") { + if (useToolset == "v142"_s) { return "v142"; } - if (useToolset == "v141") { + if (useToolset == "v141"_s) { return "v141"; } - if (useToolset == "v140") { + if (useToolset == "v140"_s) { return "v140"; } - if (useToolset == "v120") { + if (useToolset == "v120"_s) { return "v12"; } - if (useToolset == "v110") { + if (useToolset == "v110"_s) { return "v11"; } - if (useToolset == "v100") { + if (useToolset == "v100"_s) { return "v10"; } return ""; @@ -1589,17 +1591,17 @@ std::string cmGlobalVisualStudio10Generator::GetRcFlagTableName() const std::string const& toolset = this->GetPlatformToolsetString(); std::string const useToolset = this->CanonicalToolsetName(toolset); - if ((useToolset == "v140") || (useToolset == "v141") || - (useToolset == "v142")) { + if ((useToolset == "v140"_s) || (useToolset == "v141"_s) || + (useToolset == "v142"_s)) { return "v14"; } - if (useToolset == "v120") { + if (useToolset == "v120"_s) { return "v12"; } - if (useToolset == "v110") { + if (useToolset == "v110"_s) { return "v11"; } - if (useToolset == "v100") { + if (useToolset == "v100"_s) { return "v10"; } return ""; @@ -1610,17 +1612,17 @@ std::string cmGlobalVisualStudio10Generator::GetLibFlagTableName() const std::string const& toolset = this->GetPlatformToolsetString(); std::string const useToolset = this->CanonicalToolsetName(toolset); - if ((useToolset == "v140") || (useToolset == "v141") || - (useToolset == "v142")) { + if ((useToolset == "v140"_s) || (useToolset == "v141"_s) || + (useToolset == "v142"_s)) { return "v14"; } - if (useToolset == "v120") { + if (useToolset == "v120"_s) { return "v12"; } - if (useToolset == "v110") { + if (useToolset == "v110"_s) { return "v11"; } - if (useToolset == "v100") { + if (useToolset == "v100"_s) { return "v10"; } return ""; @@ -1631,22 +1633,22 @@ std::string cmGlobalVisualStudio10Generator::GetLinkFlagTableName() const std::string const& toolset = this->GetPlatformToolsetString(); std::string const useToolset = this->CanonicalToolsetName(toolset); - if (useToolset == "v142") { + if (useToolset == "v142"_s) { return "v142"; } - if (useToolset == "v141") { + if (useToolset == "v141"_s) { return "v141"; } - if (useToolset == "v140") { + if (useToolset == "v140"_s) { return "v140"; } - if (useToolset == "v120") { + if (useToolset == "v120"_s) { return "v12"; } - if (useToolset == "v110") { + if (useToolset == "v110"_s) { return "v11"; } - if (useToolset == "v100") { + if (useToolset == "v100"_s) { return "v10"; } return ""; @@ -1657,17 +1659,17 @@ std::string cmGlobalVisualStudio10Generator::GetMasmFlagTableName() const std::string const& toolset = this->GetPlatformToolsetString(); std::string const useToolset = this->CanonicalToolsetName(toolset); - if ((useToolset == "v140") || (useToolset == "v141") || - (useToolset == "v142")) { + if ((useToolset == "v140"_s) || (useToolset == "v141"_s) || + (useToolset == "v142"_s)) { return "v14"; } - if (useToolset == "v120") { + if (useToolset == "v120"_s) { return "v12"; } - if (useToolset == "v110") { + if (useToolset == "v110"_s) { return "v11"; } - if (useToolset == "v100") { + if (useToolset == "v100"_s) { return "v10"; } return ""; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index c4e1e1115d6..5491e6e6ba5 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -7,6 +7,8 @@ #include #include +#include + #include "cmGlobalGenerator.h" #include "cmGlobalVisualStudioGenerator.h" #include "cmMakefile.h" @@ -25,7 +27,7 @@ void cmGlobalVisualStudio11Generator::EnableLanguage( std::vector const& lang, cmMakefile* mf, bool optional) { for (std::string const& it : lang) { - if (it == "ASM_MARMASM") { + if (it == "ASM_MARMASM"_s) { this->MarmasmEnabled = true; } } @@ -72,7 +74,7 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf) bool cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset( std::string& toolset) const { - if (this->SystemVersion == "8.0") { + if (this->SystemVersion == "8.0"_s) { if (this->IsWindowsPhoneToolsetInstalled() && this->IsWindowsDesktopToolsetInstalled()) { toolset = "v110_wp80"; @@ -87,7 +89,7 @@ bool cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset( bool cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset( std::string& toolset) const { - if (this->SystemVersion == "8.0") { + if (this->SystemVersion == "8.0"_s) { if (this->IsWindowsStoreToolsetInstalled() && this->IsWindowsDesktopToolsetInstalled()) { toolset = "v110"; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index b7af31b6dc2..21776fcb284 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -6,6 +6,8 @@ #include #include +#include + #include "cmGlobalGenerator.h" #include "cmGlobalGeneratorFactory.h" #include "cmGlobalVisualStudioGenerator.h" @@ -137,8 +139,8 @@ bool cmGlobalVisualStudio12Generator::MatchesGeneratorName( bool cmGlobalVisualStudio12Generator::ProcessGeneratorToolsetField( std::string const& key, std::string const& value) { - if (key == "host" && - (value == "x64" || value == "x86" || value == "ARM64")) { + if (key == "host"_s && + (value == "x64"_s || value == "x86"_s || value == "ARM64"_s)) { this->GeneratorToolsetHostArchitecture = value; return true; } @@ -189,7 +191,7 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf) bool cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset( std::string& toolset) const { - if (this->SystemVersion == "8.1") { + if (this->SystemVersion == "8.1"_s) { if (this->IsWindowsPhoneToolsetInstalled() && this->IsWindowsDesktopToolsetInstalled()) { toolset = "v120_wp81"; @@ -204,7 +206,7 @@ bool cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset( bool cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset( std::string& toolset) const { - if (this->SystemVersion == "8.1") { + if (this->SystemVersion == "8.1"_s) { if (this->IsWindowsStoreToolsetInstalled() && this->IsWindowsDesktopToolsetInstalled()) { toolset = "v120"; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 4300d5c9f3d..d2e9cb2b9d5 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -6,6 +6,7 @@ #include #include +#include #include "cmGlobalGenerator.h" #include "cmGlobalGeneratorFactory.h" @@ -198,7 +199,7 @@ bool cmGlobalVisualStudio14Generator::InitializeAndroid(cmMakefile*) bool cmGlobalVisualStudio14Generator::ProcessGeneratorPlatformField( std::string const& key, std::string const& value) { - if (key == "version") { + if (key == "version"_s) { this->GeneratorPlatformVersion = value; return true; } @@ -231,7 +232,7 @@ bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf) return false; } - if (this->SystemName == "WindowsStore") { + if (this->SystemName == "WindowsStore"_s) { mf->IssueMessage( MessageType::FATAL_ERROR, "Could not find an appropriate version of the Windows 10 SDK" @@ -361,7 +362,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion( std::string const& ver = *this->GeneratorPlatformVersion; // VS 2019 and above support specifying plain "10.0". - if (this->Version >= VSVersion::VS16 && ver == "10.0") { + if (this->Version >= VSVersion::VS16 && ver == "10.0"_s) { return ver; } } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 203bb09ade9..67e0a2979c1 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -189,25 +189,25 @@ const char* cmGlobalVisualStudio7Generator::ExternalProjectType( const std::string& location) { std::string extension = cmSystemTools::GetFilenameLastExtension(location); - if (extension == ".vbproj") { + if (extension == ".vbproj"_s) { return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; } - if (extension == ".csproj") { + if (extension == ".csproj"_s) { return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; } - if (extension == ".fsproj") { + if (extension == ".fsproj"_s) { return "F2A71F9B-5D33-465A-A702-920D77279786"; } - if (extension == ".vdproj") { + if (extension == ".vdproj"_s) { return "54435603-DBB4-11D2-8724-00A0C9A8B90C"; } - if (extension == ".dbproj") { + if (extension == ".dbproj"_s) { return "C8D11400-126E-41CD-887F-60BD40844F9E"; } - if (extension == ".wixproj") { + if (extension == ".wixproj"_s) { return "930C7802-8A8C-48F9-8165-68863BCCD9DD"; } - if (extension == ".pyproj") { + if (extension == ".pyproj"_s) { return "888888A0-9F3D-457C-B088-3A5042F75D52"; } return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; @@ -252,7 +252,7 @@ cmGlobalVisualStudio7Generator::GenerateBuildCommand( continue; } bool clean = false; - if (realTarget == "clean") { + if (realTarget == "clean"_s) { clean = true; realTarget = "ALL_BUILD"; } @@ -459,7 +459,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( cmLocalGenerator* lg = target->GetLocalGenerator(); std::string dir = lg->GetCurrentBinaryDirectory(); dir = root->MaybeRelativeToCurBinDir(dir); - if (dir == ".") { + if (dir == "."_s) { dir.clear(); // msbuild cannot handle ".\" prefix } this->WriteProject(fout, *vcprojName, dir, target); @@ -572,11 +572,12 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( } if (!name.empty()) { bool addGuid = false; - if (name == "ExtensibilityGlobals" && sectionType == "postSolution") { + if (name == "ExtensibilityGlobals"_s && + sectionType == "postSolution"_s) { addGuid = true; extensibilityGlobalsOverridden = true; - } else if (name == "ExtensibilityAddIns" && - sectionType == "postSolution") { + } else if (name == "ExtensibilityAddIns"_s && + sectionType == "postSolution"_s) { extensibilityAddInsOverridden = true; } fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n"; @@ -590,7 +591,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( const std::string value = cmTrimWhitespace(itPair.substr(posEqual + 1)); fout << "\t\t" << key << " = " << value << "\n"; - if (key == "SolutionGuid") { + if (key == "SolutionGuid"_s) { addGuid = false; } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 4d7571a04d7..65c8c386243 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -12,6 +12,7 @@ #include #include +#include #include @@ -78,9 +79,9 @@ bool cmGlobalVisualStudioGenerator::SetGeneratorPlatform(std::string const& p, if (!this->InitializePlatform(mf)) { return false; } - if (this->GetPlatformName() == "x64") { + if (this->GetPlatformName() == "x64"_s) { mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - } else if (this->GetPlatformName() == "Itanium") { + } else if (this->GetPlatformName() == "Itanium"_s) { mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); } mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName()); @@ -819,7 +820,7 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly( // Intel Fortran .vfproj files do support the resource compiler. languages.erase("RC"); - return languages.size() == 1 && *languages.begin() == "Fortran"; + return languages.size() == 1 && *languages.begin() == "Fortran"_s; } bool cmGlobalVisualStudioGenerator::IsInSolution( diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 9fe66d327cd..44019f6812a 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -677,7 +677,7 @@ void cmGlobalVisualStudioVersionedGenerator::SetVSVersionVar(cmMakefile* mf) bool cmGlobalVisualStudioVersionedGenerator::ProcessGeneratorInstanceField( std::string const& key, std::string const& value) { - if (key == "version") { + if (key == "version"_s) { this->GeneratorInstanceVersion = value; return true; } @@ -868,13 +868,13 @@ cmGlobalVisualStudioVersionedGenerator::FindAuxToolset( // Accept known SxS props file names using four version components // in VS versions later than the current. - if (version == "14.28.16.9" && vcToolsetVersion == "14.28.29910") { + if (version == "14.28.16.9"_s && vcToolsetVersion == "14.28.29910"_s) { return AuxToolset::Default; } - if (version == "14.29.16.10" && vcToolsetVersion == "14.29.30037") { + if (version == "14.29.16.10"_s && vcToolsetVersion == "14.29.30037"_s) { return AuxToolset::Default; } - if (version == "14.29.16.11" && vcToolsetVersion == "14.29.30133") { + if (version == "14.29.16.11"_s && vcToolsetVersion == "14.29.30133"_s) { return AuxToolset::Default; } diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index ed44e6bbc92..ca7a1b9ece6 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -4,6 +4,9 @@ #include +#include +#include + #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmState.h" @@ -46,7 +49,7 @@ void cmGlobalWatcomWMakeGenerator::EnableLanguage( bool cmGlobalWatcomWMakeGenerator::SetSystemName(std::string const& s, cmMakefile* mf) { - if (mf->GetSafeDefinition("CMAKE_SYSTEM_PROCESSOR") == "I86") { + if (mf->GetSafeDefinition("CMAKE_SYSTEM_PROCESSOR") == "I86"_s) { mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl"); } diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 8fe6677f068..2a1521bb9a2 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmLocalVisualStudio10Generator.h" +#include + #include #include "cmGlobalGenerator.h" @@ -37,7 +39,7 @@ class cmVS10XMLParser : public cmXMLParser if (!this->GUID.empty()) { return; } - if ("ProjectGUID" == name || "ProjectGuid" == name) { + if (name == "ProjectGUID"_s || name == "ProjectGuid"_s) { this->DoGUID = true; } } diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 58d46f1b320..34b8ae34237 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -5,6 +5,7 @@ #include #include +#include #include "windows.h" @@ -204,7 +205,7 @@ std::string cmLocalVisualStudioGenerator::ConstructScript( std::string suffix; if (cmd.size() > 4) { suffix = cmSystemTools::LowerCase(cmd.substr(cmd.size() - 4)); - if (suffix == ".bat" || suffix == ".cmd") { + if (suffix == ".bat"_s || suffix == ".cmd"_s) { script += "call "; } } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4af3ebc1ac5..cea01686ebb 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include "windows.h" @@ -308,7 +309,7 @@ std::string cmVisualStudio10TargetGenerator::CalcCondition( oss << "'"; // handle special case for 32 bit C# targets if (this->ProjectType == VsProjectType::csproj && - this->Platform == "Win32") { + this->Platform == "Win32"_s) { oss << " Or "; oss << "'$(Configuration)|$(Platform)'=='"; oss << config << "|x86"; @@ -509,7 +510,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( // Setting ResolveNugetPackages to false skips this target and the build // succeeds. cm::string_view targetName{ this->GeneratorTarget->GetName() }; - if (targetName == "ALL_BUILD" || targetName == "PACKAGE" || + if (targetName == "ALL_BUILD"_s || targetName == "PACKAGE"_s || targetName == CMAKE_CHECK_BUILD_SYSTEM_TARGET) { Elem e1(e0, "PropertyGroup"); e1.Element("ResolveNugetPackages", "false"); @@ -1048,8 +1049,8 @@ void cmVisualStudio10TargetGenerator::WriteCommonPropertyGroupGlobals(Elem& e1) } cm::string_view globalKey = cm::string_view(keyIt).substr(prefix.length()); // Skip invalid or separately-handled properties. - if (globalKey.empty() || globalKey == "PROJECT_TYPES" || - globalKey == "ROOTNAMESPACE" || globalKey == "KEYWORD") { + if (globalKey.empty() || globalKey == "PROJECT_TYPES"_s || + globalKey == "ROOTNAMESPACE"_s || globalKey == "KEYWORD"_s) { continue; } cmValue value = this->GeneratorTarget->GetProperty(keyIt); @@ -1336,7 +1337,7 @@ void cmVisualStudio10TargetGenerator::WriteTargetSpecificReferences(Elem& e0) { if (this->MSTools) { if (this->GlobalGenerator->TargetsWindowsPhone() && - this->GlobalGenerator->GetSystemVersion() == "8.0") { + this->GlobalGenerator->GetSystemVersion() == "8.0"_s) { Elem(e0, "Import") .Attribute("Project", "$(MSBuildExtensionsPath)\\Microsoft\\WindowsPhone\\v" @@ -1377,7 +1378,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences(Elem& e0) } if (this->GlobalGenerator->TargetsWindowsPhone() && - this->GlobalGenerator->GetSystemVersion() == "8.0" && + this->GlobalGenerator->GetSystemVersion() == "8.0"_s && references.empty()) { references.push_back(std::string{ "platform.winmd" }); } @@ -1507,9 +1508,9 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( std::string useOfMfcValue = "false"; if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { - if (mfcFlagValue == "1") { + if (mfcFlagValue == "1"_s) { useOfMfcValue = "Static"; - } else if (mfcFlagValue == "2") { + } else if (mfcFlagValue == "2"_s) { useOfMfcValue = "Dynamic"; } } @@ -1645,7 +1646,7 @@ void cmVisualStudio10TargetGenerator::WriteAndroidConfigurationValues( } if (cmValue stlType = this->GeneratorTarget->GetProperty("ANDROID_STL_TYPE")) { - if (*stlType != "none") { + if (*stlType != "none"_s) { e1.Element("UseOfStl", *stlType); } } @@ -1956,7 +1957,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() for (auto const& ti : this->Tools) { if ((this->GeneratorTarget->GetName() == CMAKE_CHECK_BUILD_SYSTEM_TARGET) && - (ti.first == "None")) { + (ti.first == "None"_s)) { this->WriteBuildSystemSources(e0, ti.first, ti.second); } else { this->WriteGroupSources(e0, ti.first, ti.second, sourceGroups); @@ -1970,7 +1971,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() for (std::string const& oi : this->AddedFiles) { std::string fileName = cmSystemTools::LowerCase(cmSystemTools::GetFilenameName(oi)); - if (fileName == "wmappmanifest.xml") { + if (fileName == "wmappmanifest.xml"_s) { Elem e2(e1, "XML"); e2.Attribute("Include", oi); e2.Element("Filter", "Resource Files"); @@ -1979,7 +1980,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() Elem e2(e1, "AppxManifest"); e2.Attribute("Include", oi); e2.Element("Filter", "Resource Files"); - } else if (cmSystemTools::GetFilenameExtension(fileName) == ".pfx") { + } else if (cmSystemTools::GetFilenameExtension(fileName) == ".pfx"_s) { Elem e2(e1, "None"); e2.Attribute("Include", oi); e2.Element("Filter", "Resource Files"); @@ -2227,7 +2228,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource( if (this->ProjectType == VsProjectType::csproj && !this->InSourceBuild) { toolHasSettings = true; } - if (ext == "hlsl") { + if (ext == "hlsl"_s) { tool = "FXCompile"; // Figure out the type of shader compiler to use. if (cmValue st = sf->GetProperty("VS_SHADER_TYPE")) { @@ -2305,22 +2306,22 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource( toolSettings[config]["ObjectFileOutput"] = *sofn; } } - } else if (ext == "jpg" || ext == "png") { + } else if (ext == "jpg"_s || ext == "png"_s) { tool = "Image"; - } else if (ext == "resw") { + } else if (ext == "resw"_s) { tool = "PRIResource"; - } else if (ext == "xml") { + } else if (ext == "xml"_s) { tool = "XML"; - } else if (ext == "natvis") { + } else if (ext == "natvis"_s) { tool = "Natvis"; - } else if (ext == "settings") { + } else if (ext == "settings"_s) { settingsLastGenOutput = cmsys::SystemTools::GetFilenameName(sf->GetFullPath()); std::size_t pos = settingsLastGenOutput.find(".settings"); settingsLastGenOutput.replace(pos, 9, ".Designer.cs"); settingsGenerator = "SettingsSingleFileGenerator"; toolHasSettings = true; - } else if (ext == "vsixmanifest") { + } else if (ext == "vsixmanifest"_s) { subType = "Designer"; } if (cmValue c = sf->GetProperty("VS_COPY_TO_OUT_DIR")) { @@ -2341,13 +2342,13 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource( if (this->NsightTegra) { // Nsight Tegra needs specific file types to check up-to-dateness. std::string name = cmSystemTools::LowerCase(sf->GetLocation().GetName()); - if (name == "androidmanifest.xml" || name == "build.xml" || - name == "proguard.cfg" || name == "proguard-project.txt" || - ext == "properties") { + if (name == "androidmanifest.xml"_s || name == "build.xml"_s || + name == "proguard.cfg"_s || name == "proguard-project.txt"_s || + ext == "properties"_s) { tool = "AndroidBuild"; - } else if (ext == "java") { + } else if (ext == "java"_s) { tool = "JCompile"; - } else if (ext == "asm" || ext == "s") { + } else if (ext == "asm"_s || ext == "s"_s) { tool = "ClCompile"; } } @@ -2410,7 +2411,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource( e2.Element("Link", deployLocation + "\\%(FileName)%(Extension)"); } for (auto& config : this->Configurations) { - if (cge->Evaluate(this->LocalGenerator, config) == "1") { + if (cge->Evaluate(this->LocalGenerator, config) == "1"_s) { e2.WritePlatformConfigTag("DeploymentContent", "'$(Configuration)|$(Platform)'=='" + config + "|" + this->Platform + "'", @@ -2455,7 +2456,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2, // conversion uses full paths when possible to allow deeper trees. // However, CUDA 8.0 msbuild rules fail on absolute paths so for CUDA // we must use relative paths. - bool forceRelative = sf->GetLanguage() == "CUDA"; + bool forceRelative = sf->GetLanguage() == "CUDA"_s; std::string sourceFile = this->ConvertPath(sf->GetFullPath(), forceRelative); ConvertToWindowsSlash(sourceFile); e2.Attribute("Include", sourceFile); @@ -2553,22 +2554,23 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) case cmGeneratorTarget::SourceKindUnityBatched: case cmGeneratorTarget::SourceKindObjectSource: { const std::string& lang = si.Source->GetLanguage(); - if (lang == "C" || lang == "CXX") { + if (lang == "C"_s || lang == "CXX"_s) { tool = "ClCompile"; - } else if (lang == "ASM_MARMASM" && + } else if (lang == "ASM_MARMASM"_s && this->GlobalGenerator->IsMarmasmEnabled()) { tool = "MARMASM"; - } else if (lang == "ASM_MASM" && + } else if (lang == "ASM_MASM"_s && this->GlobalGenerator->IsMasmEnabled()) { tool = "MASM"; - } else if (lang == "ASM_NASM" && + } else if (lang == "ASM_NASM"_s && this->GlobalGenerator->IsNasmEnabled()) { tool = "NASM"; - } else if (lang == "RC") { + } else if (lang == "RC"_s) { tool = "ResourceCompile"; - } else if (lang == "CSharp") { + } else if (lang == "CSharp"_s) { tool = "Compile"; - } else if (lang == "CUDA" && this->GlobalGenerator->IsCudaEnabled()) { + } else if (lang == "CUDA"_s && + this->GlobalGenerator->IsCudaEnabled()) { tool = "CudaCompile"; } else { tool = "None"; @@ -2591,7 +2593,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) std::back_inserter(exclude_configs)); Elem e2(e1, tool); - bool isCSharp = (si.Source->GetLanguage() == "CSharp"); + bool isCSharp = (si.Source->GetLanguage() == "CSharp"_s); if (isCSharp && !exclude_configs.empty()) { std::stringstream conditions; bool firstConditionSet{ false }; @@ -2730,33 +2732,33 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( // Force language if the file extension does not match. // Note that MSVC treats the upper-case '.C' extension as C and not C++. std::string const ext = sf.GetExtension(); - std::string const extLang = ext == "C" + std::string const extLang = ext == "C"_s ? "C" : this->GlobalGenerator->GetLanguageFromExtension(ext.c_str()); std::string lang = this->LocalGenerator->GetSourceFileLanguage(sf); const char* compileAs = nullptr; if (lang != extLang) { - if (lang == "CXX") { + if (lang == "CXX"_s) { // force a C++ file type compileAs = "CompileAsCpp"; - } else if (lang == "C") { + } else if (lang == "C"_s) { // force to c compileAs = "CompileAsC"; } } - bool noWinRT = this->TargetCompileAsWinRT && lang == "C"; + bool noWinRT = this->TargetCompileAsWinRT && lang == "C"_s; // for the first time we need a new line if there is something // produced here. if (!objectName.empty()) { - if (lang == "CUDA") { + if (lang == "CUDA"_s) { e2.Element("CompileOut", "$(IntDir)/" + objectName); } else { e2.Element("ObjectFileName", "$(IntDir)/" + objectName); } } - if (lang == "ASM_NASM") { + if (lang == "ASM_NASM"_s) { if (cmValue objectDeps = sf.GetProperty("OBJECT_DEPENDS")) { cmList depends{ *objectDeps }; for (auto& d : depends) { @@ -2841,20 +2843,20 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; cmIDEFlagTable const* flagtable = nullptr; const std::string& srclang = source->GetLanguage(); - if (srclang == "C" || srclang == "CXX") { + if (srclang == "C"_s || srclang == "CXX"_s) { flagtable = gg->GetClFlagTable(); - } else if (srclang == "ASM_MARMASM" && + } else if (srclang == "ASM_MARMASM"_s && this->GlobalGenerator->IsMarmasmEnabled()) { flagtable = gg->GetMarmasmFlagTable(); - } else if (srclang == "ASM_MASM" && + } else if (srclang == "ASM_MASM"_s && this->GlobalGenerator->IsMasmEnabled()) { flagtable = gg->GetMasmFlagTable(); - } else if (lang == "ASM_NASM" && + } else if (lang == "ASM_NASM"_s && this->GlobalGenerator->IsNasmEnabled()) { flagtable = gg->GetNasmFlagTable(); - } else if (srclang == "RC") { + } else if (srclang == "RC"_s) { flagtable = gg->GetRcFlagTable(); - } else if (srclang == "CSharp") { + } else if (srclang == "CSharp"_s) { flagtable = gg->GetCSharpFlagTable(); } cmGeneratorExpressionInterpreter genexInterpreter( @@ -3418,7 +3420,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( } // Add C-specific flags expressible in a ClCompile meant for C++. - if (langForClCompile == "CXX") { + if (langForClCompile == "CXX"_s) { std::set languages; this->GeneratorTarget->GetLanguages(languages, configName); if (languages.count("C")) { @@ -3473,7 +3475,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( std::string managedType = clOptions.HasFlag("CompileAsManaged") ? clOptions.GetFlag("CompileAsManaged") : "Mixed"; - if (managedType == "Safe" || managedType == "Pure") { + if (managedType == "Safe"_s || managedType == "Pure"_s) { // force empty calling convention if safe clr is used clOptions.AddFlag("CallingConvention", ""); } @@ -3497,7 +3499,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // Remove any target-wide -TC or -TP flag added by the project. // Such flags are unnecessary and break our model of language selection. - if (langForClCompile == "C" || langForClCompile == "CXX") { + if (langForClCompile == "C"_s || langForClCompile == "CXX"_s) { clOptions.RemoveFlag("CompileAs"); } @@ -3743,7 +3745,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( // CUDA automatically passes the proper '--machine' flag to nvcc // for the current architecture, but does not reflect this default // in the user-visible IDE settings. Set it explicitly. - if (this->Platform == "x64") { + if (this->Platform == "x64"_s) { cudaOptions.AddFlag("TargetMachinePlatform", "64"); } @@ -3786,11 +3788,11 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( // Add runtime library selection flag. std::string const& cudaRuntime = this->GeneratorTarget->GetRuntimeLinkLibrary("CUDA", configName); - if (cudaRuntime == "STATIC") { + if (cudaRuntime == "STATIC"_s) { cudaOptions.AddFlag("CudaRuntime", "Static"); - } else if (cudaRuntime == "SHARED") { + } else if (cudaRuntime == "SHARED"_s) { cudaOptions.AddFlag("CudaRuntime", "Shared"); - } else if (cudaRuntime == "NONE") { + } else if (cudaRuntime == "NONE"_s) { cudaOptions.AddFlag("CudaRuntime", "None"); } @@ -4134,7 +4136,7 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions( e2.Element("AdditionalManifestFiles", oss.str()); } if (dpiAware) { - if (*dpiAware == "PerMonitor") { + if (*dpiAware == "PerMonitor"_s) { e2.Element("EnableDpiAwareness", "PerMonitorHighDPIAware"); } else if (cmIsOn(*dpiAware)) { e2.Element("EnableDpiAwareness", "true"); @@ -4377,7 +4379,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( } if (cmValue stackVal = this->Makefile->GetDefinition( - "CMAKE_" + linkLanguage + "_STACK_SIZE")) { + cmStrCat("CMAKE_", linkLanguage, "_STACK_SIZE"))) { linkOptions.AddFlag("StackReserveSize", *stackVal); } @@ -4409,7 +4411,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( } if (this->GlobalGenerator->TargetsWindowsPhone() && - this->GlobalGenerator->GetSystemVersion() == "8.0") { + this->GlobalGenerator->GetSystemVersion() == "8.0"_s) { // WindowsPhone 8.0 does not have ole32. linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries", "ole32.lib"); } @@ -4912,7 +4914,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile( if (this->IsMissingFiles && !(this->GlobalGenerator->TargetsWindowsPhone() && - this->GlobalGenerator->GetSystemVersion() == "8.0")) { + this->GlobalGenerator->GetSystemVersion() == "8.0"_s)) { // Move the manifest to a project directory to avoid clashes std::string artifactDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); @@ -5022,7 +5024,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) e1.Element("ApplicationType", (isWindowsPhone ? "Windows Phone" : "Windows Store")); e1.Element("DefaultLanguage", "en-US"); - if (rev == "10.0") { + if (rev == "10.0"_s) { e1.Element("ApplicationTypeRevision", rev); // Visual Studio 14.0 is necessary for building 10.0 apps e1.Element("MinimumVisualStudioVersion", "14.0"); @@ -5030,7 +5032,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } - } else if (rev == "8.1") { + } else if (rev == "8.1"_s) { e1.Element("ApplicationTypeRevision", rev); // Visual Studio 12.0 is necessary for building 8.1 apps e1.Element("MinimumVisualStudioVersion", "12.0"); @@ -5038,7 +5040,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } - } else if (rev == "8.0") { + } else if (rev == "8.0"_s) { e1.Element("ApplicationTypeRevision", rev); // Visual Studio 11.0 is necessary for building 8.0 apps e1.Element("MinimumVisualStudioVersion", "11.0"); @@ -5062,9 +5064,9 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) if (isAppContainer) { e1.Element("AppContainerApplication", "true"); } else if (!isAndroid) { - if (this->Platform == "ARM64") { + if (this->Platform == "ARM64"_s) { e1.Element("WindowsSDKDesktopARM64Support", "true"); - } else if (this->Platform == "ARM") { + } else if (this->Platform == "ARM"_s) { e1.Element("WindowsSDKDesktopARMSupport", "true"); } } @@ -5077,7 +5079,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) "VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION"); if (targetPlatformMinVersion) { e1.Element("WindowsTargetPlatformMinVersion", *targetPlatformMinVersion); - } else if (isWindowsStore && rev == "10.0") { + } else if (isWindowsStore && rev == "10.0"_s) { // If the min version is not set, then use the TargetPlatformVersion if (!targetPlatformVersion.empty()) { e1.Element("WindowsTargetPlatformMinVersion", targetPlatformVersion); @@ -5100,7 +5102,7 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles() cmGeneratorTarget::SourceKindAppManifest); std::string const& v = this->GlobalGenerator->GetSystemVersion(); if (this->GlobalGenerator->TargetsWindowsPhone()) { - if (v == "8.0") { + if (v == "8.0"_s) { // Look through the sources for WMAppManifest.xml bool foundManifest = false; for (cmGeneratorTarget::AllConfigSource const& source : @@ -5116,16 +5118,16 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles() if (!foundManifest) { this->IsMissingFiles = true; } - } else if (v == "8.1") { + } else if (v == "8.1"_s) { if (manifestSources.empty()) { this->IsMissingFiles = true; } } } else if (this->GlobalGenerator->TargetsWindowsStore()) { if (manifestSources.empty()) { - if (v == "8.0") { + if (v == "8.0"_s) { this->IsMissingFiles = true; - } else if (v == "8.1" || cmHasLiteralPrefix(v, "10.0")) { + } else if (v == "8.1"_s || cmHasLiteralPrefix(v, "10.0")) { this->IsMissingFiles = true; } } @@ -5137,15 +5139,15 @@ void cmVisualStudio10TargetGenerator::WriteMissingFiles(Elem& e1) { std::string const& v = this->GlobalGenerator->GetSystemVersion(); if (this->GlobalGenerator->TargetsWindowsPhone()) { - if (v == "8.0") { + if (v == "8.0"_s) { this->WriteMissingFilesWP80(e1); - } else if (v == "8.1") { + } else if (v == "8.1"_s) { this->WriteMissingFilesWP81(e1); } } else if (this->GlobalGenerator->TargetsWindowsStore()) { - if (v == "8.0") { + if (v == "8.0"_s) { this->WriteMissingFilesWS80(e1); - } else if (v == "8.1") { + } else if (v == "8.1"_s) { this->WriteMissingFilesWS81(e1); } else if (cmHasLiteralPrefix(v, "10.0")) { this->WriteMissingFilesWS10_0(e1); diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 7e4503b7aab..9bbe34bdcd3 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -7,6 +7,7 @@ #include #include +#include #include "cmAlgorithms.h" #include "cmLocalVisualStudioGenerator.h" @@ -117,7 +118,7 @@ bool cmVisualStudioGeneratorOptions::IsDebug() const auto i = this->FlagMap.find("DebugType"); if (i != this->FlagMap.end()) { if (i->second.size() == 1) { - return i->second[0] != "none"; + return i->second[0] != "none"_s; } } return false; @@ -137,13 +138,13 @@ bool cmVisualStudioGeneratorOptions::UsingUnicode() const { // Look for a _UNICODE definition. return std::any_of(this->Defines.begin(), this->Defines.end(), - [](std::string const& di) { return di == "_UNICODE"; }); + [](std::string const& di) { return di == "_UNICODE"_s; }); } bool cmVisualStudioGeneratorOptions::UsingSBCS() const { // Look for a _SBCS definition. return std::any_of(this->Defines.begin(), this->Defines.end(), - [](std::string const& di) { return di == "_SBCS"; }); + [](std::string const& di) { return di == "_SBCS"_s; }); } void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration() @@ -171,7 +172,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() return; } - if (subOptions.size() == 1 && subOptions[0] == "NO") { + if (subOptions.size() == 1 && subOptions[0] == "NO"_s) { AddFlag(ENABLE_UAC, "false"); return; } @@ -198,7 +199,7 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() 1, std::max(std::string::size_type(0), keyValue[1].length() - 2)); } - if (keyValue[0] == "level") { + if (keyValue[0] == "level"_s) { if (uacExecuteLevelMap.find(keyValue[1]) == uacExecuteLevelMap.end()) { // unknown level value continue; @@ -208,8 +209,8 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() continue; } - if (keyValue[0] == "uiAccess") { - if (keyValue[1] != "true" && keyValue[1] != "false") { + if (keyValue[0] == "uiAccess"_s) { + if (keyValue[1] != "true"_s && keyValue[1] != "false"_s) { // unknown uiAccess value continue; } @@ -260,11 +261,11 @@ void cmVisualStudioGeneratorOptions::ParseFinish() auto i = this->FlagMap.find("CudaRuntime"); if (i != this->FlagMap.end() && i->second.size() == 1) { std::string& cudaRuntime = i->second[0]; - if (cudaRuntime == "static") { + if (cudaRuntime == "static"_s) { cudaRuntime = "Static"; - } else if (cudaRuntime == "shared") { + } else if (cudaRuntime == "shared"_s) { cudaRuntime = "Shared"; - } else if (cudaRuntime == "none") { + } else if (cudaRuntime == "none"_s) { cudaRuntime = "None"; } } @@ -298,19 +299,19 @@ void cmVisualStudioGeneratorOptions::StoreUnknownFlag(std::string const& flag) { // Look for Intel Fortran flags that do not map well in the flag table. if (this->CurrentTool == FortranCompiler) { - if (flag == "/dbglibs" || flag == "-dbglibs") { + if (flag == "/dbglibs"_s || flag == "-dbglibs"_s) { this->FortranRuntimeDebug = true; return; } - if (flag == "/threads" || flag == "-threads") { + if (flag == "/threads"_s || flag == "-threads"_s) { this->FortranRuntimeMT = true; return; } - if (flag == "/libs:dll" || flag == "-libs:dll") { + if (flag == "/libs:dll"_s || flag == "-libs:dll"_s) { this->FortranRuntimeDLL = true; return; } - if (flag == "/libs:static" || flag == "-libs:static") { + if (flag == "/libs:static"_s || flag == "-libs:static"_s) { this->FortranRuntimeDLL = false; return; } @@ -354,7 +355,7 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( return; } std::string tag = "PreprocessorDefinitions"; - if (lang == "CUDA") { + if (lang == "CUDA"_s) { tag = "Defines"; } @@ -374,7 +375,7 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( // Escape this flag for the MSBuild. if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) { cmVS10EscapeForMSBuild(define); - if (lang == "RC") { + if (lang == "RC"_s) { cmSystemTools::ReplaceString(define, "\"", "\\\""); } } @@ -393,9 +394,9 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( } std::string tag = "AdditionalIncludeDirectories"; - if (lang == "CUDA") { + if (lang == "CUDA"_s) { tag = "Include"; - } else if (lang == "ASM_MASM" || lang == "ASM_NASM") { + } else if (lang == "ASM_MASM"_s || lang == "ASM_NASM"_s) { tag = "IncludePaths"; } @@ -409,7 +410,7 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( pos++; } - if (lang == "ASM_NASM") { + if (lang == "ASM_NASM"_s) { include += "\\"; } @@ -420,7 +421,7 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( oss << sep << include; sep = ";"; - if (lang == "Fortran") { + if (lang == "Fortran"_s) { include += "/$(ConfigurationName)"; oss << sep << include; } diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx index 71c758e87e6..76791a62e96 100644 --- a/Source/cmVisualStudioSlnParser.cxx +++ b/Source/cmVisualStudioSlnParser.cxx @@ -8,6 +8,8 @@ #include #include +#include + #include "cmsys/FStream.hxx" #include "cmStringAlgorithms.h" @@ -206,7 +208,7 @@ bool cmVisualStudioSlnParser::State::Process( this->Stack.push(FileStateTopLevel); break; case FileStateTopLevel: - if (line.GetTag() == "Project") { + if (line.GetTag() == "Project"_s) { if (line.GetValueCount() != 3) { result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); return false; @@ -221,12 +223,12 @@ bool cmVisualStudioSlnParser::State::Process( } else { this->IgnoreUntilTag("EndProject"); } - } else if (line.GetTag() == "Global") { + } else if (line.GetTag() == "Global"_s) { this->Stack.push(FileStateGlobal); - } else if (line.GetTag() == "VisualStudioVersion") { + } else if (line.GetTag() == "VisualStudioVersion"_s) { output.SetVisualStudioVersion(line.GetValue(0)); - } else if (line.GetTag() == "MinimumVisualStudioVersion") { + } else if (line.GetTag() == "MinimumVisualStudioVersion"_s) { output.SetMinimumVisualStudioVersion(line.GetValue(0)); } else { result.SetError(ResultErrorInputStructure, this->GetCurrentLine()); @@ -234,11 +236,11 @@ bool cmVisualStudioSlnParser::State::Process( } break; case FileStateProject: - if (line.GetTag() == "EndProject") { + if (line.GetTag() == "EndProject"_s) { this->Stack.pop(); - } else if (line.GetTag() == "ProjectSection") { - if (line.GetArg() == "ProjectDependencies" && - line.GetValue(0) == "postProject") { + } else if (line.GetTag() == "ProjectSection"_s) { + if (line.GetArg() == "ProjectDependencies"_s && + line.GetValue(0) == "postProject"_s) { if (this->RequestedData.test(DataGroupProjectDependenciesBit)) { this->Stack.push(FileStateProjectDependencies); } else { @@ -253,7 +255,7 @@ bool cmVisualStudioSlnParser::State::Process( } break; case FileStateProjectDependencies: - if (line.GetTag() == "EndProjectSection") { + if (line.GetTag() == "EndProjectSection"_s) { this->Stack.pop(); } else if (line.IsKeyValuePair()) { // implement dependency storing here, once needed @@ -264,25 +266,25 @@ bool cmVisualStudioSlnParser::State::Process( } break; case FileStateGlobal: - if (line.GetTag() == "EndGlobal") { + if (line.GetTag() == "EndGlobal"_s) { this->Stack.pop(); - } else if (line.GetTag() == "GlobalSection") { - if (line.GetArg() == "SolutionConfigurationPlatforms" && - line.GetValue(0) == "preSolution") { + } else if (line.GetTag() == "GlobalSection"_s) { + if (line.GetArg() == "SolutionConfigurationPlatforms"_s && + line.GetValue(0) == "preSolution"_s) { if (this->RequestedData.test(DataGroupSolutionConfigurationsBit)) { this->Stack.push(FileStateSolutionConfigurations); } else { this->IgnoreUntilTag("EndGlobalSection"); } - } else if (line.GetArg() == "ProjectConfigurationPlatforms" && - line.GetValue(0) == "postSolution") { + } else if (line.GetArg() == "ProjectConfigurationPlatforms"_s && + line.GetValue(0) == "postSolution"_s) { if (this->RequestedData.test(DataGroupProjectConfigurationsBit)) { this->Stack.push(FileStateProjectConfigurations); } else { this->IgnoreUntilTag("EndGlobalSection"); } - } else if (line.GetArg() == "NestedProjects" && - line.GetValue(0) == "preSolution") { + } else if (line.GetArg() == "NestedProjects"_s && + line.GetValue(0) == "preSolution"_s) { if (this->RequestedData.test(DataGroupSolutionFiltersBit)) { this->Stack.push(FileStateSolutionFilters); } else { @@ -300,7 +302,7 @@ bool cmVisualStudioSlnParser::State::Process( } break; case FileStateSolutionConfigurations: - if (line.GetTag() == "EndGlobalSection") { + if (line.GetTag() == "EndGlobalSection"_s) { this->Stack.pop(); } else if (line.IsKeyValuePair()) { output.AddConfiguration(line.GetValue(0)); @@ -310,7 +312,7 @@ bool cmVisualStudioSlnParser::State::Process( } break; case FileStateProjectConfigurations: - if (line.GetTag() == "EndGlobalSection") { + if (line.GetTag() == "EndGlobalSection"_s) { this->Stack.pop(); } else if (line.IsKeyValuePair()) { std::vector tagElements = @@ -331,7 +333,7 @@ bool cmVisualStudioSlnParser::State::Process( return false; } - if (activeBuild == "ActiveCfg") { + if (activeBuild == "ActiveCfg"_s) { projectEntry->AddProjectConfiguration(solutionConfiguration, line.GetValue(0)); } @@ -341,7 +343,7 @@ bool cmVisualStudioSlnParser::State::Process( } break; case FileStateSolutionFilters: - if (line.GetTag() == "EndGlobalSection") { + if (line.GetTag() == "EndGlobalSection"_s) { this->Stack.pop(); } else if (line.IsKeyValuePair()) { // implement filter storing here, once needed @@ -352,7 +354,7 @@ bool cmVisualStudioSlnParser::State::Process( } break; case FileStateGlobalSection: - if (line.GetTag() == "EndGlobalSection") { + if (line.GetTag() == "EndGlobalSection"_s) { this->Stack.pop(); } else if (line.IsKeyValuePair()) { // implement section storing here, once needed diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx index d8d0da95f75..19c8d35eccd 100644 --- a/Source/cmVisualStudioWCEPlatformParser.cxx +++ b/Source/cmVisualStudioWCEPlatformParser.cxx @@ -61,14 +61,14 @@ void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name, this->CharacterData.clear(); - if (name == "PlatformData") { + if (name == "PlatformData"_s) { this->PlatformName.clear(); this->OSMajorVersion.clear(); this->OSMinorVersion.clear(); this->Macros.clear(); } - if (name == "Macro") { + if (name == "Macro"_s) { std::string macroName; std::string macroValue; @@ -83,7 +83,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name, if (!macroName.empty()) { this->Macros[macroName] = macroValue; } - } else if (name == "Directories") { + } else if (name == "Directories"_s) { for (const char** attr = attributes; *attr; attr += 2) { if (strcmp(attr[0], "Include") == 0) { this->Include = attr[1]; @@ -99,7 +99,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name, void cmVisualStudioWCEPlatformParser::EndElement(const std::string& name) { if (!this->RequiredName) { - if (name == "PlatformName") { + if (name == "PlatformName"_s) { this->AvailablePlatforms.push_back(this->CharacterData); } return; @@ -109,13 +109,13 @@ void cmVisualStudioWCEPlatformParser::EndElement(const std::string& name) return; } - if (name == "PlatformName") { + if (name == "PlatformName"_s) { this->PlatformName = this->CharacterData; - } else if (name == "OSMajorVersion") { + } else if (name == "OSMajorVersion"_s) { this->OSMajorVersion = this->CharacterData; - } else if (name == "OSMinorVersion") { + } else if (name == "OSMinorVersion"_s) { this->OSMinorVersion = this->CharacterData; - } else if (name == "Platform") { + } else if (name == "Platform"_s) { if (this->PlatformName == this->RequiredName) { this->FoundRequiredName = true; } From a5ba00bdf875cb1290b90abb8c9f55c1b7f88876 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 14:39:37 -0400 Subject: [PATCH 164/627] strings: combine string literals where possible --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 13 ++++++++----- Source/cmGlobalVisualStudio10Generator.cxx | 6 ++++-- Source/cmGlobalVisualStudio11Generator.cxx | 6 ++++-- Source/cmGlobalVisualStudio12Generator.cxx | 6 ++++-- Source/cmGlobalVisualStudio14Generator.cxx | 3 ++- Source/cmGlobalVisualStudio71Generator.cxx | 6 +++--- Source/cmVisualStudio10TargetGenerator.cxx | 11 ++++++----- 7 files changed, 31 insertions(+), 20 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 23309352964..45f91b25277 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -104,8 +104,9 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile, std::ostringstream command; command << QuotePath(executable); - command << " -nologo"; - command << " -arch " << arch; + command << " -nologo" + " -arch " + << arch; command << " -out " << QuotePath(objectFile); for (std::string const& ext : CandleExtensions) { @@ -132,8 +133,9 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles) std::ostringstream command; command << QuotePath(executable); - command << " -nologo"; - command << " -out " << QuotePath(CMakeToWixPath(packageFileNames.at(0))); + command << " -nologo" + " -out " + << QuotePath(CMakeToWixPath(packageFileNames.at(0))); for (std::string const& ext : this->LightExtensions) { command << " -ext " << QuotePath(ext); @@ -1183,7 +1185,8 @@ void cmCPackWIXGenerator::CollectXmlNamespaces(std::string const& variableName, } else { cmCPackLogger(cmCPackLog::LOG_ERROR, "Invalid element in CPACK_WIX_CUSTOM_XMLNS ignored: " - << "\"" << str << "\"" << std::endl); + "\"" + << str << "\"" << std::endl); } } std::ostringstream oss; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 39ec1cd9d6c..8befa75f5d6 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -438,7 +438,8 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) if (this->PlatformInGeneratorName) { std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR " - << "specifies a platform too: '" << this->GetName() << "'"; + "specifies a platform too: '" + << this->GetName() << "'"; mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } @@ -468,7 +469,8 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) if (this->PlatformInGeneratorName) { std::ostringstream e; e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR " - << "specifies a platform too: '" << this->GetName() << "'"; + "specifies a platform too: '" + << this->GetName() << "'"; mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; } diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 5491e6e6ba5..84fa378100e 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -44,7 +44,8 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf) << 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 + "Desktop SDK as well as the Windows Phone '" + << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); @@ -62,7 +63,8 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf) << 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 + "Desktop SDK as well as the Windows Store '" + << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 21776fcb284..3c15bd8370b 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -159,7 +159,8 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf) << 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 + "Desktop SDK as well as the Windows Phone '" + << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); @@ -179,7 +180,8 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf) << 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 + "Desktop SDK as well as the Windows Store '" + << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index d2e9cb2b9d5..7cb5a664af0 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -182,7 +182,8 @@ bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf) << 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 + "Desktop SDK as well as the Windows Store '" + << this->SystemVersion << "' SDK. Please make sure that you have both installed"; } mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index bcb26cc1cb8..01f4803f54d 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -136,9 +136,9 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, << uname << ".vcproj" << "\", \"{" << this->GetGUID(uname) << "}\"\n" << "\tProjectSection(ProjectDependencies) = postProject\n" - << "\t\t{" << guid << "} = {" << guid << "}\n" - << "\tEndProjectSection\n" - << "EndProject\n"; + "\t\t{" << guid << "} = {" << guid << "}\n" + "\tEndProjectSection\n" + "EndProject\n"; /* clang-format on */ } } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index cea01686ebb..c7088d592bd 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -310,10 +310,11 @@ std::string cmVisualStudio10TargetGenerator::CalcCondition( // handle special case for 32 bit C# targets if (this->ProjectType == VsProjectType::csproj && this->Platform == "Win32"_s) { - oss << " Or "; - oss << "'$(Configuration)|$(Platform)'=='"; - oss << config << "|x86"; - oss << "'"; + oss << " Or " + "'$(Configuration)|$(Platform)'=='"; + oss << config + << "|x86" + "'"; } return oss.str(); } @@ -881,7 +882,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( oss << " " << i << ";\n"; } oss << " " - << "$(BuildDependsOn)\n"; + "$(BuildDependsOn)\n"; e1.Element("BuildDependsOn", oss.str()); } } From 2409f62d18b714f3342db99201eadc13420708da Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 14:57:48 -0400 Subject: [PATCH 165/627] strings: simplify streaming sequences --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 11 +++++------ Source/cmGlobalVisualStudioGenerator.cxx | 4 ++-- Source/cmVisualStudio10TargetGenerator.cxx | 9 ++++----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 45f91b25277..3a116db8d26 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -103,11 +103,10 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile, } std::ostringstream command; - command << QuotePath(executable); - command << " -nologo" + command << QuotePath(executable) + << " -nologo" " -arch " - << arch; - command << " -out " << QuotePath(objectFile); + << arch << " -out " << QuotePath(objectFile); for (std::string const& ext : CandleExtensions) { command << " -ext " << QuotePath(ext); @@ -132,8 +131,8 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles) } std::ostringstream command; - command << QuotePath(executable); - command << " -nologo" + command << QuotePath(executable) + << " -nologo" " -out " << QuotePath(CMakeToWixPath(packageFileNames.at(0))); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 65c8c386243..ad93b6cf06b 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -286,8 +286,8 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros() if (!cmSystemTools::FileTimeCompare(src, dst, &res) || res > 0) { if (!cmSystemTools::CopyFileAlways(src, dst)) { std::ostringstream oss; - oss << "Could not copy from: " << src << std::endl; - oss << " to: " << dst << std::endl; + oss << "Could not copy from: " << src << std::endl + << " to: " << dst << std::endl; cmSystemTools::Message(oss.str(), "Warning"); } } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index c7088d592bd..ddb08ba4015 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -304,15 +304,14 @@ std::string cmVisualStudio10TargetGenerator::CalcCondition( const std::string& config) const { std::ostringstream oss; - oss << "'$(Configuration)|$(Platform)'=='"; - oss << config << "|" << this->Platform; - oss << "'"; + oss << "'$(Configuration)|$(Platform)'=='" << config << "|" << this->Platform + << "'"; // handle special case for 32 bit C# targets if (this->ProjectType == VsProjectType::csproj && this->Platform == "Win32"_s) { oss << " Or " - "'$(Configuration)|$(Platform)'=='"; - oss << config + "'$(Configuration)|$(Platform)'=='" + << config << "|x86" "'"; } From 7137b1783549fb33fcc09eabdd0d77511d36c23b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 14:33:36 -0400 Subject: [PATCH 166/627] cmStrCat: use in Windows-specific sources --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 48 +-- Source/CPack/WiX/cmWIXAccessControlList.cxx | 5 +- .../CPack/WiX/cmWIXFeaturesSourceWriter.cxx | 12 +- Source/cmGlobalVisualStudio10Generator.cxx | 310 ++++++++-------- Source/cmGlobalVisualStudio11Generator.cxx | 35 +- Source/cmGlobalVisualStudio12Generator.cxx | 48 +-- Source/cmGlobalVisualStudio14Generator.cxx | 40 ++- Source/cmGlobalVisualStudio71Generator.cxx | 4 +- Source/cmGlobalVisualStudio7Generator.cxx | 23 +- Source/cmGlobalVisualStudio8Generator.cxx | 8 +- Source/cmGlobalVisualStudio9Generator.cxx | 11 +- Source/cmGlobalVisualStudioGenerator.cxx | 29 +- ...cmGlobalVisualStudioVersionedGenerator.cxx | 134 +++---- Source/cmLocalVisualStudio7Generator.cxx | 38 +- Source/cmVSSetupHelper.cxx | 11 +- Source/cmVisualStudio10TargetGenerator.cxx | 340 ++++++++++-------- Source/cmVisualStudioGeneratorOptions.cxx | 2 +- Source/cmVisualStudioSlnData.cxx | 4 +- Source/cmVisualStudioSlnParser.cxx | 6 +- Source/cmVisualStudioWCEPlatformParser.cxx | 9 +- 20 files changed, 582 insertions(+), 535 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 3a116db8d26..e9138eeed89 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -55,7 +55,7 @@ int cmCPackWIXGenerator::InitializeInternal() bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command) { - std::string logFileName = this->CPackTopLevel + "/wix.log"; + std::string logFileName = cmStrCat(this->CPackTopLevel, "/wix.log"); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Running WiX command: " << command << std::endl); @@ -113,7 +113,7 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile, } if (!cmHasSuffix(sourceFile, this->CPackTopLevel)) { - command << " " << QuotePath("-I" + this->CPackTopLevel); + command << " " << QuotePath(cmStrCat("-I", this->CPackTopLevel)); } AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command); @@ -198,7 +198,8 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() } if (!GetOption("CPACK_WIX_LICENSE_RTF")) { - std::string licenseFilename = this->CPackTopLevel + "/License.rtf"; + std::string licenseFilename = + cmStrCat(this->CPackTopLevel, "/License.rtf"); SetOption("CPACK_WIX_LICENSE_RTF", licenseFilename); if (!CreateLicenseFile()) { @@ -295,7 +296,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl() usedBaseNames.insert(uniqueBaseName); std::string objectFilename = - this->CPackTopLevel + "/" + uniqueBaseName + ".wixobj"; + cmStrCat(this->CPackTopLevel, "/", uniqueBaseName, ".wixobj"); if (!RunCandleCommand(CMakeToWixPath(sourceFilename), CMakeToWixPath(objectFilename))) { @@ -334,7 +335,8 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream) void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() { - std::string includeFilename = this->CPackTopLevel + "/cpack_variables.wxi"; + std::string includeFilename = + cmStrCat(this->CPackTopLevel, "/cpack_variables.wxi"); cmWIXSourceWriter includeFile(this->Logger, includeFilename, this->ComponentGuidType, @@ -358,7 +360,8 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() { - std::string includeFilename = this->CPackTopLevel + "/properties.wxi"; + std::string includeFilename = + cmStrCat(this->CPackTopLevel, "/properties.wxi"); cmWIXSourceWriter includeFile(this->Logger, includeFilename, this->ComponentGuidType, @@ -407,7 +410,8 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile() { - std::string includeFilename = this->CPackTopLevel + "/product_fragment.wxi"; + std::string includeFilename = + cmStrCat(this->CPackTopLevel, "/product_fragment.wxi"); cmWIXSourceWriter includeFile(this->Logger, includeFilename, this->ComponentGuidType, @@ -446,7 +450,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() // if install folder is supposed to be set absolutely, the default // component guid "*" cannot be used std::string directoryDefinitionsFilename = - this->CPackTopLevel + "/directories.wxs"; + cmStrCat(this->CPackTopLevel, "/directories.wxs"); this->WixSources.push_back(directoryDefinitionsFilename); @@ -468,7 +472,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() directoryDefinitions.BeginInstallationPrefixDirectory(GetRootFolderId(), installRoot); - std::string fileDefinitionsFilename = this->CPackTopLevel + "/files.wxs"; + std::string fileDefinitionsFilename = + cmStrCat(this->CPackTopLevel, "/files.wxs"); this->WixSources.push_back(fileDefinitionsFilename); @@ -479,7 +484,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() fileDefinitions.BeginElement("Fragment"); std::string featureDefinitionsFilename = - this->CPackTopLevel + "/features.wxs"; + cmStrCat(this->CPackTopLevel, "/features.wxs"); this->WixSources.push_back(featureDefinitionsFilename); @@ -538,7 +543,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() std::string componentPath = cmStrCat(toplevel, '/', component.Name); - std::string const componentFeatureId = "CM_C_" + component.Name; + std::string const componentFeatureId = cmStrCat("CM_C_", component.Name); cmWIXShortcuts featureShortcuts; AddComponentsToFeature(componentPath, componentFeatureId, @@ -638,7 +643,7 @@ bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate() return false; } - std::string mainSourceFilePath = this->CPackTopLevel + "/main.wxs"; + std::string mainSourceFilePath = cmStrCat(this->CPackTopLevel, "/main.wxs"); if (!ConfigureFile(wixTemplate, mainSourceFilePath)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -796,7 +801,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( std::string componentId = "CM_SHORTCUT"; if (idPrefix.size()) { - componentId += "_" + idPrefix; + componentId += cmStrCat("_", idPrefix); } componentId += idSuffix; @@ -812,7 +817,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( this->Patch->ApplyFragment(componentId, fileDefinitions); std::string registryKey = - std::string("Software\\") + cpackVendor + "\\" + cpackPackageName; + cmStrCat("Software\\", cpackVendor, "\\", cpackPackageName); shortcuts.EmitShortcuts(type, registryKey, cpackComponentName, fileDefinitions); @@ -821,8 +826,8 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( cmValue cpackWixProgramMenuFolder = GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER"); if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder != "."_s) { - fileDefinitions.EmitRemoveFolder("CM_REMOVE_PROGRAM_MENU_FOLDER" + - idSuffix); + fileDefinitions.EmitRemoveFolder( + cmStrCat("CM_REMOVE_PROGRAM_MENU_FOLDER", idSuffix)); } } @@ -929,7 +934,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions( continue; } - std::string fullPath = topdir + "/" + fileName; + std::string fullPath = cmStrCat(topdir, "/", fileName); std::string relativePath = cmSystemTools::RelativePath(toplevel.c_str(), fullPath.c_str()); @@ -937,7 +942,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions( std::string id = PathToId(relativePath); if (cmSystemTools::FileIsDirectory(fullPath.c_str())) { - std::string subDirectoryId = std::string("CM_D") + id; + std::string subDirectoryId = cmStrCat("CM_D", id); directoryDefinitions.BeginElement("Directory"); directoryDefinitions.AddAttribute("Id", subDirectoryId); @@ -967,7 +972,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions( std::string const& textLabel = packageExecutables[j]; if (cmSystemTools::LowerCase(fileName) == - cmSystemTools::LowerCase(executableName) + ".exe") { + cmStrCat(cmSystemTools::LowerCase(executableName), ".exe")) { cmWIXShortcut shortcut; shortcut.label = textLabel; shortcut.workingDirectoryId = directoryId; @@ -1036,7 +1041,7 @@ std::string cmCPackWIXGenerator::GenerateGUID() std::string cmCPackWIXGenerator::QuotePath(std::string const& path) { - return std::string("\"") + path + '"'; + return cmStrCat("\"", path, '"'); } std::string cmCPackWIXGenerator::GetRightmostExtension( @@ -1225,6 +1230,7 @@ std::string cmCPackWIXGenerator::RelativePathWithoutComponentPrefix( void cmCPackWIXGenerator::InjectXmlNamespaces(cmWIXSourceWriter& sourceWriter) { for (auto& ns : this->CustomXmlNamespaces) { - sourceWriter.AddAttributeUnlessEmpty("xmlns:" + ns.first, ns.second); + sourceWriter.AddAttributeUnlessEmpty(cmStrCat("xmlns:", ns.first), + ns.second); } } diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx index 2261a66e0fd..5dcd086adc8 100644 --- a/Source/CPack/WiX/cmWIXAccessControlList.cxx +++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx @@ -118,9 +118,8 @@ void cmWIXAccessControlList::EmitBooleanAttribute(std::string const& entry, std::string const& name) { if (!this->IsBooleanAttribute(name)) { - std::ostringstream message; - message << "Unknown boolean attribute '" << name << "'"; - this->ReportError(entry, message.str()); + this->ReportError(entry, + cmStrCat("Unknown boolean attribute '", name, "'")); } this->SourceWriter.AddAttribute(name, "yes"); diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx index a7a06488110..3246e98995d 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmWIXFeaturesSourceWriter.h" +#include "cmStringAlgorithms.h" + cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter( cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) : cmWIXSourceWriter(logger, filename, componentGuidType) @@ -17,7 +19,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( AddAttribute("Guid", CreateGuidFromComponentId("CM_PACKAGE_REGISTRY")); std::string registryKey = - std::string("Software\\Kitware\\CMake\\Packages\\") + package; + cmStrCat("Software\\Kitware\\CMake\\Packages\\", package); BeginElement("RegistryValue"); AddAttribute("Root", "HKLM"); @@ -35,7 +37,7 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( cmCPackComponentGroup const& group, cmWIXPatch& patch) { BeginElement("Feature"); - AddAttribute("Id", "CM_G_" + group.Name); + AddAttribute("Id", cmStrCat("CM_G_", group.Name)); if (group.IsExpandedByDefault) { AddAttribute("Display", "expand"); @@ -44,7 +46,7 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( AddAttributeUnlessEmpty("Title", group.DisplayName); AddAttributeUnlessEmpty("Description", group.Description); - patch.ApplyFragment("CM_G_" + group.Name, *this); + patch.ApplyFragment(cmStrCat("CM_G_", group.Name), *this); for (cmCPackComponentGroup* subgroup : group.Subgroups) { EmitFeatureForComponentGroup(*subgroup, patch); @@ -61,7 +63,7 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponent( cmCPackComponent const& component, cmWIXPatch& patch) { BeginElement("Feature"); - AddAttribute("Id", "CM_C_" + component.Name); + AddAttribute("Id", cmStrCat("CM_C_", component.Name)); AddAttributeUnlessEmpty("Title", component.DisplayName); AddAttributeUnlessEmpty("Description", component.Description); @@ -78,7 +80,7 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponent( AddAttribute("Level", "2"); } - patch.ApplyFragment("CM_C_" + component.Name, *this); + patch.ApplyFragment(cmStrCat("CM_C_", component.Name), *this); EndElement("Feature"); } diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 8befa75f5d6..9a8e64d0c3e 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -84,10 +84,10 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( { if (this->SystemIsWindowsCE && ts.empty() && this->DefaultPlatformToolset.empty()) { - std::ostringstream e; - e << this->GetName() << " Windows CE version '" << this->SystemVersion - << "' requires CMAKE_GENERATOR_TOOLSET to be set."; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat(this->GetName(), " Windows CE version '", this->SystemVersion, + "' requires CMAKE_GENERATOR_TOOLSET to be set.")); return false; } @@ -106,16 +106,17 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( if (!this->CustomFlagTableDir.empty() && !(cmSystemTools::FileIsFullPath(this->CustomFlagTableDir) && cmSystemTools::FileIsDirectory(this->CustomFlagTableDir))) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given toolset\n" - " customFlagTableDir=" << this->CustomFlagTableDir << "\n" - "that is not an absolute path to an existing directory."; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given toolset\n" + " customFlagTableDir=", + this->CustomFlagTableDir, + "\n" + "that is not an absolute path to an existing directory.")); cmSystemTools::SetFatalErrorOccurred(); return false; } @@ -126,7 +127,8 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( // differing from the "false" and "true" values used in older toolsets. // A VS 2015 update changed it back. Parse the "link.xml" file to // discover which one we need. - std::string const link_xml = this->VCTargetsPath + "/1033/link.xml"; + std::string const link_xml = + cmStrCat(this->VCTargetsPath, "/1033/link.xml"); cmsys::ifstream fin(link_xml.c_str()); std::string line; while (fin && cmSystemTools::GetLineFromStream(fin, line)) { @@ -141,24 +143,24 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( this->SupportsUnityBuilds = this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS16 || (this->Version == cmGlobalVisualStudioGenerator::VSVersion::VS15 && - cmSystemTools::PathExists(this->VCTargetsPath + - "/Microsoft.Cpp.Unity.targets")); + cmSystemTools::PathExists( + cmStrCat(this->VCTargetsPath, "/Microsoft.Cpp.Unity.targets"))); if (this->GeneratorToolsetCuda.empty()) { // Find the highest available version of the CUDA tools. std::vector cudaTools; std::string bcDir; if (this->GeneratorToolsetCudaCustomDir.empty()) { - bcDir = this->VCTargetsPath + "/BuildCustomizations"; + bcDir = cmStrCat(this->VCTargetsPath, "/BuildCustomizations"); } else { - bcDir = this->GetPlatformToolsetCudaCustomDirString() + - this->GetPlatformToolsetCudaVSIntegrationSubdirString() + - "extras\\visual_studio_integration\\MSBuildExtensions"; + bcDir = cmStrCat(this->GetPlatformToolsetCudaCustomDirString(), + this->GetPlatformToolsetCudaVSIntegrationSubdirString(), + "extras\\visual_studio_integration\\MSBuildExtensions"); cmSystemTools::ConvertToUnixSlashes(bcDir); } cmsys::Glob gl; gl.SetRelative(bcDir.c_str()); - if (gl.FindFiles(bcDir + "/CUDA *.props")) { + if (gl.FindFiles(cmStrCat(bcDir, "/CUDA *.props"))) { cudaTools = gl.GetFiles(); } if (!cudaTools.empty()) { @@ -169,18 +171,19 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( } else if (!this->GeneratorToolsetCudaCustomDir.empty()) { // Generate an error if Visual Studio integration files are not found // inside of custom cuda toolset. - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given toolset\n" - " cuda=" << this->GeneratorToolsetCudaCustomDir << "\n" - "cannot detect Visual Studio integration files in path\n" - " " << bcDir; - - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given toolset\n" + " cuda=", + this->GeneratorToolsetCudaCustomDir, + "\n" + "cannot detect Visual Studio integration files in path\n" + " ", + bcDir)); // Clear the configured tool-set this->GeneratorToolsetCuda.clear(); @@ -195,25 +198,24 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( std::string versionToolset = this->GeneratorToolsetVersion; cmsys::RegularExpression regex("[0-9][0-9]\\.[0-9][0-9]"); if (regex.find(versionToolset)) { - versionToolset = "v" + versionToolset.erase(2, 1); + versionToolset = cmStrCat("v", versionToolset.erase(2, 1)); } else { // Version not recognized. Clear it. versionToolset.clear(); } if (!cmHasPrefix(versionToolset, this->GetPlatformToolsetString())) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given toolset and version specification\n" - " " << this->GetPlatformToolsetString() << ",version=" << - this->GeneratorToolsetVersion << "\n" - "contains an invalid version specification." - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given toolset and version specification\n" + " ", + this->GetPlatformToolsetString(), + ",version=", this->GeneratorToolsetVersion, + "\n" + "contains an invalid version specification.")); // Clear the configured tool-set this->GeneratorToolsetVersion.clear(); @@ -233,40 +235,40 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( this->GeneratorToolsetVersionProps = std::move(auxProps); break; case AuxToolset::PropsMissing: { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given toolset and version specification\n" - " " << this->GetPlatformToolsetString() << ",version=" << - this->GeneratorToolsetVersion << "\n" - "does not seem to be installed at\n" << - " " << auxProps; - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given toolset and version specification\n" + " ", + this->GetPlatformToolsetString(), + ",version=", this->GeneratorToolsetVersion, + "\n" + "does not seem to be installed at\n" + " ", + auxProps)); // Clear the configured tool-set this->GeneratorToolsetVersion.clear(); this->GeneratorToolsetVersionProps = {}; } break; case AuxToolset::PropsIndeterminate: { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given toolset and version specification\n" - " " << this->GetPlatformToolsetString() << ",version=" << - this->GeneratorToolsetVersion << "\n" - "has multiple matches installed at\n" << - " " << auxProps << "\n" << - "The toolset and version specification must resolve \n" << - "to a single installed toolset"; - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given toolset and version specification\n" + " ", + this->GetPlatformToolsetString(), + ",version=", this->GeneratorToolsetVersion, + "\n" + "has multiple matches installed at\n", + " ", auxProps, "\n", + "The toolset and version specification must resolve \n" + "to a single installed toolset")); // Clear the configured tool-set this->GeneratorToolsetVersion.clear(); @@ -320,47 +322,47 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset( for (; fi != fields.end(); ++fi) { std::string::size_type pos = fi->find('='); if (pos == fi->npos) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given toolset specification\n" - " " << ts << "\n" - "that contains a field after the first ',' with no '='." - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given toolset specification\n" + " ", + ts, + "\n" + "that contains a field after the first ',' with no '='.")); return false; } std::string const key = fi->substr(0, pos); std::string const value = fi->substr(pos + 1); if (!handled.insert(key).second) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given toolset specification\n" - " " << ts << "\n" - "that contains duplicate field key '" << key << "'." - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given toolset specification\n" + " ", + ts, + "\n" + "that contains duplicate field key '", + key, "'.")); return false; } if (!this->ProcessGeneratorToolsetField(key, value)) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given toolset specification\n" - " " << ts << "\n" - "that contains invalid field '" << *fi << "'." - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given toolset specification\n" + " ", + ts, + "\n" + "that contains invalid field '", + *fi, "'.")); return false; } } @@ -436,11 +438,10 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) } } else if (this->SystemName == "Android"_s) { if (this->PlatformInGeneratorName) { - std::ostringstream e; - e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR " - "specifies a platform too: '" - << this->GetName() << "'"; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR ", + "specifies a platform too: '", this->GetName(), "'")); return false; } if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") == @@ -467,11 +468,10 @@ bool cmGlobalVisualStudio10Generator::InitializeWindows(cmMakefile*) bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) { if (this->PlatformInGeneratorName) { - std::ostringstream e; - e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR " - "specifies a platform too: '" - << this->GetName() << "'"; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR ", + "specifies a platform too: '", this->GetName(), "'")); return false; } @@ -489,17 +489,17 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf) { - std::ostringstream e; - e << this->GetName() << " does not support Windows Phone."; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat(this->GetName(), " does not support Windows Phone.")); return false; } bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf) { - std::ostringstream e; - e << this->GetName() << " does not support Windows Store."; - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat(this->GetName(), " does not support Windows Store.")); return false; } @@ -611,29 +611,30 @@ void cmGlobalVisualStudio10Generator::Generate() } if (this->LongestSource.Length > 0) { cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator(); - std::ostringstream e; - /* clang-format off */ - e << - "The binary and/or source directory paths may be too long to generate " - "Visual Studio 10 files for this project. " - "Consider choosing shorter directory names to build this project with " - "Visual Studio 10. " - "A more detailed explanation follows." - "\n" - "There is a bug in the VS 10 IDE that renders property dialog fields " - "blank for files referenced by full path in the project file. " - "However, CMake must reference at least one file by full path:\n" - " " << this->LongestSource.SourceFile->GetFullPath() << "\n" - "This is because some Visual Studio tools would append the relative " - "path to the end of the referencing directory path, as in:\n" - " " << lg->GetCurrentBinaryDirectory() << "/" - << this->LongestSource.SourceRel << "\n" - "and then incorrectly complain that the file does not exist because " - "the path length is too long for some internal buffer or API. " - "To avoid this problem CMake must use a full path for this file " - "which then triggers the VS 10 property dialog bug."; - /* clang-format on */ - lg->IssueMessage(MessageType::WARNING, e.str()); + lg->IssueMessage( + MessageType::WARNING, + cmStrCat( + "The binary and/or source directory paths may be too long to generate " + "Visual Studio 10 files for this project. " + "Consider choosing shorter directory names to build this project with " + "Visual Studio 10. " + "A more detailed explanation follows." + "\n" + "There is a bug in the VS 10 IDE that renders property dialog fields " + "blank for files referenced by full path in the project file. " + "However, CMake must reference at least one file by full path:\n" + " ", + this->LongestSource.SourceFile->GetFullPath(), + "\n" + "This is because some Visual Studio tools would append the relative " + "path to the end of the referencing directory path, as in:\n" + " ", + lg->GetCurrentBinaryDirectory(), '/', this->LongestSource.SourceRel, + "\n" + "and then incorrectly complain that the file does not exist because " + "the path length is too long for some internal buffer or API. " + "To avoid this problem CMake must use a full path for this file " + "which then triggers the VS 10 property dialog bug.")); } if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue( "CMAKE_VS_NUGET_PACKAGE_RESTORE")) { @@ -851,7 +852,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) wd += cmVersion::GetCMakeVersion(); // We record the result persistently in a file. - std::string const txt = wd + "/VCTargetsPath.txt"; + std::string const txt = cmStrCat(wd, "/VCTargetsPath.txt"); // If we have a recorded result, use it. { @@ -865,8 +866,8 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) // Prepare the work directory. if (!cmSystemTools::MakeDirectory(wd)) { - std::string e = "Failed to make directory:\n " + wd; - mf->IssueMessage(MessageType::FATAL_ERROR, e); + mf->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("Failed to make directory:\n ", wd)); cmSystemTools::SetFatalErrorOccurred(); return false; } @@ -874,7 +875,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) // Generate a project file for MSBuild to tell us the VCTargetsPath value. std::string const vcxproj = "VCTargetsPath.vcxproj"; { - std::string const vcxprojAbs = wd + "/" + vcxproj; + std::string const vcxprojAbs = cmStrCat(wd, "/", vcxproj); cmsys::ofstream fout(vcxprojAbs.c_str()); cmXMLWriter xw(fout); @@ -893,7 +894,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) cmXMLElement eig(eprj, "ItemGroup"); eig.Attribute("Label", "ProjectConfigurations"); cmXMLElement epc(eig, "ProjectConfiguration"); - epc.Attribute("Include", "Debug|" + this->GetPlatformName()); + epc.Attribute("Include", cmStrCat("Debug|", this->GetPlatformName())); cmXMLElement(epc, "Configuration").Content("Debug"); cmXMLElement(epc, "Platform").Content(this->GetPlatformName()); } @@ -976,8 +977,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) cmd.push_back(vcxproj); cmd.push_back("/p:Configuration=Debug"); cmd.push_back(cmStrCat("/p:Platform=", this->GetPlatformName())); - cmd.push_back(std::string("/p:VisualStudioVersion=") + - this->GetIDEVersion()); + cmd.push_back(cmStrCat("/p:VisualStudioVersion=", this->GetIDEVersion())); std::string out; int ret = 0; cmsys::RegularExpression regex("\n *VCTargetsPath=([^%\r\n]+)[\r\n]"); @@ -1108,7 +1108,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand( requiresRestore = false; } else if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue( - tname + "_REQUIRES_VS_PACKAGE_RESTORE")) { + cmStrCat(tname, "_REQUIRES_VS_PACKAGE_RESTORE"))) { requiresRestore = cached.IsOn(); } else { // There are no package references defined. diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 84fa378100e..0ec5e8b2189 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -3,7 +3,6 @@ #include "cmGlobalVisualStudio11Generator.h" #include -#include #include #include @@ -38,17 +37,18 @@ void cmGlobalVisualStudio11Generator::EnableLanguage( bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf) { if (!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset)) { - std::ostringstream e; + std::string e; if (this->DefaultPlatformToolset.empty()) { - e << this->GetName() << " supports Windows Phone '8.0', but not '" - << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + e = cmStrCat(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"; + e = cmStrCat( + "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(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e); return false; } return true; @@ -57,17 +57,18 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf) bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf) { if (!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset)) { - std::ostringstream e; + std::string e; if (this->DefaultPlatformToolset.empty()) { - e << this->GetName() << " supports Windows Store '8.0', but not '" - << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + e = cmStrCat(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"; + e = cmStrCat( + "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(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e); return false; } return true; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 3c15bd8370b..6c72c5df52f 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -65,7 +65,7 @@ class cmGlobalVisualStudio12Generator::Factory cmDocumentationEntry GetDocumentation() const override { - return { std::string(vs12generatorName) + " [arch]", + return { cmStrCat(vs12generatorName, " [arch]"), "Deprecated. Generates Visual Studio 2013 project files. " "Optional [arch] can be \"Win64\" or \"ARM\"." }; } @@ -80,8 +80,8 @@ class cmGlobalVisualStudio12Generator::Factory std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(vs12generatorName + std::string(" ARM")); - names.push_back(vs12generatorName + std::string(" Win64")); + names.push_back(cmStrCat(vs12generatorName, " ARM")); + names.push_back(cmStrCat(vs12generatorName, " Win64")); return names; } @@ -151,19 +151,20 @@ bool cmGlobalVisualStudio12Generator::ProcessGeneratorToolsetField( bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf) { if (!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset)) { - std::ostringstream e; + std::string e; if (this->DefaultPlatformToolset.empty()) { - e << this->GetName() - << " supports Windows Phone '8.0' and '8.1', but " - "not '" - << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + e = cmStrCat(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"; + e = cmStrCat( + "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(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e); return false; } return true; @@ -172,19 +173,20 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf) bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf) { if (!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset)) { - std::ostringstream e; + std::string e; if (this->DefaultPlatformToolset.empty()) { - e << this->GetName() - << " supports Windows Store '8.0' and '8.1', but " - "not '" - << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + e = cmStrCat(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"; + e = cmStrCat( + "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(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e); return false; } return true; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 7cb5a664af0..d6a11dfc965 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -67,7 +67,7 @@ class cmGlobalVisualStudio14Generator::Factory cmDocumentationEntry GetDocumentation() const override { - return { std::string(vs14generatorName) + " [arch]", + return { cmStrCat(vs14generatorName, " [arch]"), "Generates Visual Studio 2015 project files. " "Optional [arch] can be \"Win64\" or \"ARM\"." }; } @@ -82,8 +82,8 @@ class cmGlobalVisualStudio14Generator::Factory std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(vs14generatorName + std::string(" ARM")); - names.push_back(vs14generatorName + std::string(" Win64")); + names.push_back(cmStrCat(vs14generatorName, " ARM")); + names.push_back(cmStrCat(vs14generatorName, " Win64")); return names; } @@ -173,20 +173,21 @@ bool cmGlobalVisualStudio14Generator::VerifyNoGeneratorPlatformVersion( bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf) { - std::ostringstream e; if (!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset)) { + std::string e; if (this->DefaultPlatformToolset.empty()) { - e << this->GetName() - << " supports Windows Store '8.0', '8.1' and " - "'10.0', but not '" - << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + e = cmStrCat(this->GetName(), + " supports Windows Store '8.0', '8.1' and " + "'10.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"; + e = cmStrCat( + "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(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, e); return false; } return true; @@ -252,10 +253,11 @@ void cmGlobalVisualStudio14Generator::SetWindowsTargetPlatformVersion( this->WindowsTargetPlatformVersion = version; if (!cmSystemTools::VersionCompareEqual(this->WindowsTargetPlatformVersion, this->SystemVersion)) { - std::ostringstream e; - e << "Selecting Windows SDK version " << this->WindowsTargetPlatformVersion - << " to target Windows " << this->SystemVersion << "."; - mf->DisplayStatus(e.str(), -1); + mf->DisplayStatus(cmStrCat("Selecting Windows SDK version ", + this->WindowsTargetPlatformVersion, + " to target Windows ", this->SystemVersion, + "."), + -1); } mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION", this->WindowsTargetPlatformVersion); @@ -335,7 +337,7 @@ struct NoWindowsH { bool operator()(std::string const& p) { - return !cmSystemTools::FileExists(p + "/um/windows.h", true); + return !cmSystemTools::FileExists(cmStrCat(p, "/um/windows.h"), true); } }; class WindowsSDKTooRecent @@ -402,7 +404,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion( std::vector sdks; // Grab the paths of the different SDKs that are installed for (std::string const& i : win10Roots) { - std::string path = i + "/Include/*"; + std::string path = cmStrCat(i, "/Include/*"); cmSystemTools::GlobDirs(path, sdks); } diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 01f4803f54d..98176b0533e 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -209,8 +209,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations( cmList mapConfig; const char* dstConfig = i.c_str(); if (target.GetProperty("EXTERNAL_MSPROJECT")) { - if (cmValue m = target.GetProperty("MAP_IMPORTED_CONFIG_" + - cmSystemTools::UpperCase(i))) { + if (cmValue m = target.GetProperty( + cmStrCat("MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(i)))) { mapConfig.assign(*m); if (!mapConfig.empty()) { dstConfig = mapConfig[0].c_str(); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 67e0a2979c1..80a7be810f5 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -158,7 +158,7 @@ std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand() std::string vskey; // Search in standard location. - vskey = this->GetRegistryBase() + ";InstallDir"; + vskey = cmStrCat(this->GetRegistryBase(), ";InstallDir"); if (cmSystemTools::ReadRegistryValue(vskey, vscmd, cmSystemTools::KeyWOW64_32)) { cmSystemTools::ConvertToUnixSlashes(vscmd); @@ -259,7 +259,7 @@ cmGlobalVisualStudio7Generator::GenerateBuildCommand( GeneratedMakeCommand makeCommand; makeCommand.RequiresOutputForward = requiresOutputForward; makeCommand.Add(makeProgramSelected); - makeCommand.Add(projectName + ".sln"); + makeCommand.Add(cmStrCat(projectName, ".sln")); makeCommand.Add((clean ? "/clean" : "/build")); makeCommand.Add((config.empty() ? "Debug" : config)); makeCommand.Add("/project"); @@ -483,12 +483,12 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( } if (cumulativePath.empty()) { - cumulativePath = "CMAKE_FOLDER_GUID_" + iter; + cumulativePath = cmStrCat("CMAKE_FOLDER_GUID_", iter); } else { - VisualStudioFolders[cumulativePath].insert(cumulativePath + "/" + - iter); + VisualStudioFolders[cumulativePath].insert( + cmStrCat(cumulativePath, "/", iter)); - cumulativePath = cumulativePath + "/" + iter; + cumulativePath = cmStrCat(cumulativePath, "/", iter); } } @@ -552,7 +552,8 @@ std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath( void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( std::ostream& fout, cmLocalGenerator* root) { - std::string const guid = this->GetGUID(root->GetProjectName() + ".sln"); + std::string const guid = + this->GetGUID(cmStrCat(root->GetProjectName(), ".sln")); bool extensibilityGlobalsOverridden = false; bool extensibilityAddInsOverridden = false; const std::vector propKeys = @@ -680,7 +681,7 @@ std::string cmGlobalVisualStudio7Generator::WriteUtilityDepend( std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name) { - std::string const& guidStoreName = name + "_GUID_CMAKE"; + std::string const& guidStoreName = cmStrCat(name, "_GUID_CMAKE"); if (cmValue storedGUID = this->CMakeInstance->GetCacheDefinition(guidStoreName)) { return *storedGUID; @@ -705,9 +706,7 @@ void cmGlobalVisualStudio7Generator::AppendDirectoryForConfig( const std::string& suffix, std::string& dir) { if (!config.empty()) { - dir += prefix; - dir += config; - dir += suffix; + dir += cmStrCat(prefix, config, suffix); } } @@ -728,7 +727,7 @@ std::set cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( // check if target is part of default build if (target->GetName() == t) { const std::string propertyName = - "CMAKE_VS_INCLUDE_" + t + "_TO_DEFAULT_BUILD"; + cmStrCat("CMAKE_VS_INCLUDE_", t, "_TO_DEFAULT_BUILD"); // inspect CMAKE_VS_INCLUDE__TO_DEFAULT_BUILD properties for (std::string const& i : configs) { cmValue propertyValue = diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index acb20d1d043..a2a7cb12eb1 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -341,7 +341,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() std::string argS = cmStrCat("-S", lg.GetSourceDirectory()); std::string argB = cmStrCat("-B", lg.GetBinaryDirectory()); std::string const sln = - lg.GetBinaryDirectory() + "/" + lg.GetProjectName() + ".sln"; + cmStrCat(lg.GetBinaryDirectory(), "/", lg.GetProjectName(), ".sln"); cmCustomCommandLines commandLines = cmMakeSingleCommandLine( { cmSystemTools::GetCMakeCommand(), argS, argB, "--check-stamp-list", stampList, "--vs-solution-file", sln }); @@ -364,7 +364,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() lg.AddCustomCommandToOutput(std::move(cc), true)) { gt->AddSource(file->ResolveFullPath()); } else { - cmSystemTools::Error("Error adding rule for " + stamps[0]); + cmSystemTools::Error(cmStrCat("Error adding rule for ", stamps[0])); } } @@ -409,8 +409,8 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( cmList mapConfig; const char* dstConfig = i.c_str(); if (target.GetProperty("EXTERNAL_MSPROJECT")) { - if (cmValue m = target.GetProperty("MAP_IMPORTED_CONFIG_" + - cmSystemTools::UpperCase(i))) { + if (cmValue m = target.GetProperty( + cmStrCat("MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(i)))) { mapConfig.assign(*m); if (!mapConfig.empty()) { dstConfig = mapConfig[0].c_str(); diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index e3964051463..462db2a81f7 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -9,6 +9,7 @@ #include "cmGlobalGenerator.h" #include "cmGlobalGeneratorFactory.h" #include "cmGlobalVisualStudioGenerator.h" +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmVisualStudioWCEPlatformParser.h" @@ -63,7 +64,7 @@ class cmGlobalVisualStudio9Generator::Factory : public cmGlobalGeneratorFactory cmDocumentationEntry GetDocumentation() const override { - return { std::string(vs9generatorName) + " [arch]", + return { cmStrCat(vs9generatorName, " [arch]"), "Deprecated. Generates Visual Studio 2008 project files. " "Optional [arch] can be \"Win64\" or \"IA64\"." }; } @@ -78,14 +79,14 @@ class cmGlobalVisualStudio9Generator::Factory : public cmGlobalGeneratorFactory std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(vs9generatorName + std::string(" Win64")); - names.push_back(vs9generatorName + std::string(" IA64")); + names.push_back(cmStrCat(vs9generatorName, " Win64")); + names.push_back(cmStrCat(vs9generatorName, " IA64")); cmVisualStudioWCEPlatformParser parser; parser.ParseVersion("9.0"); const std::vector& availablePlatforms = parser.GetAvailablePlatforms(); for (std::string const& i : availablePlatforms) { - names.push_back("Visual Studio 9 2008 " + i); + names.push_back(cmStrCat("Visual Studio 9 2008 ", i)); } return names; } @@ -144,7 +145,7 @@ std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory() cmSystemTools::ConvertToUnixSlashes(base); // 9.0 macros folder: - path = base + "/VSMacros80"; + path = cmStrCat(base, "/VSMacros80"); // *NOT* a typo; right now in Visual Studio 2008 beta the macros // folder is VSMacros80... They may change it to 90 before final // release of 2008 or they may not... we'll have to keep our eyes diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index ad93b6cf06b..be5b79fa82f 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -185,8 +185,8 @@ std::string cmGlobalVisualStudioGenerator::GetRegistryBase() std::string cmGlobalVisualStudioGenerator::GetRegistryBase(const char* version) { - std::string key = R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\)"; - return key + version; + return cmStrCat(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\)", + version); } void cmGlobalVisualStudioGenerator::AddExtraIDETargets() @@ -275,7 +275,7 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros() std::string src = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Templates/" CMAKE_VSMACROS_FILENAME); - std::string dst = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME; + std::string dst = cmStrCat(dir, "/CMakeMacros/" CMAKE_VSMACROS_FILENAME); // Copy the macros file to the user directory only if the // destination does not exist or the source location is newer. @@ -310,7 +310,8 @@ void cmGlobalVisualStudioGenerator::CallVisualStudioMacro( // - there were .sln/.vcproj files changed during generation // if (!dir.empty()) { - std::string macrosFile = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME; + std::string macrosFile = + cmStrCat(dir, "/CMakeMacros/" CMAKE_VSMACROS_FILENAME); std::string nextSubkeyName; if (cmSystemTools::FileExists(macrosFile) && IsVisualStudioMacrosFileRegistered( @@ -519,9 +520,9 @@ std::string cmGlobalVisualStudioGenerator::GetStartupProjectName( } root->GetMakefile()->IssueMessage( MessageType::AUTHOR_WARNING, - "Directory property VS_STARTUP_PROJECT specifies target " - "'" + - startup + "' that does not exist. Ignoring."); + cmStrCat("Directory property VS_STARTUP_PROJECT specifies target " + "'", + startup, "' that does not exist. Ignoring.")); } // default, if not specified @@ -547,7 +548,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, LONG result = ERROR_SUCCESS; DWORD index = 0; - keyname = regKeyBase + "\\OtherProjects7"; + keyname = cmStrCat(regKeyBase, "\\OtherProjects7"); hkey = nullptr; result = RegOpenKeyExW(HKEY_CURRENT_USER, cmsys::Encoding::ToWide(keyname).c_str(), @@ -639,7 +640,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, // as the name of the next subkey. nextAvailableSubKeyName = std::to_string(index); - keyname = regKeyBase + "\\RecordingProject7"; + keyname = cmStrCat(regKeyBase, "\\RecordingProject7"); hkey = nullptr; result = RegOpenKeyExW(HKEY_CURRENT_USER, cmsys::Encoding::ToWide(keyname).c_str(), @@ -685,7 +686,7 @@ void WriteVSMacrosFileRegistryEntry(const std::string& nextAvailableSubKeyName, const std::string& macrosFile, const std::string& regKeyBase) { - std::string keyname = regKeyBase + "\\OtherProjects7"; + std::string keyname = cmStrCat(regKeyBase, "\\OtherProjects7"); HKEY hkey = nullptr; LONG result = RegOpenKeyExW(HKEY_CURRENT_USER, cmsys::Encoding::ToWide(keyname).c_str(), @@ -906,10 +907,10 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( cmSystemTools::ReplaceString(obj_dir_expanded, this->GetCMakeCFGIntDir(), configName.c_str()); cmSystemTools::MakeDirectory(obj_dir_expanded); - std::string const objs_file = obj_dir_expanded + "/objects.txt"; + std::string const objs_file = cmStrCat(obj_dir_expanded, "/objects.txt"); cmGeneratedFileStream fout(objs_file.c_str()); if (!fout) { - cmSystemTools::Error("could not open " + objs_file); + cmSystemTools::Error(cmStrCat("could not open ", objs_file)); return; } @@ -920,7 +921,7 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( // It must exist because we populated the mapping just above. const auto& v = mapping[it]; assert(!v.empty()); - std::string objFile = obj_dir + v; + std::string objFile = cmStrCat(obj_dir, v); objs.push_back(objFile); } std::vector externalObjectSources; @@ -976,7 +977,7 @@ bool cmGlobalVisualStudioGenerator::Open(const std::string& bindir, const std::string& projectName, bool dryRun) { - std::string sln = bindir + "/" + projectName + ".sln"; + std::string sln = cmStrCat(bindir, "/", projectName, ".sln"); if (dryRun) { return cmSystemTools::FileExists(sln, true); diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 44019f6812a..8b408a9f73b 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -211,7 +211,7 @@ static const char* cmVS15GenName(const std::string& name, std::string& genName) if (cmHasLiteralPrefix(p, " 2017")) { p += 5; } - genName = std::string(vs15generatorName) + p; + genName = cmStrCat(vs15generatorName, p); return p; } @@ -250,7 +250,7 @@ class cmGlobalVisualStudioVersionedGenerator::Factory15 cmDocumentationEntry GetDocumentation() const override { - return { std::string(vs15generatorName) + " [arch]", + return { cmStrCat(vs15generatorName, " [arch]"), "Generates Visual Studio 2017 project files. " "Optional [arch] can be \"Win64\" or \"ARM\"." }; } @@ -265,8 +265,8 @@ class cmGlobalVisualStudioVersionedGenerator::Factory15 std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(vs15generatorName + std::string(" ARM")); - names.push_back(vs15generatorName + std::string(" Win64")); + names.push_back(cmStrCat(vs15generatorName, " ARM")); + names.push_back(cmStrCat(vs15generatorName, " Win64")); return names; } @@ -306,7 +306,7 @@ static const char* cmVS16GenName(const std::string& name, std::string& genName) if (cmHasLiteralPrefix(p, " 2019")) { p += 5; } - genName = std::string(vs16generatorName) + p; + genName = cmStrCat(vs16generatorName, p); return p; } @@ -320,7 +320,7 @@ static const char* cmVS17GenName(const std::string& name, std::string& genName) if (cmHasLiteralPrefix(p, " 2022")) { p += 5; } - genName = std::string(vs17generatorName) + p; + genName = cmStrCat(vs17generatorName, p); return p; } @@ -526,18 +526,19 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( cmsys::RegularExpression versionRegex( cmStrCat("^", majorStr, R"(\.[0-9]+\.[0-9]+\.[0-9]+$)")); if (!versionRegex.find(this->GeneratorInstanceVersion)) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given instance specification\n" - " " << i << "\n" - "but the version field is not 4 integer components" - " starting in " << majorStr << "." - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given instance specification\n" + " ", + i, + "\n" + "but the version field is not 4 integer components" + " starting in ", + majorStr, ".")); return false; } } @@ -566,14 +567,13 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( return false; } } else if (!this->vsSetupAPIHelper.GetVSInstanceInfo(vsInstance)) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "could not find any instance of Visual Studio.\n"; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "could not find any instance of Visual Studio.\n")); return false; } @@ -619,47 +619,47 @@ bool cmGlobalVisualStudioVersionedGenerator::ParseGeneratorInstance( for (; fi != fields.end(); ++fi) { std::string::size_type pos = fi->find('='); if (pos == fi->npos) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given instance specification\n" - " " << is << "\n" - "that contains a field after the first ',' with no '='." - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given instance specification\n" + " ", + is, + "\n" + "that contains a field after the first ',' with no '='.")); return false; } std::string const key = fi->substr(0, pos); std::string const value = fi->substr(pos + 1); if (!handled.insert(key).second) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given instance specification\n" - " " << is << "\n" - "that contains duplicate field key '" << key << "'." - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given instance specification\n" + " ", + is, + "\n" + "that contains duplicate field key '", + key, "'.")); return false; } if (!this->ProcessGeneratorInstanceField(key, value)) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given instance specification\n" - " " << is << "\n" - "that contains invalid field '" << *fi << "'." - ; - /* clang-format on */ - mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + mf->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given instance specification\n" + " ", + is, + "\n" + "that contains invalid field '", + *fi, "'.")); return false; } } @@ -956,8 +956,8 @@ bool cmGlobalVisualStudioVersionedGenerator::IsWin81SDKInstalled() const "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\" "Windows Kits\\Installed Roots;KitsRoot81", win81Root, cmSystemTools::KeyWOW64_32)) { - return cmSystemTools::FileExists(win81Root + "/include/um/windows.h", - true); + return cmSystemTools::FileExists( + cmStrCat(win81Root, "/include/um/windows.h"), true); } return false; } @@ -990,29 +990,29 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS17) { if (VSIsArm64Host()) { if (VSHasDotNETFrameworkArm64()) { - msbuild = vs + "/MSBuild/Current/Bin/arm64/MSBuild.exe"; + msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/arm64/MSBuild.exe"); if (cmSystemTools::FileExists(msbuild)) { return msbuild; } } if (VSIsWindows11OrGreater()) { - msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe"; + msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/amd64/MSBuild.exe"); if (cmSystemTools::FileExists(msbuild)) { return msbuild; } } } else { - msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe"; + msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/amd64/MSBuild.exe"); if (cmSystemTools::FileExists(msbuild)) { return msbuild; } } } - msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe"; + msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/MSBuild.exe"); if (cmSystemTools::FileExists(msbuild)) { return msbuild; } - msbuild = vs + "/MSBuild/15.0/Bin/MSBuild.exe"; + msbuild = cmStrCat(vs, "/MSBuild/15.0/Bin/MSBuild.exe"); if (cmSystemTools::FileExists(msbuild)) { return msbuild; } @@ -1029,7 +1029,7 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindDevEnvCommand() // Ask Visual Studio Installer tool. std::string vs; if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) { - devenv = vs + "/Common7/IDE/devenv.com"; + devenv = cmStrCat(vs, "/Common7/IDE/devenv.com"); if (cmSystemTools::FileExists(devenv)) { return devenv; } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 24ef5c2c1a4..eaa2c2c32ef 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -283,7 +283,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() file->ResolveFullPath(); return file; } - cmSystemTools::Error("Error adding rule for " + makefileIn); + cmSystemTools::Error(cmStrCat("Error adding rule for ", makefileIn)); return nullptr; } @@ -673,8 +673,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( : target->GetLinkerLanguage(configName)); if (linkLanguage.empty()) { cmSystemTools::Error( - "CMake can not determine linker language for target: " + - target->GetName()); + cmStrCat("CMake can not determine linker language for target: ", + target->GetName())); return; } langForClCompile = linkLanguage; @@ -961,7 +961,7 @@ std::string cmLocalVisualStudio7Generator::GetBuildTypeLinkerFlags( { std::string configTypeUpper = cmSystemTools::UpperCase(configName); std::string extraLinkOptionsBuildTypeDef = - rootLinkerFlags + "_" + configTypeUpper; + cmStrCat(rootLinkerFlags, "_", configTypeUpper); const std::string& extraLinkOptionsBuildType = this->Makefile->GetRequiredDefinition(extraLinkOptionsBuildTypeDef); @@ -978,19 +978,19 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( std::string temp; std::string extraLinkOptions; if (target->GetType() == cmStateEnums::EXECUTABLE) { - extraLinkOptions = - this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") + " " + - GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName); + extraLinkOptions = cmStrCat( + this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"), " ", + GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName)); } if (target->GetType() == cmStateEnums::SHARED_LIBRARY) { - extraLinkOptions = - this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") + - " " + GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName); + extraLinkOptions = cmStrCat( + this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"), " ", + GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName)); } if (target->GetType() == cmStateEnums::MODULE_LIBRARY) { - extraLinkOptions = - this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") + - " " + GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName); + extraLinkOptions = cmStrCat( + this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"), " ", + GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName)); } cmValue targetLinkFlags = target->GetProperty("LINK_FLAGS"); @@ -1285,7 +1285,8 @@ void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool( << "\"/>\n"; if (dir) { - std::string const exe = *dir + "\\" + target->GetFullName(config); + std::string const exe = + cmStrCat(*dir, "\\", target->GetFullName(config)); fout << "\t\t\tConvertToXMLOutputPath(dir + "/$(ConfigurationName)") << "," - << this->ConvertToXMLOutputPath(dir); + << this->ConvertToXMLOutputPath( + cmStrCat(dir, "/$(ConfigurationName)")) + << "," << this->ConvertToXMLOutputPath(dir); comma = ","; } } @@ -1550,11 +1552,11 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo( switch (cmOutputConverter::GetFortranFormat( sf.GetSafeProperty("Fortran_FORMAT"))) { case cmOutputConverter::FortranFormatFixed: - fc.CompileFlags = "-fixed " + fc.CompileFlags; + fc.CompileFlags = cmStrCat("-fixed ", fc.CompileFlags); needfc = true; break; case cmOutputConverter::FortranFormatFree: - fc.CompileFlags = "-free " + fc.CompileFlags; + fc.CompileFlags = cmStrCat("-free ", fc.CompileFlags); needfc = true; break; default: diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index 6702b7b337a..ccf24a0dc57 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -63,15 +63,16 @@ const WCHAR* ComponentType = L"Component"; bool LoadVSInstanceVCToolsetVersion(VSInstanceInfo& vsInstanceInfo) { std::string const vcRoot = vsInstanceInfo.GetInstallLocation(); - std::string vcToolsVersionFile = - vcRoot + "/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt"; + std::string vcToolsVersionFile = cmStrCat( + vcRoot, "/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt"); std::string vcToolsVersion; cmsys::ifstream fin(vcToolsVersionFile.c_str()); if (!fin || !cmSystemTools::GetLineFromStream(fin, vcToolsVersion)) { return false; } vcToolsVersion = cmTrimWhitespace(vcToolsVersion); - std::string const vcToolsDir = vcRoot + "/VC/Tools/MSVC/" + vcToolsVersion; + std::string const vcToolsDir = + cmStrCat(vcRoot, "/VC/Tools/MSVC/", vcToolsVersion); if (!cmSystemTools::FileIsDirectory(vcToolsDir)) { return false; } @@ -434,14 +435,14 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() std::string envVSCommonToolsDir; std::string envVSCommonToolsDirEnvName = - "VS" + std::to_string(this->Version) + "0COMNTOOLS"; + cmStrCat("VS", std::to_string(this->Version), "0COMNTOOLS"); if (cmSystemTools::GetEnv(envVSCommonToolsDirEnvName.c_str(), envVSCommonToolsDir)) { cmSystemTools::ConvertToUnixSlashes(envVSCommonToolsDir); } - std::string const wantVersion = std::to_string(this->Version) + '.'; + std::string const wantVersion = cmStrCat(std::to_string(this->Version), '.'); bool specifiedLocationNotSpecifiedVersion = false; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ddb08ba4015..b4c55b3fae5 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -291,8 +291,8 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator( this->TargetCompileAsWinRT = false; this->IsMissingFiles = false; this->DefaultArtifactDir = - this->LocalGenerator->GetCurrentBinaryDirectory() + "/" + - this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); + cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), "/", + this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget)); this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() == this->Makefile->GetCurrentBinaryDirectory()); this->ClassifyAllConfigSources(); @@ -377,10 +377,10 @@ void cmVisualStudio10TargetGenerator::Generate() if (this->ProjectType == VsProjectType::csproj && this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { - std::string message = "The C# target \"" + - this->GeneratorTarget->GetName() + - "\" is of type STATIC_LIBRARY. This is discouraged (and may be " - "disabled in future). Make it a SHARED library instead."; + std::string message = + cmStrCat("The C# target \"", this->GeneratorTarget->GetName(), + "\" is of type STATIC_LIBRARY. This is discouraged (and may be " + "disabled in future). Make it a SHARED library instead."); this->Makefile->IssueMessage(MessageType::DEPRECATION_WARNING, message); } @@ -624,8 +624,10 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( .empty()) { e1.Element( "CudaToolkitCustomDir", - this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString() + - this->GlobalGenerator->GetPlatformToolsetCudaNvccSubdirString()); + cmStrCat( + this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString(), + this->GlobalGenerator + ->GetPlatformToolsetCudaNvccSubdirString())); } } @@ -729,15 +731,15 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString(); std::string cudaPath = customDir.empty() ? "$(VCTargetsPath)\\BuildCustomizations\\" - : customDir + - this->GlobalGenerator - ->GetPlatformToolsetCudaVSIntegrationSubdirString() + - R"(extras\visual_studio_integration\MSBuildExtensions\)"; + : cmStrCat(customDir, + this->GlobalGenerator + ->GetPlatformToolsetCudaVSIntegrationSubdirString(), + R"(extras\visual_studio_integration\MSBuildExtensions\)"); Elem(e1, "Import") .Attribute("Project", - std::move(cudaPath) + "CUDA " + - this->GlobalGenerator->GetPlatformToolsetCuda() + - ".props"); + cmStrCat(std::move(cudaPath), "CUDA ", + this->GlobalGenerator->GetPlatformToolsetCuda(), + ".props")); } if (this->GlobalGenerator->IsMarmasmEnabled()) { Elem(e1, "Import") @@ -783,7 +785,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( ConvertToWindowsSlash(props); Elem(e1, "Import") .Attribute("Project", props) - .Attribute("Condition", "exists('" + props + "')") + .Attribute("Condition", cmStrCat("exists('", props, "')")) .Attribute("Label", "LocalAppDataPlatform"); } @@ -833,15 +835,15 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString(); std::string cudaPath = customDir.empty() ? "$(VCTargetsPath)\\BuildCustomizations\\" - : customDir + - this->GlobalGenerator - ->GetPlatformToolsetCudaVSIntegrationSubdirString() + - R"(extras\visual_studio_integration\MSBuildExtensions\)"; + : cmStrCat(customDir, + this->GlobalGenerator + ->GetPlatformToolsetCudaVSIntegrationSubdirString(), + R"(extras\visual_studio_integration\MSBuildExtensions\)"); Elem(e1, "Import") .Attribute("Project", - std::move(cudaPath) + "CUDA " + - this->GlobalGenerator->GetPlatformToolsetCuda() + - ".targets"); + cmStrCat(std::move(cudaPath), "CUDA ", + this->GlobalGenerator->GetPlatformToolsetCuda(), + ".targets")); } if (this->GlobalGenerator->IsMarmasmEnabled()) { Elem(e1, "Import") @@ -868,7 +870,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( if (this->ProjectType == VsProjectType::csproj) { for (std::string const& c : this->Configurations) { Elem e1(e0, "PropertyGroup"); - e1.Attribute("Condition", "'$(Configuration)' == '" + c + "'"); + e1.Attribute("Condition", cmStrCat("'$(Configuration)' == '", c, "'")); e1.SetHasElements(); this->WriteEvents(e1, c); } @@ -893,17 +895,19 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile( { if (this->ProjectType != VsProjectType::csproj || !this->GeneratorTarget->IsDotNetSdkTarget()) { - std::string message = "The target \"" + this->GeneratorTarget->GetName() + - "\" is not eligible for .Net SDK style project."; + std::string message = + cmStrCat("The target \"", this->GeneratorTarget->GetName(), + "\" is not eligible for .Net SDK style project."); this->Makefile->IssueMessage(MessageType::INTERNAL_ERROR, message); return; } if (this->HasCustomCommands()) { - std::string message = "The target \"" + this->GeneratorTarget->GetName() + + std::string message = cmStrCat( + "The target \"", this->GeneratorTarget->GetName(), "\" does not currently support add_custom_command as the Visual Studio " "generators have not yet learned how to generate custom commands in " - ".Net SDK-style projects."; + ".Net SDK-style projects."); this->Makefile->IssueMessage(MessageType::FATAL_ERROR, message); return; } @@ -986,11 +990,13 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile( for (const std::string& config : this->Configurations) { Elem e1(e0, "PropertyGroup"); - e1.Attribute("Condition", "'$(Configuration)' == '" + config + "'"); + e1.Attribute("Condition", + cmStrCat("'$(Configuration)' == '", config, "'")); e1.SetHasElements(); this->WriteEvents(e1, config); - std::string outDir = this->GeneratorTarget->GetDirectory(config) + "/"; + std::string outDir = + cmStrCat(this->GeneratorTarget->GetDirectory(config), "/"); ConvertToWindowsSlash(outDir); e1.Element("OutputPath", outDir); @@ -1011,7 +1017,7 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile( void cmVisualStudio10TargetGenerator::WriteCommonPropertyGroupGlobals(Elem& e1) { e1.Attribute("Label", "Globals"); - e1.Element("ProjectGuid", "{" + this->GUID + "}"); + e1.Element("ProjectGuid", cmStrCat("{", this->GUID, "}")); cmValue vsProjectTypes = this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES"); @@ -1107,7 +1113,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0) if (cmHasPrefix(i.first, vsDnRef)) { std::string path = i.second; if (!cmsys::SystemTools::FileIsFullPath(path)) { - path = this->Makefile->GetCurrentSourceDirectory() + "/" + path; + path = + cmStrCat(this->Makefile->GetCurrentSourceDirectory(), "/", path); } ConvertToWindowsSlash(path); this->DotNetHintReferences[""].emplace_back( @@ -1176,7 +1183,8 @@ void cmVisualStudio10TargetGenerator::WriteImports(Elem& e0) cmList argsSplit{ *imports }; for (auto& path : argsSplit) { if (!cmsys::SystemTools::FileIsFullPath(path)) { - path = this->Makefile->GetCurrentSourceDirectory() + "/" + path; + path = + cmStrCat(this->Makefile->GetCurrentSourceDirectory(), "/", path); } ConvertToWindowsSlash(path); Elem e1(e0, "Import"); @@ -1191,7 +1199,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags( static const std::string refpropPrefix = "VS_DOTNET_REFERENCEPROP_"; static const std::string refpropInfix = "_TAG_"; - const std::string refPropFullPrefix = refpropPrefix + ref + refpropInfix; + const std::string refPropFullPrefix = + cmStrCat(refpropPrefix, ref, refpropInfix); using CustomTags = std::map; CustomTags tags; cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties(); @@ -1243,7 +1252,8 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0) e2.Attribute("Include", obj); if (this->ProjectType != VsProjectType::csproj) { - std::string hFileName = obj.substr(0, obj.find_last_of('.')) + ".h"; + std::string hFileName = + cmStrCat(obj.substr(0, obj.find_last_of('.')), ".h"); e2.Element("DependentUpon", hFileName); for (std::string const& c : this->Configurations) { @@ -1269,10 +1279,10 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0) e2.Element("Link", link); } // Determine if this is a generated resource from a .Designer.cs file - std::string designerResource = - cmSystemTools::GetFilenamePath(oi->GetFullPath()) + "/" + - cmSystemTools::GetFilenameWithoutLastExtension(oi->GetFullPath()) + - ".Designer.cs"; + std::string designerResource = cmStrCat( + cmSystemTools::GetFilenamePath(oi->GetFullPath()), "/", + cmSystemTools::GetFilenameWithoutLastExtension(oi->GetFullPath()), + ".Designer.cs"); if (cmsys::SystemTools::FileExists(designerResource)) { std::string generator = "PublicResXFileCodeGenerator"; if (cmValue g = oi->GetProperty("VS_RESOURCE_GENERATOR")) { @@ -1400,7 +1410,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations(Elem& e0) e1.Attribute("Label", "ProjectConfigurations"); for (std::string const& c : this->Configurations) { Elem e2(e1, "ProjectConfiguration"); - e2.Attribute("Include", c + "|" + this->Platform); + e2.Attribute("Include", cmStrCat(c, "|", this->Platform)); e2.Element("Configuration", c); e2.Element("Platform", this->Platform); } @@ -1576,7 +1586,8 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged( e1.Element("DefineDebug", "true"); } - std::string outDir = this->GeneratorTarget->GetDirectory(config) + "/"; + std::string outDir = + cmStrCat(this->GeneratorTarget->GetDirectory(config), "/"); ConvertToWindowsSlash(outDir); e1.Element("OutputPath", outDir); @@ -1603,7 +1614,7 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged( if (cmStateEnums::EXECUTABLE == this->GeneratorTarget->GetType()) { e1.Element("StartAction", "Program"); - e1.Element("StartProgram", outDir + assemblyName + ".exe"); + e1.Element("StartProgram", cmStrCat(outDir, assemblyName, ".exe")); } OptionsHelper oh(o, e1); @@ -1618,10 +1629,10 @@ void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues( const char* toolset = gg->GetPlatformToolset(); e1.Element("NdkToolchainVersion", toolset ? toolset : "Default"); if (cmValue minApi = this->GeneratorTarget->GetProperty("ANDROID_API_MIN")) { - e1.Element("AndroidMinAPI", "android-" + *minApi); + e1.Element("AndroidMinAPI", cmStrCat("android-", *minApi)); } if (cmValue api = this->GeneratorTarget->GetProperty("ANDROID_API")) { - e1.Element("AndroidTargetAPI", "android-" + *api); + e1.Element("AndroidTargetAPI", cmStrCat("android-", *api)); } if (cmValue cpuArch = this->GeneratorTarget->GetProperty("ANDROID_ARCH")) { @@ -1724,9 +1735,9 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( // preventing dependent rebuilds. this->ForceOld(sourcePath); } else { - std::string error = - cmStrCat("Could not create file: [", sourcePath, "] "); - cmSystemTools::Error(error + cmSystemTools::GetLastSystemError()); + cmSystemTools::Error(cmStrCat("Could not create file: [", sourcePath, + "] ", + cmSystemTools::GetLastSystemError())); } } } @@ -1811,8 +1822,8 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( } script += lg->FinishConstructScript(this->ProjectType); if (this->ProjectType == VsProjectType::csproj) { - std::string name = "CustomCommand_" + c + "_" + - cmSystemTools::ComputeStringMD5(sourcePath); + std::string name = cmStrCat("CustomCommand_", c, "_", + cmSystemTools::ComputeStringMD5(sourcePath)); this->WriteCustomRuleCSharp(e0, c, name, script, additional_inputs.str(), outputs.str(), comment, ccg); } else { @@ -1883,7 +1894,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCSharp( e1.S << "\n Inputs=\"" << cmVS10EscapeAttr(inputs) << "\""; e1.S << "\n Outputs=\"" << cmVS10EscapeAttr(outputs) << "\""; if (!comment.empty()) { - Elem(e1, "Exec").Attribute("Command", "echo " + comment); + Elem(e1, "Exec").Attribute("Command", cmStrCat("echo ", comment)); } Elem(e1, "Exec").Attribute("Command", script); } @@ -2014,11 +2025,11 @@ void cmVisualStudio10TargetGenerator::WriteGroups() for (cmSourceGroup const* sg : groupsVec) { std::string const& name = sg->GetFullName(); if (!name.empty()) { - std::string guidName = "SG_Filter_" + name; + std::string guidName = cmStrCat("SG_Filter_", name); std::string guid = this->GlobalGenerator->GetGUID(guidName); Elem e2(e1, "Filter"); e2.Attribute("Include", name); - e2.Element("UniqueIdentifier", "{" + guid + "}"); + e2.Element("UniqueIdentifier", cmStrCat("{", guid, "}")); } } @@ -2027,7 +2038,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string guid = this->GlobalGenerator->GetGUID(guidName); Elem e2(e1, "Filter"); e2.Attribute("Include", "Resource Files"); - e2.Element("UniqueIdentifier", "{" + guid + "}"); + e2.Element("UniqueIdentifier", cmStrCat("{", guid, "}")); e2.Element("Extensions", "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;" "gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms"); @@ -2041,7 +2052,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string guid = this->GlobalGenerator->GetGUID(guidName); Elem e2(e1, "Filter"); e2.Attribute("Include", filter); - e2.Element("UniqueIdentifier", "{" + guid + "}"); + e2.Element("UniqueIdentifier", cmStrCat("{", guid, "}")); } } } @@ -2376,7 +2387,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource( if (ParsedToolTargetSettings.find(tool) == ParsedToolTargetSettings.end()) { cmValue toolTargetProperty = this->GeneratorTarget->Target->GetProperty( - "VS_SOURCE_SETTINGS_" + std::string(tool)); + cmStrCat("VS_SOURCE_SETTINGS_", tool)); ConfigToSettings toolTargetSettings; if (toolTargetProperty) { ParseSettingsProperty(*toolTargetProperty, toolTargetSettings); @@ -2408,19 +2419,22 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource( ge.Parse(deployContent); // Deployment location cannot be set on a configuration basis if (!deployLocation.empty()) { - e2.Element("Link", deployLocation + "\\%(FileName)%(Extension)"); + e2.Element("Link", + cmStrCat(deployLocation, "\\%(FileName)%(Extension)")); } for (auto& config : this->Configurations) { if (cge->Evaluate(this->LocalGenerator, config) == "1"_s) { - e2.WritePlatformConfigTag("DeploymentContent", - "'$(Configuration)|$(Platform)'=='" + - config + "|" + this->Platform + "'", - "true"); + e2.WritePlatformConfigTag( + "DeploymentContent", + cmStrCat("'$(Configuration)|$(Platform)'=='", config, "|", + this->Platform, "'"), + "true"); } else { - e2.WritePlatformConfigTag("ExcludedFromBuild", - "'$(Configuration)|$(Platform)'=='" + - config + "|" + this->Platform + "'", - "true"); + e2.WritePlatformConfigTag( + "ExcludedFromBuild", + cmStrCat("'$(Configuration)|$(Platform)'=='", config, "|", + this->Platform, "'"), + "true"); } } } @@ -2601,8 +2615,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) if (firstConditionSet) { conditions << " Or "; } - conditions << "('$(Configuration)|$(Platform)'=='" + - this->Configurations[ci] + "|" + this->Platform + "')"; + conditions << "('$(Configuration)|$(Platform)'=='" + << this->Configurations[ci] << "|" << this->Platform + << "')"; firstConditionSet = true; } e2.Attribute("Condition", conditions.str()); @@ -2682,9 +2697,9 @@ void cmVisualStudio10TargetGenerator::FinishWritingSource( writtenSettings.push_back(setting.first); } else { e2.WritePlatformConfigTag(setting.first, - "'$(Configuration)|$(Platform)'=='" + - configSettings.first + "|" + - this->Platform + "'", + cmStrCat("'$(Configuration)|$(Platform)'=='", + configSettings.first, "|", + this->Platform, "'"), setting.second); } } @@ -2752,9 +2767,9 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( // produced here. if (!objectName.empty()) { if (lang == "CUDA"_s) { - e2.Element("CompileOut", "$(IntDir)/" + objectName); + e2.Element("CompileOut", cmStrCat("$(IntDir)/", objectName)); } else { - e2.Element("ObjectFileName", "$(IntDir)/" + objectName); + e2.Element("ObjectFileName", cmStrCat("$(IntDir)/", objectName)); } } @@ -2981,9 +2996,9 @@ void cmVisualStudio10TargetGenerator::WriteExcludeFromBuild( { for (size_t ci : exclude_configs) { e2.WritePlatformConfigTag("ExcludedFromBuild", - "'$(Configuration)|$(Platform)'=='" + - this->Configurations[ci] + "|" + - this->Platform + "'", + cmStrCat("'$(Configuration)|$(Platform)'=='", + this->Configurations[ci], "|", + this->Platform, "'"), "true"); } } @@ -3017,7 +3032,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions( outDir = intermediateDir; targetNameFull = cmStrCat(this->GeneratorTarget->GetName(), ".lib"); } else { - outDir = this->GeneratorTarget->GetDirectory(config) + "/"; + outDir = cmStrCat(this->GeneratorTarget->GetDirectory(config), "/"); targetNameFull = this->GeneratorTarget->GetFullName(config); } ConvertToWindowsSlash(intermediateDir); @@ -3202,7 +3217,7 @@ std::string cmVisualStudio10TargetGenerator::GetTargetOutputName() const } const auto& nameComponents = this->GeneratorTarget->GetFullNameComponents(config); - return nameComponents.prefix + nameComponents.base; + return cmStrCat(nameComponents.prefix, nameComponents.base); } bool cmVisualStudio10TargetGenerator::ComputeClOptions() @@ -3240,8 +3255,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( const std::string& linkLanguage = this->GeneratorTarget->GetLinkerLanguage(configName); if (linkLanguage.empty()) { - cmSystemTools::Error( - "CMake can not determine linker language for target: " + this->Name); + cmSystemTools::Error(cmStrCat( + "CMake can not determine linker language for target: ", this->Name)); return false; } @@ -3333,11 +3348,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( defineFlags.find("/clr") != std::string::npos || defineFlags.find("-clr") != std::string::npos) { if (configName == this->Configurations[0]) { - std::string message = "For the target \"" + - this->GeneratorTarget->GetName() + - "\" the /clr compiler flag was added manually. " + - "Set usage of C++/CLI by setting COMMON_LANGUAGE_RUNTIME " - "target property."; + std::string message = + cmStrCat("For the target \"", this->GeneratorTarget->GetName(), + "\" the /clr compiler flag was added manually. ", + "Set usage of C++/CLI by setting COMMON_LANGUAGE_RUNTIME " + "target property."); this->Makefile->IssueMessage(MessageType::WARNING, message); } } @@ -3345,9 +3360,9 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( this->GeneratorTarget->GetProperty("COMMON_LANGUAGE_RUNTIME")) { std::string clrString = *clr; if (!clrString.empty()) { - clrString = ":" + clrString; + clrString = cmStrCat(":", clrString); } - flags += " /clr" + clrString; + flags += cmStrCat(" /clr", clrString); } } @@ -3594,9 +3609,10 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions( Options& rcOptions = *pOptions; std::string CONFIG = cmSystemTools::UpperCase(configName); - std::string rcConfigFlagsVar = "CMAKE_RC_FLAGS_" + CONFIG; - std::string flags = this->Makefile->GetSafeDefinition("CMAKE_RC_FLAGS") + - " " + this->Makefile->GetSafeDefinition(rcConfigFlagsVar); + std::string rcConfigFlagsVar = cmStrCat("CMAKE_RC_FLAGS_", CONFIG); + std::string flags = + cmStrCat(this->Makefile->GetSafeDefinition("CMAKE_RC_FLAGS"), " ", + this->Makefile->GetSafeDefinition(rcConfigFlagsVar)); rcOptions.Parse(flags); @@ -3737,7 +3753,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( // limitation by creating the directory and passing the flag ourselves. pdb = this->ConvertPath(pdb, true); ConvertToWindowsSlash(pdb); - std::string const clFd = R"(-Xcompiler="-Fd\")" + pdb + R"(\"")"; + std::string const clFd = cmStrCat(R"(-Xcompiler="-Fd\")", pdb, R"(\"")"); cudaOptions.AppendFlagString("AdditionalOptions", clFd); } } @@ -3762,7 +3778,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( cudaOptions.RemoveFlag("AdditionalCompilerOptions"); if (!aco.empty()) { aco = this->LocalGenerator->EscapeForShell(aco, false); - cudaOptions.AppendFlagString("AdditionalOptions", "-Xcompiler=" + aco); + cudaOptions.AppendFlagString("AdditionalOptions", + cmStrCat("-Xcompiler=", aco)); } } @@ -4143,7 +4160,8 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions( } else if (cmIsOff(*dpiAware)) { e2.Element("EnableDpiAwareness", "false"); } else { - cmSystemTools::Error("Bad parameter for VS_DPI_AWARE: " + *dpiAware); + cmSystemTools::Error( + cmStrCat("Bad parameter for VS_DPI_AWARE: ", *dpiAware)); } } } @@ -4231,7 +4249,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( } { - std::string manifest_xml = rootDir + "/AndroidManifest.xml"; + std::string manifest_xml = cmStrCat(rootDir, "/AndroidManifest.xml"); ConvertToWindowsSlash(manifest_xml); e2.Element("AndroidManifestLocation", manifest_xml); } @@ -4239,7 +4257,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( if (cmValue antAdditionalOptions = this->GeneratorTarget->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS")) { e2.Element("AdditionalOptions", - *antAdditionalOptions + " %(AdditionalOptions)"); + cmStrCat(*antAdditionalOptions, " %(AdditionalOptions)")); } } @@ -4270,8 +4288,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( const std::string& linkLanguage = linkClosure->LinkerLanguage; if (linkLanguage.empty()) { - cmSystemTools::Error( - "CMake can not determine linker language for target: " + this->Name); + cmSystemTools::Error(cmStrCat( + "CMake can not determine linker language for target: ", this->Name)); return false; } @@ -4288,7 +4306,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( std::string linkFlagVarBase = cmStrCat("CMAKE_", linkType, "_LINKER_FLAGS"); flags += " "; flags += this->Makefile->GetRequiredDefinition(linkFlagVarBase); - std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG; + std::string linkFlagVar = cmStrCat(linkFlagVarBase, "_", CONFIG); flags += " "; flags += this->Makefile->GetRequiredDefinition(linkFlagVar); cmValue targetLinkFlags = this->GeneratorTarget->GetProperty("LINK_FLAGS"); @@ -4311,8 +4329,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( this->GeneratorTarget->GetLinkInformation(config); if (!pcli) { cmSystemTools::Error( - "CMake can not compute cmComputeLinkInformation for target: " + - this->Name); + cmStrCat("CMake can not compute cmComputeLinkInformation for target: ", + this->Name)); return false; } cmComputeLinkInformation& cli = *pcli; @@ -4337,7 +4355,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( // first just full path linkDirs.push_back(d); // next path with configuration type Debug, Release, etc - linkDirs.push_back(d + "/$(Configuration)"); + linkDirs.push_back(cmStrCat(d, "/$(Configuration)")); } linkDirs.push_back("%(AdditionalLibraryDirectories)"); linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs); @@ -4476,8 +4494,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions( this->GeneratorTarget->GetLinkInformation(config); if (!pcli) { cmSystemTools::Error( - "CMake can not compute cmComputeLinkInformation for target: " + - this->Name); + cmStrCat("CMake can not compute cmComputeLinkInformation for target: ", + this->Name)); return false; } @@ -4793,7 +4811,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) ConvertToWindowsSlash(path); Elem e2(e1, "ProjectReference"); e2.Attribute("Include", path); - e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}"); + e2.Element("Project", + cmStrCat("{", this->GlobalGenerator->GetGUID(name), "}")); e2.Element("Name", name); this->WriteDotNetReferenceCustomTags(e2, name); if (dt->IsCSharpOnly() || cmHasLiteralSuffix(path, "csproj")) { @@ -4832,17 +4851,18 @@ void cmVisualStudio10TargetGenerator::WritePlatformExtensions(Elem& e1) void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension( Elem& e1, std::string const& extension, std::string const& version) { - const std::string s = "$([Microsoft.Build.Utilities.ToolLocationHelper]" - "::GetPlatformExtensionSDKLocation(`" + - extension + ", Version=" + version + - "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, " - "$(ExtensionSDKDirectoryRoot), null))" - "\\DesignTime\\CommonConfiguration\\Neutral\\" + - extension + ".props"; + const std::string s = + cmStrCat("$([Microsoft.Build.Utilities.ToolLocationHelper]" + "::GetPlatformExtensionSDKLocation(`", + extension, ", Version=", version, + "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, " + "$(ExtensionSDKDirectoryRoot), null))" + "\\DesignTime\\CommonConfiguration\\Neutral\\", + extension, ".props"); Elem e2(e1, "Import"); e2.Attribute("Project", s); - e2.Attribute("Condition", "exists('" + s + "')"); + e2.Attribute("Condition", cmStrCat("exists('", s, "')")); } void cmVisualStudio10TargetGenerator::WriteSDKReferences(Elem& e0) @@ -4893,7 +4913,7 @@ void cmVisualStudio10TargetGenerator::WriteSingleSDKReference( Elem& e1, std::string const& extension, std::string const& version) { Elem(e1, "SDKReference") - .Attribute("Include", extension + ", Version=" + version); + .Attribute("Include", cmStrCat(extension, ", Version=", version)); } void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile( @@ -4920,9 +4940,9 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile( this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); Elem e1(e0, "PropertyGroup"); - e1.Element("AppxPackageArtifactsDir", artifactDir + "\\"); + e1.Element("AppxPackageArtifactsDir", cmStrCat(artifactDir, "\\")); std::string resourcePriFile = - this->DefaultArtifactDir + "/resources.pri"; + cmStrCat(this->DefaultArtifactDir, "/resources.pri"); ConvertToWindowsSlash(resourcePriFile); e1.Element("ProjectPriFullPath", resourcePriFile); @@ -4930,10 +4950,12 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile( // aren't targeting WP8.0, add a default certificate if (pfxFile.empty()) { std::string templateFolder = - cmSystemTools::GetCMakeRoot() + "/Templates/Windows"; - pfxFile = this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx"; - cmSystemTools::CopyAFile(templateFolder + "/Windows_TemporaryKey.pfx", - pfxFile, false); + cmStrCat(cmSystemTools::GetCMakeRoot(), "/Templates/Windows"); + pfxFile = + cmStrCat(this->DefaultArtifactDir, "/Windows_TemporaryKey.pfx"); + cmSystemTools::CopyAFile( + cmStrCat(templateFolder, "/Windows_TemporaryKey.pfx"), pfxFile, + false); ConvertToWindowsSlash(pfxFile); this->AddedFiles.push_back(pfxFile); this->AddedDefaultCertificate = true; @@ -4974,7 +4996,8 @@ void cmVisualStudio10TargetGenerator::ClassifyAllConfigSource( // where the user supplied the file name and Visual Studio // appended the suffix. std::string resx = acs.Source->ResolveFullPath(); - std::string hFileName = resx.substr(0, resx.find_last_of('.')) + ".h"; + std::string hFileName = + cmStrCat(resx.substr(0, resx.find_last_of('.')), ".h"); this->ExpectedResxHeaders.insert(hFileName); } break; case cmGeneratorTarget::SourceKindXaml: { @@ -4984,8 +5007,8 @@ void cmVisualStudio10TargetGenerator::ClassifyAllConfigSource( // where the user supplied the file name and Visual Studio // appended the suffix. std::string xaml = acs.Source->ResolveFullPath(); - std::string hFileName = xaml + ".h"; - std::string cppFileName = xaml + ".cpp"; + std::string hFileName = cmStrCat(xaml, ".h"); + std::string cppFileName = cmStrCat(xaml, ".cpp"); this->ExpectedXamlHeaders.insert(hFileName); this->ExpectedXamlSources.insert(cppFileName); } break; @@ -5053,7 +5076,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) cmStateEnums::EXECUTABLE) { e1.Element("XapOutputs", "true"); e1.Element("XapFilename", - this->Name + "_$(Configuration)_$(Platform).xap"); + cmStrCat(this->Name, "_$(Configuration)_$(Platform).xap")); } } } else if (isAndroid) { @@ -5158,13 +5181,13 @@ void cmVisualStudio10TargetGenerator::WriteMissingFiles(Elem& e1) void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1) { std::string templateFolder = - cmSystemTools::GetCMakeRoot() + "/Templates/Windows"; + cmStrCat(cmSystemTools::GetCMakeRoot(), "/Templates/Windows"); // For WP80, the manifest needs to be in the same folder as the project // this can cause an overwrite problem if projects aren't organized in // folders - std::string manifestFile = - this->LocalGenerator->GetCurrentBinaryDirectory() + "/WMAppManifest.xml"; + std::string manifestFile = cmStrCat( + this->LocalGenerator->GetCurrentBinaryDirectory(), "/WMAppManifest.xml"); std::string artifactDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); @@ -5221,22 +5244,22 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1) } this->AddedFiles.push_back(sourceFile); - std::string smallLogo = this->DefaultArtifactDir + "/SmallLogo.png"; - cmSystemTools::CopyAFile(templateFolder + "/SmallLogo.png", smallLogo, - false); + std::string smallLogo = cmStrCat(this->DefaultArtifactDir, "/SmallLogo.png"); + cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/SmallLogo.png"), + smallLogo, false); ConvertToWindowsSlash(smallLogo); Elem(e1, "Image").Attribute("Include", smallLogo); this->AddedFiles.push_back(smallLogo); - std::string logo = this->DefaultArtifactDir + "/Logo.png"; - cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false); + std::string logo = cmStrCat(this->DefaultArtifactDir, "/Logo.png"); + cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/Logo.png"), logo, false); ConvertToWindowsSlash(logo); Elem(e1, "Image").Attribute("Include", logo); this->AddedFiles.push_back(logo); std::string applicationIcon = - this->DefaultArtifactDir + "/ApplicationIcon.png"; - cmSystemTools::CopyAFile(templateFolder + "/ApplicationIcon.png", + cmStrCat(this->DefaultArtifactDir, "/ApplicationIcon.png"); + cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/ApplicationIcon.png"), applicationIcon, false); ConvertToWindowsSlash(applicationIcon); Elem(e1, "Image").Attribute("Include", applicationIcon); @@ -5246,7 +5269,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1) void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81(Elem& e1) { std::string manifestFile = - this->DefaultArtifactDir + "/package.appxManifest"; + cmStrCat(this->DefaultArtifactDir, "/package.appxManifest"); std::string artifactDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); @@ -5308,7 +5331,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81(Elem& e1) void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80(Elem& e1) { std::string manifestFile = - this->DefaultArtifactDir + "/package.appxManifest"; + cmStrCat(this->DefaultArtifactDir, "/package.appxManifest"); std::string artifactDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); @@ -5362,7 +5385,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80(Elem& e1) void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81(Elem& e1) { std::string manifestFile = - this->DefaultArtifactDir + "/package.appxManifest"; + cmStrCat(this->DefaultArtifactDir, "/package.appxManifest"); std::string artifactDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); @@ -5421,7 +5444,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81(Elem& e1) void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0(Elem& e1) { std::string manifestFile = - this->DefaultArtifactDir + "/package.appxManifest"; + cmStrCat(this->DefaultArtifactDir, "/package.appxManifest"); std::string artifactDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); @@ -5482,7 +5505,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( Elem& e1, const std::string& manifestFile) { std::string templateFolder = - cmSystemTools::GetCMakeRoot() + "/Templates/Windows"; + cmStrCat(cmSystemTools::GetCMakeRoot(), "/Templates/Windows"); std::string sourceFile = this->ConvertPath(manifestFile, false); ConvertToWindowsSlash(sourceFile); @@ -5493,36 +5516,38 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( } this->AddedFiles.push_back(sourceFile); - std::string smallLogo = this->DefaultArtifactDir + "/SmallLogo.png"; - cmSystemTools::CopyAFile(templateFolder + "/SmallLogo.png", smallLogo, - false); + std::string smallLogo = cmStrCat(this->DefaultArtifactDir, "/SmallLogo.png"); + cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/SmallLogo.png"), + smallLogo, false); ConvertToWindowsSlash(smallLogo); Elem(e1, "Image").Attribute("Include", smallLogo); this->AddedFiles.push_back(smallLogo); - std::string smallLogo44 = this->DefaultArtifactDir + "/SmallLogo44x44.png"; - cmSystemTools::CopyAFile(templateFolder + "/SmallLogo44x44.png", smallLogo44, - false); + std::string smallLogo44 = + cmStrCat(this->DefaultArtifactDir, "/SmallLogo44x44.png"); + cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/SmallLogo44x44.png"), + smallLogo44, false); ConvertToWindowsSlash(smallLogo44); Elem(e1, "Image").Attribute("Include", smallLogo44); this->AddedFiles.push_back(smallLogo44); - std::string logo = this->DefaultArtifactDir + "/Logo.png"; - cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false); + std::string logo = cmStrCat(this->DefaultArtifactDir, "/Logo.png"); + cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/Logo.png"), logo, false); ConvertToWindowsSlash(logo); Elem(e1, "Image").Attribute("Include", logo); this->AddedFiles.push_back(logo); - std::string storeLogo = this->DefaultArtifactDir + "/StoreLogo.png"; - cmSystemTools::CopyAFile(templateFolder + "/StoreLogo.png", storeLogo, - false); + std::string storeLogo = cmStrCat(this->DefaultArtifactDir, "/StoreLogo.png"); + cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/StoreLogo.png"), + storeLogo, false); ConvertToWindowsSlash(storeLogo); Elem(e1, "Image").Attribute("Include", storeLogo); this->AddedFiles.push_back(storeLogo); - std::string splashScreen = this->DefaultArtifactDir + "/SplashScreen.png"; - cmSystemTools::CopyAFile(templateFolder + "/SplashScreen.png", splashScreen, - false); + std::string splashScreen = + cmStrCat(this->DefaultArtifactDir, "/SplashScreen.png"); + cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/SplashScreen.png"), + splashScreen, false); ConvertToWindowsSlash(splashScreen); Elem(e1, "Image").Attribute("Include", splashScreen); this->AddedFiles.push_back(splashScreen); @@ -5530,7 +5555,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( if (this->AddedDefaultCertificate) { // This file has already been added to the build so don't copy it std::string keyFile = - this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx"; + cmStrCat(this->DefaultArtifactDir, "/Windows_TemporaryKey.pfx"); ConvertToWindowsSlash(keyFile); Elem(e1, "None").Attribute("Include", keyFile); } @@ -5605,8 +5630,9 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink( cmSourceGroup* sourceGroup = this->Makefile->FindSourceGroup(fullFileName, sourceGroups); if (sourceGroup && !sourceGroup->GetFullName().empty()) { - sourceGroupedFile = sourceGroup->GetFullName() + "/" + - cmsys::SystemTools::GetFilenameName(fullFileName); + sourceGroupedFile = + cmStrCat(sourceGroup->GetFullName(), "/", + cmsys::SystemTools::GetFilenameName(fullFileName)); cmsys::SystemTools::ConvertToUnixSlashes(sourceGroupedFile); } @@ -5654,8 +5680,9 @@ void cmVisualStudio10TargetGenerator::UpdateCache() // Store a cache entry that later determines, if a package restore is // required. this->GeneratorTarget->Makefile->AddCacheDefinition( - this->GeneratorTarget->GetName() + "_REQUIRES_VS_PACKAGE_RESTORE", "ON", - "Value Computed by CMake", cmStateEnums::STATIC); + cmStrCat(this->GeneratorTarget->GetName(), + "_REQUIRES_VS_PACKAGE_RESTORE"), + "ON", "Value Computed by CMake", cmStateEnums::STATIC); } else { // If there are any dependencies that require package restore, inherit the // cache variable. @@ -5668,7 +5695,8 @@ void cmVisualStudio10TargetGenerator::UpdateCache() for (cmGeneratorTarget const* dt : depends) { if (dt->HasPackageReferences()) { this->GeneratorTarget->Makefile->AddCacheDefinition( - this->GeneratorTarget->GetName() + "_REQUIRES_VS_PACKAGE_RESTORE", + cmStrCat(this->GeneratorTarget->GetName(), + "_REQUIRES_VS_PACKAGE_RESTORE"), "ON", "Value Computed by CMake", cmStateEnums::STATIC); } } diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 9bbe34bdcd3..80e37bd3d80 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -280,7 +280,7 @@ void cmVisualStudioGeneratorOptions::PrependInheritedString( return; } std::string& value = i->second[0]; - value = "%(" + key + ") " + value; + value = cmStrCat("%(", key, ") ", value); } void cmVisualStudioGeneratorOptions::Reparse(std::string const& key) diff --git a/Source/cmVisualStudioSlnData.cxx b/Source/cmVisualStudioSlnData.cxx index 4b6754eaa2e..d824462443f 100644 --- a/Source/cmVisualStudioSlnData.cxx +++ b/Source/cmVisualStudioSlnData.cxx @@ -5,6 +5,7 @@ #include #include +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" void cmSlnProjectEntry::AddProjectConfiguration( @@ -72,7 +73,8 @@ std::string cmSlnData::GetConfigurationTarget( const std::string& projectName, const std::string& solutionConfiguration, const std::string& platformName) { - std::string solutionTarget = solutionConfiguration + "|" + platformName; + std::string solutionTarget = + cmStrCat(solutionConfiguration, "|", platformName); cm::optional project = GetProjectByName(projectName); if (!project) { return platformName; diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx index 76791a62e96..9b615663d65 100644 --- a/Source/cmVisualStudioSlnParser.cxx +++ b/Source/cmVisualStudioSlnParser.cxx @@ -83,7 +83,7 @@ bool cmVisualStudioSlnParser::ParsedLine::IsKeyValuePair() const std::string cmVisualStudioSlnParser::ParsedLine::GetArgVerbatim() const { if (this->Arg.second) { - return Quote + this->Arg.first + Quote; + return cmStrCat(Quote, this->Arg.first, Quote); } return this->Arg.first; } @@ -103,7 +103,7 @@ std::string cmVisualStudioSlnParser::ParsedLine::GetValueVerbatim( if (idxValue < this->Values.size()) { const StringData& data = this->Values[idxValue]; if (data.second) { - return Quote + data.first + Quote; + return cmStrCat(Quote, data.first, Quote); } return data.first; } @@ -546,7 +546,7 @@ bool cmVisualStudioSlnParser::ParseBOM(std::istream& input, std::string& line, return false; } if (!this->LastResult.HadBOM) { - line = bom + line; // it wasn't a BOM, prepend it to first line + line = cmStrCat(bom, line); // it wasn't a BOM, prepend it to first line } return true; } diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx index 19c8d35eccd..aa7aae766e8 100644 --- a/Source/cmVisualStudioWCEPlatformParser.cxx +++ b/Source/cmVisualStudioWCEPlatformParser.cxx @@ -7,14 +7,15 @@ #include #include "cmGlobalVisualStudioGenerator.h" +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version) { const std::string registryBase = cmGlobalVisualStudioGenerator::GetRegistryBase(version); - const std::string vckey = registryBase + "\\Setup\\VC;ProductDir"; - const std::string vskey = registryBase + "\\Setup\\VS;ProductDir"; + const std::string vckey = cmStrCat(registryBase, "\\Setup\\VC;ProductDir"); + const std::string vskey = cmStrCat(registryBase, "\\Setup\\VS;ProductDir"); if (!cmSystemTools::ReadRegistryValue(vckey, this->VcInstallDir, cmSystemTools::KeyWOW64_32) || @@ -28,7 +29,7 @@ int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version) this->VsInstallDir.append("/"); const std::string configFilename = - this->VcInstallDir + "vcpackages/WCE.VCPlatform.config"; + cmStrCat(this->VcInstallDir, "vcpackages/WCE.VCPlatform.config"); return this->ParseFile(configFilename.c_str()); } @@ -39,7 +40,7 @@ std::string cmVisualStudioWCEPlatformParser::GetOSVersion() const return OSMajorVersion; } - return OSMajorVersion + "." + OSMinorVersion; + return cmStrCat(OSMajorVersion, ".", OSMinorVersion); } const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const From 809248a0c9f3c2c203399d4cefe10a23cfc53add Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 14:35:46 -0400 Subject: [PATCH 167/627] strings: use character literals where possible --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 30 +++---- Source/CPack/WiX/cmWIXAccessControlList.cxx | 2 +- Source/CPack/WiX/cmWIXPatch.cxx | 6 +- Source/CPack/WiX/cmWIXPatchParser.cxx | 2 +- .../CPack/WiX/cmWIXRichTextFormatWriter.cxx | 6 +- Source/CPack/WiX/cmWIXSourceWriter.cxx | 28 +++--- Source/CPack/cmCPackCygwinBinaryGenerator.cxx | 6 +- Source/CPack/cmCPackCygwinSourceGenerator.cxx | 4 +- Source/cmGlobalVisualStudio10Generator.cxx | 10 +-- Source/cmGlobalVisualStudio14Generator.cxx | 6 +- Source/cmGlobalVisualStudio71Generator.cxx | 6 +- Source/cmGlobalVisualStudio7Generator.cxx | 8 +- Source/cmGlobalVisualStudio8Generator.cxx | 26 +++--- Source/cmGlobalVisualStudioGenerator.cxx | 6 +- ...cmGlobalVisualStudioVersionedGenerator.cxx | 4 +- Source/cmLocalVisualStudio7Generator.cxx | 16 ++-- Source/cmVisualStudio10TargetGenerator.cxx | 89 ++++++++++--------- Source/cmVisualStudioGeneratorOptions.cxx | 6 +- Source/cmVisualStudioSlnData.cxx | 2 +- Source/cmVisualStudioWCEPlatformParser.cxx | 2 +- 20 files changed, 133 insertions(+), 132 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index e9138eeed89..95301200449 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -113,12 +113,12 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile, } if (!cmHasSuffix(sourceFile, this->CPackTopLevel)) { - command << " " << QuotePath(cmStrCat("-I", this->CPackTopLevel)); + command << ' ' << QuotePath(cmStrCat("-I", this->CPackTopLevel)); } AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command); - command << " " << QuotePath(sourceFile); + command << ' ' << QuotePath(sourceFile); return RunWiXCommand(command.str()); } @@ -147,7 +147,7 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles) AddCustomFlags("CPACK_WIX_LIGHT_EXTRA_FLAGS", command); - command << " " << objectFiles; + command << ' ' << objectFiles; return RunWiXCommand(command.str()); } @@ -296,14 +296,14 @@ bool cmCPackWIXGenerator::PackageFilesImpl() usedBaseNames.insert(uniqueBaseName); std::string objectFilename = - cmStrCat(this->CPackTopLevel, "/", uniqueBaseName, ".wixobj"); + cmStrCat(this->CPackTopLevel, '/', uniqueBaseName, ".wixobj"); if (!RunCandleCommand(CMakeToWixPath(sourceFilename), CMakeToWixPath(objectFilename))) { return false; } - objectFiles << " " << QuotePath(CMakeToWixPath(objectFilename)); + objectFiles << ' ' << QuotePath(CMakeToWixPath(objectFilename)); } AppendUserSuppliedExtraObjects(objectFiles); @@ -795,13 +795,13 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( std::string idSuffix; if (!cpackComponentName.empty()) { - idSuffix += "_"; + idSuffix += '_'; idSuffix += cpackComponentName; } std::string componentId = "CM_SHORTCUT"; if (idPrefix.size()) { - componentId += cmStrCat("_", idPrefix); + componentId += cmStrCat('_', idPrefix); } componentId += idSuffix; @@ -817,7 +817,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( this->Patch->ApplyFragment(componentId, fileDefinitions); std::string registryKey = - cmStrCat("Software\\", cpackVendor, "\\", cpackPackageName); + cmStrCat("Software\\", cpackVendor, '\\', cpackPackageName); shortcuts.EmitShortcuts(type, registryKey, cpackComponentName, fileDefinitions); @@ -934,7 +934,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions( continue; } - std::string fullPath = cmStrCat(topdir, "/", fileName); + std::string fullPath = cmStrCat(topdir, '/', fileName); std::string relativePath = cmSystemTools::RelativePath(toplevel.c_str(), fullPath.c_str()); @@ -1041,7 +1041,7 @@ std::string cmCPackWIXGenerator::GenerateGUID() std::string cmCPackWIXGenerator::QuotePath(std::string const& path) { - return cmStrCat("\"", path, '"'); + return cmStrCat('"', path, '"'); } std::string cmCPackWIXGenerator::GetRightmostExtension( @@ -1095,18 +1095,18 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path) } std::ostringstream result; - result << idPrefix << "_" << identifier; + result << idPrefix << '_' << identifier; size_t ambiguityCount = ++IdAmbiguityCounter[identifier]; if (ambiguityCount > 999) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while trying to generate a unique Id for '" - << path << "'" << std::endl); + << path << '\'' << std::endl); return std::string(); } else if (ambiguityCount > 1) { - result << "_" << ambiguityCount; + result << '_' << ambiguityCount; } std::string resultString = result.str(); @@ -1190,7 +1190,7 @@ void cmCPackWIXGenerator::CollectXmlNamespaces(std::string const& variableName, cmCPackLogger(cmCPackLog::LOG_ERROR, "Invalid element in CPACK_WIX_CUSTOM_XMLNS ignored: " "\"" - << str << "\"" << std::endl); + << str << '"' << std::endl); } } std::ostringstream oss; @@ -1211,7 +1211,7 @@ void cmCPackWIXGenerator::AddCustomFlags(std::string const& variableName, cmList list{ variableContent }; for (std::string const& i : list) { - stream << " " << QuotePath(i); + stream << ' ' << QuotePath(i); } } diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx index 5dcd086adc8..6aba2289b22 100644 --- a/Source/CPack/WiX/cmWIXAccessControlList.cxx +++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx @@ -119,7 +119,7 @@ void cmWIXAccessControlList::EmitBooleanAttribute(std::string const& entry, { if (!this->IsBooleanAttribute(name)) { this->ReportError(entry, - cmStrCat("Unknown boolean attribute '", name, "'")); + cmStrCat("Unknown boolean attribute '", name, '\'')); } this->SourceWriter.AddAttribute(name, "yes"); diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index 122ffaff5a1..c3ada17d726 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -14,7 +14,7 @@ bool cmWIXPatch::LoadFragments(std::string const& patchFilePath) cmWIXPatchParser parser(Fragments, Logger); if (!parser.ParseFile(patchFilePath.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Failed parsing XML patch file: '" << patchFilePath << "'" + "Failed parsing XML patch file: '" << patchFilePath << '\'' << std::endl); return false; } @@ -75,9 +75,9 @@ bool cmWIXPatch::CheckForUnappliedFragments() fragmentList += ", "; } - fragmentList += "'"; + fragmentList += '\''; fragmentList += fragment.first; - fragmentList += "'"; + fragmentList += '\''; } if (!fragmentList.empty()) { diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 57539d3c4a8..6a44d63924e 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -143,7 +143,7 @@ void cmWIXPatchParser::ReportError(int line, int column, const char* msg) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while processing XML patch file at " - << line << ":" << column << ": " << msg << std::endl); + << line << ':' << column << ": " << msg << std::endl); Valid = false; } diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx index d7e534a705c..f3fe3deafe6 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx @@ -135,7 +135,7 @@ void cmWIXRichTextFormatWriter::WriteDocumentPrefix() void cmWIXRichTextFormatWriter::ControlWord(std::string const& keyword) { - File << "\\" << keyword; + File << '\\' << keyword; } void cmWIXRichTextFormatWriter::NewControlWord(std::string const& keyword) @@ -175,12 +175,12 @@ void cmWIXRichTextFormatWriter::EmitUnicodeSurrogate(int c) } else { File << (c - 65536); } - File << "?"; + File << '?'; } void cmWIXRichTextFormatWriter::EmitInvalidCodepoint(int c) { ControlWord("cf1 "); - File << "[INVALID-BYTE-" << int(c) << "]"; + File << "[INVALID-BYTE-" << int(c) << ']'; ControlWord("cf0 "); } diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index 8e9bfdf3f5b..e13a3e00064 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -34,7 +34,7 @@ cmWIXSourceWriter::~cmWIXSourceWriter() cmCPackLogger(cmCPackLog::LOG_ERROR, Elements.size() - 1 << " WiX elements were still open when closing '" - << SourceFilename << "'" << std::endl); + << SourceFilename << '\'' << std::endl); return; } @@ -44,12 +44,12 @@ cmWIXSourceWriter::~cmWIXSourceWriter() void cmWIXSourceWriter::BeginElement(std::string const& name) { if (State == BEGIN) { - File << ">"; + File << '>'; } - File << "\n"; + File << '\n'; Indent(Elements.size()); - File << "<" << name; + File << '<' << name; Elements.push_back(name); State = BEGIN; @@ -60,7 +60,7 @@ void cmWIXSourceWriter::EndElement(std::string const& name) if (Elements.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "can not end WiX element with no open elements in '" - << SourceFilename << "'" << std::endl); + << SourceFilename << '\'' << std::endl); return; } @@ -68,14 +68,14 @@ void cmWIXSourceWriter::EndElement(std::string const& name) cmCPackLogger(cmCPackLog::LOG_ERROR, "WiX element <" << Elements.back() << "> can not be closed by in '" << SourceFilename << "'" << std::endl); + << "> in '" << SourceFilename << '\'' << std::endl); return; } if (State == DEFAULT) { - File << "\n"; + File << '\n'; Indent(Elements.size() - 1); - File << ""; + File << "'; } else { File << "/>"; } @@ -87,13 +87,13 @@ void cmWIXSourceWriter::EndElement(std::string const& name) void cmWIXSourceWriter::AddTextNode(std::string const& text) { if (State == BEGIN) { - File << ">"; + File << '>'; } if (Elements.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "can not add text without open WiX element in '" - << SourceFilename << "'" << std::endl); + << SourceFilename << '\'' << std::endl); return; } @@ -105,12 +105,12 @@ void cmWIXSourceWriter::AddProcessingInstruction(std::string const& target, std::string const& content) { if (State == BEGIN) { - File << ">"; + File << '>'; } - File << "\n"; + File << '\n'; Indent(Elements.size()); - File << ""; + File << ""; State = DEFAULT; } @@ -118,7 +118,7 @@ void cmWIXSourceWriter::AddProcessingInstruction(std::string const& target, void cmWIXSourceWriter::AddAttribute(std::string const& key, std::string const& value) { - File << " " << key << "=\"" << EscapeAttributeValue(value) << '"'; + File << ' ' << key << "=\"" << EscapeAttributeValue(value) << '"'; } void cmWIXSourceWriter::AddAttributeUnlessEmpty(std::string const& key, diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx index fabf4c566cf..fcb79a2e8ee 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx @@ -44,9 +44,9 @@ int cmCPackCygwinBinaryGenerator::PackageFiles() cmGeneratedFileStream ofs(manifestFile); for (std::string const& file : files) { // remove the temp dir and replace with /usr - ofs << file.substr(tempdir.size()) << "\n"; + ofs << file.substr(tempdir.size()) << '\n'; } - ofs << manifest << "\n"; + ofs << manifest << '\n'; } // add the manifest file to the list of all files files.push_back(manifestFile); @@ -60,7 +60,7 @@ const char* cmCPackCygwinBinaryGenerator::GetOutputExtension() this->OutputExtension = "-"; cmValue patchNumber = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER"); if (!patchNumber) { - this->OutputExtension += "1"; + this->OutputExtension += '1'; cmCPackLogger(cmCPackLog::LOG_WARNING, "CPACK_CYGWIN_PATCH_NUMBER not specified using 1" << std::endl); diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx index a5863ff8364..f025a6c01f2 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx +++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx @@ -98,7 +98,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles() cmCPackLogger(cmCPackLog::LOG_WARNING, "CPACK_CYGWIN_PATCH_NUMBER" << " not specified, defaulting to 1\n"); - outerTarFile += "1"; + outerTarFile += '1'; } else { outerTarFile += patch; } @@ -150,7 +150,7 @@ const char* cmCPackCygwinSourceGenerator::GetOutputExtension() cmCPackLogger(cmCPackLog::LOG_WARNING, "CPACK_CYGWIN_PATCH_NUMBER" << " not specified, defaulting to 1\n"); - this->OutputExtension += "1"; + this->OutputExtension += '1'; } else { this->OutputExtension += patch; } diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 9a8e64d0c3e..41cd807b4bb 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -198,7 +198,7 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( std::string versionToolset = this->GeneratorToolsetVersion; cmsys::RegularExpression regex("[0-9][0-9]\\.[0-9][0-9]"); if (regex.find(versionToolset)) { - versionToolset = cmStrCat("v", versionToolset.erase(2, 1)); + versionToolset = cmStrCat('v', versionToolset.erase(2, 1)); } else { // Version not recognized. Clear it. versionToolset.clear(); @@ -441,7 +441,7 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) mf->IssueMessage( MessageType::FATAL_ERROR, cmStrCat("CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR ", - "specifies a platform too: '", this->GetName(), "'")); + "specifies a platform too: '", this->GetName(), '\'')); return false; } if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") == @@ -471,7 +471,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) mf->IssueMessage( MessageType::FATAL_ERROR, cmStrCat("CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR ", - "specifies a platform too: '", this->GetName(), "'")); + "specifies a platform too: '", this->GetName(), '\'')); return false; } @@ -848,7 +848,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) wd = cmStrCat(this->GetCMakeInstance()->GetHomeOutputDirectory(), "/CMakeFiles"); } - wd += "/"; + wd += '/'; wd += cmVersion::GetCMakeVersion(); // We record the result persistently in a file. @@ -875,7 +875,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) // Generate a project file for MSBuild to tell us the VCTargetsPath value. std::string const vcxproj = "VCTargetsPath.vcxproj"; { - std::string const vcxprojAbs = cmStrCat(wd, "/", vcxproj); + std::string const vcxprojAbs = cmStrCat(wd, '/', vcxproj); cmsys::ofstream fout(vcxprojAbs.c_str()); cmXMLWriter xw(fout); diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index d6a11dfc965..1350945766a 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -161,11 +161,11 @@ bool cmGlobalVisualStudio14Generator::VerifyNoGeneratorPlatformVersion( "given platform specification containing a\n" " version=" << *this->GeneratorPlatformVersion << "\n" "field. The version field is not supported when targeting\n" - " " << this->SystemName << " " << this->SystemVersion << "\n" + " " << this->SystemName << ' ' << this->SystemVersion << '\n' ; /* clang-format on */ if (reason) { - e << *reason << "."; + e << *reason << '.'; } mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); return false; @@ -256,7 +256,7 @@ void cmGlobalVisualStudio14Generator::SetWindowsTargetPlatformVersion( mf->DisplayStatus(cmStrCat("Selecting Windows SDK version ", this->WindowsTargetPlatformVersion, " to target Windows ", this->SystemVersion, - "."), + '.'), -1); } mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION", diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 98176b0533e..8375b72cab8 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -86,7 +86,7 @@ void cmGlobalVisualStudio71Generator::WriteSolutionConfigurations( { fout << "\tGlobalSection(SolutionConfiguration) = preSolution\n"; for (std::string const& i : configs) { - fout << "\t\t" << i << " = " << i << "\n"; + fout << "\t\t" << i << " = " << i << '\n'; } fout << "\tEndGlobalSection\n"; } @@ -217,11 +217,11 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations( } } } - fout << "\t\t{" << guid << "}." << i << ".ActiveCfg = " << dstConfig << "|" + fout << "\t\t{" << guid << "}." << i << ".ActiveCfg = " << dstConfig << '|' << platformName << std::endl; auto ci = configsPartOfDefaultBuild.find(i); if (!(ci == configsPartOfDefaultBuild.end())) { - fout << "\t\t{" << guid << "}." << i << ".Build.0 = " << dstConfig << "|" + fout << "\t\t{" << guid << "}." << i << ".Build.0 = " << dstConfig << '|' << platformName << std::endl; } } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 80a7be810f5..b2657a764e2 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -486,9 +486,9 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( cumulativePath = cmStrCat("CMAKE_FOLDER_GUID_", iter); } else { VisualStudioFolders[cumulativePath].insert( - cmStrCat(cumulativePath, "/", iter)); + cmStrCat(cumulativePath, '/', iter)); - cumulativePath = cmStrCat(cumulativePath, "/", iter); + cumulativePath = cmStrCat(cumulativePath, '/', iter); } } @@ -581,7 +581,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( sectionType == "postSolution"_s) { extensibilityAddInsOverridden = true; } - fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n"; + fout << "\tGlobalSection(" << name << ") = " << sectionType << '\n'; cmValue p = root->GetMakefile()->GetProperty(it); cmList keyValuePairs{ *p }; for (std::string const& itPair : keyValuePairs) { @@ -591,7 +591,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections( cmTrimWhitespace(itPair.substr(0, posEqual)); const std::string value = cmTrimWhitespace(itPair.substr(posEqual + 1)); - fout << "\t\t" << key << " = " << value << "\n"; + fout << "\t\t" << key << " = " << value << '\n'; if (key == "SolutionGuid"_s) { addGuid = false; } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index a2a7cb12eb1..2e87502b20a 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -304,7 +304,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() for (const auto& gi : generators) { stampFile = cmStrCat(gi->GetMakefile()->GetCurrentBinaryDirectory(), "/CMakeFiles/generate.stamp"); - fout << stampFile << "\n"; + fout << stampFile << '\n'; stamps.push_back(stampFile); } } @@ -341,7 +341,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() std::string argS = cmStrCat("-S", lg.GetSourceDirectory()); std::string argB = cmStrCat("-B", lg.GetBinaryDirectory()); std::string const sln = - cmStrCat(lg.GetBinaryDirectory(), "/", lg.GetProjectName(), ".sln"); + cmStrCat(lg.GetBinaryDirectory(), '/', lg.GetProjectName(), ".sln"); cmCustomCommandLines commandLines = cmMakeSingleCommandLine( { cmSystemTools::GetCMakeCommand(), argS, argB, "--check-stamp-list", stampList, "--vs-solution-file", sln }); @@ -392,8 +392,8 @@ void cmGlobalVisualStudio8Generator::WriteSolutionConfigurations( { fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"; for (std::string const& i : configs) { - fout << "\t\t" << i << "|" << this->GetPlatformName() << " = " << i << "|" - << this->GetPlatformName() << "\n"; + fout << "\t\t" << i << '|' << this->GetPlatformName() << " = " << i << '|' + << this->GetPlatformName() << '\n'; } fout << "\tEndGlobalSection\n"; } @@ -417,25 +417,25 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( } } } - fout << "\t\t{" << guid << "}." << i << "|" << this->GetPlatformName() - << ".ActiveCfg = " << dstConfig << "|" + fout << "\t\t{" << guid << "}." << i << '|' << this->GetPlatformName() + << ".ActiveCfg = " << dstConfig << '|' << (!platformMapping.empty() ? platformMapping : this->GetPlatformName()) - << "\n"; + << '\n'; auto ci = configsPartOfDefaultBuild.find(i); if (!(ci == configsPartOfDefaultBuild.end())) { - fout << "\t\t{" << guid << "}." << i << "|" << this->GetPlatformName() - << ".Build.0 = " << dstConfig << "|" + fout << "\t\t{" << guid << "}." << i << '|' << this->GetPlatformName() + << ".Build.0 = " << dstConfig << '|' << (!platformMapping.empty() ? platformMapping : this->GetPlatformName()) - << "\n"; + << '\n'; } if (this->NeedsDeploy(target, dstConfig)) { - fout << "\t\t{" << guid << "}." << i << "|" << this->GetPlatformName() - << ".Deploy.0 = " << dstConfig << "|" + fout << "\t\t{" << guid << "}." << i << '|' << this->GetPlatformName() + << ".Deploy.0 = " << dstConfig << '|' << (!platformMapping.empty() ? platformMapping : this->GetPlatformName()) - << "\n"; + << '\n'; } } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index be5b79fa82f..5305fecda37 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -243,12 +243,12 @@ void cmGlobalVisualStudioGenerator::ComputeTargetObjectDirectory( std::string tgtDir = gt->LocalGenerator->GetTargetDirectory(gt); if (!tgtDir.empty()) { dir += tgtDir; - dir += "/"; + dir += '/'; } const char* cd = this->GetCMakeCFGIntDir(); if (cd && *cd) { dir += cd; - dir += "/"; + dir += '/'; } gt->ObjectDirectory = dir; } @@ -977,7 +977,7 @@ bool cmGlobalVisualStudioGenerator::Open(const std::string& bindir, const std::string& projectName, bool dryRun) { - std::string sln = cmStrCat(bindir, "/", projectName, ".sln"); + std::string sln = cmStrCat(bindir, '/', projectName, ".sln"); if (dryRun) { return cmSystemTools::FileExists(sln, true); diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 8b408a9f73b..938e4a3b0d0 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -524,7 +524,7 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( if (!this->GeneratorInstanceVersion.empty()) { std::string const majorStr = VSVersionToMajorString(this->Version); cmsys::RegularExpression versionRegex( - cmStrCat("^", majorStr, R"(\.[0-9]+\.[0-9]+\.[0-9]+$)")); + cmStrCat('^', majorStr, R"(\.[0-9]+\.[0-9]+\.[0-9]+$)")); if (!versionRegex.find(this->GeneratorInstanceVersion)) { mf->IssueMessage( MessageType::FATAL_ERROR, @@ -538,7 +538,7 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance( "\n" "but the version field is not 4 integer components" " starting in ", - majorStr, ".")); + majorStr, '.')); return false; } } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index eaa2c2c32ef..ef8a7e26bca 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -961,7 +961,7 @@ std::string cmLocalVisualStudio7Generator::GetBuildTypeLinkerFlags( { std::string configTypeUpper = cmSystemTools::UpperCase(configName); std::string extraLinkOptionsBuildTypeDef = - cmStrCat(rootLinkerFlags, "_", configTypeUpper); + cmStrCat(rootLinkerFlags, '_', configTypeUpper); const std::string& extraLinkOptionsBuildType = this->Makefile->GetRequiredDefinition(extraLinkOptionsBuildTypeDef); @@ -979,30 +979,30 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( std::string extraLinkOptions; if (target->GetType() == cmStateEnums::EXECUTABLE) { extraLinkOptions = cmStrCat( - this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"), " ", + this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"), ' ', GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName)); } if (target->GetType() == cmStateEnums::SHARED_LIBRARY) { extraLinkOptions = cmStrCat( - this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"), " ", + this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"), ' ', GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName)); } if (target->GetType() == cmStateEnums::MODULE_LIBRARY) { extraLinkOptions = cmStrCat( - this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"), " ", + this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"), ' ', GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName)); } cmValue targetLinkFlags = target->GetProperty("LINK_FLAGS"); if (targetLinkFlags) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += *targetLinkFlags; } std::string configTypeUpper = cmSystemTools::UpperCase(configName); std::string linkFlagsConfig = cmStrCat("LINK_FLAGS_", configTypeUpper); targetLinkFlags = target->GetProperty(linkFlagsConfig); if (targetLinkFlags) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += *targetLinkFlags; } @@ -1286,7 +1286,7 @@ void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool( if (dir) { std::string const exe = - cmStrCat(*dir, "\\", target->GetFullName(config)); + cmStrCat(*dir, '\\', target->GetFullName(config)); fout << "\t\t\tConvertToXMLOutputPath( cmStrCat(dir, "/$(ConfigurationName)")) - << "," << this->ConvertToXMLOutputPath(dir); + << ',' << this->ConvertToXMLOutputPath(dir); comma = ","; } } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b4c55b3fae5..6e12402fc56 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -104,7 +104,7 @@ struct cmVisualStudio10TargetGenerator::Elem void SetHasElements() { if (!HasElements) { - this->S << ">"; + this->S << '>'; HasElements = true; } } @@ -116,13 +116,13 @@ struct cmVisualStudio10TargetGenerator::Elem } Elem& Attribute(const char* an, std::string av) { - this->S << " " << an << "=\"" << cmVS10EscapeAttr(std::move(av)) << "\""; + this->S << ' ' << an << "=\"" << cmVS10EscapeAttr(std::move(av)) << '"'; return *this; } void Content(std::string val) { if (!this->HasContent) { - this->S << ">"; + this->S << '>'; this->HasContent = true; } this->S << cmVS10EscapeXML(std::move(val)); @@ -135,9 +135,9 @@ struct cmVisualStudio10TargetGenerator::Elem } if (HasElements) { - this->WriteString("Tag << ">"; + this->WriteString("Tag << '>'; } else if (HasContent) { - this->S << "Tag << ">"; + this->S << "Tag << '>'; } else { this->S << " />"; } @@ -291,7 +291,7 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator( this->TargetCompileAsWinRT = false; this->IsMissingFiles = false; this->DefaultArtifactDir = - cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), "/", + cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), '/', this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget)); this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() == this->Makefile->GetCurrentBinaryDirectory()); @@ -304,8 +304,8 @@ std::string cmVisualStudio10TargetGenerator::CalcCondition( const std::string& config) const { std::ostringstream oss; - oss << "'$(Configuration)|$(Platform)'=='" << config << "|" << this->Platform - << "'"; + oss << "'$(Configuration)|$(Platform)'=='" << config << '|' << this->Platform + << '\''; // handle special case for 32 bit C# targets if (this->ProjectType == VsProjectType::csproj && this->Platform == "Win32"_s) { @@ -870,7 +870,8 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( if (this->ProjectType == VsProjectType::csproj) { for (std::string const& c : this->Configurations) { Elem e1(e0, "PropertyGroup"); - e1.Attribute("Condition", cmStrCat("'$(Configuration)' == '", c, "'")); + e1.Attribute("Condition", + cmStrCat("'$(Configuration)' == '", c, '\'')); e1.SetHasElements(); this->WriteEvents(e1, c); } @@ -991,12 +992,12 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile( for (const std::string& config : this->Configurations) { Elem e1(e0, "PropertyGroup"); e1.Attribute("Condition", - cmStrCat("'$(Configuration)' == '", config, "'")); + cmStrCat("'$(Configuration)' == '", config, '\'')); e1.SetHasElements(); this->WriteEvents(e1, config); std::string outDir = - cmStrCat(this->GeneratorTarget->GetDirectory(config), "/"); + cmStrCat(this->GeneratorTarget->GetDirectory(config), '/'); ConvertToWindowsSlash(outDir); e1.Element("OutputPath", outDir); @@ -1017,7 +1018,7 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile( void cmVisualStudio10TargetGenerator::WriteCommonPropertyGroupGlobals(Elem& e1) { e1.Attribute("Label", "Globals"); - e1.Element("ProjectGuid", cmStrCat("{", this->GUID, "}")); + e1.Element("ProjectGuid", cmStrCat('{', this->GUID, '}')); cmValue vsProjectTypes = this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES"); @@ -1114,7 +1115,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0) std::string path = i.second; if (!cmsys::SystemTools::FileIsFullPath(path)) { path = - cmStrCat(this->Makefile->GetCurrentSourceDirectory(), "/", path); + cmStrCat(this->Makefile->GetCurrentSourceDirectory(), '/', path); } ConvertToWindowsSlash(path); this->DotNetHintReferences[""].emplace_back( @@ -1184,7 +1185,7 @@ void cmVisualStudio10TargetGenerator::WriteImports(Elem& e0) for (auto& path : argsSplit) { if (!cmsys::SystemTools::FileIsFullPath(path)) { path = - cmStrCat(this->Makefile->GetCurrentSourceDirectory(), "/", path); + cmStrCat(this->Makefile->GetCurrentSourceDirectory(), '/', path); } ConvertToWindowsSlash(path); Elem e1(e0, "Import"); @@ -1280,7 +1281,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0) } // Determine if this is a generated resource from a .Designer.cs file std::string designerResource = cmStrCat( - cmSystemTools::GetFilenamePath(oi->GetFullPath()), "/", + cmSystemTools::GetFilenamePath(oi->GetFullPath()), '/', cmSystemTools::GetFilenameWithoutLastExtension(oi->GetFullPath()), ".Designer.cs"); if (cmsys::SystemTools::FileExists(designerResource)) { @@ -1368,9 +1369,9 @@ void cmVisualStudio10TargetGenerator::WriteTargetsFileReferences(Elem& e1) if (j > 0) { oss << " Or "; } - oss << "'$(Configuration)'=='" << tac.Configs[j] << "'"; + oss << "'$(Configuration)'=='" << tac.Configs[j] << '\''; } - oss << ")"; + oss << ')'; } Elem(e1, "Import") @@ -1410,7 +1411,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations(Elem& e0) e1.Attribute("Label", "ProjectConfigurations"); for (std::string const& c : this->Configurations) { Elem e2(e1, "ProjectConfiguration"); - e2.Attribute("Include", cmStrCat(c, "|", this->Platform)); + e2.Attribute("Include", cmStrCat(c, '|', this->Platform)); e2.Element("Configuration", c); e2.Element("Platform", this->Platform); } @@ -1587,7 +1588,7 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged( } std::string outDir = - cmStrCat(this->GeneratorTarget->GetDirectory(config), "/"); + cmStrCat(this->GeneratorTarget->GetDirectory(config), '/'); ConvertToWindowsSlash(outDir); e1.Element("OutputPath", outDir); @@ -1822,7 +1823,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( } script += lg->FinishConstructScript(this->ProjectType); if (this->ProjectType == VsProjectType::csproj) { - std::string name = cmStrCat("CustomCommand_", c, "_", + std::string name = cmStrCat("CustomCommand_", c, '_', cmSystemTools::ComputeStringMD5(sourcePath)); this->WriteCustomRuleCSharp(e0, c, name, script, additional_inputs.str(), outputs.str(), comment, ccg); @@ -2029,7 +2030,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string guid = this->GlobalGenerator->GetGUID(guidName); Elem e2(e1, "Filter"); e2.Attribute("Include", name); - e2.Element("UniqueIdentifier", cmStrCat("{", guid, "}")); + e2.Element("UniqueIdentifier", cmStrCat('{', guid, '}')); } } @@ -2038,7 +2039,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string guid = this->GlobalGenerator->GetGUID(guidName); Elem e2(e1, "Filter"); e2.Attribute("Include", "Resource Files"); - e2.Element("UniqueIdentifier", cmStrCat("{", guid, "}")); + e2.Element("UniqueIdentifier", cmStrCat('{', guid, '}')); e2.Element("Extensions", "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;" "gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms"); @@ -2052,7 +2053,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string guid = this->GlobalGenerator->GetGUID(guidName); Elem e2(e1, "Filter"); e2.Attribute("Include", filter); - e2.Element("UniqueIdentifier", cmStrCat("{", guid, "}")); + e2.Element("UniqueIdentifier", cmStrCat('{', guid, '}')); } } } @@ -2426,14 +2427,14 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource( if (cge->Evaluate(this->LocalGenerator, config) == "1"_s) { e2.WritePlatformConfigTag( "DeploymentContent", - cmStrCat("'$(Configuration)|$(Platform)'=='", config, "|", - this->Platform, "'"), + cmStrCat("'$(Configuration)|$(Platform)'=='", config, '|', + this->Platform, '\''), "true"); } else { e2.WritePlatformConfigTag( "ExcludedFromBuild", - cmStrCat("'$(Configuration)|$(Platform)'=='", config, "|", - this->Platform, "'"), + cmStrCat("'$(Configuration)|$(Platform)'=='", config, '|', + this->Platform, '\''), "true"); } } @@ -2616,7 +2617,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) conditions << " Or "; } conditions << "('$(Configuration)|$(Platform)'=='" - << this->Configurations[ci] << "|" << this->Platform + << this->Configurations[ci] << '|' << this->Platform << "')"; firstConditionSet = true; } @@ -2698,8 +2699,8 @@ void cmVisualStudio10TargetGenerator::FinishWritingSource( } else { e2.WritePlatformConfigTag(setting.first, cmStrCat("'$(Configuration)|$(Platform)'=='", - configSettings.first, "|", - this->Platform, "'"), + configSettings.first, '|', + this->Platform, '\''), setting.second); } } @@ -2793,7 +2794,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( std::string defPropName = cmStrCat("COMPILE_DEFINITIONS_", configUpper); if (cmValue ccdefs = sf.GetProperty(defPropName)) { if (!configDefines.empty()) { - configDefines += ";"; + configDefines += ';'; } configDependentDefines |= cmGeneratorExpression::Find(*ccdefs) != std::string::npos; @@ -2997,8 +2998,8 @@ void cmVisualStudio10TargetGenerator::WriteExcludeFromBuild( for (size_t ci : exclude_configs) { e2.WritePlatformConfigTag("ExcludedFromBuild", cmStrCat("'$(Configuration)|$(Platform)'=='", - this->Configurations[ci], "|", - this->Platform, "'"), + this->Configurations[ci], '|', + this->Platform, '\''), "true"); } } @@ -3032,7 +3033,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions( outDir = intermediateDir; targetNameFull = cmStrCat(this->GeneratorTarget->GetName(), ".lib"); } else { - outDir = cmStrCat(this->GeneratorTarget->GetDirectory(config), "/"); + outDir = cmStrCat(this->GeneratorTarget->GetDirectory(config), '/'); targetNameFull = this->GeneratorTarget->GetFullName(config); } ConvertToWindowsSlash(intermediateDir); @@ -3360,7 +3361,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( this->GeneratorTarget->GetProperty("COMMON_LANGUAGE_RUNTIME")) { std::string clrString = *clr; if (!clrString.empty()) { - clrString = cmStrCat(":", clrString); + clrString = cmStrCat(':', clrString); } flags += cmStrCat(" /clr", clrString); } @@ -3611,7 +3612,7 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions( std::string CONFIG = cmSystemTools::UpperCase(configName); std::string rcConfigFlagsVar = cmStrCat("CMAKE_RC_FLAGS_", CONFIG); std::string flags = - cmStrCat(this->Makefile->GetSafeDefinition("CMAKE_RC_FLAGS"), " ", + cmStrCat(this->Makefile->GetSafeDefinition("CMAKE_RC_FLAGS"), ' ', this->Makefile->GetSafeDefinition(rcConfigFlagsVar)); rcOptions.Parse(flags); @@ -4304,19 +4305,19 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( } std::string flags; std::string linkFlagVarBase = cmStrCat("CMAKE_", linkType, "_LINKER_FLAGS"); - flags += " "; + flags += ' '; flags += this->Makefile->GetRequiredDefinition(linkFlagVarBase); - std::string linkFlagVar = cmStrCat(linkFlagVarBase, "_", CONFIG); - flags += " "; + std::string linkFlagVar = cmStrCat(linkFlagVarBase, '_', CONFIG); + flags += ' '; flags += this->Makefile->GetRequiredDefinition(linkFlagVar); cmValue targetLinkFlags = this->GeneratorTarget->GetProperty("LINK_FLAGS"); if (targetLinkFlags) { - flags += " "; + flags += ' '; flags += *targetLinkFlags; } std::string flagsProp = cmStrCat("LINK_FLAGS_", CONFIG); if (cmValue flagsConfig = this->GeneratorTarget->GetProperty(flagsProp)) { - flags += " "; + flags += ' '; flags += *flagsConfig; } @@ -4812,7 +4813,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) Elem e2(e1, "ProjectReference"); e2.Attribute("Include", path); e2.Element("Project", - cmStrCat("{", this->GlobalGenerator->GetGUID(name), "}")); + cmStrCat('{', this->GlobalGenerator->GetGUID(name), '}')); e2.Element("Name", name); this->WriteDotNetReferenceCustomTags(e2, name); if (dt->IsCSharpOnly() || cmHasLiteralSuffix(path, "csproj")) { @@ -4940,7 +4941,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile( this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); Elem e1(e0, "PropertyGroup"); - e1.Element("AppxPackageArtifactsDir", cmStrCat(artifactDir, "\\")); + e1.Element("AppxPackageArtifactsDir", cmStrCat(artifactDir, '\\')); std::string resourcePriFile = cmStrCat(this->DefaultArtifactDir, "/resources.pri"); ConvertToWindowsSlash(resourcePriFile); @@ -5631,7 +5632,7 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink( this->Makefile->FindSourceGroup(fullFileName, sourceGroups); if (sourceGroup && !sourceGroup->GetFullName().empty()) { sourceGroupedFile = - cmStrCat(sourceGroup->GetFullName(), "/", + cmStrCat(sourceGroup->GetFullName(), '/', cmsys::SystemTools::GetFilenameName(fullFileName)); cmsys::SystemTools::ConvertToUnixSlashes(sourceGroupedFile); } diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 80e37bd3d80..6188134d5aa 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -361,7 +361,7 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( std::ostringstream oss; if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) { - oss << "%(" << tag << ")"; + oss << "%(" << tag << ')'; } auto de = cmRemoveDuplicates(this->Defines); for (std::string const& di : cmMakeRange(this->Defines.cbegin(), de)) { @@ -411,7 +411,7 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( } if (lang == "ASM_NASM"_s) { - include += "\\"; + include += '\\'; } // Escape this include for the MSBuild. @@ -428,7 +428,7 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( } if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) { - oss << sep << "%(" << tag << ")"; + oss << sep << "%(" << tag << ')'; } this->OutputFlag(fout, indent, tag, oss.str()); diff --git a/Source/cmVisualStudioSlnData.cxx b/Source/cmVisualStudioSlnData.cxx index d824462443f..f685158957f 100644 --- a/Source/cmVisualStudioSlnData.cxx +++ b/Source/cmVisualStudioSlnData.cxx @@ -74,7 +74,7 @@ std::string cmSlnData::GetConfigurationTarget( const std::string& platformName) { std::string solutionTarget = - cmStrCat(solutionConfiguration, "|", platformName); + cmStrCat(solutionConfiguration, '|', platformName); cm::optional project = GetProjectByName(projectName); if (!project) { return platformName; diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx index aa7aae766e8..f13457f1d0c 100644 --- a/Source/cmVisualStudioWCEPlatformParser.cxx +++ b/Source/cmVisualStudioWCEPlatformParser.cxx @@ -40,7 +40,7 @@ std::string cmVisualStudioWCEPlatformParser::GetOSVersion() const return OSMajorVersion; } - return cmStrCat(OSMajorVersion, ".", OSMinorVersion); + return cmStrCat(OSMajorVersion, '.', OSMinorVersion); } const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const From d4144b9c0a1a8a8f3a24ff33fc2582bb319d73ac Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 14:43:10 -0400 Subject: [PATCH 168/627] strings: use `emplace_back` with `cmStrCat` arguments --- Source/CPack/cmCPackInnoSetupGenerator.cxx | 8 ++++---- Source/cmExportBuildFileGenerator.cxx | 4 ++-- Source/cmExportInstallFileGenerator.cxx | 4 ++-- Source/cmGlobalGhsMultiGenerator.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 6 +++--- Source/cmGlobalVisualStudio12Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio14Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio9Generator.cxx | 8 ++++---- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 4 ++-- Source/cmNinjaTargetGenerator.cxx | 3 ++- Source/cmQtAutoMocUic.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- 12 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx index ada9a5b8de6..b8bf070ffe2 100644 --- a/Source/CPack/cmCPackInnoSetupGenerator.cxx +++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx @@ -106,7 +106,7 @@ int cmCPackInnoSetupGenerator::PackageFiles() const cmList extraScripts(GetOption("CPACK_INNOSETUP_EXTRA_SCRIPTS")); for (const std::string& i : extraScripts) { - includeDirectives.push_back(cmStrCat( + includeDirectives.emplace_back(cmStrCat( "#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel)))); } } @@ -142,7 +142,7 @@ int cmCPackInnoSetupGenerator::PackageFiles() const cmList codeFiles(GetOption("CPACK_INNOSETUP_CODE_FILES")); for (const std::string& i : codeFiles) { - codeIncludes.push_back(cmStrCat( + codeIncludes.emplace_back(cmStrCat( "#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel)))); } } @@ -781,7 +781,7 @@ bool cmCPackInnoSetupGenerator::ConfigureISScript() // Create internal variables std::vector setupSection; for (const auto& i : setupDirectives) { - setupSection.push_back(cmStrCat(i.first, '=', TranslateBool(i.second))); + setupSection.emplace_back(cmStrCat(i.first, '=', TranslateBool(i.second))); } // Also create comments if the sections are empty @@ -1082,7 +1082,7 @@ std::string cmCPackInnoSetupGenerator::ISKeyValueLine( std::vector keys; for (const char* i : availableKeys) { if (params.count(i)) { - keys.push_back(cmStrCat(i, ": ", params.at(i))); + keys.emplace_back(cmStrCat(i, ": ", params.at(i))); } } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 8d3960cd1ee..fd357866001 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -419,7 +419,7 @@ std::string cmExportBuildFileGenerator::GetFileSetDirectories( resultVector.push_back( cmStrCat("\"$<$:", dest, ">\"")); } else { - resultVector.push_back(cmStrCat('"', dest, '"')); + resultVector.emplace_back(cmStrCat('"', dest, '"')); break; } } @@ -478,7 +478,7 @@ std::string cmExportBuildFileGenerator::GetFileSetFiles(cmGeneratorTarget* gte, resultVector.push_back( cmStrCat("\"$<$:", escapedFile, ">\"")); } else { - resultVector.push_back(cmStrCat('"', escapedFile, '"')); + resultVector.emplace_back(cmStrCat('"', escapedFile, '"')); } } } diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 264c947ff3c..6cf3a09ec89 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -616,7 +616,7 @@ std::string cmExportInstallFileGenerator::GetFileSetDirectories( resultVector.push_back( cmStrCat("\"$<$:", dest, ">\"")); } else { - resultVector.push_back(cmStrCat('"', dest, '"')); + resultVector.emplace_back(cmStrCat('"', dest, '"')); break; } } @@ -690,7 +690,7 @@ std::string cmExportInstallFileGenerator::GetFileSetFiles( resultVector.push_back( cmStrCat("\"$<$:", escapedFile, ">\"")); } else { - resultVector.push_back(cmStrCat('"', escapedFile, '"')); + resultVector.emplace_back(cmStrCat('"', escapedFile, '"')); } } } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 2453bfc0fcf..4ba53ec8724 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -670,7 +670,7 @@ bool cmGlobalGhsMultiGenerator::AddCheckTarget() } // Add the cache file. - listFiles.push_back(cmStrCat( + listFiles.emplace_back(cmStrCat( this->GetCMakeInstance()->GetHomeOutputDirectory(), "/CMakeCache.txt")); // Print not implemented warning. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 41cd807b4bb..7a852f874dd 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -975,9 +975,9 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) std::vector cmd; cmd.push_back(this->GetMSBuildCommand()); cmd.push_back(vcxproj); - cmd.push_back("/p:Configuration=Debug"); - cmd.push_back(cmStrCat("/p:Platform=", this->GetPlatformName())); - cmd.push_back(cmStrCat("/p:VisualStudioVersion=", this->GetIDEVersion())); + cmd.emplace_back("/p:Configuration=Debug"); + cmd.emplace_back(cmStrCat("/p:Platform=", this->GetPlatformName())); + cmd.emplace_back(cmStrCat("/p:VisualStudioVersion=", this->GetIDEVersion())); std::string out; int ret = 0; cmsys::RegularExpression regex("\n *VCTargetsPath=([^%\r\n]+)[\r\n]"); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 6c72c5df52f..1f1a2c3e51b 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -80,8 +80,8 @@ class cmGlobalVisualStudio12Generator::Factory std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(cmStrCat(vs12generatorName, " ARM")); - names.push_back(cmStrCat(vs12generatorName, " Win64")); + names.emplace_back(cmStrCat(vs12generatorName, " ARM")); + names.emplace_back(cmStrCat(vs12generatorName, " Win64")); return names; } diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 1350945766a..9f1926d522a 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -82,8 +82,8 @@ class cmGlobalVisualStudio14Generator::Factory std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(cmStrCat(vs14generatorName, " ARM")); - names.push_back(cmStrCat(vs14generatorName, " Win64")); + names.emplace_back(cmStrCat(vs14generatorName, " ARM")); + names.emplace_back(cmStrCat(vs14generatorName, " Win64")); return names; } diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 462db2a81f7..de2153d0832 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -72,21 +72,21 @@ class cmGlobalVisualStudio9Generator::Factory : public cmGlobalGeneratorFactory std::vector GetGeneratorNames() const override { std::vector names; - names.push_back(vs9generatorName); + names.emplace_back(vs9generatorName); return names; } std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(cmStrCat(vs9generatorName, " Win64")); - names.push_back(cmStrCat(vs9generatorName, " IA64")); + names.emplace_back(cmStrCat(vs9generatorName, " Win64")); + names.emplace_back(cmStrCat(vs9generatorName, " IA64")); cmVisualStudioWCEPlatformParser parser; parser.ParseVersion("9.0"); const std::vector& availablePlatforms = parser.GetAvailablePlatforms(); for (std::string const& i : availablePlatforms) { - names.push_back(cmStrCat("Visual Studio 9 2008 ", i)); + names.emplace_back(cmStrCat("Visual Studio 9 2008 ", i)); } return names; } diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 938e4a3b0d0..52e6d421222 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -265,8 +265,8 @@ class cmGlobalVisualStudioVersionedGenerator::Factory15 std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(cmStrCat(vs15generatorName, " ARM")); - names.push_back(cmStrCat(vs15generatorName, " Win64")); + names.emplace_back(cmStrCat(vs15generatorName, " ARM")); + names.emplace_back(cmStrCat(vs15generatorName, " Win64")); return names; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d712d719567..4837ee6d8ed 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1052,7 +1052,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( for (std::string const& l : this->GetLinkedTargetDirectories(language, config)) { - build.ImplicitDeps.push_back(cmStrCat(l, '/', language, "Modules.json")); + build.ImplicitDeps.emplace_back( + cmStrCat(l, '/', language, "Modules.json")); } this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index a101a818ec2..62b51727509 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -2116,7 +2116,7 @@ void cmQtAutoMocUicT::JobCompileMocT::MaybeWriteMocResponseFile( cmd.resize(1); // Specify response file - cmd.push_back(cmStrCat('@', responseFile)); + cmd.emplace_back(cmStrCat('@', responseFile)); } #else static_cast(outputFile); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6e12402fc56..5ba9332d12e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4356,7 +4356,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( // first just full path linkDirs.push_back(d); // next path with configuration type Debug, Release, etc - linkDirs.push_back(cmStrCat(d, "/$(Configuration)")); + linkDirs.emplace_back(cmStrCat(d, "/$(Configuration)")); } linkDirs.push_back("%(AdditionalLibraryDirectories)"); linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs); From 48b38d2d864988081725cc0d306a18ae1e79ac96 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 14:58:16 -0400 Subject: [PATCH 169/627] cmLocalVisualStudio10Generator: remove unnecessary `.c_str()` --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 7 +++---- Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx | 2 +- Source/cmLocalVisualStudio10Generator.cxx | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 95301200449..c5b7abd75d7 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -936,12 +936,11 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions( std::string fullPath = cmStrCat(topdir, '/', fileName); - std::string relativePath = - cmSystemTools::RelativePath(toplevel.c_str(), fullPath.c_str()); + std::string relativePath = cmSystemTools::RelativePath(toplevel, fullPath); std::string id = PathToId(relativePath); - if (cmSystemTools::FileIsDirectory(fullPath.c_str())) { + if (cmSystemTools::FileIsDirectory(fullPath)) { std::string subDirectoryId = cmStrCat("CM_D", id); directoryDefinitions.BeginElement("Directory"); @@ -1070,7 +1069,7 @@ std::string cmCPackWIXGenerator::PathToId(std::string const& path) std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path) { std::vector components; - cmSystemTools::SplitPath(path.c_str(), components, false); + cmSystemTools::SplitPath(path, components, false); size_t replacementCount = 0; diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx index 13bbf37975f..a655d86dff1 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -55,7 +55,7 @@ size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory( std::vector installRoot; - cmSystemTools::SplitPath(installRootString.c_str(), installRoot); + cmSystemTools::SplitPath(installRootString, installRoot); if (!installRoot.empty() && installRoot.back().empty()) { installRoot.pop_back(); diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 2a1521bb9a2..165f0fd706d 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -95,7 +95,7 @@ void cmLocalVisualStudio10Generator::ReadAndStoreExternalGUID( std::string guidStoreName = cmStrCat(name, "_GUID_CMAKE"); // save the GUID in the cache this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry( - guidStoreName, parser.GUID.c_str(), "Stored GUID", cmStateEnums::INTERNAL); + guidStoreName, parser.GUID, "Stored GUID", cmStateEnums::INTERNAL); } const char* cmLocalVisualStudio10Generator::ReportErrorLabel() const From 46f71720fe4064cc6a309c9dd9bd05060bda0667 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 14:58:46 -0400 Subject: [PATCH 170/627] cmVisualStudioSlnParser: simplify switch statement --- Source/cmVisualStudioSlnParser.cxx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx index 9b615663d65..adfd4c56c4b 100644 --- a/Source/cmVisualStudioSlnParser.cxx +++ b/Source/cmVisualStudioSlnParser.cxx @@ -171,17 +171,12 @@ LineFormat cmVisualStudioSlnParser::State::NextLineFormat() const case FileStateTopLevel: return LineMultiValueTag; case FileStateProject: - return LineSingleValueTag; - case FileStateProjectDependencies: - return LineKeyValuePair; case FileStateGlobal: return LineSingleValueTag; + case FileStateProjectDependencies: case FileStateSolutionConfigurations: - return LineKeyValuePair; case FileStateProjectConfigurations: - return LineKeyValuePair; case FileStateSolutionFilters: - return LineKeyValuePair; case FileStateGlobalSection: return LineKeyValuePair; case FileStateIgnore: From 1159cdc2354ab1f2eb8bcd76782fd464c715fcaa Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 14:59:17 -0400 Subject: [PATCH 171/627] cmVisualStudioWCEPlatformParser: combine character pushbacks --- Source/cmVisualStudioWCEPlatformParser.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx index f13457f1d0c..8aa53846085 100644 --- a/Source/cmVisualStudioWCEPlatformParser.cxx +++ b/Source/cmVisualStudioWCEPlatformParser.cxx @@ -25,8 +25,7 @@ int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version) } cmSystemTools::ConvertToUnixSlashes(this->VcInstallDir); cmSystemTools::ConvertToUnixSlashes(this->VsInstallDir); - this->VcInstallDir.append("/"); - this->VsInstallDir.append("/"); + this->VcInstallDir.append("//"); const std::string configFilename = cmStrCat(this->VcInstallDir, "vcpackages/WCE.VCPlatform.config"); From e8983bd20d7bfecba1d5961a68e61bc13efe5e37 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:04:55 -0400 Subject: [PATCH 172/627] clang-tidy: fix `readability-braces-around-statements` lints --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 18 ++++++++++++------ Source/CPack/WiX/cmWIXAccessControlList.cxx | 3 ++- Source/CPack/WiX/cmWIXPatch.cxx | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index c5b7abd75d7..0dd776041d2 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -314,8 +314,9 @@ bool cmCPackWIXGenerator::PackageFilesImpl() void cmCPackWIXGenerator::AppendUserSuppliedExtraSources() { cmValue cpackWixExtraSources = GetOption("CPACK_WIX_EXTRA_SOURCES"); - if (!cpackWixExtraSources) + if (!cpackWixExtraSources) { return; + } cmExpandList(cpackWixExtraSources, this->WixSources); } @@ -323,8 +324,9 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraSources() void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream) { cmValue cpackWixExtraObjects = GetOption("CPACK_WIX_EXTRA_OBJECTS"); - if (!cpackWixExtraObjects) + if (!cpackWixExtraObjects) { return; + } cmList expandedExtraObjects{ cpackWixExtraObjects }; @@ -1059,8 +1061,9 @@ std::string cmCPackWIXGenerator::GetRightmostExtension( std::string cmCPackWIXGenerator::PathToId(std::string const& path) { id_map_t::const_iterator i = PathToIdMap.find(path); - if (i != PathToIdMap.end()) + if (i != PathToIdMap.end()) { return i->second; + } std::string id = CreateNewIdForPath(path); return id; @@ -1077,8 +1080,9 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path) std::string currentComponent; for (size_t i = 1; i < components.size(); ++i) { - if (i != 1) + if (i != 1) { identifier += '.'; + } currentComponent = NormalizeComponentForId(components[i], replacementCount); @@ -1163,8 +1167,9 @@ void cmCPackWIXGenerator::CollectExtensions(std::string const& variableName, extension_set_t& extensions) { cmValue variableContent = GetOption(variableName); - if (!variableContent) + if (!variableContent) { return; + } cmList list{ variableContent }; extensions.insert(list.begin(), list.end()); @@ -1204,8 +1209,9 @@ void cmCPackWIXGenerator::AddCustomFlags(std::string const& variableName, std::ostream& stream) { cmValue variableContent = GetOption(variableName); - if (!variableContent) + if (!variableContent) { return; + } cmList list{ variableContent }; diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx index 6aba2289b22..cdb86c3a3fa 100644 --- a/Source/CPack/WiX/cmWIXAccessControlList.cxx +++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx @@ -107,8 +107,9 @@ bool cmWIXAccessControlList::IsBooleanAttribute(std::string const& name) size_t i = 0; while (validAttributes[i]) { - if (name == validAttributes[i++]) + if (name == validAttributes[i++]) { return true; + } } return false; diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index c3ada17d726..70033a3dd87 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -26,8 +26,9 @@ void cmWIXPatch::ApplyFragment(std::string const& id, cmWIXSourceWriter& writer) { cmWIXPatchParser::fragment_map_t::iterator i = Fragments.find(id); - if (i == Fragments.end()) + if (i == Fragments.end()) { return; + } const cmWIXPatchElement& fragment = i->second; for (auto const& attr : fragment.attributes) { From 93a366697f5310738935b2f25dbf978f39031764 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:05:21 -0400 Subject: [PATCH 173/627] clang-tidy: fix `modernize-use-nullptr` lints --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 7 ++++--- Source/CPack/WiX/cmWIXAccessControlList.cxx | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 0dd776041d2..1f55b801ef3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -63,8 +63,9 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command) std::string output; int returnValue = 0; - bool status = cmSystemTools::RunSingleCommand( - command, &output, &output, &returnValue, 0, cmSystemTools::OUTPUT_NONE); + bool status = + cmSystemTools::RunSingleCommand(command, &output, &output, &returnValue, + nullptr, cmSystemTools::OUTPUT_NONE); cmsys::ofstream logFile(logFileName.c_str(), std::ios::app); logFile << command << std::endl; @@ -665,7 +666,7 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy( { for (auto const& i : ComponentGroups) { cmCPackComponentGroup const& group = i.second; - if (group.ParentGroup == 0) { + if (group.ParentGroup == nullptr) { featureDefinitions.EmitFeatureForComponentGroup(group, *this->Patch); } } diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx index cdb86c3a3fa..0ebe2f46774 100644 --- a/Source/CPack/WiX/cmWIXAccessControlList.cxx +++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx @@ -102,7 +102,7 @@ bool cmWIXAccessControlList::IsBooleanAttribute(std::string const& name) "Write", "WriteAttributes", "WriteExtendedAttributes", - 0 + nullptr }; size_t i = 0; From 4489e9a85ce96ec6d15856b298f3d0255c8d615b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:21:01 -0400 Subject: [PATCH 174/627] clang-tidy: fix `modernize-use-auto` lints --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- Source/CPack/WiX/cmWIXPatch.cxx | 2 +- Source/CPack/WiX/cmWIXShortcut.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 1f55b801ef3..b12b8173c44 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -1061,7 +1061,7 @@ std::string cmCPackWIXGenerator::GetRightmostExtension( std::string cmCPackWIXGenerator::PathToId(std::string const& path) { - id_map_t::const_iterator i = PathToIdMap.find(path); + auto i = PathToIdMap.find(path); if (i != PathToIdMap.end()) { return i->second; } diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index 70033a3dd87..c65449c8b7d 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -25,7 +25,7 @@ bool cmWIXPatch::LoadFragments(std::string const& patchFilePath) void cmWIXPatch::ApplyFragment(std::string const& id, cmWIXSourceWriter& writer) { - cmWIXPatchParser::fragment_map_t::iterator i = Fragments.find(id); + auto i = Fragments.find(id); if (i == Fragments.end()) { return; } diff --git a/Source/CPack/WiX/cmWIXShortcut.cxx b/Source/CPack/WiX/cmWIXShortcut.cxx index c3eb219a9dc..1cfb6c1922c 100644 --- a/Source/CPack/WiX/cmWIXShortcut.cxx +++ b/Source/CPack/WiX/cmWIXShortcut.cxx @@ -20,7 +20,7 @@ bool cmWIXShortcuts::EmitShortcuts( std::string const& cpackComponentName, cmWIXFilesSourceWriter& fileDefinitions) const { - shortcut_type_map_t::const_iterator i = this->Shortcuts.find(type); + auto i = this->Shortcuts.find(type); if (i == this->Shortcuts.end()) { return false; From ffa49c23aaab2d1361321b9de32ef4da9e34c3bc Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:22:05 -0400 Subject: [PATCH 175/627] clang-tidy: fix `readability-else-after-return` lints --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 16 ++++++++-------- Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index b12b8173c44..31ddb0e072e 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -997,12 +997,12 @@ bool cmCPackWIXGenerator::RequireOption(std::string const& name, value = *tmp; return true; - } else { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Required variable " << name << " not set" << std::endl); - - return false; } + + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Required variable " << name << " not set" << std::endl); + + return false; } std::string cmCPackWIXGenerator::GetArchitecture() const @@ -1012,9 +1012,8 @@ std::string cmCPackWIXGenerator::GetArchitecture() const if (void_p_size == "8"_s) { return "x64"; - } else { - return "x86"; } + return "x86"; } std::string cmCPackWIXGenerator::GenerateGUID() @@ -1109,7 +1108,8 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path) << path << '\'' << std::endl); return std::string(); - } else if (ambiguityCount > 1) { + } + if (ambiguityCount > 1) { result << '_' << ambiguityCount; } diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx index f3fe3deafe6..cef2da9cb28 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx @@ -158,7 +158,8 @@ void cmWIXRichTextFormatWriter::EmitUnicodeCodepoint(int c) // Do not emit byte order mark (BOM) if (c == 0xFEFF) { return; - } else if (c <= 0xFFFF) { + } + if (c <= 0xFFFF) { EmitUnicodeSurrogate(c); } else { c -= 0x10000; From e1699f123e6968eab5a1c1fe2336c0ce8258b3a1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 28 Jul 2023 00:01:11 -0400 Subject: [PATCH 176/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d6546f240ad..81e027ed7da 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230727) +set(CMake_VERSION_PATCH 20230728) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 9526679bbc882f6eb904a401380cf3d6574ba91a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Jul 2023 13:11:18 -0400 Subject: [PATCH 177/627] ci: Update base images to Debian 12 --- .gitlab/ci/docker/debian10/install_deps.sh | 15 --------------- .../Dockerfile | 2 +- .../deps_packages.lst | 13 ++++++------- .../docker-clean | 0 .../dpkg-exclude | 0 .../install_deps.sh | 0 .../{debian10 => debian12-x86_64}/Dockerfile | 4 ++-- .../deps_packages.lst | 18 ++++++++++-------- .../{debian10 => debian12-x86_64}/docker-clean | 0 .../{debian10 => debian12-x86_64}/dpkg-exclude | 0 .../ci/docker/debian12-x86_64/install_deps.sh | 15 +++++++++++++++ .../install_iwyu.sh | 3 +-- .../install_rvm.sh | 2 +- .../iwyu_packages.lst | 6 +++--- .../rvm_packages.lst | 0 15 files changed, 39 insertions(+), 39 deletions(-) delete mode 100755 .gitlab/ci/docker/debian10/install_deps.sh rename .gitlab/ci/docker/{debian10-aarch64 => debian12-aarch64}/Dockerfile (97%) rename .gitlab/ci/docker/{debian10-aarch64 => debian12-aarch64}/deps_packages.lst (90%) rename .gitlab/ci/docker/{debian10-aarch64 => debian12-aarch64}/docker-clean (100%) rename .gitlab/ci/docker/{debian10-aarch64 => debian12-aarch64}/dpkg-exclude (100%) rename .gitlab/ci/docker/{debian10-aarch64 => debian12-aarch64}/install_deps.sh (100%) rename .gitlab/ci/docker/{debian10 => debian12-x86_64}/Dockerfile (96%) rename .gitlab/ci/docker/{debian10 => debian12-x86_64}/deps_packages.lst (88%) rename .gitlab/ci/docker/{debian10 => debian12-x86_64}/docker-clean (100%) rename .gitlab/ci/docker/{debian10 => debian12-x86_64}/dpkg-exclude (100%) create mode 100755 .gitlab/ci/docker/debian12-x86_64/install_deps.sh rename .gitlab/ci/docker/{debian10 => debian12-x86_64}/install_iwyu.sh (76%) rename .gitlab/ci/docker/{debian10 => debian12-x86_64}/install_rvm.sh (92%) rename .gitlab/ci/docker/{debian10 => debian12-x86_64}/iwyu_packages.lst (61%) rename .gitlab/ci/docker/{debian10 => debian12-x86_64}/rvm_packages.lst (100%) diff --git a/.gitlab/ci/docker/debian10/install_deps.sh b/.gitlab/ci/docker/debian10/install_deps.sh deleted file mode 100755 index a00e322cd8d..00000000000 --- a/.gitlab/ci/docker/debian10/install_deps.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -apt-get install -y $(grep '^[^#]\+$' /root/deps_packages.lst) - -curl -L -O https://github.com/IronLanguages/ironpython2/releases/download/ipy-2.7.10/ironpython_2.7.10.deb -echo 'e1aceec1d49ffa66e9059a52168a734999dcccc50164a60e2936649cae698f3e ironpython_2.7.10.deb' > ironpython.sha256sum -sha256sum --check ironpython.sha256sum -dpkg -i ironpython_2.7.10.deb -rm ironpython_2.7.10.deb ironpython.sha256sum - -# Perforce -curl -L https://www.perforce.com/downloads/perforce/r21.2/bin.linux26x86_64/helix-core-server.tgz -o - \ - | tar -C /usr/local/bin -xvzf - -- p4 p4d diff --git a/.gitlab/ci/docker/debian10-aarch64/Dockerfile b/.gitlab/ci/docker/debian12-aarch64/Dockerfile similarity index 97% rename from .gitlab/ci/docker/debian10-aarch64/Dockerfile rename to .gitlab/ci/docker/debian12-aarch64/Dockerfile index a0687e3e301..58b5e0e9f9d 100644 --- a/.gitlab/ci/docker/debian10-aarch64/Dockerfile +++ b/.gitlab/ci/docker/debian12-aarch64/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG BASE_IMAGE=arm64v8/debian:10 +ARG BASE_IMAGE=arm64v8/debian:12 FROM ${BASE_IMAGE} AS apt-cache # Populate APT cache w/ the fresh metadata and prefetch packages. diff --git a/.gitlab/ci/docker/debian10-aarch64/deps_packages.lst b/.gitlab/ci/docker/debian12-aarch64/deps_packages.lst similarity index 90% rename from .gitlab/ci/docker/debian10-aarch64/deps_packages.lst rename to .gitlab/ci/docker/debian12-aarch64/deps_packages.lst index ca833230bc0..c92c71508b4 100644 --- a/.gitlab/ci/docker/debian10-aarch64/deps_packages.lst +++ b/.gitlab/ci/docker/debian12-aarch64/deps_packages.lst @@ -20,14 +20,14 @@ libzstd-dev zlib1g-dev # Install iwyu runtime deps. -clang-6.0 +clang-15 libncurses6 # Tools needed for the test suite. jq # Packages needed to test CTest. -bzr bzr-xmloutput +bzr cvs subversion mercurial @@ -73,20 +73,19 @@ libopenal-dev libopenmpi-dev openmpi-bin libosp-dev libpng-dev -libpq-dev postgresql-server-dev-11 +libpq-dev postgresql-server-dev-15 libprotobuf-dev libprotobuf-c-dev libprotoc-dev protobuf-compiler protobuf-compiler-grpc -libsdl-dev +libsdl1.2-dev libsqlite3-dev libtiff-dev libuv1-dev -libwxgtk3.0-dev +libwxgtk3.2-dev libx11-dev libxalan-c-dev libxerces-c-dev libxml2-dev libxml2-utils libxslt-dev xsltproc -openjdk-11-jdk -python2 python2-dev python-numpy pypy pypy-dev +openjdk-17-jdk python3 python3-dev python3-numpy pypy3 pypy3-dev python3-venv qtbase5-dev qtbase5-dev-tools ruby ruby-dev diff --git a/.gitlab/ci/docker/debian10-aarch64/docker-clean b/.gitlab/ci/docker/debian12-aarch64/docker-clean similarity index 100% rename from .gitlab/ci/docker/debian10-aarch64/docker-clean rename to .gitlab/ci/docker/debian12-aarch64/docker-clean diff --git a/.gitlab/ci/docker/debian10-aarch64/dpkg-exclude b/.gitlab/ci/docker/debian12-aarch64/dpkg-exclude similarity index 100% rename from .gitlab/ci/docker/debian10-aarch64/dpkg-exclude rename to .gitlab/ci/docker/debian12-aarch64/dpkg-exclude diff --git a/.gitlab/ci/docker/debian10-aarch64/install_deps.sh b/.gitlab/ci/docker/debian12-aarch64/install_deps.sh similarity index 100% rename from .gitlab/ci/docker/debian10-aarch64/install_deps.sh rename to .gitlab/ci/docker/debian12-aarch64/install_deps.sh diff --git a/.gitlab/ci/docker/debian10/Dockerfile b/.gitlab/ci/docker/debian12-x86_64/Dockerfile similarity index 96% rename from .gitlab/ci/docker/debian10/Dockerfile rename to .gitlab/ci/docker/debian12-x86_64/Dockerfile index d86642876ce..477e763d2da 100644 --- a/.gitlab/ci/docker/debian10/Dockerfile +++ b/.gitlab/ci/docker/debian12-x86_64/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG BASE_IMAGE=debian:10 +ARG BASE_IMAGE=debian:12 FROM ${BASE_IMAGE} AS apt-cache # Populate APT cache w/ the fresh metadata and prefetch packages. @@ -56,7 +56,7 @@ RUN --mount=type=bind,source=install_deps.sh,target=/root/install_deps.sh \ RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \ tar -C / -xf /root/iwyu.tar \ - && ln -s /usr/lib/llvm-6.0/bin/include-what-you-use /usr/bin/include-what-you-use-6.0 + && ln -s /usr/lib/llvm-15/bin/include-what-you-use /usr/bin/include-what-you-use-15 RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \ tar -C /usr/local -xf /root/rvm.tar diff --git a/.gitlab/ci/docker/debian10/deps_packages.lst b/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst similarity index 88% rename from .gitlab/ci/docker/debian10/deps_packages.lst rename to .gitlab/ci/docker/debian12-x86_64/deps_packages.lst index fc5c1741e51..a59f2c91b59 100644 --- a/.gitlab/ci/docker/debian10/deps_packages.lst +++ b/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst @@ -20,18 +20,21 @@ libzstd-dev zlib1g-dev # Install iwyu runtime deps. -clang-6.0 +clang-15 libncurses6 # Tools needed for the test suite. jq # Packages needed to test CTest. -bzr bzr-xmloutput +bzr cvs subversion mercurial +# Install HIP language toolchain. +hipcc + # Install swift runtime deps. libncurses5 @@ -76,25 +79,24 @@ libopenal-dev libopenmpi-dev openmpi-bin libosp-dev libpng-dev -libpq-dev postgresql-server-dev-11 +libpq-dev postgresql-server-dev-15 libprotobuf-dev libprotobuf-c-dev libprotoc-dev protobuf-compiler protobuf-compiler-grpc -libsdl-dev +libsdl1.2-dev libsqlite3-dev libtiff-dev libuv1-dev -libwxgtk3.0-dev +libwxgtk3.2-dev libx11-dev libxalan-c-dev libxerces-c-dev libxml2-dev libxml2-utils libxslt-dev xsltproc -openjdk-11-jdk -python2 python2-dev python-numpy pypy pypy-dev +openjdk-17-jdk python3 python3-dev python3-numpy pypy3 pypy3-dev python3-venv qtbase5-dev qtbase5-dev-tools ruby ruby-dev swig unixodbc-dev -# CMake_TEST_FindPython2_IronPython +# Packages needed to test ironpython. libmono-system-windows-forms4.0-cil diff --git a/.gitlab/ci/docker/debian10/docker-clean b/.gitlab/ci/docker/debian12-x86_64/docker-clean similarity index 100% rename from .gitlab/ci/docker/debian10/docker-clean rename to .gitlab/ci/docker/debian12-x86_64/docker-clean diff --git a/.gitlab/ci/docker/debian10/dpkg-exclude b/.gitlab/ci/docker/debian12-x86_64/dpkg-exclude similarity index 100% rename from .gitlab/ci/docker/debian10/dpkg-exclude rename to .gitlab/ci/docker/debian12-x86_64/dpkg-exclude diff --git a/.gitlab/ci/docker/debian12-x86_64/install_deps.sh b/.gitlab/ci/docker/debian12-x86_64/install_deps.sh new file mode 100755 index 00000000000..7bfcacdec5e --- /dev/null +++ b/.gitlab/ci/docker/debian12-x86_64/install_deps.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +apt-get install -y $(grep '^[^#]\+$' /root/deps_packages.lst) + +curl -L -O https://github.com/IronLanguages/ironpython3/releases/download/v3.4.0/ironpython_3.4.0.deb +echo '7dcd10b7a0ec0342bd7e20eebb597a96bb15267eb797d59358a3b1cfaa3e1adc ironpython_3.4.0.deb' > ironpython.sha256sum +sha256sum --check ironpython.sha256sum +dpkg -i ironpython_3.4.0.deb +rm ironpython_3.4.0.deb ironpython.sha256sum + +# Perforce +curl -L https://www.perforce.com/downloads/perforce/r21.2/bin.linux26x86_64/helix-core-server.tgz -o - \ + | tar -C /usr/local/bin -xvzf - -- p4 p4d diff --git a/.gitlab/ci/docker/debian10/install_iwyu.sh b/.gitlab/ci/docker/debian12-x86_64/install_iwyu.sh similarity index 76% rename from .gitlab/ci/docker/debian10/install_iwyu.sh rename to .gitlab/ci/docker/debian12-x86_64/install_iwyu.sh index 4814a7161e0..bbeceb8f131 100755 --- a/.gitlab/ci/docker/debian10/install_iwyu.sh +++ b/.gitlab/ci/docker/debian12-x86_64/install_iwyu.sh @@ -8,7 +8,7 @@ apt-get install -y $(grep '^[^#]\+$' /root/iwyu_packages.lst) cd /root git clone "https://github.com/include-what-you-use/include-what-you-use.git" cd include-what-you-use -readonly llvm_version="$( clang-6.0 --version | head -n1 | cut -d' ' -f3 | cut -d. -f-2 )" +readonly llvm_version="$( clang-15 --version | head -n1 | cut -d' ' -f4 | cut -d. -f-1 )" git checkout "clang_$llvm_version" mkdir build cd build @@ -16,7 +16,6 @@ cd build cmake -GNinja \ -DCMAKE_BUILD_TYPE=Release \ "-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-$llvm_version" \ - "-DIWYU_LLVM_ROOT_PATH=/usr/lib/llvm-$llvm_version" \ .. ninja DESTDIR=/root/iwyu-destdir ninja install diff --git a/.gitlab/ci/docker/debian10/install_rvm.sh b/.gitlab/ci/docker/debian12-x86_64/install_rvm.sh similarity index 92% rename from .gitlab/ci/docker/debian10/install_rvm.sh rename to .gitlab/ci/docker/debian12-x86_64/install_rvm.sh index c6fff70d024..1ad42c4580f 100755 --- a/.gitlab/ci/docker/debian10/install_rvm.sh +++ b/.gitlab/ci/docker/debian12-x86_64/install_rvm.sh @@ -11,7 +11,7 @@ gpg2 --keyserver hkps://keyserver.ubuntu.com \ curl -sSL https://get.rvm.io | bash -s stable # keep version in sync with `env_debian*_ninja.sh` -/usr/local/rvm/bin/rvm install ruby-2.7.0 +/usr/local/rvm/bin/rvm install ruby-3.2.2 for p in archives examples gem-cache log src; do touch /usr/local/rvm/${p}/.tar_exclude diff --git a/.gitlab/ci/docker/debian10/iwyu_packages.lst b/.gitlab/ci/docker/debian12-x86_64/iwyu_packages.lst similarity index 61% rename from .gitlab/ci/docker/debian10/iwyu_packages.lst rename to .gitlab/ci/docker/debian12-x86_64/iwyu_packages.lst index 9e291c9b046..2dbddba9f84 100644 --- a/.gitlab/ci/docker/debian10/iwyu_packages.lst +++ b/.gitlab/ci/docker/debian12-x86_64/iwyu_packages.lst @@ -1,7 +1,7 @@ # Install development tools. -clang-6.0 -libclang-6.0-dev -llvm-6.0-dev +clang-15 +libclang-15-dev +llvm-15-dev libz-dev g++ cmake diff --git a/.gitlab/ci/docker/debian10/rvm_packages.lst b/.gitlab/ci/docker/debian12-x86_64/rvm_packages.lst similarity index 100% rename from .gitlab/ci/docker/debian10/rvm_packages.lst rename to .gitlab/ci/docker/debian12-x86_64/rvm_packages.lst From 09db788636d3fccf23b6a670b4630b905eb24f2a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Jul 2023 13:16:27 -0400 Subject: [PATCH 178/627] ci: use Debian 12 images and environments --- .gitlab-ci.yml | 32 +++++------ ... configure_debian12_aarch64_extdeps.cmake} | 0 ...=> configure_debian12_aarch64_ninja.cmake} | 11 ++-- ...cmake => configure_debian12_extdeps.cmake} | 0 ...yu.cmake => configure_debian12_iwyu.cmake} | 2 +- ... configure_debian12_makefiles_clang.cmake} | 0 ...onfigure_debian12_makefiles_inplace.cmake} | 0 ...a.cmake => configure_debian12_ninja.cmake} | 14 ++--- ...e => configure_debian12_ninja_clang.cmake} | 0 .gitlab/ci/env_debian10_makefiles_clang.sh | 2 - .gitlab/ci/env_debian10_ninja_clang.sh | 2 - ...eps.sh => env_debian12_aarch64_extdeps.sh} | 0 ...n10_extdeps.sh => env_debian12_extdeps.sh} | 0 .gitlab/ci/env_debian12_makefiles_clang.sh | 2 + ...ebian10_ninja.sh => env_debian12_ninja.sh} | 2 +- .gitlab/ci/env_debian12_ninja_clang.sh | 2 + .gitlab/os-linux.yml | 56 +++++++++---------- 17 files changed, 59 insertions(+), 66 deletions(-) rename .gitlab/ci/{configure_debian10_aarch64_extdeps.cmake => configure_debian12_aarch64_extdeps.cmake} (100%) rename .gitlab/ci/{configure_debian10_aarch64_ninja.cmake => configure_debian12_aarch64_ninja.cmake} (90%) rename .gitlab/ci/{configure_debian10_extdeps.cmake => configure_debian12_extdeps.cmake} (100%) rename .gitlab/ci/{configure_debian10_iwyu.cmake => configure_debian12_iwyu.cmake} (72%) rename .gitlab/ci/{configure_debian10_makefiles_clang.cmake => configure_debian12_makefiles_clang.cmake} (100%) rename .gitlab/ci/{configure_debian10_makefiles_inplace.cmake => configure_debian12_makefiles_inplace.cmake} (100%) rename .gitlab/ci/{configure_debian10_ninja.cmake => configure_debian12_ninja.cmake} (88%) rename .gitlab/ci/{configure_debian10_ninja_clang.cmake => configure_debian12_ninja_clang.cmake} (100%) delete mode 100644 .gitlab/ci/env_debian10_makefiles_clang.sh delete mode 100644 .gitlab/ci/env_debian10_ninja_clang.sh rename .gitlab/ci/{env_debian10_aarch64_extdeps.sh => env_debian12_aarch64_extdeps.sh} (100%) rename .gitlab/ci/{env_debian10_extdeps.sh => env_debian12_extdeps.sh} (100%) create mode 100644 .gitlab/ci/env_debian12_makefiles_clang.sh rename .gitlab/ci/{env_debian10_ninja.sh => env_debian12_ninja.sh} (90%) create mode 100644 .gitlab/ci/env_debian12_ninja_clang.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d8806c3b496..864ee2edfc5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -96,9 +96,9 @@ l:codespell: - .linux_x86_64_tags - .run_automatically -l:iwyu-debian10: +l:iwyu-debian12: extends: - - .debian10_iwyu + - .debian12_iwyu - .cmake_build_linux - .linux_x86_64_tags - .run_automatically @@ -153,9 +153,9 @@ b:centos7-aarch64: CMAKE_CI_ARTIFACTS_NAME: "artifacts-centos7-aarch64" CMAKE_CI_NO_MR: "true" -t:debian10-ninja: +t:debian12-ninja: extends: - - .debian10_ninja + - .debian12_ninja - .cmake_test_linux_release - .linux_x86_64_tags - .cmake_junit_artifacts @@ -164,9 +164,9 @@ t:debian10-ninja: variables: CMAKE_CI_JOB_NIGHTLY_NINJA: "true" -t:debian10-aarch64-ninja: +t:debian12-aarch64-ninja: extends: - - .debian10_aarch64_ninja + - .debian12_aarch64_ninja - .cmake_test_linux_release - .linux_aarch64_tags - .cmake_junit_artifacts @@ -175,9 +175,9 @@ t:debian10-aarch64-ninja: variables: CMAKE_CI_NO_MR: "true" -t:debian10-ninja-clang: +t:debian12-ninja-clang: extends: - - .debian10_ninja_clang + - .debian12_ninja_clang - .cmake_test_linux_release - .linux_x86_64_tags - .run_dependent @@ -185,9 +185,9 @@ t:debian10-ninja-clang: variables: CMAKE_CI_JOB_NIGHTLY: "true" -t:debian10-makefiles-clang: +t:debian12-makefiles-clang: extends: - - .debian10_makefiles_clang + - .debian12_makefiles_clang - .cmake_test_linux_release - .linux_x86_64_tags - .run_dependent @@ -354,27 +354,27 @@ b:fedora38-ninja: variables: CMAKE_CI_JOB_CONTINUOUS: "true" -b:debian10-makefiles-inplace: +b:debian12-makefiles-inplace: extends: - - .debian10_makefiles_inplace + - .debian12_makefiles_inplace - .cmake_build_linux_standalone - .linux_x86_64_tags - .run_manually variables: CMAKE_CI_JOB_NIGHTLY: "true" -b:debian10-extdeps: +b:debian12-extdeps: extends: - - .debian10_extdeps + - .debian12_extdeps - .cmake_build_linux_standalone - .linux_x86_64_tags - .run_manually variables: CMAKE_CI_JOB_NIGHTLY: "true" -b:debian10-aarch64-extdeps: +b:debian12-aarch64-extdeps: extends: - - .debian10_aarch64_extdeps + - .debian12_aarch64_extdeps - .cmake_build_linux_standalone - .linux_aarch64_tags - .run_manually diff --git a/.gitlab/ci/configure_debian10_aarch64_extdeps.cmake b/.gitlab/ci/configure_debian12_aarch64_extdeps.cmake similarity index 100% rename from .gitlab/ci/configure_debian10_aarch64_extdeps.cmake rename to .gitlab/ci/configure_debian12_aarch64_extdeps.cmake diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian12_aarch64_ninja.cmake similarity index 90% rename from .gitlab/ci/configure_debian10_aarch64_ninja.cmake rename to .gitlab/ci/configure_debian12_aarch64_ninja.cmake index 91d4632f72e..5b97e4f4ee5 100644 --- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake +++ b/.gitlab/ci/configure_debian12_aarch64_ninja.cmake @@ -28,14 +28,14 @@ set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5 "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_MPICH_C_COMPILER "/usr/bin/h5pcc.mpich" CACHE FILEPATH "") set(CMake_TEST_FindHDF5_MPICH_C_COMPILER_EXPLICIT "ON" CACHE BOOL "") -# set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER "/usr/bin/h5c++.mpich" CACHE FILEPATH "") # h5c++.mpich does not exist -# set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "") +set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER "/usr/bin/h5c++.mpich" CACHE FILEPATH "") +set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_MPICH_Fortran_COMPILER "/usr/bin/h5pfc.mpich" CACHE FILEPATH "") set(CMake_TEST_FindHDF5_MPICH_Fortran_COMPILER_EXPLICIT "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_OpenMPI_C_COMPILER "/usr/bin/h5pcc.openmpi" CACHE FILEPATH "") set(CMake_TEST_FindHDF5_OpenMPI_C_COMPILER_EXPLICIT "ON" CACHE BOOL "") -# set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER "/usr/bin/h5c++.openmpi" CACHE FILEPATH "") # h5c++.openmpi does not exist -# set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "") +set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER "/usr/bin/h5c++.openmpi" CACHE FILEPATH "") +set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_OpenMPI_Fortran_COMPILER "/usr/bin/h5pfc.openmpi" CACHE FILEPATH "") set(CMake_TEST_FindHDF5_OpenMPI_Fortran_COMPILER_EXPLICIT "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_Serial_C_COMPILER "/usr/bin/h5cc" CACHE FILEPATH "") @@ -74,11 +74,8 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "") set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "") -set(CMake_TEST_FindPython2 "ON" CACHE BOOL "") set(CMake_TEST_FindPython3 "ON" CACHE BOOL "") -set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") set(CMake_TEST_FindPython3_NumPy "ON" CACHE BOOL "") -set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "") set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "") set(CMake_TEST_FindRuby "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_extdeps.cmake b/.gitlab/ci/configure_debian12_extdeps.cmake similarity index 100% rename from .gitlab/ci/configure_debian10_extdeps.cmake rename to .gitlab/ci/configure_debian12_extdeps.cmake diff --git a/.gitlab/ci/configure_debian10_iwyu.cmake b/.gitlab/ci/configure_debian12_iwyu.cmake similarity index 72% rename from .gitlab/ci/configure_debian10_iwyu.cmake rename to .gitlab/ci/configure_debian12_iwyu.cmake index abe750d3de2..ff6db60b518 100644 --- a/.gitlab/ci/configure_debian10_iwyu.cmake +++ b/.gitlab/ci/configure_debian12_iwyu.cmake @@ -1,6 +1,6 @@ set(CMake_RUN_IWYU ON CACHE BOOL "") # Uncomment to diagnose IWYU problems as needed. #set(CMake_IWYU_VERBOSE ON CACHE BOOL "") -set(IWYU_COMMAND "/usr/bin/include-what-you-use-6.0" CACHE FILEPATH "") +set(IWYU_COMMAND "/usr/bin/include-what-you-use-15" CACHE FILEPATH "") include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/configure_debian10_makefiles_clang.cmake b/.gitlab/ci/configure_debian12_makefiles_clang.cmake similarity index 100% rename from .gitlab/ci/configure_debian10_makefiles_clang.cmake rename to .gitlab/ci/configure_debian12_makefiles_clang.cmake diff --git a/.gitlab/ci/configure_debian10_makefiles_inplace.cmake b/.gitlab/ci/configure_debian12_makefiles_inplace.cmake similarity index 100% rename from .gitlab/ci/configure_debian10_makefiles_inplace.cmake rename to .gitlab/ci/configure_debian12_makefiles_inplace.cmake diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian12_ninja.cmake similarity index 88% rename from .gitlab/ci/configure_debian10_ninja.cmake rename to .gitlab/ci/configure_debian12_ninja.cmake index 0576d1137de..f70e3d5cbd7 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian12_ninja.cmake @@ -32,14 +32,14 @@ set(CMake_TEST_FindGTK2 "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5 "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_MPICH_C_COMPILER "/usr/bin/h5pcc.mpich" CACHE FILEPATH "") set(CMake_TEST_FindHDF5_MPICH_C_COMPILER_EXPLICIT "ON" CACHE BOOL "") -# set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER "/usr/bin/h5c++.mpich" CACHE FILEPATH "") # h5c++.mpich does not exist -# set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "") +set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER "/usr/bin/h5c++.mpich" CACHE FILEPATH "") +set(CMake_TEST_FindHDF5_MPICH_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_MPICH_Fortran_COMPILER "/usr/bin/h5pfc.mpich" CACHE FILEPATH "") set(CMake_TEST_FindHDF5_MPICH_Fortran_COMPILER_EXPLICIT "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_OpenMPI_C_COMPILER "/usr/bin/h5pcc.openmpi" CACHE FILEPATH "") set(CMake_TEST_FindHDF5_OpenMPI_C_COMPILER_EXPLICIT "ON" CACHE BOOL "") -# set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER "/usr/bin/h5c++.openmpi" CACHE FILEPATH "") # h5c++.openmpi does not exist -# set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "") +set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER "/usr/bin/h5c++.openmpi" CACHE FILEPATH "") +set(CMake_TEST_FindHDF5_OpenMPI_CXX_COMPILER_EXPLICIT "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_OpenMPI_Fortran_COMPILER "/usr/bin/h5pfc.openmpi" CACHE FILEPATH "") set(CMake_TEST_FindHDF5_OpenMPI_Fortran_COMPILER_EXPLICIT "ON" CACHE BOOL "") set(CMake_TEST_FindHDF5_Serial_C_COMPILER "/usr/bin/h5cc" CACHE FILEPATH "") @@ -78,12 +78,8 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "") set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "") -set(CMake_TEST_FindPython2 "ON" CACHE BOOL "") set(CMake_TEST_FindPython3 "ON" CACHE BOOL "") -set(CMake_TEST_FindPython2_IronPython "ON" CACHE BOOL "") -set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") -set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") -set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_IronPython "ON" CACHE BOOL "") set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "") set(CMake_TEST_FindRuby "ON" CACHE BOOL "") set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_ninja_clang.cmake b/.gitlab/ci/configure_debian12_ninja_clang.cmake similarity index 100% rename from .gitlab/ci/configure_debian10_ninja_clang.cmake rename to .gitlab/ci/configure_debian12_ninja_clang.cmake diff --git a/.gitlab/ci/env_debian10_makefiles_clang.sh b/.gitlab/ci/env_debian10_makefiles_clang.sh deleted file mode 100644 index e0d5d6105b3..00000000000 --- a/.gitlab/ci/env_debian10_makefiles_clang.sh +++ /dev/null @@ -1,2 +0,0 @@ -export CC=/usr/bin/clang-7 -export CXX=/usr/bin/clang++-7 diff --git a/.gitlab/ci/env_debian10_ninja_clang.sh b/.gitlab/ci/env_debian10_ninja_clang.sh deleted file mode 100644 index e0d5d6105b3..00000000000 --- a/.gitlab/ci/env_debian10_ninja_clang.sh +++ /dev/null @@ -1,2 +0,0 @@ -export CC=/usr/bin/clang-7 -export CXX=/usr/bin/clang++-7 diff --git a/.gitlab/ci/env_debian10_aarch64_extdeps.sh b/.gitlab/ci/env_debian12_aarch64_extdeps.sh similarity index 100% rename from .gitlab/ci/env_debian10_aarch64_extdeps.sh rename to .gitlab/ci/env_debian12_aarch64_extdeps.sh diff --git a/.gitlab/ci/env_debian10_extdeps.sh b/.gitlab/ci/env_debian12_extdeps.sh similarity index 100% rename from .gitlab/ci/env_debian10_extdeps.sh rename to .gitlab/ci/env_debian12_extdeps.sh diff --git a/.gitlab/ci/env_debian12_makefiles_clang.sh b/.gitlab/ci/env_debian12_makefiles_clang.sh new file mode 100644 index 00000000000..eda7c1fa818 --- /dev/null +++ b/.gitlab/ci/env_debian12_makefiles_clang.sh @@ -0,0 +1,2 @@ +export CC=/usr/bin/clang-15 +export CXX=/usr/bin/clang++-15 diff --git a/.gitlab/ci/env_debian10_ninja.sh b/.gitlab/ci/env_debian12_ninja.sh similarity index 90% rename from .gitlab/ci/env_debian10_ninja.sh rename to .gitlab/ci/env_debian12_ninja.sh index ba8ad479dd1..b2b471dd289 100644 --- a/.gitlab/ci/env_debian10_ninja.sh +++ b/.gitlab/ci/env_debian12_ninja.sh @@ -1,4 +1,4 @@ -export MY_RUBY_HOME="/usr/local/rvm/rubies/ruby-2.7.0" +export MY_RUBY_HOME="/usr/local/rvm/rubies/ruby-3.2.2" if test -z "$CI_MERGE_REQUEST_ID"; then curl -L -O "https://download.swift.org/swift-5.7.1-release/ubuntu1804/swift-5.7.1-RELEASE/swift-5.7.1-RELEASE-ubuntu18.04.tar.gz" diff --git a/.gitlab/ci/env_debian12_ninja_clang.sh b/.gitlab/ci/env_debian12_ninja_clang.sh new file mode 100644 index 00000000000..eda7c1fa818 --- /dev/null +++ b/.gitlab/ci/env_debian12_ninja_clang.sh @@ -0,0 +1,2 @@ +export CC=/usr/bin/clang-15 +export CXX=/usr/bin/clang++-15 diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 79217eeaff2..def66dee3fa 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -44,23 +44,23 @@ ### Debian -.debian10: - image: "kitware/cmake:ci-debian10-x86_64-2023-03-29" +.debian12: + image: "kitware/cmake:ci-debian12-x86_64-2023-07-27" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" CMAKE_ARCH: x86_64 -.debian10_iwyu: - extends: .debian10 +.debian12_iwyu: + extends: .debian12 variables: - CMAKE_CONFIGURATION: debian10_iwyu + CMAKE_CONFIGURATION: debian12_iwyu CTEST_NO_WARNINGS_ALLOWED: 1 CMAKE_CI_NO_INSTALL: 1 -.debian10_aarch64: - image: "kitware/cmake:ci-debian10-aarch64-2023-03-29" +.debian12_aarch64: + image: "kitware/cmake:ci-debian12-aarch64-2023-07-27" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" @@ -112,44 +112,44 @@ #### Build and test -.debian10_ninja: - extends: .debian10 +.debian12_ninja: + extends: .debian12 variables: - CMAKE_CONFIGURATION: debian10_ninja + CMAKE_CONFIGURATION: debian12_ninja CTEST_NO_WARNINGS_ALLOWED: 1 -.debian10_aarch64_ninja: - extends: .debian10_aarch64 +.debian12_aarch64_ninja: + extends: .debian12_aarch64 variables: - CMAKE_CONFIGURATION: debian10_aarch64_ninja + CMAKE_CONFIGURATION: debian12_aarch64_ninja CTEST_NO_WARNINGS_ALLOWED: 1 -.debian10_makefiles_inplace: - extends: .debian10 +.debian12_makefiles_inplace: + extends: .debian12 variables: - CMAKE_CONFIGURATION: debian10_makefiles_inplace + CMAKE_CONFIGURATION: debian12_makefiles_inplace CMAKE_GENERATOR: "Unix Makefiles" CMAKE_CI_BOOTSTRAP: 1 CMAKE_CI_INPLACE: 1 CMAKE_CI_NO_INSTALL: 1 CTEST_NO_WARNINGS_ALLOWED: 1 -.debian10_extdeps: - extends: .debian10 +.debian12_extdeps: + extends: .debian12 variables: - CMAKE_CONFIGURATION: debian10_extdeps + CMAKE_CONFIGURATION: debian12_extdeps CMAKE_CI_BUILD_TYPE: Release CTEST_NO_WARNINGS_ALLOWED: 1 -.debian10_aarch64_extdeps: - extends: .debian10_aarch64 +.debian12_aarch64_extdeps: + extends: .debian12_aarch64 variables: - CMAKE_CONFIGURATION: debian10_aarch64_extdeps + CMAKE_CONFIGURATION: debian12_aarch64_extdeps CMAKE_CI_BUILD_TYPE: Release CTEST_NO_WARNINGS_ALLOWED: 1 @@ -187,18 +187,18 @@ ### Clang Compiler -.debian10_makefiles_clang: - extends: .debian10 +.debian12_makefiles_clang: + extends: .debian12 variables: - CMAKE_CONFIGURATION: debian10_makefiles_clang + CMAKE_CONFIGURATION: debian12_makefiles_clang CMAKE_GENERATOR: "Unix Makefiles" -.debian10_ninja_clang: - extends: .debian10 +.debian12_ninja_clang: + extends: .debian12 variables: - CMAKE_CONFIGURATION: debian10_ninja_clang + CMAKE_CONFIGURATION: debian12_ninja_clang .fedora38_makefiles_clang: extends: .fedora38 From 241ee252ce0fadeacfb1c6349b5838708e3a4e35 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Jul 2023 13:17:31 -0400 Subject: [PATCH 179/627] IWYU: Update for Debian 12 CI job `include-what-you-use` diagnostics, in practice, are specific to the environment's compiler and standard library. Update includes to satisfy IWYU for our CI job under Debian 12. --- .gitlab/ci/configure_debian12_iwyu.cmake | 1 + Source/CTest/cmCTestBZR.cxx | 1 - Source/CTest/cmCTestBuildHandler.cxx | 1 + Source/CTest/cmCTestCVS.cxx | 1 - Source/CTest/cmCTestConfigureCommand.cxx | 1 + Source/CTest/cmCTestCoverageHandler.cxx | 2 + Source/CTest/cmCTestGIT.cxx | 1 - Source/CTest/cmCTestHG.cxx | 1 - Source/CTest/cmCTestMemCheckHandler.cxx | 1 + Source/CTest/cmCTestP4.cxx | 1 - Source/CTest/cmCTestSVN.cxx | 1 - Source/CTest/cmCTestTestCommand.cxx | 1 + Source/CTest/cmCTestTestHandler.cxx | 1 + Source/CTest/cmCTestTestHandler.h | 2 +- Source/CTest/cmParseGTMCoverage.cxx | 1 - Source/CTest/cmProcess.cxx | 1 + .../cmCursesCacheEntryComposite.cxx | 1 + .../LexerParser/cmCommandArgumentParser.cxx | 105 +- Source/LexerParser/cmCommandArgumentParser.y | 1 - Source/LexerParser/cmDependsJavaParser.cxx | 1431 ++++++++--------- Source/LexerParser/cmDependsJavaParser.y | 1 - Source/LexerParser/cmExprParser.cxx | 105 +- Source/LexerParser/cmExprParser.y | 1 - Source/LexerParser/cmGccDepfileLexer.cxx | 33 +- Source/LexerParser/cmGccDepfileLexer.h | 7 +- Source/cmBinUtilsMacOSMachOLinker.cxx | 1 - Source/cmBlockCommand.cxx | 3 +- .../cmCMakeHostSystemInformationCommand.cxx | 1 + Source/cmCMakeLanguageCommand.cxx | 3 +- Source/cmCMakePresetsGraph.cxx | 1 + Source/cmCMakePresetsGraph.h | 4 +- ...kePresetsGraphReadJSONConfigurePresets.cxx | 3 +- ...MakePresetsGraphReadJSONPackagePresets.cxx | 1 - ...cmCMakePresetsGraphReadJSONTestPresets.cxx | 1 - ...akePresetsGraphReadJSONWorkflowPresets.cxx | 1 - Source/cmCPackPropertiesGenerator.cxx | 1 + Source/cmCTest.cxx | 1 + Source/cmCommonTargetGenerator.cxx | 1 + Source/cmComputeLinkDepends.cxx | 1 + Source/cmConditionEvaluator.h | 2 +- Source/cmCoreTryCompile.cxx | 1 - Source/cmCxxModuleMapper.h | 3 +- Source/cmDebuggerAdapter.h | 2 +- Source/cmDebuggerBreakpointManager.cxx | 1 - Source/cmDebuggerBreakpointManager.h | 6 +- Source/cmDebuggerExceptionManager.h | 3 +- Source/cmDebuggerProtocol.h | 2 +- Source/cmDebuggerVariablesHelper.cxx | 1 + Source/cmDebuggerVariablesManager.h | 9 +- Source/cmDefinitions.cxx | 1 - Source/cmDefinitions.h | 1 - Source/cmDependsCompiler.cxx | 1 - Source/cmDependsFortran.cxx | 1 + Source/cmDocumentationFormatter.cxx | 2 +- Source/cmDocumentationFormatter.h | 1 + Source/cmExportBuildAndroidMKGenerator.cxx | 1 + Source/cmExportBuildAndroidMKGenerator.h | 1 - Source/cmExportInstallAndroidMKGenerator.h | 1 - Source/cmExportLibraryDependenciesCommand.cxx | 1 + Source/cmExportTryCompileFileGenerator.cxx | 2 - Source/cmFileAPI.cxx | 1 - Source/cmFileAPICodemodel.cxx | 1 - Source/cmFileTime.cxx | 1 - Source/cmFindBase.cxx | 1 + Source/cmFindPackageCommand.cxx | 1 - Source/cmGccDepfileLexerHelper.cxx | 1 - Source/cmGeneratedFileStream.cxx | 1 + Source/cmGeneratorExpressionParser.h | 3 +- Source/cmGeneratorTarget.cxx | 1 + Source/cmGeneratorTarget.h | 2 +- Source/cmGhsMultiTargetGenerator.cxx | 1 + Source/cmGlobalGenerator.cxx | 3 + Source/cmGlobalGenerator.h | 8 +- Source/cmGlobalNinjaGenerator.cxx | 1 + Source/cmInstallCxxModuleBmiGenerator.cxx | 1 + Source/cmInstallCxxModuleBmiGenerator.h | 1 - Source/cmInstallDirectoryGenerator.h | 1 - Source/cmInstallExportGenerator.cxx | 1 + Source/cmInstallExportGenerator.h | 1 - Source/cmInstallFileSetGenerator.h | 1 - Source/cmInstallFilesGenerator.h | 1 - ...InstallGetRuntimeDependenciesGenerator.cxx | 1 + ...cmInstallGetRuntimeDependenciesGenerator.h | 1 - ...InstallImportedRuntimeArtifactsGenerator.h | 1 - .../cmInstallRuntimeDependencySetGenerator.h | 1 - Source/cmInstallScriptGenerator.h | 1 - Source/cmInstallTargetGenerator.cxx | 1 + Source/cmInstallTargetGenerator.h | 1 - Source/cmInstalledFile.h | 3 +- Source/cmJSONState.cxx | 3 +- Source/cmJSONState.h | 1 - Source/cmLocalGenerator.cxx | 2 + Source/cmLocalGenerator.h | 4 +- Source/cmLocalNinjaGenerator.cxx | 2 + Source/cmMakefile.cxx | 1 + Source/cmMakefile.h | 8 +- Source/cmMakefileProfilingData.cxx | 1 - Source/cmMessenger.cxx | 1 + Source/cmMessenger.h | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 1 - Source/cmNinjaTargetGenerator.cxx | 1 - Source/cmOrderDirectories.cxx | 1 + Source/cmOutputConverter.cxx | 1 + Source/cmOutputRequiredFilesCommand.cxx | 1 + Source/cmProjectCommand.cxx | 1 - Source/cmQtAutoGenerator.cxx | 2 + Source/cmQtAutoMocUic.cxx | 1 + Source/cmQtAutoRcc.cxx | 1 - Source/cmState.h | 1 - Source/cmStateSnapshot.cxx | 1 + Source/cmStateSnapshot.h | 1 - Source/cmString.hxx | 1 - Source/cmSystemTools.cxx | 2 +- Source/cmSystemTools.h | 2 +- Source/cmTarget.h | 10 +- Source/cmTargetLinkLibrariesCommand.cxx | 1 + Source/cmTransformDepfile.cxx | 1 - Source/cmUVHandlePtr.cxx | 3 + Source/cmUVProcessChain.cxx | 3 - Source/cmUVProcessChain.h | 2 + Source/cmValue.h | 1 - Source/cmVisualStudio10TargetGenerator.cxx | 1 + Source/cmWindowsRegistry.cxx | 1 - Source/cmWindowsRegistry.h | 1 + Source/cmXcFramework.cxx | 1 - Source/cm_codecvt.cxx | 2 + Source/cm_codecvt.hxx | 2 +- Source/cmake.h | 4 +- Tests/CMakeLib/testCMExtAlgorithm.cxx | 1 - Tests/CMakeLib/testEncoding.cxx | 1 + Tests/CMakeLib/testGccDepfileReader.cxx | 1 - Tests/CMakeLib/testList.cxx | 1 - Tests/CMakeLib/testOptional.cxx | 1 - Tests/CMakeLib/testString.cxx | 2 - Tests/CMakeLib/testUVProcessChain.cxx | 1 - Utilities/IWYU/mapping.imp | 74 +- 136 files changed, 950 insertions(+), 1020 deletions(-) diff --git a/.gitlab/ci/configure_debian12_iwyu.cmake b/.gitlab/ci/configure_debian12_iwyu.cmake index ff6db60b518..37ccbf455df 100644 --- a/.gitlab/ci/configure_debian12_iwyu.cmake +++ b/.gitlab/ci/configure_debian12_iwyu.cmake @@ -1,4 +1,5 @@ set(CMake_RUN_IWYU ON CACHE BOOL "") +set(CMake_IWYU_OPTIONS "-DCMAKE_IWYU_FORWARD_STD_HASH" CACHE STRING "") # Uncomment to diagnose IWYU problems as needed. #set(CMake_IWYU_VERBOSE ON CACHE BOOL "") set(IWYU_COMMAND "/usr/bin/include-what-you-use-15" CACHE FILEPATH "") diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 81a866aa26e..246e8117f4b 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -16,7 +16,6 @@ #include "cmCTest.h" #include "cmCTestVC.h" -#include "cmProcessTools.h" #include "cmSystemTools.h" #include "cmXMLParser.h" diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 882b579fff5..00ecf42c5e7 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -3,6 +3,7 @@ #include "cmCTestBuildHandler.h" #include +#include #include #include diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 87ab7625c60..95e898cf8a7 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -10,7 +10,6 @@ #include "cmsys/RegularExpression.hxx" #include "cmCTest.h" -#include "cmProcessTools.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index bae1f540114..e0326a9edf4 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -4,6 +4,7 @@ #include #include +#include #include diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 5c48cbfc84e..2874be7dc5a 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -9,7 +9,9 @@ #include #include #include +#include #include +#include #include #include diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index a6e7ac52c82..5f8cb741585 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -16,7 +16,6 @@ #include "cmCTestVC.h" #include "cmList.h" #include "cmProcessOutput.h" -#include "cmProcessTools.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmValue.h" diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 97b01badbf4..02837ba9df9 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -11,7 +11,6 @@ #include "cmCTest.h" #include "cmCTestVC.h" -#include "cmProcessTools.h" #include "cmSystemTools.h" #include "cmXMLParser.h" diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 6f6a6426a4c..b51de843d3e 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index e22ec4b556b..0e002b9fa6a 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -14,7 +14,6 @@ #include "cmCTest.h" #include "cmCTestVC.h" #include "cmList.h" -#include "cmProcessTools.h" #include "cmRange.h" #include "cmSystemTools.h" diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 4c98fdff31d..91a1177beec 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -13,7 +13,6 @@ #include "cmCTest.h" #include "cmCTestVC.h" -#include "cmProcessTools.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmXMLParser.h" diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index 5488388c820..c717868c36c 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -4,6 +4,7 @@ #include #include +#include #include #include diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 5ac696b86e9..94014a8317e 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 315a5b761c2..3e80c9477ed 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -22,7 +22,7 @@ #include "cmCTest.h" #include "cmCTestGenericHandler.h" #include "cmCTestResourceSpec.h" -#include "cmCTestTypes.h" +#include "cmCTestTypes.h" // IWYU pragma: keep #include "cmDuration.h" #include "cmListFileCache.h" #include "cmValue.h" diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index 14417cc3056..c63b496951d 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -2,7 +2,6 @@ #include #include -#include #include #include "cmsys/Directory.hxx" diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 269b92c01f8..2c809b6e979 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -4,6 +4,7 @@ #include #include +#include #include #include diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index fc5450ef2bc..0b104eae212 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -4,6 +4,7 @@ #include #include +#include #include diff --git a/Source/LexerParser/cmCommandArgumentParser.cxx b/Source/LexerParser/cmCommandArgumentParser.cxx index 4c49e0f9f9a..7ea0b1519e4 100644 --- a/Source/LexerParser/cmCommandArgumentParser.cxx +++ b/Source/LexerParser/cmCommandArgumentParser.cxx @@ -97,7 +97,6 @@ Run bison like this: # include #endif -#include /* Make sure the parser uses standard memory allocation. The default generated parser malloc/free declarations do not work on all platforms. */ @@ -137,7 +136,7 @@ static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message); # endif #endif -#line 141 "cmCommandArgumentParser.cxx" +#line 140 "cmCommandArgumentParser.cxx" # ifndef YY_CAST # ifdef __cplusplus @@ -576,9 +575,9 @@ static const yytype_int8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 102, 102, 108, 111, 116, 119, 124, 127, 132, - 135, 138, 141, 144, 147, 152, 155, 158, 161, 166, - 169, 174, 177, 182, 185 + 0, 101, 101, 107, 110, 115, 118, 123, 126, 131, + 134, 137, 140, 143, 146, 151, 154, 157, 160, 165, + 168, 173, 176, 181, 184 }; #endif @@ -1437,192 +1436,192 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); switch (yyn) { case 2: /* Start: GoalWithOptionalBackSlash */ -#line 102 "cmCommandArgumentParser.y" +#line 101 "cmCommandArgumentParser.y" { (yyval.str) = 0; yyGetParser->SetResult((yyvsp[0].str)); } -#line 1446 "cmCommandArgumentParser.cxx" +#line 1445 "cmCommandArgumentParser.cxx" break; case 3: /* GoalWithOptionalBackSlash: Goal */ -#line 108 "cmCommandArgumentParser.y" +#line 107 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1454 "cmCommandArgumentParser.cxx" +#line 1453 "cmCommandArgumentParser.cxx" break; case 4: /* GoalWithOptionalBackSlash: Goal "\\" */ -#line 111 "cmCommandArgumentParser.y" +#line 110 "cmCommandArgumentParser.y" { (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); } -#line 1462 "cmCommandArgumentParser.cxx" +#line 1461 "cmCommandArgumentParser.cxx" break; case 5: /* Goal: %empty */ -#line 116 "cmCommandArgumentParser.y" +#line 115 "cmCommandArgumentParser.y" { (yyval.str) = 0; } -#line 1470 "cmCommandArgumentParser.cxx" +#line 1469 "cmCommandArgumentParser.cxx" break; case 6: /* Goal: String Goal */ -#line 119 "cmCommandArgumentParser.y" +#line 118 "cmCommandArgumentParser.y" { (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); } -#line 1478 "cmCommandArgumentParser.cxx" +#line 1477 "cmCommandArgumentParser.cxx" break; case 7: /* String: OuterText */ -#line 124 "cmCommandArgumentParser.y" +#line 123 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1486 "cmCommandArgumentParser.cxx" +#line 1485 "cmCommandArgumentParser.cxx" break; case 8: /* String: Variable */ -#line 127 "cmCommandArgumentParser.y" +#line 126 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1494 "cmCommandArgumentParser.cxx" +#line 1493 "cmCommandArgumentParser.cxx" break; case 9: /* OuterText: cal_NAME */ -#line 132 "cmCommandArgumentParser.y" +#line 131 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1502 "cmCommandArgumentParser.cxx" +#line 1501 "cmCommandArgumentParser.cxx" break; case 10: /* OuterText: "@" */ -#line 135 "cmCommandArgumentParser.y" +#line 134 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1510 "cmCommandArgumentParser.cxx" +#line 1509 "cmCommandArgumentParser.cxx" break; case 11: /* OuterText: "$" */ -#line 138 "cmCommandArgumentParser.y" +#line 137 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1518 "cmCommandArgumentParser.cxx" +#line 1517 "cmCommandArgumentParser.cxx" break; case 12: /* OuterText: "{" */ -#line 141 "cmCommandArgumentParser.y" +#line 140 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1526 "cmCommandArgumentParser.cxx" +#line 1525 "cmCommandArgumentParser.cxx" break; case 13: /* OuterText: "}" */ -#line 144 "cmCommandArgumentParser.y" +#line 143 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1534 "cmCommandArgumentParser.cxx" +#line 1533 "cmCommandArgumentParser.cxx" break; case 14: /* OuterText: cal_SYMBOL */ -#line 147 "cmCommandArgumentParser.y" +#line 146 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1542 "cmCommandArgumentParser.cxx" +#line 1541 "cmCommandArgumentParser.cxx" break; case 15: /* Variable: cal_ENVCURLY EnvVarName "}" */ -#line 152 "cmCommandArgumentParser.y" +#line 151 "cmCommandArgumentParser.y" { (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str)); } -#line 1550 "cmCommandArgumentParser.cxx" +#line 1549 "cmCommandArgumentParser.cxx" break; case 16: /* Variable: cal_NCURLY MultipleIds "}" */ -#line 155 "cmCommandArgumentParser.y" +#line 154 "cmCommandArgumentParser.y" { (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str)); } -#line 1558 "cmCommandArgumentParser.cxx" +#line 1557 "cmCommandArgumentParser.cxx" break; case 17: /* Variable: cal_DCURLY MultipleIds "}" */ -#line 158 "cmCommandArgumentParser.y" +#line 157 "cmCommandArgumentParser.y" { (yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str)); } -#line 1566 "cmCommandArgumentParser.cxx" +#line 1565 "cmCommandArgumentParser.cxx" break; case 18: /* Variable: cal_ATNAME */ -#line 161 "cmCommandArgumentParser.y" +#line 160 "cmCommandArgumentParser.y" { (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str)); } -#line 1574 "cmCommandArgumentParser.cxx" +#line 1573 "cmCommandArgumentParser.cxx" break; case 19: /* EnvVarName: MultipleIds */ -#line 166 "cmCommandArgumentParser.y" +#line 165 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1582 "cmCommandArgumentParser.cxx" +#line 1581 "cmCommandArgumentParser.cxx" break; case 20: /* EnvVarName: cal_SYMBOL EnvVarName */ -#line 169 "cmCommandArgumentParser.y" +#line 168 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[-1].str); } -#line 1590 "cmCommandArgumentParser.cxx" +#line 1589 "cmCommandArgumentParser.cxx" break; case 21: /* MultipleIds: %empty */ -#line 174 "cmCommandArgumentParser.y" +#line 173 "cmCommandArgumentParser.y" { (yyval.str) = 0; } -#line 1598 "cmCommandArgumentParser.cxx" +#line 1597 "cmCommandArgumentParser.cxx" break; case 22: /* MultipleIds: ID MultipleIds */ -#line 177 "cmCommandArgumentParser.y" +#line 176 "cmCommandArgumentParser.y" { (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); } -#line 1606 "cmCommandArgumentParser.cxx" +#line 1605 "cmCommandArgumentParser.cxx" break; case 23: /* ID: cal_NAME */ -#line 182 "cmCommandArgumentParser.y" +#line 181 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1614 "cmCommandArgumentParser.cxx" +#line 1613 "cmCommandArgumentParser.cxx" break; case 24: /* ID: Variable */ -#line 185 "cmCommandArgumentParser.y" +#line 184 "cmCommandArgumentParser.y" { (yyval.str) = (yyvsp[0].str); } -#line 1622 "cmCommandArgumentParser.cxx" +#line 1621 "cmCommandArgumentParser.cxx" break; -#line 1626 "cmCommandArgumentParser.cxx" +#line 1625 "cmCommandArgumentParser.cxx" default: break; } @@ -1846,7 +1845,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); return yyresult; } -#line 190 "cmCommandArgumentParser.y" +#line 189 "cmCommandArgumentParser.y" /* End of grammar */ diff --git a/Source/LexerParser/cmCommandArgumentParser.y b/Source/LexerParser/cmCommandArgumentParser.y index 602e1c3fce1..59f4b322b4d 100644 --- a/Source/LexerParser/cmCommandArgumentParser.y +++ b/Source/LexerParser/cmCommandArgumentParser.y @@ -22,7 +22,6 @@ Run bison like this: # include #endif -#include /* Make sure the parser uses standard memory allocation. The default generated parser malloc/free declarations do not work on all platforms. */ diff --git a/Source/LexerParser/cmDependsJavaParser.cxx b/Source/LexerParser/cmDependsJavaParser.cxx index 59cf1be3ddf..6755c708651 100644 --- a/Source/LexerParser/cmDependsJavaParser.cxx +++ b/Source/LexerParser/cmDependsJavaParser.cxx @@ -88,7 +88,6 @@ Run bison like this: #include "cmConfigure.h" // IWYU pragma: keep -#include #include #include #include @@ -126,7 +125,7 @@ static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message); # endif #endif -#line 130 "cmDependsJavaParser.cxx" +#line 129 "cmDependsJavaParser.cxx" # ifndef YY_CAST # ifdef __cplusplus @@ -814,42 +813,42 @@ static const yytype_int8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { - 0, 185, 185, 194, 202, 210, 218, 226, 234, 243, - 251, 260, 268, 277, 282, 287, 292, 297, 302, 307, - 312, 318, 326, 335, 345, 354, 363, 371, 381, 387, - 394, 401, 407, 414, 423, 433, 443, 452, 460, 469, - 478, 484, 493, 499, 508, 514, 523, 535, 543, 552, - 564, 577, 585, 593, 602, 610, 619, 619, 619, 620, - 621, 621, 621, 621, 621, 621, 622, 625, 635, 644, - 653, 662, 672, 678, 687, 696, 705, 713, 722, 731, - 737, 746, 754, 762, 770, 779, 787, 796, 802, 810, - 819, 827, 836, 845, 854, 862, 871, 879, 887, 896, - 905, 915, 922, 932, 942, 949, 956, 959, 965, 975, - 985, 995, 1001, 1011, 1021, 1031, 1040, 1050, 1061, 1071, - 1078, 1088, 1097, 1107, 1116, 1126, 1132, 1142, 1151, 1161, - 1171, 1178, 1187, 1196, 1205, 1214, 1222, 1231, 1240, 1250, - 1260, 1269, 1279, 1289, 1296, 1305, 1315, 1324, 1334, 1343, - 1350, 1360, 1369, 1379, 1388, 1397, 1407, 1417, 1426, 1436, - 1445, 1454, 1463, 1472, 1481, 1491, 1500, 1509, 1518, 1527, - 1537, 1546, 1555, 1564, 1573, 1582, 1591, 1600, 1609, 1618, - 1627, 1636, 1646, 1656, 1667, 1677, 1687, 1696, 1705, 1714, - 1723, 1732, 1741, 1751, 1761, 1771, 1781, 1788, 1795, 1802, - 1812, 1819, 1829, 1839, 1848, 1858, 1867, 1877, 1884, 1891, - 1898, 1906, 1913, 1923, 1930, 1940, 1950, 1957, 1967, 1976, - 1986, 1996, 2005, 2015, 2024, 2034, 2045, 2052, 2059, 2070, - 2080, 2090, 2100, 2109, 2119, 2126, 2136, 2145, 2155, 2162, - 2172, 2181, 2191, 2200, 2206, 2215, 2224, 2233, 2242, 2252, - 2262, 2269, 2279, 2286, 2296, 2305, 2315, 2324, 2333, 2342, - 2352, 2359, 2369, 2378, 2388, 2398, 2404, 2411, 2421, 2431, - 2441, 2452, 2462, 2473, 2483, 2494, 2504, 2514, 2523, 2532, - 2541, 2550, 2560, 2570, 2580, 2589, 2598, 2607, 2616, 2626, - 2636, 2646, 2655, 2664, 2673, 2683, 2692, 2701, 2708, 2717, - 2726, 2735, 2745, 2754, 2763, 2773, 2782, 2791, 2800, 2810, - 2819, 2828, 2837, 2846, 2855, 2865, 2874, 2883, 2893, 2902, - 2912, 2921, 2931, 2940, 2950, 2959, 2969, 2978, 2988, 2997, - 3007, 3016, 3026, 3036, 3046, 3055, 3065, 3074, 3083, 3092, - 3101, 3110, 3119, 3128, 3137, 3146, 3155, 3164, 3174, 3184, - 3194, 3203 + 0, 184, 184, 193, 201, 209, 217, 225, 233, 242, + 250, 259, 267, 276, 281, 286, 291, 296, 301, 306, + 311, 317, 325, 334, 344, 353, 362, 370, 380, 386, + 393, 400, 406, 413, 422, 432, 442, 451, 459, 468, + 477, 483, 492, 498, 507, 513, 522, 534, 542, 551, + 563, 576, 584, 592, 601, 609, 618, 618, 618, 619, + 620, 620, 620, 620, 620, 620, 621, 624, 634, 643, + 652, 661, 671, 677, 686, 695, 704, 712, 721, 730, + 736, 745, 753, 761, 769, 778, 786, 795, 801, 809, + 818, 826, 835, 844, 853, 861, 870, 878, 886, 895, + 904, 914, 921, 931, 941, 948, 955, 958, 964, 974, + 984, 994, 1000, 1010, 1020, 1030, 1039, 1049, 1060, 1070, + 1077, 1087, 1096, 1106, 1115, 1125, 1131, 1141, 1150, 1160, + 1170, 1177, 1186, 1195, 1204, 1213, 1221, 1230, 1239, 1249, + 1259, 1268, 1278, 1288, 1295, 1304, 1314, 1323, 1333, 1342, + 1349, 1359, 1368, 1378, 1387, 1396, 1406, 1416, 1425, 1435, + 1444, 1453, 1462, 1471, 1480, 1490, 1499, 1508, 1517, 1526, + 1536, 1545, 1554, 1563, 1572, 1581, 1590, 1599, 1608, 1617, + 1626, 1635, 1645, 1655, 1666, 1676, 1686, 1695, 1704, 1713, + 1722, 1731, 1740, 1750, 1760, 1770, 1780, 1787, 1794, 1801, + 1811, 1818, 1828, 1838, 1847, 1857, 1866, 1876, 1883, 1890, + 1897, 1905, 1912, 1922, 1929, 1939, 1949, 1956, 1966, 1975, + 1985, 1995, 2004, 2014, 2023, 2033, 2044, 2051, 2058, 2069, + 2079, 2089, 2099, 2108, 2118, 2125, 2135, 2144, 2154, 2161, + 2171, 2180, 2190, 2199, 2205, 2214, 2223, 2232, 2241, 2251, + 2261, 2268, 2278, 2285, 2295, 2304, 2314, 2323, 2332, 2341, + 2351, 2358, 2368, 2377, 2387, 2397, 2403, 2410, 2420, 2430, + 2440, 2451, 2461, 2472, 2482, 2493, 2503, 2513, 2522, 2531, + 2540, 2549, 2559, 2569, 2579, 2588, 2597, 2606, 2615, 2625, + 2635, 2645, 2654, 2663, 2672, 2682, 2691, 2700, 2707, 2716, + 2725, 2734, 2744, 2753, 2762, 2772, 2781, 2790, 2799, 2809, + 2818, 2827, 2836, 2845, 2854, 2864, 2873, 2882, 2892, 2901, + 2911, 2920, 2930, 2939, 2949, 2958, 2968, 2977, 2987, 2996, + 3006, 3015, 3025, 3035, 3045, 3054, 3064, 3073, 3082, 3091, + 3100, 3109, 3118, 3127, 3136, 3145, 3154, 3163, 3173, 3183, + 3193, 3202 }; #endif @@ -2470,214 +2469,214 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); switch (yyn) { case 2: /* Goal: CompilationUnit */ -#line 186 "cmDependsJavaParser.y" +#line 185 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2481 "cmDependsJavaParser.cxx" +#line 2480 "cmDependsJavaParser.cxx" break; case 3: /* Literal: IntegerLiteral */ -#line 195 "cmDependsJavaParser.y" +#line 194 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2492 "cmDependsJavaParser.cxx" +#line 2491 "cmDependsJavaParser.cxx" break; case 4: /* Literal: jp_FLOATINGPOINTLITERAL */ -#line 203 "cmDependsJavaParser.y" +#line 202 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2503 "cmDependsJavaParser.cxx" +#line 2502 "cmDependsJavaParser.cxx" break; case 5: /* Literal: jp_BOOLEANLITERAL */ -#line 211 "cmDependsJavaParser.y" +#line 210 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2514 "cmDependsJavaParser.cxx" +#line 2513 "cmDependsJavaParser.cxx" break; case 6: /* Literal: jp_CHARACTERLITERAL */ -#line 219 "cmDependsJavaParser.y" +#line 218 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2525 "cmDependsJavaParser.cxx" +#line 2524 "cmDependsJavaParser.cxx" break; case 7: /* Literal: jp_STRINGLITERAL */ -#line 227 "cmDependsJavaParser.y" +#line 226 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2536 "cmDependsJavaParser.cxx" +#line 2535 "cmDependsJavaParser.cxx" break; case 8: /* Literal: jp_NULLLITERAL */ -#line 235 "cmDependsJavaParser.y" +#line 234 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2547 "cmDependsJavaParser.cxx" +#line 2546 "cmDependsJavaParser.cxx" break; case 9: /* IntegerLiteral: jp_DECIMALINTEGERLITERAL */ -#line 244 "cmDependsJavaParser.y" +#line 243 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2558 "cmDependsJavaParser.cxx" +#line 2557 "cmDependsJavaParser.cxx" break; case 10: /* IntegerLiteral: jp_HEXINTEGERLITERAL */ -#line 252 "cmDependsJavaParser.y" +#line 251 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2569 "cmDependsJavaParser.cxx" +#line 2568 "cmDependsJavaParser.cxx" break; case 11: /* Type: PrimitiveType */ -#line 261 "cmDependsJavaParser.y" +#line 260 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2580 "cmDependsJavaParser.cxx" +#line 2579 "cmDependsJavaParser.cxx" break; case 12: /* Type: ReferenceType */ -#line 269 "cmDependsJavaParser.y" +#line 268 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2591 "cmDependsJavaParser.cxx" +#line 2590 "cmDependsJavaParser.cxx" break; case 13: /* PrimitiveType: jp_BYTE_TYPE */ -#line 278 "cmDependsJavaParser.y" +#line 277 "cmDependsJavaParser.y" { jpElementStart(0); } -#line 2599 "cmDependsJavaParser.cxx" +#line 2598 "cmDependsJavaParser.cxx" break; case 14: /* PrimitiveType: jp_SHORT_TYPE */ -#line 283 "cmDependsJavaParser.y" +#line 282 "cmDependsJavaParser.y" { jpElementStart(0); } -#line 2607 "cmDependsJavaParser.cxx" +#line 2606 "cmDependsJavaParser.cxx" break; case 15: /* PrimitiveType: jp_INT_TYPE */ -#line 288 "cmDependsJavaParser.y" +#line 287 "cmDependsJavaParser.y" { jpElementStart(0); } -#line 2615 "cmDependsJavaParser.cxx" +#line 2614 "cmDependsJavaParser.cxx" break; case 16: /* PrimitiveType: jp_LONG_TYPE */ -#line 293 "cmDependsJavaParser.y" +#line 292 "cmDependsJavaParser.y" { jpElementStart(0); } -#line 2623 "cmDependsJavaParser.cxx" +#line 2622 "cmDependsJavaParser.cxx" break; case 17: /* PrimitiveType: jp_CHAR_TYPE */ -#line 298 "cmDependsJavaParser.y" +#line 297 "cmDependsJavaParser.y" { jpElementStart(0); } -#line 2631 "cmDependsJavaParser.cxx" +#line 2630 "cmDependsJavaParser.cxx" break; case 18: /* PrimitiveType: jp_FLOAT_TYPE */ -#line 303 "cmDependsJavaParser.y" +#line 302 "cmDependsJavaParser.y" { jpElementStart(0); } -#line 2639 "cmDependsJavaParser.cxx" +#line 2638 "cmDependsJavaParser.cxx" break; case 19: /* PrimitiveType: jp_DOUBLE_TYPE */ -#line 308 "cmDependsJavaParser.y" +#line 307 "cmDependsJavaParser.y" { jpElementStart(0); } -#line 2647 "cmDependsJavaParser.cxx" +#line 2646 "cmDependsJavaParser.cxx" break; case 20: /* PrimitiveType: jp_BOOLEAN_TYPE */ -#line 313 "cmDependsJavaParser.y" +#line 312 "cmDependsJavaParser.y" { jpElementStart(0); } -#line 2655 "cmDependsJavaParser.cxx" +#line 2654 "cmDependsJavaParser.cxx" break; case 21: /* ReferenceType: ClassOrInterfaceType */ -#line 319 "cmDependsJavaParser.y" +#line 318 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2666 "cmDependsJavaParser.cxx" +#line 2665 "cmDependsJavaParser.cxx" break; case 22: /* ReferenceType: ArrayType */ -#line 327 "cmDependsJavaParser.y" +#line 326 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2677 "cmDependsJavaParser.cxx" +#line 2676 "cmDependsJavaParser.cxx" break; case 23: /* ClassOrInterfaceType: Name */ -#line 336 "cmDependsJavaParser.y" +#line 335 "cmDependsJavaParser.y" { jpElementStart(1); jpStoreClass((yyvsp[0].str)); @@ -2685,44 +2684,44 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2689 "cmDependsJavaParser.cxx" +#line 2688 "cmDependsJavaParser.cxx" break; case 24: /* ClassType: ClassOrInterfaceType */ -#line 346 "cmDependsJavaParser.y" +#line 345 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2700 "cmDependsJavaParser.cxx" +#line 2699 "cmDependsJavaParser.cxx" break; case 25: /* InterfaceType: ClassOrInterfaceType */ -#line 355 "cmDependsJavaParser.y" +#line 354 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2711 "cmDependsJavaParser.cxx" +#line 2710 "cmDependsJavaParser.cxx" break; case 26: /* ArrayType: PrimitiveType Dims */ -#line 364 "cmDependsJavaParser.y" +#line 363 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2722 "cmDependsJavaParser.cxx" +#line 2721 "cmDependsJavaParser.cxx" break; case 27: /* ArrayType: Name Dims */ -#line 372 "cmDependsJavaParser.y" +#line 371 "cmDependsJavaParser.y" { jpElementStart(2); jpStoreClass((yyvsp[-1].str)); @@ -2730,56 +2729,56 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2734 "cmDependsJavaParser.cxx" +#line 2733 "cmDependsJavaParser.cxx" break; case 28: /* Name: SimpleName */ -#line 382 "cmDependsJavaParser.y" +#line 381 "cmDependsJavaParser.y" { jpElementStart(1); (yyval.str) = (yyvsp[0].str); } -#line 2743 "cmDependsJavaParser.cxx" +#line 2742 "cmDependsJavaParser.cxx" break; case 29: /* Name: QualifiedName */ -#line 388 "cmDependsJavaParser.y" +#line 387 "cmDependsJavaParser.y" { jpElementStart(1); (yyval.str) = (yyvsp[0].str); } -#line 2752 "cmDependsJavaParser.cxx" +#line 2751 "cmDependsJavaParser.cxx" break; case 30: /* SimpleName: Identifier */ -#line 395 "cmDependsJavaParser.y" +#line 394 "cmDependsJavaParser.y" { jpElementStart(1); (yyval.str) = (yyvsp[0].str); } -#line 2761 "cmDependsJavaParser.cxx" +#line 2760 "cmDependsJavaParser.cxx" break; case 31: /* Identifier: jp_NAME */ -#line 402 "cmDependsJavaParser.y" +#line 401 "cmDependsJavaParser.y" { jpElementStart(1); (yyval.str) = (yyvsp[0].str); } -#line 2770 "cmDependsJavaParser.cxx" +#line 2769 "cmDependsJavaParser.cxx" break; case 32: /* Identifier: jp_DOLLAR jp_NAME */ -#line 408 "cmDependsJavaParser.y" +#line 407 "cmDependsJavaParser.y" { jpElementStart(2); (yyval.str) = (yyvsp[0].str); } -#line 2779 "cmDependsJavaParser.cxx" +#line 2778 "cmDependsJavaParser.cxx" break; case 33: /* QualifiedName: Name jp_DOT Identifier */ -#line 415 "cmDependsJavaParser.y" +#line 414 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->AddClassFound((yyvsp[-2].str)); @@ -2787,11 +2786,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->DeallocateParserType(&((yyvsp[-2].str))); (yyval.str) = const_cast(yyGetParser->GetCurrentCombine()); } -#line 2791 "cmDependsJavaParser.cxx" +#line 2790 "cmDependsJavaParser.cxx" break; case 34: /* QualifiedName: Name jp_DOT jp_CLASS */ -#line 424 "cmDependsJavaParser.y" +#line 423 "cmDependsJavaParser.y" { jpElementStart(3); jpStoreClass((yyvsp[-2].str)); @@ -2800,11 +2799,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2804 "cmDependsJavaParser.cxx" +#line 2803 "cmDependsJavaParser.cxx" break; case 35: /* QualifiedName: Name jp_DOT jp_THIS */ -#line 434 "cmDependsJavaParser.y" +#line 433 "cmDependsJavaParser.y" { jpElementStart(3); jpStoreClass((yyvsp[-2].str)); @@ -2813,118 +2812,118 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2817 "cmDependsJavaParser.cxx" +#line 2816 "cmDependsJavaParser.cxx" break; case 36: /* QualifiedName: SimpleType jp_DOT jp_CLASS */ -#line 444 "cmDependsJavaParser.y" +#line 443 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2828 "cmDependsJavaParser.cxx" +#line 2827 "cmDependsJavaParser.cxx" break; case 37: /* SimpleType: PrimitiveType */ -#line 453 "cmDependsJavaParser.y" +#line 452 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2839 "cmDependsJavaParser.cxx" +#line 2838 "cmDependsJavaParser.cxx" break; case 38: /* SimpleType: jp_VOID */ -#line 461 "cmDependsJavaParser.y" +#line 460 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2850 "cmDependsJavaParser.cxx" +#line 2849 "cmDependsJavaParser.cxx" break; case 39: /* CompilationUnit: PackageDeclarationopt ImportDeclarations TypeDeclarations */ -#line 470 "cmDependsJavaParser.y" +#line 469 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2861 "cmDependsJavaParser.cxx" +#line 2860 "cmDependsJavaParser.cxx" break; case 40: /* PackageDeclarationopt: %empty */ -#line 478 "cmDependsJavaParser.y" +#line 477 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2871 "cmDependsJavaParser.cxx" +#line 2870 "cmDependsJavaParser.cxx" break; case 41: /* PackageDeclarationopt: PackageDeclaration */ -#line 485 "cmDependsJavaParser.y" +#line 484 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2882 "cmDependsJavaParser.cxx" +#line 2881 "cmDependsJavaParser.cxx" break; case 42: /* ImportDeclarations: %empty */ -#line 493 "cmDependsJavaParser.y" +#line 492 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2892 "cmDependsJavaParser.cxx" +#line 2891 "cmDependsJavaParser.cxx" break; case 43: /* ImportDeclarations: ImportDeclarations ImportDeclaration */ -#line 500 "cmDependsJavaParser.y" +#line 499 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2903 "cmDependsJavaParser.cxx" +#line 2902 "cmDependsJavaParser.cxx" break; case 44: /* TypeDeclarations: %empty */ -#line 508 "cmDependsJavaParser.y" +#line 507 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2913 "cmDependsJavaParser.cxx" +#line 2912 "cmDependsJavaParser.cxx" break; case 45: /* TypeDeclarations: TypeDeclarations TypeDeclaration */ -#line 515 "cmDependsJavaParser.y" +#line 514 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2924 "cmDependsJavaParser.cxx" +#line 2923 "cmDependsJavaParser.cxx" break; case 46: /* PackageDeclaration: jp_PACKAGE Name jp_SEMICOL */ -#line 524 "cmDependsJavaParser.y" +#line 523 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->SetCurrentPackage((yyvsp[-1].str)); @@ -2934,33 +2933,33 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2938 "cmDependsJavaParser.cxx" +#line 2937 "cmDependsJavaParser.cxx" break; case 47: /* ImportDeclaration: SingleTypeImportDeclaration */ -#line 536 "cmDependsJavaParser.y" +#line 535 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2949 "cmDependsJavaParser.cxx" +#line 2948 "cmDependsJavaParser.cxx" break; case 48: /* ImportDeclaration: TypeImportOnDemandDeclaration */ -#line 544 "cmDependsJavaParser.y" +#line 543 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2960 "cmDependsJavaParser.cxx" +#line 2959 "cmDependsJavaParser.cxx" break; case 49: /* SingleTypeImportDeclaration: jp_IMPORT Name jp_SEMICOL */ -#line 553 "cmDependsJavaParser.y" +#line 552 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->AddPackagesImport((yyvsp[-1].str)); @@ -2970,11 +2969,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2974 "cmDependsJavaParser.cxx" +#line 2973 "cmDependsJavaParser.cxx" break; case 50: /* TypeImportOnDemandDeclaration: jp_IMPORT Name jp_DOT jp_TIMES jp_SEMICOL */ -#line 565 "cmDependsJavaParser.y" +#line 564 "cmDependsJavaParser.y" { jpElementStart(5); std::string str = (yyvsp[-3].str); @@ -2985,77 +2984,77 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2989 "cmDependsJavaParser.cxx" +#line 2988 "cmDependsJavaParser.cxx" break; case 51: /* TypeDeclaration: ClassDeclaration */ -#line 578 "cmDependsJavaParser.y" +#line 577 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3000 "cmDependsJavaParser.cxx" +#line 2999 "cmDependsJavaParser.cxx" break; case 52: /* TypeDeclaration: InterfaceDeclaration */ -#line 586 "cmDependsJavaParser.y" +#line 585 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3011 "cmDependsJavaParser.cxx" +#line 3010 "cmDependsJavaParser.cxx" break; case 53: /* TypeDeclaration: jp_SEMICOL */ -#line 594 "cmDependsJavaParser.y" +#line 593 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3022 "cmDependsJavaParser.cxx" +#line 3021 "cmDependsJavaParser.cxx" break; case 54: /* Modifiers: Modifier */ -#line 603 "cmDependsJavaParser.y" +#line 602 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3033 "cmDependsJavaParser.cxx" +#line 3032 "cmDependsJavaParser.cxx" break; case 55: /* Modifiers: Modifiers Modifier */ -#line 611 "cmDependsJavaParser.y" +#line 610 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3044 "cmDependsJavaParser.cxx" +#line 3043 "cmDependsJavaParser.cxx" break; case 67: /* ClassHeader: Modifiersopt jp_CLASS Identifier */ -#line 626 "cmDependsJavaParser.y" +#line 625 "cmDependsJavaParser.y" { yyGetParser->StartClass((yyvsp[0].str)); jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); } -#line 3055 "cmDependsJavaParser.cxx" +#line 3054 "cmDependsJavaParser.cxx" break; case 68: /* ClassDeclaration: ClassHeader ClassBody */ -#line 636 "cmDependsJavaParser.y" +#line 635 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -3063,11 +3062,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 3067 "cmDependsJavaParser.cxx" +#line 3066 "cmDependsJavaParser.cxx" break; case 69: /* ClassDeclaration: ClassHeader Interfaces ClassBody */ -#line 645 "cmDependsJavaParser.y" +#line 644 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(2); @@ -3075,11 +3074,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 3079 "cmDependsJavaParser.cxx" +#line 3078 "cmDependsJavaParser.cxx" break; case 70: /* ClassDeclaration: ClassHeader Super ClassBody */ -#line 654 "cmDependsJavaParser.y" +#line 653 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -3087,11 +3086,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 3091 "cmDependsJavaParser.cxx" +#line 3090 "cmDependsJavaParser.cxx" break; case 71: /* ClassDeclaration: ClassHeader Super Interfaces ClassBody */ -#line 663 "cmDependsJavaParser.y" +#line 662 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -3099,226 +3098,226 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 3103 "cmDependsJavaParser.cxx" +#line 3102 "cmDependsJavaParser.cxx" break; case 72: /* Modifiersopt: %empty */ -#line 672 "cmDependsJavaParser.y" +#line 671 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3113 "cmDependsJavaParser.cxx" +#line 3112 "cmDependsJavaParser.cxx" break; case 73: /* Modifiersopt: Modifiers */ -#line 679 "cmDependsJavaParser.y" +#line 678 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3124 "cmDependsJavaParser.cxx" +#line 3123 "cmDependsJavaParser.cxx" break; case 74: /* Super: jp_EXTENDS ClassType */ -#line 688 "cmDependsJavaParser.y" +#line 687 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3135 "cmDependsJavaParser.cxx" +#line 3134 "cmDependsJavaParser.cxx" break; case 75: /* Interfaces: jp_IMPLEMENTS InterfaceTypeList */ -#line 697 "cmDependsJavaParser.y" +#line 696 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3146 "cmDependsJavaParser.cxx" +#line 3145 "cmDependsJavaParser.cxx" break; case 76: /* InterfaceTypeList: InterfaceType */ -#line 706 "cmDependsJavaParser.y" +#line 705 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3157 "cmDependsJavaParser.cxx" +#line 3156 "cmDependsJavaParser.cxx" break; case 77: /* InterfaceTypeList: InterfaceTypeList jp_COMMA InterfaceType */ -#line 714 "cmDependsJavaParser.y" +#line 713 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3168 "cmDependsJavaParser.cxx" +#line 3167 "cmDependsJavaParser.cxx" break; case 78: /* ClassBody: jp_CURLYSTART ClassBodyDeclarations jp_CURLYEND */ -#line 723 "cmDependsJavaParser.y" +#line 722 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3179 "cmDependsJavaParser.cxx" +#line 3178 "cmDependsJavaParser.cxx" break; case 79: /* ClassBodyDeclarations: %empty */ -#line 731 "cmDependsJavaParser.y" +#line 730 "cmDependsJavaParser.y" { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3189 "cmDependsJavaParser.cxx" +#line 3188 "cmDependsJavaParser.cxx" break; case 80: /* ClassBodyDeclarations: ClassBodyDeclarations ClassBodyDeclaration */ -#line 738 "cmDependsJavaParser.y" +#line 737 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3200 "cmDependsJavaParser.cxx" +#line 3199 "cmDependsJavaParser.cxx" break; case 81: /* ClassBodyDeclaration: ClassMemberDeclaration */ -#line 747 "cmDependsJavaParser.y" +#line 746 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3211 "cmDependsJavaParser.cxx" +#line 3210 "cmDependsJavaParser.cxx" break; case 82: /* ClassBodyDeclaration: StaticInitializer */ -#line 755 "cmDependsJavaParser.y" +#line 754 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3222 "cmDependsJavaParser.cxx" +#line 3221 "cmDependsJavaParser.cxx" break; case 83: /* ClassBodyDeclaration: ConstructorDeclaration */ -#line 763 "cmDependsJavaParser.y" +#line 762 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3233 "cmDependsJavaParser.cxx" +#line 3232 "cmDependsJavaParser.cxx" break; case 84: /* ClassBodyDeclaration: TypeDeclaration */ -#line 771 "cmDependsJavaParser.y" +#line 770 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3244 "cmDependsJavaParser.cxx" +#line 3243 "cmDependsJavaParser.cxx" break; case 85: /* ClassMemberDeclaration: FieldDeclaration */ -#line 780 "cmDependsJavaParser.y" +#line 779 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3255 "cmDependsJavaParser.cxx" +#line 3254 "cmDependsJavaParser.cxx" break; case 86: /* ClassMemberDeclaration: MethodDeclaration */ -#line 788 "cmDependsJavaParser.y" +#line 787 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3266 "cmDependsJavaParser.cxx" +#line 3265 "cmDependsJavaParser.cxx" break; case 87: /* FieldDeclaration: Modifiersopt Type VariableDeclarators jp_SEMICOL */ -#line 797 "cmDependsJavaParser.y" +#line 796 "cmDependsJavaParser.y" { jpElementStart(4); } -#line 3274 "cmDependsJavaParser.cxx" +#line 3273 "cmDependsJavaParser.cxx" break; case 88: /* VariableDeclarators: VariableDeclarator */ -#line 803 "cmDependsJavaParser.y" +#line 802 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3285 "cmDependsJavaParser.cxx" +#line 3284 "cmDependsJavaParser.cxx" break; case 89: /* VariableDeclarators: VariableDeclarators jp_COMMA VariableDeclarator */ -#line 811 "cmDependsJavaParser.y" +#line 810 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3296 "cmDependsJavaParser.cxx" +#line 3295 "cmDependsJavaParser.cxx" break; case 90: /* VariableDeclarator: VariableDeclaratorId */ -#line 820 "cmDependsJavaParser.y" +#line 819 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3307 "cmDependsJavaParser.cxx" +#line 3306 "cmDependsJavaParser.cxx" break; case 91: /* VariableDeclarator: VariableDeclaratorId jp_EQUALS VariableInitializer */ -#line 828 "cmDependsJavaParser.y" +#line 827 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3318 "cmDependsJavaParser.cxx" +#line 3317 "cmDependsJavaParser.cxx" break; case 92: /* VariableDeclaratorId: Identifier */ -#line 837 "cmDependsJavaParser.y" +#line 836 "cmDependsJavaParser.y" { jpElementStart(1); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -3326,77 +3325,77 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3330 "cmDependsJavaParser.cxx" +#line 3329 "cmDependsJavaParser.cxx" break; case 93: /* VariableDeclaratorId: VariableDeclaratorId jp_BRACKETSTART jp_BRACKETEND */ -#line 846 "cmDependsJavaParser.y" +#line 845 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3341 "cmDependsJavaParser.cxx" +#line 3340 "cmDependsJavaParser.cxx" break; case 94: /* VariableInitializer: Expression */ -#line 855 "cmDependsJavaParser.y" +#line 854 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3352 "cmDependsJavaParser.cxx" +#line 3351 "cmDependsJavaParser.cxx" break; case 95: /* VariableInitializer: ArrayInitializer */ -#line 863 "cmDependsJavaParser.y" +#line 862 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3363 "cmDependsJavaParser.cxx" +#line 3362 "cmDependsJavaParser.cxx" break; case 96: /* MethodDeclaration: MethodHeader jp_SEMICOL */ -#line 872 "cmDependsJavaParser.y" +#line 871 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3374 "cmDependsJavaParser.cxx" +#line 3373 "cmDependsJavaParser.cxx" break; case 97: /* MethodDeclaration: MethodHeader MethodBody */ -#line 880 "cmDependsJavaParser.y" +#line 879 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3385 "cmDependsJavaParser.cxx" +#line 3384 "cmDependsJavaParser.cxx" break; case 98: /* MethodDeclaration: MethodHeader MethodBody jp_SEMICOL */ -#line 888 "cmDependsJavaParser.y" +#line 887 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3396 "cmDependsJavaParser.cxx" +#line 3395 "cmDependsJavaParser.cxx" break; case 99: /* MethodHeader: Modifiersopt Type MethodDeclarator Throwsopt */ -#line 897 "cmDependsJavaParser.y" +#line 896 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -3404,11 +3403,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3408 "cmDependsJavaParser.cxx" +#line 3407 "cmDependsJavaParser.cxx" break; case 100: /* MethodHeader: Modifiersopt jp_VOID MethodDeclarator Throwsopt */ -#line 906 "cmDependsJavaParser.y" +#line 905 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -3416,22 +3415,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3420 "cmDependsJavaParser.cxx" +#line 3419 "cmDependsJavaParser.cxx" break; case 101: /* Throwsopt: %empty */ -#line 915 "cmDependsJavaParser.y" +#line 914 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3431 "cmDependsJavaParser.cxx" +#line 3430 "cmDependsJavaParser.cxx" break; case 102: /* Throwsopt: Throws */ -#line 923 "cmDependsJavaParser.y" +#line 922 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3439,11 +3438,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3443 "cmDependsJavaParser.cxx" +#line 3442 "cmDependsJavaParser.cxx" break; case 103: /* MethodDeclarator: Identifier jp_PARESTART FormalParameterListopt jp_PAREEND */ -#line 933 "cmDependsJavaParser.y" +#line 932 "cmDependsJavaParser.y" { jpElementStart(4); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -3452,40 +3451,40 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3456 "cmDependsJavaParser.cxx" +#line 3455 "cmDependsJavaParser.cxx" break; case 104: /* MethodDeclarator: MethodDeclarator jp_BRACKETSTART jp_BRACKETEND */ -#line 943 "cmDependsJavaParser.y" +#line 942 "cmDependsJavaParser.y" { jpElementStart(3); } -#line 3465 "cmDependsJavaParser.cxx" +#line 3464 "cmDependsJavaParser.cxx" break; case 105: /* FormalParameterListopt: %empty */ -#line 949 "cmDependsJavaParser.y" +#line 948 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3476 "cmDependsJavaParser.cxx" +#line 3475 "cmDependsJavaParser.cxx" break; case 107: /* FormalParameterList: FormalParameter */ -#line 960 "cmDependsJavaParser.y" +#line 959 "cmDependsJavaParser.y" { jpElementStart(1); } -#line 3485 "cmDependsJavaParser.cxx" +#line 3484 "cmDependsJavaParser.cxx" break; case 108: /* FormalParameterList: FormalParameterList jp_COMMA FormalParameter */ -#line 966 "cmDependsJavaParser.y" +#line 965 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -3493,11 +3492,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3497 "cmDependsJavaParser.cxx" +#line 3496 "cmDependsJavaParser.cxx" break; case 109: /* FormalParameter: Modifiersopt Type VariableDeclaratorId */ -#line 976 "cmDependsJavaParser.y" +#line 975 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -3505,11 +3504,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3509 "cmDependsJavaParser.cxx" +#line 3508 "cmDependsJavaParser.cxx" break; case 110: /* Throws: jp_THROWS ClassTypeList */ -#line 986 "cmDependsJavaParser.y" +#line 985 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -3517,20 +3516,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3521 "cmDependsJavaParser.cxx" +#line 3520 "cmDependsJavaParser.cxx" break; case 111: /* ClassTypeList: ClassType */ -#line 996 "cmDependsJavaParser.y" +#line 995 "cmDependsJavaParser.y" { jpElementStart(1); } -#line 3530 "cmDependsJavaParser.cxx" +#line 3529 "cmDependsJavaParser.cxx" break; case 112: /* ClassTypeList: ClassTypeList jp_COMMA ClassType */ -#line 1002 "cmDependsJavaParser.y" +#line 1001 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -3538,11 +3537,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3542 "cmDependsJavaParser.cxx" +#line 3541 "cmDependsJavaParser.cxx" break; case 113: /* MethodBody: Block */ -#line 1012 "cmDependsJavaParser.y" +#line 1011 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3550,11 +3549,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3554 "cmDependsJavaParser.cxx" +#line 3553 "cmDependsJavaParser.cxx" break; case 114: /* StaticInitializer: jp_STATIC Block */ -#line 1022 "cmDependsJavaParser.y" +#line 1021 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -3562,11 +3561,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3566 "cmDependsJavaParser.cxx" +#line 3565 "cmDependsJavaParser.cxx" break; case 115: /* ConstructorDeclaration: Modifiersopt ConstructorDeclarator Throwsopt ConstructorBody */ -#line 1032 "cmDependsJavaParser.y" +#line 1031 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -3574,11 +3573,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3578 "cmDependsJavaParser.cxx" +#line 3577 "cmDependsJavaParser.cxx" break; case 116: /* ConstructorDeclaration: Modifiersopt ConstructorDeclarator Throwsopt ConstructorBody jp_SEMICOL */ -#line 1041 "cmDependsJavaParser.y" +#line 1040 "cmDependsJavaParser.y" { jpElementStart(5); jpCheckEmpty(5); @@ -3586,11 +3585,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3590 "cmDependsJavaParser.cxx" +#line 3589 "cmDependsJavaParser.cxx" break; case 117: /* ConstructorDeclarator: SimpleName jp_PARESTART FormalParameterListopt jp_PAREEND */ -#line 1051 "cmDependsJavaParser.y" +#line 1050 "cmDependsJavaParser.y" { jpElementStart(4); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -3599,11 +3598,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3603 "cmDependsJavaParser.cxx" +#line 3602 "cmDependsJavaParser.cxx" break; case 118: /* ConstructorBody: jp_CURLYSTART ExplicitConstructorInvocationopt BlockStatementsopt jp_CURLYEND */ -#line 1062 "cmDependsJavaParser.y" +#line 1061 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -3611,22 +3610,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3615 "cmDependsJavaParser.cxx" +#line 3614 "cmDependsJavaParser.cxx" break; case 119: /* ExplicitConstructorInvocationopt: %empty */ -#line 1071 "cmDependsJavaParser.y" +#line 1070 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3626 "cmDependsJavaParser.cxx" +#line 3625 "cmDependsJavaParser.cxx" break; case 120: /* ExplicitConstructorInvocationopt: ExplicitConstructorInvocationopt ExplicitConstructorInvocation */ -#line 1079 "cmDependsJavaParser.y" +#line 1078 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -3634,11 +3633,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3638 "cmDependsJavaParser.cxx" +#line 3637 "cmDependsJavaParser.cxx" break; case 121: /* ExplicitConstructorInvocation: jp_THIS jp_PARESTART ArgumentListopt jp_PAREEND jp_SEMICOL */ -#line 1089 "cmDependsJavaParser.y" +#line 1088 "cmDependsJavaParser.y" { jpElementStart(5); jpCheckEmpty(5); @@ -3646,11 +3645,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3650 "cmDependsJavaParser.cxx" +#line 3649 "cmDependsJavaParser.cxx" break; case 122: /* ExplicitConstructorInvocation: jp_SUPER jp_PARESTART ArgumentListopt jp_PAREEND jp_SEMICOL */ -#line 1098 "cmDependsJavaParser.y" +#line 1097 "cmDependsJavaParser.y" { jpElementStart(5); jpCheckEmpty(5); @@ -3658,22 +3657,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3662 "cmDependsJavaParser.cxx" +#line 3661 "cmDependsJavaParser.cxx" break; case 123: /* InterfaceHeader: Modifiersopt jp_INTERFACE Identifier */ -#line 1108 "cmDependsJavaParser.y" +#line 1107 "cmDependsJavaParser.y" { yyGetParser->StartClass((yyvsp[0].str)); jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); } -#line 3673 "cmDependsJavaParser.cxx" +#line 3672 "cmDependsJavaParser.cxx" break; case 124: /* InterfaceDeclaration: InterfaceHeader ExtendsInterfacesopt InterfaceBody */ -#line 1117 "cmDependsJavaParser.y" +#line 1116 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -3681,21 +3680,21 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 3685 "cmDependsJavaParser.cxx" +#line 3684 "cmDependsJavaParser.cxx" break; case 125: /* ExtendsInterfacesopt: %empty */ -#line 1126 "cmDependsJavaParser.y" +#line 1125 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3695 "cmDependsJavaParser.cxx" +#line 3694 "cmDependsJavaParser.cxx" break; case 126: /* ExtendsInterfacesopt: ExtendsInterfaces */ -#line 1133 "cmDependsJavaParser.y" +#line 1132 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3703,11 +3702,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3707 "cmDependsJavaParser.cxx" +#line 3706 "cmDependsJavaParser.cxx" break; case 127: /* ExtendsInterfaces: jp_EXTENDS InterfaceType */ -#line 1143 "cmDependsJavaParser.y" +#line 1142 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -3715,11 +3714,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3719 "cmDependsJavaParser.cxx" +#line 3718 "cmDependsJavaParser.cxx" break; case 128: /* ExtendsInterfaces: ExtendsInterfaces jp_COMMA InterfaceType */ -#line 1152 "cmDependsJavaParser.y" +#line 1151 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -3727,11 +3726,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3731 "cmDependsJavaParser.cxx" +#line 3730 "cmDependsJavaParser.cxx" break; case 129: /* InterfaceBody: jp_CURLYSTART InterfaceMemberDeclarations jp_CURLYEND */ -#line 1162 "cmDependsJavaParser.y" +#line 1161 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -3739,33 +3738,33 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3743 "cmDependsJavaParser.cxx" +#line 3742 "cmDependsJavaParser.cxx" break; case 130: /* InterfaceMemberDeclarations: %empty */ -#line 1171 "cmDependsJavaParser.y" +#line 1170 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3754 "cmDependsJavaParser.cxx" +#line 3753 "cmDependsJavaParser.cxx" break; case 131: /* InterfaceMemberDeclarations: InterfaceMemberDeclarations InterfaceMemberDeclaration */ -#line 1179 "cmDependsJavaParser.y" +#line 1178 "cmDependsJavaParser.y" { jpElementStart(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3765 "cmDependsJavaParser.cxx" +#line 3764 "cmDependsJavaParser.cxx" break; case 132: /* InterfaceMemberDeclaration: ConstantDeclaration */ -#line 1188 "cmDependsJavaParser.y" +#line 1187 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3773,11 +3772,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3777 "cmDependsJavaParser.cxx" +#line 3776 "cmDependsJavaParser.cxx" break; case 133: /* InterfaceMemberDeclaration: AbstractMethodDeclaration */ -#line 1197 "cmDependsJavaParser.y" +#line 1196 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3785,11 +3784,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3789 "cmDependsJavaParser.cxx" +#line 3788 "cmDependsJavaParser.cxx" break; case 134: /* InterfaceMemberDeclaration: ClassDeclaration */ -#line 1206 "cmDependsJavaParser.y" +#line 1205 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3797,22 +3796,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3801 "cmDependsJavaParser.cxx" +#line 3800 "cmDependsJavaParser.cxx" break; case 135: /* InterfaceMemberDeclaration: ClassDeclaration jp_SEMICOL */ -#line 1215 "cmDependsJavaParser.y" +#line 1214 "cmDependsJavaParser.y" { jpElementStart(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3812 "cmDependsJavaParser.cxx" +#line 3811 "cmDependsJavaParser.cxx" break; case 136: /* InterfaceMemberDeclaration: InterfaceDeclaration */ -#line 1223 "cmDependsJavaParser.y" +#line 1222 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3820,22 +3819,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3824 "cmDependsJavaParser.cxx" +#line 3823 "cmDependsJavaParser.cxx" break; case 137: /* InterfaceMemberDeclaration: InterfaceDeclaration jp_SEMICOL */ -#line 1232 "cmDependsJavaParser.y" +#line 1231 "cmDependsJavaParser.y" { jpElementStart(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3835 "cmDependsJavaParser.cxx" +#line 3834 "cmDependsJavaParser.cxx" break; case 138: /* ConstantDeclaration: FieldDeclaration */ -#line 1241 "cmDependsJavaParser.y" +#line 1240 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3843,11 +3842,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3847 "cmDependsJavaParser.cxx" +#line 3846 "cmDependsJavaParser.cxx" break; case 139: /* AbstractMethodDeclaration: MethodHeader Semicols */ -#line 1251 "cmDependsJavaParser.y" +#line 1250 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -3855,11 +3854,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3859 "cmDependsJavaParser.cxx" +#line 3858 "cmDependsJavaParser.cxx" break; case 140: /* Semicols: jp_SEMICOL */ -#line 1261 "cmDependsJavaParser.y" +#line 1260 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3867,11 +3866,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3871 "cmDependsJavaParser.cxx" +#line 3870 "cmDependsJavaParser.cxx" break; case 141: /* Semicols: Semicols jp_SEMICOL */ -#line 1270 "cmDependsJavaParser.y" +#line 1269 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -3879,11 +3878,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3883 "cmDependsJavaParser.cxx" +#line 3882 "cmDependsJavaParser.cxx" break; case 142: /* ArrayInitializer: jp_CURLYSTART VariableInitializersOptional jp_CURLYEND */ -#line 1280 "cmDependsJavaParser.y" +#line 1279 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -3891,22 +3890,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3895 "cmDependsJavaParser.cxx" +#line 3894 "cmDependsJavaParser.cxx" break; case 143: /* VariableInitializersOptional: %empty */ -#line 1289 "cmDependsJavaParser.y" +#line 1288 "cmDependsJavaParser.y" { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3906 "cmDependsJavaParser.cxx" +#line 3905 "cmDependsJavaParser.cxx" break; case 144: /* VariableInitializersOptional: VariableInitializers */ -#line 1297 "cmDependsJavaParser.y" +#line 1296 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3914,11 +3913,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3918 "cmDependsJavaParser.cxx" +#line 3917 "cmDependsJavaParser.cxx" break; case 145: /* VariableInitializersOptional: VariableInitializers jp_COMMA */ -#line 1306 "cmDependsJavaParser.y" +#line 1305 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -3926,11 +3925,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3930 "cmDependsJavaParser.cxx" +#line 3929 "cmDependsJavaParser.cxx" break; case 146: /* VariableInitializers: VariableInitializer */ -#line 1316 "cmDependsJavaParser.y" +#line 1315 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3938,11 +3937,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3942 "cmDependsJavaParser.cxx" +#line 3941 "cmDependsJavaParser.cxx" break; case 147: /* VariableInitializers: VariableInitializers jp_COMMA VariableInitializer */ -#line 1325 "cmDependsJavaParser.y" +#line 1324 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -3950,33 +3949,33 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3954 "cmDependsJavaParser.cxx" +#line 3953 "cmDependsJavaParser.cxx" break; case 148: /* Block: jp_CURLYSTART BlockStatementsopt jp_CURLYEND */ -#line 1335 "cmDependsJavaParser.y" +#line 1334 "cmDependsJavaParser.y" { jpElementStart(4); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3965 "cmDependsJavaParser.cxx" +#line 3964 "cmDependsJavaParser.cxx" break; case 149: /* BlockStatementsopt: %empty */ -#line 1343 "cmDependsJavaParser.y" +#line 1342 "cmDependsJavaParser.y" { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3976 "cmDependsJavaParser.cxx" +#line 3975 "cmDependsJavaParser.cxx" break; case 150: /* BlockStatementsopt: BlockStatements */ -#line 1351 "cmDependsJavaParser.y" +#line 1350 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3984,11 +3983,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 3988 "cmDependsJavaParser.cxx" +#line 3987 "cmDependsJavaParser.cxx" break; case 151: /* BlockStatements: BlockStatement */ -#line 1361 "cmDependsJavaParser.y" +#line 1360 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -3996,11 +3995,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4000 "cmDependsJavaParser.cxx" +#line 3999 "cmDependsJavaParser.cxx" break; case 152: /* BlockStatements: BlockStatements BlockStatement */ -#line 1370 "cmDependsJavaParser.y" +#line 1369 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(2); @@ -4008,11 +4007,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4012 "cmDependsJavaParser.cxx" +#line 4011 "cmDependsJavaParser.cxx" break; case 153: /* BlockStatement: LocalVariableDeclarationStatement */ -#line 1380 "cmDependsJavaParser.y" +#line 1379 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4020,11 +4019,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4024 "cmDependsJavaParser.cxx" +#line 4023 "cmDependsJavaParser.cxx" break; case 154: /* BlockStatement: Statement */ -#line 1389 "cmDependsJavaParser.y" +#line 1388 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4032,11 +4031,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4036 "cmDependsJavaParser.cxx" +#line 4035 "cmDependsJavaParser.cxx" break; case 155: /* BlockStatement: ClassDeclaration */ -#line 1398 "cmDependsJavaParser.y" +#line 1397 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4044,11 +4043,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4048 "cmDependsJavaParser.cxx" +#line 4047 "cmDependsJavaParser.cxx" break; case 156: /* LocalVariableDeclarationStatement: LocalVariableDeclaration jp_SEMICOL */ -#line 1408 "cmDependsJavaParser.y" +#line 1407 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(2); @@ -4056,11 +4055,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4060 "cmDependsJavaParser.cxx" +#line 4059 "cmDependsJavaParser.cxx" break; case 157: /* LocalVariableDeclaration: Modifiers Type VariableDeclarators */ -#line 1418 "cmDependsJavaParser.y" +#line 1417 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(3); @@ -4068,11 +4067,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4072 "cmDependsJavaParser.cxx" +#line 4071 "cmDependsJavaParser.cxx" break; case 158: /* LocalVariableDeclaration: Type VariableDeclarators */ -#line 1427 "cmDependsJavaParser.y" +#line 1426 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(2); @@ -4080,11 +4079,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4084 "cmDependsJavaParser.cxx" +#line 4083 "cmDependsJavaParser.cxx" break; case 159: /* Statement: StatementWithoutTrailingSubstatement */ -#line 1437 "cmDependsJavaParser.y" +#line 1436 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4092,11 +4091,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4096 "cmDependsJavaParser.cxx" +#line 4095 "cmDependsJavaParser.cxx" break; case 160: /* Statement: LabeledStatement */ -#line 1446 "cmDependsJavaParser.y" +#line 1445 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4104,11 +4103,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4108 "cmDependsJavaParser.cxx" +#line 4107 "cmDependsJavaParser.cxx" break; case 161: /* Statement: IfThenStatement */ -#line 1455 "cmDependsJavaParser.y" +#line 1454 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4116,11 +4115,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4120 "cmDependsJavaParser.cxx" +#line 4119 "cmDependsJavaParser.cxx" break; case 162: /* Statement: IfThenElseStatement */ -#line 1464 "cmDependsJavaParser.y" +#line 1463 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4128,11 +4127,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4132 "cmDependsJavaParser.cxx" +#line 4131 "cmDependsJavaParser.cxx" break; case 163: /* Statement: WhileStatement */ -#line 1473 "cmDependsJavaParser.y" +#line 1472 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4140,11 +4139,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4144 "cmDependsJavaParser.cxx" +#line 4143 "cmDependsJavaParser.cxx" break; case 164: /* Statement: ForStatement */ -#line 1482 "cmDependsJavaParser.y" +#line 1481 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4152,11 +4151,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4156 "cmDependsJavaParser.cxx" +#line 4155 "cmDependsJavaParser.cxx" break; case 165: /* StatementNoShortIf: StatementWithoutTrailingSubstatement */ -#line 1492 "cmDependsJavaParser.y" +#line 1491 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4164,11 +4163,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4168 "cmDependsJavaParser.cxx" +#line 4167 "cmDependsJavaParser.cxx" break; case 166: /* StatementNoShortIf: LabeledStatementNoShortIf */ -#line 1501 "cmDependsJavaParser.y" +#line 1500 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4176,11 +4175,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4180 "cmDependsJavaParser.cxx" +#line 4179 "cmDependsJavaParser.cxx" break; case 167: /* StatementNoShortIf: IfThenElseStatementNoShortIf */ -#line 1510 "cmDependsJavaParser.y" +#line 1509 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4188,11 +4187,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4192 "cmDependsJavaParser.cxx" +#line 4191 "cmDependsJavaParser.cxx" break; case 168: /* StatementNoShortIf: WhileStatementNoShortIf */ -#line 1519 "cmDependsJavaParser.y" +#line 1518 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4200,11 +4199,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4204 "cmDependsJavaParser.cxx" +#line 4203 "cmDependsJavaParser.cxx" break; case 169: /* StatementNoShortIf: ForStatementNoShortIf */ -#line 1528 "cmDependsJavaParser.y" +#line 1527 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4212,11 +4211,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4216 "cmDependsJavaParser.cxx" +#line 4215 "cmDependsJavaParser.cxx" break; case 170: /* StatementWithoutTrailingSubstatement: Block */ -#line 1538 "cmDependsJavaParser.y" +#line 1537 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4224,11 +4223,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4228 "cmDependsJavaParser.cxx" +#line 4227 "cmDependsJavaParser.cxx" break; case 171: /* StatementWithoutTrailingSubstatement: EmptyStatement */ -#line 1547 "cmDependsJavaParser.y" +#line 1546 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4236,11 +4235,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4240 "cmDependsJavaParser.cxx" +#line 4239 "cmDependsJavaParser.cxx" break; case 172: /* StatementWithoutTrailingSubstatement: ExpressionStatement */ -#line 1556 "cmDependsJavaParser.y" +#line 1555 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4248,11 +4247,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4252 "cmDependsJavaParser.cxx" +#line 4251 "cmDependsJavaParser.cxx" break; case 173: /* StatementWithoutTrailingSubstatement: SwitchStatement */ -#line 1565 "cmDependsJavaParser.y" +#line 1564 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4260,11 +4259,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4264 "cmDependsJavaParser.cxx" +#line 4263 "cmDependsJavaParser.cxx" break; case 174: /* StatementWithoutTrailingSubstatement: DoStatement */ -#line 1574 "cmDependsJavaParser.y" +#line 1573 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4272,11 +4271,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4276 "cmDependsJavaParser.cxx" +#line 4275 "cmDependsJavaParser.cxx" break; case 175: /* StatementWithoutTrailingSubstatement: BreakStatement */ -#line 1583 "cmDependsJavaParser.y" +#line 1582 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4284,11 +4283,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4288 "cmDependsJavaParser.cxx" +#line 4287 "cmDependsJavaParser.cxx" break; case 176: /* StatementWithoutTrailingSubstatement: ContinueStatement */ -#line 1592 "cmDependsJavaParser.y" +#line 1591 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4296,11 +4295,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4300 "cmDependsJavaParser.cxx" +#line 4299 "cmDependsJavaParser.cxx" break; case 177: /* StatementWithoutTrailingSubstatement: ReturnStatement */ -#line 1601 "cmDependsJavaParser.y" +#line 1600 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4308,11 +4307,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4312 "cmDependsJavaParser.cxx" +#line 4311 "cmDependsJavaParser.cxx" break; case 178: /* StatementWithoutTrailingSubstatement: SynchronizedStatement */ -#line 1610 "cmDependsJavaParser.y" +#line 1609 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4320,11 +4319,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4324 "cmDependsJavaParser.cxx" +#line 4323 "cmDependsJavaParser.cxx" break; case 179: /* StatementWithoutTrailingSubstatement: ThrowStatement */ -#line 1619 "cmDependsJavaParser.y" +#line 1618 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4332,11 +4331,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4336 "cmDependsJavaParser.cxx" +#line 4335 "cmDependsJavaParser.cxx" break; case 180: /* StatementWithoutTrailingSubstatement: TryStatement */ -#line 1628 "cmDependsJavaParser.y" +#line 1627 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4344,11 +4343,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4348 "cmDependsJavaParser.cxx" +#line 4347 "cmDependsJavaParser.cxx" break; case 181: /* StatementWithoutTrailingSubstatement: AssertStatement */ -#line 1637 "cmDependsJavaParser.y" +#line 1636 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4356,11 +4355,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4360 "cmDependsJavaParser.cxx" +#line 4359 "cmDependsJavaParser.cxx" break; case 182: /* EmptyStatement: jp_SEMICOL */ -#line 1647 "cmDependsJavaParser.y" +#line 1646 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4368,11 +4367,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4372 "cmDependsJavaParser.cxx" +#line 4371 "cmDependsJavaParser.cxx" break; case 183: /* LabeledStatement: Identifier jp_COLON Statement */ -#line 1657 "cmDependsJavaParser.y" +#line 1656 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[-2].str))); @@ -4381,11 +4380,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4385 "cmDependsJavaParser.cxx" +#line 4384 "cmDependsJavaParser.cxx" break; case 184: /* LabeledStatementNoShortIf: Identifier jp_COLON StatementNoShortIf */ -#line 1668 "cmDependsJavaParser.y" +#line 1667 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -4393,11 +4392,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4397 "cmDependsJavaParser.cxx" +#line 4396 "cmDependsJavaParser.cxx" break; case 185: /* ExpressionStatement: StatementExpression jp_SEMICOL */ -#line 1678 "cmDependsJavaParser.y" +#line 1677 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -4405,11 +4404,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4409 "cmDependsJavaParser.cxx" +#line 4408 "cmDependsJavaParser.cxx" break; case 186: /* StatementExpression: Assignment */ -#line 1688 "cmDependsJavaParser.y" +#line 1687 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4417,11 +4416,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4421 "cmDependsJavaParser.cxx" +#line 4420 "cmDependsJavaParser.cxx" break; case 187: /* StatementExpression: PreIncrementExpression */ -#line 1697 "cmDependsJavaParser.y" +#line 1696 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4429,11 +4428,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4433 "cmDependsJavaParser.cxx" +#line 4432 "cmDependsJavaParser.cxx" break; case 188: /* StatementExpression: PreDecrementExpression */ -#line 1706 "cmDependsJavaParser.y" +#line 1705 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4441,11 +4440,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4445 "cmDependsJavaParser.cxx" +#line 4444 "cmDependsJavaParser.cxx" break; case 189: /* StatementExpression: PostIncrementExpression */ -#line 1715 "cmDependsJavaParser.y" +#line 1714 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4453,11 +4452,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4457 "cmDependsJavaParser.cxx" +#line 4456 "cmDependsJavaParser.cxx" break; case 190: /* StatementExpression: PostDecrementExpression */ -#line 1724 "cmDependsJavaParser.y" +#line 1723 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4465,11 +4464,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4469 "cmDependsJavaParser.cxx" +#line 4468 "cmDependsJavaParser.cxx" break; case 191: /* StatementExpression: MethodInvocation */ -#line 1733 "cmDependsJavaParser.y" +#line 1732 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4477,11 +4476,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4481 "cmDependsJavaParser.cxx" +#line 4480 "cmDependsJavaParser.cxx" break; case 192: /* StatementExpression: ClassInstanceCreationExpression */ -#line 1742 "cmDependsJavaParser.y" +#line 1741 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4489,11 +4488,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4493 "cmDependsJavaParser.cxx" +#line 4492 "cmDependsJavaParser.cxx" break; case 193: /* IfThenStatement: jp_IF jp_PARESTART Expression jp_PAREEND Statement */ -#line 1752 "cmDependsJavaParser.y" +#line 1751 "cmDependsJavaParser.y" { jpElementStart(5); jpCheckEmpty(5); @@ -4501,11 +4500,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4505 "cmDependsJavaParser.cxx" +#line 4504 "cmDependsJavaParser.cxx" break; case 194: /* IfThenElseStatement: jp_IF jp_PARESTART Expression jp_PAREEND StatementNoShortIf jp_ELSE Statement */ -#line 1762 "cmDependsJavaParser.y" +#line 1761 "cmDependsJavaParser.y" { jpElementStart(7); jpCheckEmpty(7); @@ -4513,11 +4512,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4517 "cmDependsJavaParser.cxx" +#line 4516 "cmDependsJavaParser.cxx" break; case 195: /* IfThenElseStatementNoShortIf: jp_IF jp_PARESTART Expression jp_PAREEND StatementNoShortIf jp_ELSE StatementNoShortIf */ -#line 1772 "cmDependsJavaParser.y" +#line 1771 "cmDependsJavaParser.y" { jpElementStart(7); jpCheckEmpty(7); @@ -4525,40 +4524,40 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4529 "cmDependsJavaParser.cxx" +#line 4528 "cmDependsJavaParser.cxx" break; case 196: /* SwitchStatement: jp_SWITCH jp_PARESTART Expression jp_PAREEND SwitchBlock */ -#line 1782 "cmDependsJavaParser.y" +#line 1781 "cmDependsJavaParser.y" { jpElementStart(5); } -#line 4538 "cmDependsJavaParser.cxx" +#line 4537 "cmDependsJavaParser.cxx" break; case 197: /* SwitchBlock: jp_CURLYSTART SwitchBlockStatementGroups SwitchLabelsopt jp_CURLYEND */ -#line 1789 "cmDependsJavaParser.y" +#line 1788 "cmDependsJavaParser.y" { jpElementStart(4); } -#line 4547 "cmDependsJavaParser.cxx" +#line 4546 "cmDependsJavaParser.cxx" break; case 198: /* SwitchLabelsopt: %empty */ -#line 1795 "cmDependsJavaParser.y" +#line 1794 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4558 "cmDependsJavaParser.cxx" +#line 4557 "cmDependsJavaParser.cxx" break; case 199: /* SwitchLabelsopt: SwitchLabels */ -#line 1803 "cmDependsJavaParser.y" +#line 1802 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4566,22 +4565,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4570 "cmDependsJavaParser.cxx" +#line 4569 "cmDependsJavaParser.cxx" break; case 200: /* SwitchBlockStatementGroups: %empty */ -#line 1812 "cmDependsJavaParser.y" +#line 1811 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4581 "cmDependsJavaParser.cxx" +#line 4580 "cmDependsJavaParser.cxx" break; case 201: /* SwitchBlockStatementGroups: SwitchBlockStatementGroups SwitchBlockStatementGroup */ -#line 1820 "cmDependsJavaParser.y" +#line 1819 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -4589,11 +4588,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4593 "cmDependsJavaParser.cxx" +#line 4592 "cmDependsJavaParser.cxx" break; case 202: /* SwitchBlockStatementGroup: SwitchLabels BlockStatements */ -#line 1830 "cmDependsJavaParser.y" +#line 1829 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -4601,11 +4600,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4605 "cmDependsJavaParser.cxx" +#line 4604 "cmDependsJavaParser.cxx" break; case 203: /* SwitchLabels: SwitchLabel */ -#line 1840 "cmDependsJavaParser.y" +#line 1839 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4613,11 +4612,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4617 "cmDependsJavaParser.cxx" +#line 4616 "cmDependsJavaParser.cxx" break; case 204: /* SwitchLabels: SwitchLabels SwitchLabel */ -#line 1849 "cmDependsJavaParser.y" +#line 1848 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -4625,11 +4624,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4629 "cmDependsJavaParser.cxx" +#line 4628 "cmDependsJavaParser.cxx" break; case 205: /* SwitchLabel: jp_CASE ConstantExpression jp_COLON */ -#line 1859 "cmDependsJavaParser.y" +#line 1858 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -4637,11 +4636,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4641 "cmDependsJavaParser.cxx" +#line 4640 "cmDependsJavaParser.cxx" break; case 206: /* SwitchLabel: jp_DEFAULT jp_COLON */ -#line 1868 "cmDependsJavaParser.y" +#line 1867 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -4649,58 +4648,58 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4653 "cmDependsJavaParser.cxx" +#line 4652 "cmDependsJavaParser.cxx" break; case 207: /* WhileStatement: jp_WHILE jp_PARESTART Expression jp_PAREEND Statement */ -#line 1878 "cmDependsJavaParser.y" +#line 1877 "cmDependsJavaParser.y" { jpElementStart(5); } -#line 4662 "cmDependsJavaParser.cxx" +#line 4661 "cmDependsJavaParser.cxx" break; case 208: /* WhileStatementNoShortIf: jp_WHILE jp_PARESTART Expression jp_PAREEND StatementNoShortIf */ -#line 1885 "cmDependsJavaParser.y" +#line 1884 "cmDependsJavaParser.y" { jpElementStart(5); } -#line 4671 "cmDependsJavaParser.cxx" +#line 4670 "cmDependsJavaParser.cxx" break; case 209: /* DoStatement: jp_DO Statement jp_WHILE jp_PARESTART Expression jp_PAREEND jp_SEMICOL */ -#line 1892 "cmDependsJavaParser.y" +#line 1891 "cmDependsJavaParser.y" { jpElementStart(7); } -#line 4680 "cmDependsJavaParser.cxx" +#line 4679 "cmDependsJavaParser.cxx" break; case 210: /* ForStatement: jp_FOR jp_PARESTART ForInitopt jp_SEMICOL Expressionopt jp_SEMICOL ForUpdateopt jp_PAREEND Statement */ -#line 1900 "cmDependsJavaParser.y" +#line 1899 "cmDependsJavaParser.y" { jpElementStart(9); } -#line 4689 "cmDependsJavaParser.cxx" +#line 4688 "cmDependsJavaParser.cxx" break; case 211: /* ForUpdateopt: %empty */ -#line 1906 "cmDependsJavaParser.y" +#line 1905 "cmDependsJavaParser.y" { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4700 "cmDependsJavaParser.cxx" +#line 4699 "cmDependsJavaParser.cxx" break; case 212: /* ForUpdateopt: ForUpdate */ -#line 1914 "cmDependsJavaParser.y" +#line 1913 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4708,22 +4707,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4712 "cmDependsJavaParser.cxx" +#line 4711 "cmDependsJavaParser.cxx" break; case 213: /* ForInitopt: %empty */ -#line 1923 "cmDependsJavaParser.y" +#line 1922 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4723 "cmDependsJavaParser.cxx" +#line 4722 "cmDependsJavaParser.cxx" break; case 214: /* ForInitopt: ForInit */ -#line 1931 "cmDependsJavaParser.y" +#line 1930 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4731,33 +4730,33 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4735 "cmDependsJavaParser.cxx" +#line 4734 "cmDependsJavaParser.cxx" break; case 215: /* ForStatementNoShortIf: jp_FOR jp_PARESTART ForInitopt jp_SEMICOL Expressionopt jp_SEMICOL ForUpdateopt jp_PAREEND StatementNoShortIf */ -#line 1942 "cmDependsJavaParser.y" +#line 1941 "cmDependsJavaParser.y" { jpElementStart(9); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4746 "cmDependsJavaParser.cxx" +#line 4745 "cmDependsJavaParser.cxx" break; case 216: /* Expressionopt: %empty */ -#line 1950 "cmDependsJavaParser.y" +#line 1949 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4757 "cmDependsJavaParser.cxx" +#line 4756 "cmDependsJavaParser.cxx" break; case 217: /* Expressionopt: Expression */ -#line 1958 "cmDependsJavaParser.y" +#line 1957 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4765,11 +4764,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4769 "cmDependsJavaParser.cxx" +#line 4768 "cmDependsJavaParser.cxx" break; case 218: /* ForInit: StatementExpressionList */ -#line 1968 "cmDependsJavaParser.y" +#line 1967 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4777,11 +4776,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4781 "cmDependsJavaParser.cxx" +#line 4780 "cmDependsJavaParser.cxx" break; case 219: /* ForInit: LocalVariableDeclaration */ -#line 1977 "cmDependsJavaParser.y" +#line 1976 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4789,11 +4788,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4793 "cmDependsJavaParser.cxx" +#line 4792 "cmDependsJavaParser.cxx" break; case 220: /* ForUpdate: StatementExpressionList */ -#line 1987 "cmDependsJavaParser.y" +#line 1986 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4801,11 +4800,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4805 "cmDependsJavaParser.cxx" +#line 4804 "cmDependsJavaParser.cxx" break; case 221: /* StatementExpressionList: StatementExpression */ -#line 1997 "cmDependsJavaParser.y" +#line 1996 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4813,11 +4812,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4817 "cmDependsJavaParser.cxx" +#line 4816 "cmDependsJavaParser.cxx" break; case 222: /* StatementExpressionList: StatementExpressionList jp_COMMA StatementExpression */ -#line 2006 "cmDependsJavaParser.y" +#line 2005 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -4825,11 +4824,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4829 "cmDependsJavaParser.cxx" +#line 4828 "cmDependsJavaParser.cxx" break; case 223: /* AssertStatement: jp_ASSERT Expression jp_SEMICOL */ -#line 2016 "cmDependsJavaParser.y" +#line 2015 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -4837,11 +4836,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4841 "cmDependsJavaParser.cxx" +#line 4840 "cmDependsJavaParser.cxx" break; case 224: /* AssertStatement: jp_ASSERT Expression jp_COLON Expression jp_SEMICOL */ -#line 2025 "cmDependsJavaParser.y" +#line 2024 "cmDependsJavaParser.y" { jpElementStart(5); jpCheckEmpty(5); @@ -4849,11 +4848,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4853 "cmDependsJavaParser.cxx" +#line 4852 "cmDependsJavaParser.cxx" break; case 225: /* BreakStatement: jp_BREAK Identifieropt jp_SEMICOL */ -#line 2035 "cmDependsJavaParser.y" +#line 2034 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[-1].str))); @@ -4862,31 +4861,31 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4866 "cmDependsJavaParser.cxx" +#line 4865 "cmDependsJavaParser.cxx" break; case 226: /* Identifieropt: %empty */ -#line 2045 "cmDependsJavaParser.y" +#line 2044 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4877 "cmDependsJavaParser.cxx" +#line 4876 "cmDependsJavaParser.cxx" break; case 227: /* Identifieropt: Identifier */ -#line 2053 "cmDependsJavaParser.y" +#line 2052 "cmDependsJavaParser.y" { jpElementStart(1); } -#line 4886 "cmDependsJavaParser.cxx" +#line 4885 "cmDependsJavaParser.cxx" break; case 228: /* ContinueStatement: jp_CONTINUE Identifieropt jp_SEMICOL */ -#line 2060 "cmDependsJavaParser.y" +#line 2059 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[-1].str))); @@ -4895,11 +4894,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4899 "cmDependsJavaParser.cxx" +#line 4898 "cmDependsJavaParser.cxx" break; case 229: /* ReturnStatement: jp_RETURN Expressionopt jp_SEMICOL */ -#line 2071 "cmDependsJavaParser.y" +#line 2070 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -4907,11 +4906,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4911 "cmDependsJavaParser.cxx" +#line 4910 "cmDependsJavaParser.cxx" break; case 230: /* ThrowStatement: jp_THROW Expression jp_SEMICOL */ -#line 2081 "cmDependsJavaParser.y" +#line 2080 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -4919,11 +4918,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4923 "cmDependsJavaParser.cxx" +#line 4922 "cmDependsJavaParser.cxx" break; case 231: /* SynchronizedStatement: jp_SYNCHRONIZED jp_PARESTART Expression jp_PAREEND Block */ -#line 2091 "cmDependsJavaParser.y" +#line 2090 "cmDependsJavaParser.y" { jpElementStart(5); jpCheckEmpty(5); @@ -4931,11 +4930,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4935 "cmDependsJavaParser.cxx" +#line 4934 "cmDependsJavaParser.cxx" break; case 232: /* TryStatement: jp_TRY Block Catches */ -#line 2101 "cmDependsJavaParser.y" +#line 2100 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -4943,11 +4942,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4947 "cmDependsJavaParser.cxx" +#line 4946 "cmDependsJavaParser.cxx" break; case 233: /* TryStatement: jp_TRY Block Catchesopt Finally */ -#line 2110 "cmDependsJavaParser.y" +#line 2109 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -4955,22 +4954,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4959 "cmDependsJavaParser.cxx" +#line 4958 "cmDependsJavaParser.cxx" break; case 234: /* Catchesopt: %empty */ -#line 2119 "cmDependsJavaParser.y" +#line 2118 "cmDependsJavaParser.y" { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4970 "cmDependsJavaParser.cxx" +#line 4969 "cmDependsJavaParser.cxx" break; case 235: /* Catchesopt: Catches */ -#line 2127 "cmDependsJavaParser.y" +#line 2126 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4978,11 +4977,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4982 "cmDependsJavaParser.cxx" +#line 4981 "cmDependsJavaParser.cxx" break; case 236: /* Catches: CatchClause */ -#line 2137 "cmDependsJavaParser.y" +#line 2136 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -4990,11 +4989,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 4994 "cmDependsJavaParser.cxx" +#line 4993 "cmDependsJavaParser.cxx" break; case 237: /* Catches: Catches CatchClause */ -#line 2146 "cmDependsJavaParser.y" +#line 2145 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5002,20 +5001,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5006 "cmDependsJavaParser.cxx" +#line 5005 "cmDependsJavaParser.cxx" break; case 238: /* CatchClause: jp_CATCH jp_PARESTART FormalParameter jp_PAREEND Block */ -#line 2156 "cmDependsJavaParser.y" +#line 2155 "cmDependsJavaParser.y" { jpElementStart(5); } -#line 5015 "cmDependsJavaParser.cxx" +#line 5014 "cmDependsJavaParser.cxx" break; case 239: /* Finally: jp_FINALLY Block */ -#line 2163 "cmDependsJavaParser.y" +#line 2162 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5023,11 +5022,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5027 "cmDependsJavaParser.cxx" +#line 5026 "cmDependsJavaParser.cxx" break; case 240: /* Primary: PrimaryNoNewArray */ -#line 2173 "cmDependsJavaParser.y" +#line 2172 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5035,11 +5034,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5039 "cmDependsJavaParser.cxx" +#line 5038 "cmDependsJavaParser.cxx" break; case 241: /* Primary: ArrayCreationExpression */ -#line 2182 "cmDependsJavaParser.y" +#line 2181 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5047,11 +5046,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5051 "cmDependsJavaParser.cxx" +#line 5050 "cmDependsJavaParser.cxx" break; case 242: /* PrimaryNoNewArray: Literal */ -#line 2192 "cmDependsJavaParser.y" +#line 2191 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5059,20 +5058,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5063 "cmDependsJavaParser.cxx" +#line 5062 "cmDependsJavaParser.cxx" break; case 243: /* PrimaryNoNewArray: jp_THIS */ -#line 2201 "cmDependsJavaParser.y" +#line 2200 "cmDependsJavaParser.y" { jpElementStart(1); } -#line 5072 "cmDependsJavaParser.cxx" +#line 5071 "cmDependsJavaParser.cxx" break; case 244: /* PrimaryNoNewArray: jp_PARESTART Expression jp_PAREEND */ -#line 2207 "cmDependsJavaParser.y" +#line 2206 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5080,11 +5079,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5084 "cmDependsJavaParser.cxx" +#line 5083 "cmDependsJavaParser.cxx" break; case 245: /* PrimaryNoNewArray: ClassInstanceCreationExpression */ -#line 2216 "cmDependsJavaParser.y" +#line 2215 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5092,11 +5091,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5096 "cmDependsJavaParser.cxx" +#line 5095 "cmDependsJavaParser.cxx" break; case 246: /* PrimaryNoNewArray: FieldAccess */ -#line 2225 "cmDependsJavaParser.y" +#line 2224 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5104,11 +5103,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5108 "cmDependsJavaParser.cxx" +#line 5107 "cmDependsJavaParser.cxx" break; case 247: /* PrimaryNoNewArray: MethodInvocation */ -#line 2234 "cmDependsJavaParser.y" +#line 2233 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5116,11 +5115,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5120 "cmDependsJavaParser.cxx" +#line 5119 "cmDependsJavaParser.cxx" break; case 248: /* PrimaryNoNewArray: ArrayAccess */ -#line 2243 "cmDependsJavaParser.y" +#line 2242 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5128,11 +5127,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5132 "cmDependsJavaParser.cxx" +#line 5131 "cmDependsJavaParser.cxx" break; case 249: /* ClassInstanceCreationExpression: New ClassType jp_PARESTART ArgumentListopt jp_PAREEND ClassBodyOpt */ -#line 2253 "cmDependsJavaParser.y" +#line 2252 "cmDependsJavaParser.y" { jpElementStart(6); jpCheckEmpty(6); @@ -5140,22 +5139,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5144 "cmDependsJavaParser.cxx" +#line 5143 "cmDependsJavaParser.cxx" break; case 250: /* ClassBodyOpt: %empty */ -#line 2262 "cmDependsJavaParser.y" +#line 2261 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 5155 "cmDependsJavaParser.cxx" +#line 5154 "cmDependsJavaParser.cxx" break; case 251: /* ClassBodyOpt: ClassBody */ -#line 2270 "cmDependsJavaParser.y" +#line 2269 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5163,22 +5162,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5167 "cmDependsJavaParser.cxx" +#line 5166 "cmDependsJavaParser.cxx" break; case 252: /* ArgumentListopt: %empty */ -#line 2279 "cmDependsJavaParser.y" +#line 2278 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 5178 "cmDependsJavaParser.cxx" +#line 5177 "cmDependsJavaParser.cxx" break; case 253: /* ArgumentListopt: ArgumentList */ -#line 2287 "cmDependsJavaParser.y" +#line 2286 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5186,11 +5185,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5190 "cmDependsJavaParser.cxx" +#line 5189 "cmDependsJavaParser.cxx" break; case 254: /* ArgumentList: Expression */ -#line 2297 "cmDependsJavaParser.y" +#line 2296 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5198,11 +5197,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5202 "cmDependsJavaParser.cxx" +#line 5201 "cmDependsJavaParser.cxx" break; case 255: /* ArgumentList: ArgumentList jp_COMMA Expression */ -#line 2306 "cmDependsJavaParser.y" +#line 2305 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5210,11 +5209,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5214 "cmDependsJavaParser.cxx" +#line 5213 "cmDependsJavaParser.cxx" break; case 256: /* ArrayCreationExpression: New PrimitiveType DimExprs Dimsopt */ -#line 2316 "cmDependsJavaParser.y" +#line 2315 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -5222,11 +5221,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5226 "cmDependsJavaParser.cxx" +#line 5225 "cmDependsJavaParser.cxx" break; case 257: /* ArrayCreationExpression: New ClassOrInterfaceType DimExprs Dimsopt */ -#line 2325 "cmDependsJavaParser.y" +#line 2324 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -5234,11 +5233,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5238 "cmDependsJavaParser.cxx" +#line 5237 "cmDependsJavaParser.cxx" break; case 258: /* ArrayCreationExpression: New PrimitiveType Dims ArrayInitializer */ -#line 2334 "cmDependsJavaParser.y" +#line 2333 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -5246,11 +5245,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5250 "cmDependsJavaParser.cxx" +#line 5249 "cmDependsJavaParser.cxx" break; case 259: /* ArrayCreationExpression: New ClassOrInterfaceType Dims ArrayInitializer */ -#line 2343 "cmDependsJavaParser.y" +#line 2342 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -5258,22 +5257,22 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5262 "cmDependsJavaParser.cxx" +#line 5261 "cmDependsJavaParser.cxx" break; case 260: /* Dimsopt: %empty */ -#line 2352 "cmDependsJavaParser.y" +#line 2351 "cmDependsJavaParser.y" { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 5273 "cmDependsJavaParser.cxx" +#line 5272 "cmDependsJavaParser.cxx" break; case 261: /* Dimsopt: Dims */ -#line 2360 "cmDependsJavaParser.y" +#line 2359 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5281,11 +5280,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5285 "cmDependsJavaParser.cxx" +#line 5284 "cmDependsJavaParser.cxx" break; case 262: /* DimExprs: DimExpr */ -#line 2370 "cmDependsJavaParser.y" +#line 2369 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5293,11 +5292,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5297 "cmDependsJavaParser.cxx" +#line 5296 "cmDependsJavaParser.cxx" break; case 263: /* DimExprs: DimExprs DimExpr */ -#line 2379 "cmDependsJavaParser.y" +#line 2378 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5305,11 +5304,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5309 "cmDependsJavaParser.cxx" +#line 5308 "cmDependsJavaParser.cxx" break; case 264: /* DimExpr: jp_BRACKETSTART Expression jp_BRACKETEND */ -#line 2389 "cmDependsJavaParser.y" +#line 2388 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5317,29 +5316,29 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5321 "cmDependsJavaParser.cxx" +#line 5320 "cmDependsJavaParser.cxx" break; case 265: /* Dims: jp_BRACKETSTART jp_BRACKETEND */ -#line 2399 "cmDependsJavaParser.y" +#line 2398 "cmDependsJavaParser.y" { jpElementStart(2); } -#line 5330 "cmDependsJavaParser.cxx" +#line 5329 "cmDependsJavaParser.cxx" break; case 266: /* Dims: Dims jp_BRACKETSTART jp_BRACKETEND */ -#line 2405 "cmDependsJavaParser.y" +#line 2404 "cmDependsJavaParser.y" { jpElementStart(3); } -#line 5339 "cmDependsJavaParser.cxx" +#line 5338 "cmDependsJavaParser.cxx" break; case 267: /* FieldAccess: Primary jp_DOT Identifier */ -#line 2412 "cmDependsJavaParser.y" +#line 2411 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5348,11 +5347,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5352 "cmDependsJavaParser.cxx" +#line 5351 "cmDependsJavaParser.cxx" break; case 268: /* FieldAccess: jp_SUPER jp_DOT Identifier */ -#line 2422 "cmDependsJavaParser.y" +#line 2421 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5361,11 +5360,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5365 "cmDependsJavaParser.cxx" +#line 5364 "cmDependsJavaParser.cxx" break; case 269: /* FieldAccess: jp_THIS jp_DOT Identifier */ -#line 2432 "cmDependsJavaParser.y" +#line 2431 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5374,11 +5373,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5378 "cmDependsJavaParser.cxx" +#line 5377 "cmDependsJavaParser.cxx" break; case 270: /* FieldAccess: Primary jp_DOT jp_THIS */ -#line 2442 "cmDependsJavaParser.y" +#line 2441 "cmDependsJavaParser.y" { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5387,11 +5386,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5391 "cmDependsJavaParser.cxx" +#line 5390 "cmDependsJavaParser.cxx" break; case 271: /* MethodInvocation: Name jp_PARESTART ArgumentListopt jp_PAREEND */ -#line 2453 "cmDependsJavaParser.y" +#line 2452 "cmDependsJavaParser.y" { jpElementStart(4); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -5400,11 +5399,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5404 "cmDependsJavaParser.cxx" +#line 5403 "cmDependsJavaParser.cxx" break; case 272: /* MethodInvocation: Primary jp_DOT Identifier jp_PARESTART ArgumentListopt jp_PAREEND */ -#line 2463 "cmDependsJavaParser.y" +#line 2462 "cmDependsJavaParser.y" { jpElementStart(6); yyGetParser->DeallocateParserType(&((yyvsp[-5].str))); @@ -5414,11 +5413,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5418 "cmDependsJavaParser.cxx" +#line 5417 "cmDependsJavaParser.cxx" break; case 273: /* MethodInvocation: jp_SUPER jp_DOT Identifier jp_PARESTART ArgumentListopt jp_PAREEND */ -#line 2474 "cmDependsJavaParser.y" +#line 2473 "cmDependsJavaParser.y" { jpElementStart(6); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -5427,11 +5426,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5431 "cmDependsJavaParser.cxx" +#line 5430 "cmDependsJavaParser.cxx" break; case 274: /* MethodInvocation: jp_THIS jp_DOT Identifier jp_PARESTART ArgumentListopt jp_PAREEND */ -#line 2484 "cmDependsJavaParser.y" +#line 2483 "cmDependsJavaParser.y" { jpElementStart(6); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -5440,11 +5439,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5444 "cmDependsJavaParser.cxx" +#line 5443 "cmDependsJavaParser.cxx" break; case 275: /* ArrayAccess: Name jp_BRACKETSTART Expression jp_BRACKETEND */ -#line 2495 "cmDependsJavaParser.y" +#line 2494 "cmDependsJavaParser.y" { jpElementStart(4); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -5453,11 +5452,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5457 "cmDependsJavaParser.cxx" +#line 5456 "cmDependsJavaParser.cxx" break; case 276: /* ArrayAccess: PrimaryNoNewArray jp_BRACKETSTART Expression jp_BRACKETEND */ -#line 2505 "cmDependsJavaParser.y" +#line 2504 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -5465,11 +5464,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5469 "cmDependsJavaParser.cxx" +#line 5468 "cmDependsJavaParser.cxx" break; case 277: /* PostfixExpression: Primary */ -#line 2515 "cmDependsJavaParser.y" +#line 2514 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5477,11 +5476,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5481 "cmDependsJavaParser.cxx" +#line 5480 "cmDependsJavaParser.cxx" break; case 278: /* PostfixExpression: Name */ -#line 2524 "cmDependsJavaParser.y" +#line 2523 "cmDependsJavaParser.y" { jpElementStart(1); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5489,11 +5488,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5493 "cmDependsJavaParser.cxx" +#line 5492 "cmDependsJavaParser.cxx" break; case 279: /* PostfixExpression: ArrayType jp_DOT jp_CLASS */ -#line 2533 "cmDependsJavaParser.y" +#line 2532 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5501,11 +5500,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5505 "cmDependsJavaParser.cxx" +#line 5504 "cmDependsJavaParser.cxx" break; case 280: /* PostfixExpression: PostIncrementExpression */ -#line 2542 "cmDependsJavaParser.y" +#line 2541 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5513,11 +5512,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5517 "cmDependsJavaParser.cxx" +#line 5516 "cmDependsJavaParser.cxx" break; case 281: /* PostfixExpression: PostDecrementExpression */ -#line 2551 "cmDependsJavaParser.y" +#line 2550 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5525,11 +5524,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5529 "cmDependsJavaParser.cxx" +#line 5528 "cmDependsJavaParser.cxx" break; case 282: /* PostIncrementExpression: PostfixExpression jp_PLUSPLUS */ -#line 2561 "cmDependsJavaParser.y" +#line 2560 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5537,11 +5536,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5541 "cmDependsJavaParser.cxx" +#line 5540 "cmDependsJavaParser.cxx" break; case 283: /* PostDecrementExpression: PostfixExpression jp_MINUSMINUS */ -#line 2571 "cmDependsJavaParser.y" +#line 2570 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5549,11 +5548,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5553 "cmDependsJavaParser.cxx" +#line 5552 "cmDependsJavaParser.cxx" break; case 284: /* UnaryExpression: PreIncrementExpression */ -#line 2581 "cmDependsJavaParser.y" +#line 2580 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5561,11 +5560,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5565 "cmDependsJavaParser.cxx" +#line 5564 "cmDependsJavaParser.cxx" break; case 285: /* UnaryExpression: PreDecrementExpression */ -#line 2590 "cmDependsJavaParser.y" +#line 2589 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5573,11 +5572,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5577 "cmDependsJavaParser.cxx" +#line 5576 "cmDependsJavaParser.cxx" break; case 286: /* UnaryExpression: jp_PLUS UnaryExpression */ -#line 2599 "cmDependsJavaParser.y" +#line 2598 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5585,11 +5584,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5589 "cmDependsJavaParser.cxx" +#line 5588 "cmDependsJavaParser.cxx" break; case 287: /* UnaryExpression: jp_MINUS UnaryExpression */ -#line 2608 "cmDependsJavaParser.y" +#line 2607 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5597,11 +5596,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5601 "cmDependsJavaParser.cxx" +#line 5600 "cmDependsJavaParser.cxx" break; case 288: /* UnaryExpression: UnaryExpressionNotPlusMinus */ -#line 2617 "cmDependsJavaParser.y" +#line 2616 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5609,11 +5608,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5613 "cmDependsJavaParser.cxx" +#line 5612 "cmDependsJavaParser.cxx" break; case 289: /* PreIncrementExpression: jp_PLUSPLUS UnaryExpression */ -#line 2627 "cmDependsJavaParser.y" +#line 2626 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5621,11 +5620,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5625 "cmDependsJavaParser.cxx" +#line 5624 "cmDependsJavaParser.cxx" break; case 290: /* PreDecrementExpression: jp_MINUSMINUS UnaryExpression */ -#line 2637 "cmDependsJavaParser.y" +#line 2636 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5633,11 +5632,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5637 "cmDependsJavaParser.cxx" +#line 5636 "cmDependsJavaParser.cxx" break; case 291: /* UnaryExpressionNotPlusMinus: PostfixExpression */ -#line 2647 "cmDependsJavaParser.y" +#line 2646 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5645,11 +5644,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5649 "cmDependsJavaParser.cxx" +#line 5648 "cmDependsJavaParser.cxx" break; case 292: /* UnaryExpressionNotPlusMinus: jp_TILDE UnaryExpression */ -#line 2656 "cmDependsJavaParser.y" +#line 2655 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5657,11 +5656,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5661 "cmDependsJavaParser.cxx" +#line 5660 "cmDependsJavaParser.cxx" break; case 293: /* UnaryExpressionNotPlusMinus: jp_EXCLAMATION UnaryExpression */ -#line 2665 "cmDependsJavaParser.y" +#line 2664 "cmDependsJavaParser.y" { jpElementStart(2); jpCheckEmpty(2); @@ -5669,11 +5668,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5673 "cmDependsJavaParser.cxx" +#line 5672 "cmDependsJavaParser.cxx" break; case 294: /* UnaryExpressionNotPlusMinus: CastExpression */ -#line 2674 "cmDependsJavaParser.y" +#line 2673 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5681,11 +5680,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5685 "cmDependsJavaParser.cxx" +#line 5684 "cmDependsJavaParser.cxx" break; case 295: /* CastExpression: jp_PARESTART PrimitiveType Dimsopt jp_PAREEND UnaryExpression */ -#line 2684 "cmDependsJavaParser.y" +#line 2683 "cmDependsJavaParser.y" { jpElementStart(5); jpCheckEmpty(5); @@ -5693,11 +5692,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5697 "cmDependsJavaParser.cxx" +#line 5696 "cmDependsJavaParser.cxx" break; case 296: /* CastExpression: jp_PARESTART Expression jp_PAREEND UnaryExpressionNotPlusMinus */ -#line 2693 "cmDependsJavaParser.y" +#line 2692 "cmDependsJavaParser.y" { jpElementStart(4); jpCheckEmpty(4); @@ -5705,20 +5704,20 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5709 "cmDependsJavaParser.cxx" +#line 5708 "cmDependsJavaParser.cxx" break; case 297: /* CastExpression: jp_PARESTART Name Dims jp_PAREEND UnaryExpressionNotPlusMinus */ -#line 2702 "cmDependsJavaParser.y" +#line 2701 "cmDependsJavaParser.y" { jpElementStart(5); } -#line 5718 "cmDependsJavaParser.cxx" +#line 5717 "cmDependsJavaParser.cxx" break; case 298: /* MultiplicativeExpression: UnaryExpression */ -#line 2709 "cmDependsJavaParser.y" +#line 2708 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5726,11 +5725,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5730 "cmDependsJavaParser.cxx" +#line 5729 "cmDependsJavaParser.cxx" break; case 299: /* MultiplicativeExpression: MultiplicativeExpression jp_TIMES UnaryExpression */ -#line 2718 "cmDependsJavaParser.y" +#line 2717 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5738,11 +5737,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5742 "cmDependsJavaParser.cxx" +#line 5741 "cmDependsJavaParser.cxx" break; case 300: /* MultiplicativeExpression: MultiplicativeExpression jp_DIVIDE UnaryExpression */ -#line 2727 "cmDependsJavaParser.y" +#line 2726 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5750,11 +5749,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5754 "cmDependsJavaParser.cxx" +#line 5753 "cmDependsJavaParser.cxx" break; case 301: /* MultiplicativeExpression: MultiplicativeExpression jp_PERCENT UnaryExpression */ -#line 2736 "cmDependsJavaParser.y" +#line 2735 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5762,11 +5761,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5766 "cmDependsJavaParser.cxx" +#line 5765 "cmDependsJavaParser.cxx" break; case 302: /* AdditiveExpression: MultiplicativeExpression */ -#line 2746 "cmDependsJavaParser.y" +#line 2745 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5774,11 +5773,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5778 "cmDependsJavaParser.cxx" +#line 5777 "cmDependsJavaParser.cxx" break; case 303: /* AdditiveExpression: AdditiveExpression jp_PLUS MultiplicativeExpression */ -#line 2755 "cmDependsJavaParser.y" +#line 2754 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5786,11 +5785,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5790 "cmDependsJavaParser.cxx" +#line 5789 "cmDependsJavaParser.cxx" break; case 304: /* AdditiveExpression: AdditiveExpression jp_MINUS MultiplicativeExpression */ -#line 2764 "cmDependsJavaParser.y" +#line 2763 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5798,11 +5797,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5802 "cmDependsJavaParser.cxx" +#line 5801 "cmDependsJavaParser.cxx" break; case 305: /* ShiftExpression: AdditiveExpression */ -#line 2774 "cmDependsJavaParser.y" +#line 2773 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5810,11 +5809,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5814 "cmDependsJavaParser.cxx" +#line 5813 "cmDependsJavaParser.cxx" break; case 306: /* ShiftExpression: ShiftExpression jp_LTLT AdditiveExpression */ -#line 2783 "cmDependsJavaParser.y" +#line 2782 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5822,11 +5821,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5826 "cmDependsJavaParser.cxx" +#line 5825 "cmDependsJavaParser.cxx" break; case 307: /* ShiftExpression: ShiftExpression jp_GTGT AdditiveExpression */ -#line 2792 "cmDependsJavaParser.y" +#line 2791 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5834,11 +5833,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5838 "cmDependsJavaParser.cxx" +#line 5837 "cmDependsJavaParser.cxx" break; case 308: /* ShiftExpression: ShiftExpression jp_GTGTGT AdditiveExpression */ -#line 2801 "cmDependsJavaParser.y" +#line 2800 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5846,11 +5845,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5850 "cmDependsJavaParser.cxx" +#line 5849 "cmDependsJavaParser.cxx" break; case 309: /* RelationalExpression: ShiftExpression */ -#line 2811 "cmDependsJavaParser.y" +#line 2810 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5858,11 +5857,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5862 "cmDependsJavaParser.cxx" +#line 5861 "cmDependsJavaParser.cxx" break; case 310: /* RelationalExpression: RelationalExpression jp_LESSTHAN ShiftExpression */ -#line 2820 "cmDependsJavaParser.y" +#line 2819 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5870,11 +5869,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5874 "cmDependsJavaParser.cxx" +#line 5873 "cmDependsJavaParser.cxx" break; case 311: /* RelationalExpression: RelationalExpression jp_GREATER ShiftExpression */ -#line 2829 "cmDependsJavaParser.y" +#line 2828 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5882,11 +5881,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5886 "cmDependsJavaParser.cxx" +#line 5885 "cmDependsJavaParser.cxx" break; case 312: /* RelationalExpression: RelationalExpression jp_LTEQUALS ShiftExpression */ -#line 2838 "cmDependsJavaParser.y" +#line 2837 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5894,11 +5893,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5898 "cmDependsJavaParser.cxx" +#line 5897 "cmDependsJavaParser.cxx" break; case 313: /* RelationalExpression: RelationalExpression jp_GTEQUALS ShiftExpression */ -#line 2847 "cmDependsJavaParser.y" +#line 2846 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5906,11 +5905,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5910 "cmDependsJavaParser.cxx" +#line 5909 "cmDependsJavaParser.cxx" break; case 314: /* RelationalExpression: RelationalExpression jp_INSTANCEOF ReferenceType */ -#line 2856 "cmDependsJavaParser.y" +#line 2855 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5918,11 +5917,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5922 "cmDependsJavaParser.cxx" +#line 5921 "cmDependsJavaParser.cxx" break; case 315: /* EqualityExpression: RelationalExpression */ -#line 2866 "cmDependsJavaParser.y" +#line 2865 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5930,11 +5929,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5934 "cmDependsJavaParser.cxx" +#line 5933 "cmDependsJavaParser.cxx" break; case 316: /* EqualityExpression: EqualityExpression jp_EQUALSEQUALS RelationalExpression */ -#line 2875 "cmDependsJavaParser.y" +#line 2874 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5942,11 +5941,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5946 "cmDependsJavaParser.cxx" +#line 5945 "cmDependsJavaParser.cxx" break; case 317: /* EqualityExpression: EqualityExpression jp_EXCLAMATIONEQUALS RelationalExpression */ -#line 2884 "cmDependsJavaParser.y" +#line 2883 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5954,11 +5953,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5958 "cmDependsJavaParser.cxx" +#line 5957 "cmDependsJavaParser.cxx" break; case 318: /* AndExpression: EqualityExpression */ -#line 2894 "cmDependsJavaParser.y" +#line 2893 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5966,11 +5965,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5970 "cmDependsJavaParser.cxx" +#line 5969 "cmDependsJavaParser.cxx" break; case 319: /* AndExpression: AndExpression jp_AND EqualityExpression */ -#line 2903 "cmDependsJavaParser.y" +#line 2902 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -5978,11 +5977,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5982 "cmDependsJavaParser.cxx" +#line 5981 "cmDependsJavaParser.cxx" break; case 320: /* ExclusiveOrExpression: AndExpression */ -#line 2913 "cmDependsJavaParser.y" +#line 2912 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -5990,11 +5989,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 5994 "cmDependsJavaParser.cxx" +#line 5993 "cmDependsJavaParser.cxx" break; case 321: /* ExclusiveOrExpression: ExclusiveOrExpression jp_CARROT AndExpression */ -#line 2922 "cmDependsJavaParser.y" +#line 2921 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -6002,11 +6001,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6006 "cmDependsJavaParser.cxx" +#line 6005 "cmDependsJavaParser.cxx" break; case 322: /* InclusiveOrExpression: ExclusiveOrExpression */ -#line 2932 "cmDependsJavaParser.y" +#line 2931 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6014,11 +6013,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6018 "cmDependsJavaParser.cxx" +#line 6017 "cmDependsJavaParser.cxx" break; case 323: /* InclusiveOrExpression: InclusiveOrExpression jp_PIPE ExclusiveOrExpression */ -#line 2941 "cmDependsJavaParser.y" +#line 2940 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -6026,11 +6025,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6030 "cmDependsJavaParser.cxx" +#line 6029 "cmDependsJavaParser.cxx" break; case 324: /* ConditionalAndExpression: InclusiveOrExpression */ -#line 2951 "cmDependsJavaParser.y" +#line 2950 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6038,11 +6037,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6042 "cmDependsJavaParser.cxx" +#line 6041 "cmDependsJavaParser.cxx" break; case 325: /* ConditionalAndExpression: ConditionalAndExpression jp_ANDAND InclusiveOrExpression */ -#line 2960 "cmDependsJavaParser.y" +#line 2959 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -6050,11 +6049,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6054 "cmDependsJavaParser.cxx" +#line 6053 "cmDependsJavaParser.cxx" break; case 326: /* ConditionalOrExpression: ConditionalAndExpression */ -#line 2970 "cmDependsJavaParser.y" +#line 2969 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6062,11 +6061,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6066 "cmDependsJavaParser.cxx" +#line 6065 "cmDependsJavaParser.cxx" break; case 327: /* ConditionalOrExpression: ConditionalOrExpression jp_PIPEPIPE ConditionalAndExpression */ -#line 2979 "cmDependsJavaParser.y" +#line 2978 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -6074,11 +6073,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6078 "cmDependsJavaParser.cxx" +#line 6077 "cmDependsJavaParser.cxx" break; case 328: /* ConditionalExpression: ConditionalOrExpression */ -#line 2989 "cmDependsJavaParser.y" +#line 2988 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6086,11 +6085,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6090 "cmDependsJavaParser.cxx" +#line 6089 "cmDependsJavaParser.cxx" break; case 329: /* ConditionalExpression: ConditionalOrExpression jp_QUESTION Expression jp_COLON ConditionalExpression */ -#line 2998 "cmDependsJavaParser.y" +#line 2997 "cmDependsJavaParser.y" { jpElementStart(5); jpCheckEmpty(5); @@ -6098,11 +6097,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6102 "cmDependsJavaParser.cxx" +#line 6101 "cmDependsJavaParser.cxx" break; case 330: /* AssignmentExpression: ConditionalExpression */ -#line 3008 "cmDependsJavaParser.y" +#line 3007 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6110,11 +6109,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6114 "cmDependsJavaParser.cxx" +#line 6113 "cmDependsJavaParser.cxx" break; case 331: /* AssignmentExpression: Assignment */ -#line 3017 "cmDependsJavaParser.y" +#line 3016 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6122,11 +6121,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6126 "cmDependsJavaParser.cxx" +#line 6125 "cmDependsJavaParser.cxx" break; case 332: /* Assignment: LeftHandSide AssignmentOperator AssignmentExpression */ -#line 3027 "cmDependsJavaParser.y" +#line 3026 "cmDependsJavaParser.y" { jpElementStart(3); jpCheckEmpty(3); @@ -6134,11 +6133,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6138 "cmDependsJavaParser.cxx" +#line 6137 "cmDependsJavaParser.cxx" break; case 333: /* LeftHandSide: Name */ -#line 3037 "cmDependsJavaParser.y" +#line 3036 "cmDependsJavaParser.y" { jpElementStart(1); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -6147,11 +6146,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6151 "cmDependsJavaParser.cxx" +#line 6150 "cmDependsJavaParser.cxx" break; case 334: /* LeftHandSide: FieldAccess */ -#line 3047 "cmDependsJavaParser.y" +#line 3046 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6159,11 +6158,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6163 "cmDependsJavaParser.cxx" +#line 6162 "cmDependsJavaParser.cxx" break; case 335: /* LeftHandSide: ArrayAccess */ -#line 3056 "cmDependsJavaParser.y" +#line 3055 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6171,11 +6170,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6175 "cmDependsJavaParser.cxx" +#line 6174 "cmDependsJavaParser.cxx" break; case 336: /* AssignmentOperator: jp_EQUALS */ -#line 3066 "cmDependsJavaParser.y" +#line 3065 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6183,11 +6182,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6187 "cmDependsJavaParser.cxx" +#line 6186 "cmDependsJavaParser.cxx" break; case 337: /* AssignmentOperator: jp_TIMESEQUALS */ -#line 3075 "cmDependsJavaParser.y" +#line 3074 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6195,11 +6194,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6199 "cmDependsJavaParser.cxx" +#line 6198 "cmDependsJavaParser.cxx" break; case 338: /* AssignmentOperator: jp_DIVIDEEQUALS */ -#line 3084 "cmDependsJavaParser.y" +#line 3083 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6207,11 +6206,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6211 "cmDependsJavaParser.cxx" +#line 6210 "cmDependsJavaParser.cxx" break; case 339: /* AssignmentOperator: jp_PERCENTEQUALS */ -#line 3093 "cmDependsJavaParser.y" +#line 3092 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6219,11 +6218,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6223 "cmDependsJavaParser.cxx" +#line 6222 "cmDependsJavaParser.cxx" break; case 340: /* AssignmentOperator: jp_PLUSEQUALS */ -#line 3102 "cmDependsJavaParser.y" +#line 3101 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6231,11 +6230,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6235 "cmDependsJavaParser.cxx" +#line 6234 "cmDependsJavaParser.cxx" break; case 341: /* AssignmentOperator: jp_MINUSEQUALS */ -#line 3111 "cmDependsJavaParser.y" +#line 3110 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6243,11 +6242,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6247 "cmDependsJavaParser.cxx" +#line 6246 "cmDependsJavaParser.cxx" break; case 342: /* AssignmentOperator: jp_LESLESEQUALS */ -#line 3120 "cmDependsJavaParser.y" +#line 3119 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6255,11 +6254,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6259 "cmDependsJavaParser.cxx" +#line 6258 "cmDependsJavaParser.cxx" break; case 343: /* AssignmentOperator: jp_GTGTEQUALS */ -#line 3129 "cmDependsJavaParser.y" +#line 3128 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6267,11 +6266,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6271 "cmDependsJavaParser.cxx" +#line 6270 "cmDependsJavaParser.cxx" break; case 344: /* AssignmentOperator: jp_GTGTGTEQUALS */ -#line 3138 "cmDependsJavaParser.y" +#line 3137 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6279,11 +6278,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6283 "cmDependsJavaParser.cxx" +#line 6282 "cmDependsJavaParser.cxx" break; case 345: /* AssignmentOperator: jp_ANDEQUALS */ -#line 3147 "cmDependsJavaParser.y" +#line 3146 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6291,11 +6290,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6295 "cmDependsJavaParser.cxx" +#line 6294 "cmDependsJavaParser.cxx" break; case 346: /* AssignmentOperator: jp_CARROTEQUALS */ -#line 3156 "cmDependsJavaParser.y" +#line 3155 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6303,11 +6302,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6307 "cmDependsJavaParser.cxx" +#line 6306 "cmDependsJavaParser.cxx" break; case 347: /* AssignmentOperator: jp_PIPEEQUALS */ -#line 3165 "cmDependsJavaParser.y" +#line 3164 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6315,11 +6314,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6319 "cmDependsJavaParser.cxx" +#line 6318 "cmDependsJavaParser.cxx" break; case 348: /* Expression: AssignmentExpression */ -#line 3175 "cmDependsJavaParser.y" +#line 3174 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6327,11 +6326,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6331 "cmDependsJavaParser.cxx" +#line 6330 "cmDependsJavaParser.cxx" break; case 349: /* ConstantExpression: Expression */ -#line 3185 "cmDependsJavaParser.y" +#line 3184 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6339,11 +6338,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6343 "cmDependsJavaParser.cxx" +#line 6342 "cmDependsJavaParser.cxx" break; case 350: /* New: jp_NEW */ -#line 3195 "cmDependsJavaParser.y" +#line 3194 "cmDependsJavaParser.y" { jpElementStart(1); jpCheckEmpty(1); @@ -6351,11 +6350,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6355 "cmDependsJavaParser.cxx" +#line 6354 "cmDependsJavaParser.cxx" break; case 351: /* New: Name jp_DOT jp_NEW */ -#line 3204 "cmDependsJavaParser.y" +#line 3203 "cmDependsJavaParser.y" { jpElementStart(3); jpStoreClass((yyvsp[-2].str)); @@ -6364,11 +6363,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); yyGetParser->SetCurrentCombine(""); } -#line 6368 "cmDependsJavaParser.cxx" +#line 6367 "cmDependsJavaParser.cxx" break; -#line 6372 "cmDependsJavaParser.cxx" +#line 6371 "cmDependsJavaParser.cxx" default: break; } @@ -6592,7 +6591,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); return yyresult; } -#line 3213 "cmDependsJavaParser.y" +#line 3212 "cmDependsJavaParser.y" /* End of grammar */ diff --git a/Source/LexerParser/cmDependsJavaParser.y b/Source/LexerParser/cmDependsJavaParser.y index ff37af267e2..d64043adcb4 100644 --- a/Source/LexerParser/cmDependsJavaParser.y +++ b/Source/LexerParser/cmDependsJavaParser.y @@ -13,7 +13,6 @@ Run bison like this: #include "cmConfigure.h" // IWYU pragma: keep -#include #include #include #include diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx index cb5e498be85..80c0abdc40f 100644 --- a/Source/LexerParser/cmExprParser.cxx +++ b/Source/LexerParser/cmExprParser.cxx @@ -88,7 +88,6 @@ Run bison like this: #include "cmConfigure.h" // IWYU pragma: keep -#include #include #include #include @@ -127,7 +126,7 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); # pragma diag_suppress 550 /* variable set but never used */ #endif -#line 131 "cmExprParser.cxx" +#line 130 "cmExprParser.cxx" # ifndef YY_CAST # ifdef __cplusplus @@ -569,9 +568,9 @@ static const yytype_int8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 88, 88, 93, 96, 101, 104, 109, 112, 117, - 120, 123, 128, 131, 134, 139, 142, 145, 151, 156, - 159, 162, 165, 170, 173 + 0, 87, 87, 92, 95, 100, 103, 108, 111, 116, + 119, 122, 127, 130, 133, 138, 141, 144, 150, 155, + 158, 161, 164, 169, 172 }; #endif @@ -1432,194 +1431,194 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); switch (yyn) { case 2: /* start: exp */ -#line 88 "cmExprParser.y" +#line 87 "cmExprParser.y" { cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number)); } -#line 1440 "cmExprParser.cxx" +#line 1439 "cmExprParser.cxx" break; case 3: /* exp: bitwiseor */ -#line 93 "cmExprParser.y" +#line 92 "cmExprParser.y" { (yyval.Number) = (yyvsp[0].Number); } -#line 1448 "cmExprParser.cxx" +#line 1447 "cmExprParser.cxx" break; case 4: /* exp: exp exp_OR bitwiseor */ -#line 96 "cmExprParser.y" +#line 95 "cmExprParser.y" { (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number); } -#line 1456 "cmExprParser.cxx" +#line 1455 "cmExprParser.cxx" break; case 5: /* bitwiseor: bitwisexor */ -#line 101 "cmExprParser.y" +#line 100 "cmExprParser.y" { (yyval.Number) = (yyvsp[0].Number); } -#line 1464 "cmExprParser.cxx" +#line 1463 "cmExprParser.cxx" break; case 6: /* bitwiseor: bitwiseor exp_XOR bitwisexor */ -#line 104 "cmExprParser.y" +#line 103 "cmExprParser.y" { (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number); } -#line 1472 "cmExprParser.cxx" +#line 1471 "cmExprParser.cxx" break; case 7: /* bitwisexor: bitwiseand */ -#line 109 "cmExprParser.y" +#line 108 "cmExprParser.y" { (yyval.Number) = (yyvsp[0].Number); } -#line 1480 "cmExprParser.cxx" +#line 1479 "cmExprParser.cxx" break; case 8: /* bitwisexor: bitwisexor exp_AND bitwiseand */ -#line 112 "cmExprParser.y" +#line 111 "cmExprParser.y" { (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number); } -#line 1488 "cmExprParser.cxx" +#line 1487 "cmExprParser.cxx" break; case 9: /* bitwiseand: shift */ -#line 117 "cmExprParser.y" +#line 116 "cmExprParser.y" { (yyval.Number) = (yyvsp[0].Number); } -#line 1496 "cmExprParser.cxx" +#line 1495 "cmExprParser.cxx" break; case 10: /* bitwiseand: bitwiseand exp_SHIFTLEFT shift */ -#line 120 "cmExprParser.y" +#line 119 "cmExprParser.y" { (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number); } -#line 1504 "cmExprParser.cxx" +#line 1503 "cmExprParser.cxx" break; case 11: /* bitwiseand: bitwiseand exp_SHIFTRIGHT shift */ -#line 123 "cmExprParser.y" +#line 122 "cmExprParser.y" { (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number); } -#line 1512 "cmExprParser.cxx" +#line 1511 "cmExprParser.cxx" break; case 12: /* shift: term */ -#line 128 "cmExprParser.y" +#line 127 "cmExprParser.y" { (yyval.Number) = (yyvsp[0].Number); } -#line 1520 "cmExprParser.cxx" +#line 1519 "cmExprParser.cxx" break; case 13: /* shift: shift exp_PLUS term */ -#line 131 "cmExprParser.y" +#line 130 "cmExprParser.y" { (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number); } -#line 1528 "cmExprParser.cxx" +#line 1527 "cmExprParser.cxx" break; case 14: /* shift: shift exp_MINUS term */ -#line 134 "cmExprParser.y" +#line 133 "cmExprParser.y" { (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number); } -#line 1536 "cmExprParser.cxx" +#line 1535 "cmExprParser.cxx" break; case 15: /* term: unary */ -#line 139 "cmExprParser.y" +#line 138 "cmExprParser.y" { (yyval.Number) = (yyvsp[0].Number); } -#line 1544 "cmExprParser.cxx" +#line 1543 "cmExprParser.cxx" break; case 16: /* term: term exp_TIMES unary */ -#line 142 "cmExprParser.y" +#line 141 "cmExprParser.y" { (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number); } -#line 1552 "cmExprParser.cxx" +#line 1551 "cmExprParser.cxx" break; case 17: /* term: term exp_DIVIDE unary */ -#line 145 "cmExprParser.y" +#line 144 "cmExprParser.y" { if (yyvsp[0].Number == 0) { throw std::overflow_error("divide by zero"); } (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number); } -#line 1563 "cmExprParser.cxx" +#line 1562 "cmExprParser.cxx" break; case 18: /* term: term exp_MOD unary */ -#line 151 "cmExprParser.y" +#line 150 "cmExprParser.y" { (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number); } -#line 1571 "cmExprParser.cxx" +#line 1570 "cmExprParser.cxx" break; case 19: /* unary: factor */ -#line 156 "cmExprParser.y" +#line 155 "cmExprParser.y" { (yyval.Number) = (yyvsp[0].Number); } -#line 1579 "cmExprParser.cxx" +#line 1578 "cmExprParser.cxx" break; case 20: /* unary: exp_PLUS unary */ -#line 159 "cmExprParser.y" +#line 158 "cmExprParser.y" { (yyval.Number) = + (yyvsp[0].Number); } -#line 1587 "cmExprParser.cxx" +#line 1586 "cmExprParser.cxx" break; case 21: /* unary: exp_MINUS unary */ -#line 162 "cmExprParser.y" +#line 161 "cmExprParser.y" { (yyval.Number) = - (yyvsp[0].Number); } -#line 1595 "cmExprParser.cxx" +#line 1594 "cmExprParser.cxx" break; case 22: /* unary: exp_NOT unary */ -#line 165 "cmExprParser.y" +#line 164 "cmExprParser.y" { (yyval.Number) = ~ (yyvsp[0].Number); } -#line 1603 "cmExprParser.cxx" +#line 1602 "cmExprParser.cxx" break; case 23: /* factor: exp_NUMBER */ -#line 170 "cmExprParser.y" +#line 169 "cmExprParser.y" { (yyval.Number) = (yyvsp[0].Number); } -#line 1611 "cmExprParser.cxx" +#line 1610 "cmExprParser.cxx" break; case 24: /* factor: exp_OPENPARENT exp exp_CLOSEPARENT */ -#line 173 "cmExprParser.y" +#line 172 "cmExprParser.y" { (yyval.Number) = (yyvsp[-1].Number); } -#line 1619 "cmExprParser.cxx" +#line 1618 "cmExprParser.cxx" break; -#line 1623 "cmExprParser.cxx" +#line 1622 "cmExprParser.cxx" default: break; } @@ -1843,7 +1842,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); return yyresult; } -#line 178 "cmExprParser.y" +#line 177 "cmExprParser.y" /* End of grammar */ diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y index 1c959f694d4..51df56efcc2 100644 --- a/Source/LexerParser/cmExprParser.y +++ b/Source/LexerParser/cmExprParser.y @@ -13,7 +13,6 @@ Run bison like this: #include "cmConfigure.h" // IWYU pragma: keep -#include #include #include #include diff --git a/Source/LexerParser/cmGccDepfileLexer.cxx b/Source/LexerParser/cmGccDepfileLexer.cxx index e58885301e8..ca5577e6a65 100644 --- a/Source/LexerParser/cmGccDepfileLexer.cxx +++ b/Source/LexerParser/cmGccDepfileLexer.cxx @@ -256,7 +256,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -421,7 +420,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -498,7 +497,7 @@ static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); void *yyalloc ( yy_size_t , yyscan_t yyscanner ); void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); @@ -545,7 +544,7 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ - yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; @@ -674,8 +673,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -722,7 +721,7 @@ FILE *yyget_out ( yyscan_t yyscanner ); void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); - yy_size_t yyget_leng ( yyscan_t yyscanner ); + int yyget_leng ( yyscan_t yyscanner ); char *yyget_text ( yyscan_t yyscanner ); @@ -795,7 +794,7 @@ static int input ( yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1241,7 +1240,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1255,7 +1254,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1313,7 +1312,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1406,7 +1405,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - yy_size_t number_to_move = yyg->yy_n_chars + 2; + int number_to_move = yyg->yy_n_chars + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; char *source = @@ -1458,7 +1457,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1836,12 +1835,12 @@ YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - yy_size_t i; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); @@ -1885,7 +1884,7 @@ static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) do \ { \ /* Undo effects of setting up yytext. */ \ - yy_size_t yyless_macro_arg = (n); \ + int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = yyg->yy_hold_char; \ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ @@ -1953,7 +1952,7 @@ FILE *yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t yyget_leng (yyscan_t yyscanner) +int yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; diff --git a/Source/LexerParser/cmGccDepfileLexer.h b/Source/LexerParser/cmGccDepfileLexer.h index ab73ebcc1fe..7d34060a10f 100644 --- a/Source/LexerParser/cmGccDepfileLexer.h +++ b/Source/LexerParser/cmGccDepfileLexer.h @@ -258,7 +258,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -372,7 +371,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -416,7 +415,7 @@ void yypop_buffer_state ( yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); void *yyalloc ( yy_size_t , yyscan_t yyscanner ); void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); @@ -463,7 +462,7 @@ FILE *yyget_out ( yyscan_t yyscanner ); void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); - yy_size_t yyget_leng ( yyscan_t yyscanner ); + int yyget_leng ( yyscan_t yyscanner ); char *yyget_text ( yyscan_t yyscanner ); diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx index c0643776cd1..90e08913f7c 100644 --- a/Source/cmBinUtilsMacOSMachOLinker.cxx +++ b/Source/cmBinUtilsMacOSMachOLinker.cxx @@ -5,7 +5,6 @@ #include #include -#include #include #include diff --git a/Source/cmBlockCommand.cxx b/Source/cmBlockCommand.cxx index ec79149060c..42f1ad377b2 100644 --- a/Source/cmBlockCommand.cxx +++ b/Source/cmBlockCommand.cxx @@ -3,7 +3,8 @@ #include "cmBlockCommand.h" -#include // IWYU pragma: keep +#include +#include #include #include diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index 81ed41ffaca..da680ca9381 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx index d65543a8c6b..329427cf2f4 100644 --- a/Source/cmCMakeLanguageCommand.cxx +++ b/Source/cmCMakeLanguageCommand.cxx @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -21,7 +20,7 @@ #include "cmGlobalGenerator.h" #include "cmListFileCache.h" #include "cmMakefile.h" -#include "cmMessageType.h" +#include "cmMessageType.h" // IWYU pragma: keep #include "cmRange.h" #include "cmState.h" #include "cmStringAlgorithms.h" diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx index 13eddbe24f9..270700087d6 100644 --- a/Source/cmCMakePresetsGraph.cxx +++ b/Source/cmCMakePresetsGraph.cxx @@ -4,6 +4,7 @@ #include #include +#include #include #include #include diff --git a/Source/cmCMakePresetsGraph.h b/Source/cmCMakePresetsGraph.h index 78446245091..a000e7dee3c 100644 --- a/Source/cmCMakePresetsGraph.h +++ b/Source/cmCMakePresetsGraph.h @@ -15,9 +15,9 @@ #include #include "cmJSONState.h" -#include "cmStateTypes.h" +#include "cmStateTypes.h" // IWYU pragma: keep -#include "CTest/cmCTestTypes.h" +#include "CTest/cmCTestTypes.h" // IWYU pragma: keep enum class PackageResolveMode; diff --git a/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx b/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx index 66ec6a49302..3890cd05513 100644 --- a/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx @@ -16,9 +16,10 @@ #include "cmCMakePresetsGraph.h" #include "cmCMakePresetsGraphInternal.h" #include "cmJSONHelpers.h" -#include "cmJSONState.h" #include "cmStateTypes.h" +class cmJSONState; + namespace { using CacheVariable = cmCMakePresetsGraph::CacheVariable; using ConfigurePreset = cmCMakePresetsGraph::ConfigurePreset; diff --git a/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx b/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx index 7290d4defaf..bbd77ba3f0e 100644 --- a/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include -#include #include #include #include diff --git a/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx b/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx index 791be04a58b..a7c59fa1907 100644 --- a/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include -#include #include #include #include diff --git a/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx b/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx index 7224e17d602..f596d6c430b 100644 --- a/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include -#include #include #include diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx index cc9ad010344..fbf7d737f78 100644 --- a/Source/cmCPackPropertiesGenerator.cxx +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -1,6 +1,7 @@ #include "cmCPackPropertiesGenerator.h" #include +#include #include #include "cmGeneratorExpression.h" diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index a3110413f82..6ff64373723 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 1924235ddac..e583daa028a 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -4,6 +4,7 @@ #include #include +#include #include #include diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index f51a1c895c9..7394d8655be 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index 9486b167e80..4f42206d07d 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -10,7 +10,7 @@ #include #include "cmListFileCache.h" -#include "cmMessageType.h" +#include "cmMessageType.h" // IWYU pragma: keep #include "cmPolicies.h" #include "cmValue.h" diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 0a1ed303ccc..cddbb9bb14b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -7,7 +7,6 @@ #include #include #include -#include #include #include diff --git a/Source/cmCxxModuleMapper.h b/Source/cmCxxModuleMapper.h index ef01e48ad03..34111f7f771 100644 --- a/Source/cmCxxModuleMapper.h +++ b/Source/cmCxxModuleMapper.h @@ -13,7 +13,8 @@ #include #include -#include "cmScanDepFormat.h" +enum class LookupMethod; +struct cmScanDepInfo; enum class CxxModuleMapFormat { diff --git a/Source/cmDebuggerAdapter.h b/Source/cmDebuggerAdapter.h index f261d88d8f8..3403b363849 100644 --- a/Source/cmDebuggerAdapter.h +++ b/Source/cmDebuggerAdapter.h @@ -16,7 +16,7 @@ #include // IWYU pragma: keep -#include "cmMessageType.h" +#include "cmMessageType.h" // IWYU pragma: keep class cmListFileFunction; class cmMakefile; diff --git a/Source/cmDebuggerBreakpointManager.cxx b/Source/cmDebuggerBreakpointManager.cxx index 4ae6728d401..db18c6ef56d 100644 --- a/Source/cmDebuggerBreakpointManager.cxx +++ b/Source/cmDebuggerBreakpointManager.cxx @@ -5,7 +5,6 @@ #include #include #include -#include #include #include diff --git a/Source/cmDebuggerBreakpointManager.h b/Source/cmDebuggerBreakpointManager.h index 747722f235c..815262a04fe 100644 --- a/Source/cmDebuggerBreakpointManager.h +++ b/Source/cmDebuggerBreakpointManager.h @@ -14,11 +14,9 @@ #include -class cmListFileFunction; +#include "cmDebuggerSourceBreakpoint.h" -namespace cmDebugger { -class cmDebuggerSourceBreakpoint; -} +class cmListFileFunction; namespace dap { class Session; diff --git a/Source/cmDebuggerExceptionManager.h b/Source/cmDebuggerExceptionManager.h index b8191284d26..4c044d7ec32 100644 --- a/Source/cmDebuggerExceptionManager.h +++ b/Source/cmDebuggerExceptionManager.h @@ -5,7 +5,6 @@ #include "cmConfigure.h" // IWYU pragma: keep #include -#include #include #include #include @@ -14,7 +13,7 @@ #include -#include "cmMessageType.h" +#include "cmMessageType.h" // IWYU pragma: keep namespace dap { class Session; diff --git a/Source/cmDebuggerProtocol.h b/Source/cmDebuggerProtocol.h index 4334aedb82e..d4b1a966723 100644 --- a/Source/cmDebuggerProtocol.h +++ b/Source/cmDebuggerProtocol.h @@ -4,7 +4,7 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include +#include #include diff --git a/Source/cmDebuggerVariablesHelper.cxx b/Source/cmDebuggerVariablesHelper.cxx index b2e85f2d7ce..73f91116e75 100644 --- a/Source/cmDebuggerVariablesHelper.cxx +++ b/Source/cmDebuggerVariablesHelper.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/Source/cmDebuggerVariablesManager.h b/Source/cmDebuggerVariablesManager.h index c219164233e..9a64f108571 100644 --- a/Source/cmDebuggerVariablesManager.h +++ b/Source/cmDebuggerVariablesManager.h @@ -7,14 +7,9 @@ #include #include #include -#include -#include // IWYU pragma: keep - -namespace dap { -struct Variable; -struct VariablesRequest; -} +#include +#include namespace cmDebugger { diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index a5f8aabec6f..453c0d1b6dc 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -3,7 +3,6 @@ #include "cmDefinitions.h" #include -#include #include #include diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 22fef807af2..11d89471d27 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -4,7 +4,6 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include #include #include #include diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx index c8061c36ee1..27f328d0b9d 100644 --- a/Source/cmDependsCompiler.cxx +++ b/Source/cmDependsCompiler.cxx @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index d038db74a2f..2a5056545d7 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "cmsys/FStream.hxx" diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index 70ba1fc3db4..b85b2f55677 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmDocumentationFormatter.h" -#include +#include // IWYU pragma: keep #include #include #include diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h index e269f6abc28..9d35e0a034d 100644 --- a/Source/cmDocumentationFormatter.h +++ b/Source/cmDocumentationFormatter.h @@ -4,6 +4,7 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include #include #include diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index 5e7008b957f..c54e6acc94b 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExportBuildAndroidMKGenerator.h" +#include #include #include #include diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h index 1a9a626cd10..7067488bc42 100644 --- a/Source/cmExportBuildAndroidMKGenerator.h +++ b/Source/cmExportBuildAndroidMKGenerator.h @@ -8,7 +8,6 @@ #include #include "cmExportBuildFileGenerator.h" -#include "cmExportFileGenerator.h" #include "cmStateTypes.h" class cmGeneratorTarget; diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h index c05751a15e6..061358ddd18 100644 --- a/Source/cmExportInstallAndroidMKGenerator.h +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -8,7 +8,6 @@ #include #include -#include "cmExportFileGenerator.h" #include "cmExportInstallFileGenerator.h" #include "cmStateTypes.h" diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index 8aec12b6605..02d044424a5 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -3,6 +3,7 @@ #include "cmExportLibraryDependenciesCommand.h" #include +#include #include #include diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 7e525d5f5c0..00c917325cb 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExportTryCompileFileGenerator.h" -#include #include #include @@ -13,7 +12,6 @@ #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmList.h" -#include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx index 8abb5a82f31..8b0f3097f50 100644 --- a/Source/cmFileAPI.cxx +++ b/Source/cmFileAPI.cxx @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 280ebb0136c..812b1b5a4f5 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/Source/cmFileTime.cxx b/Source/cmFileTime.cxx index 0606baf71fe..3d103d3785c 100644 --- a/Source/cmFileTime.cxx +++ b/Source/cmFileTime.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmFileTime.h" -#include #include // Use a platform-specific API to get file times efficiently. diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 5e92dd028cb..9f784181461 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index f863a512bcd..30458cdec76 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -11,7 +11,6 @@ #include #include -#include #include #include diff --git a/Source/cmGccDepfileLexerHelper.cxx b/Source/cmGccDepfileLexerHelper.cxx index 87377de4010..a375904fc94 100644 --- a/Source/cmGccDepfileLexerHelper.cxx +++ b/Source/cmGccDepfileLexerHelper.cxx @@ -4,7 +4,6 @@ #include #include -#include #include #include diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index e669f68d334..37a2be4a75a 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -3,6 +3,7 @@ #include "cmGeneratedFileStream.h" #include +#include #include "cmStringAlgorithms.h" #include "cmSystemTools.h" diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h index 63273e4bf5a..490de0a58b3 100644 --- a/Source/cmGeneratorExpressionParser.h +++ b/Source/cmGeneratorExpressionParser.h @@ -7,10 +7,9 @@ #include #include +#include "cmGeneratorExpressionEvaluator.h" #include "cmGeneratorExpressionLexer.h" -struct cmGeneratorExpressionEvaluator; - struct cmGeneratorExpressionParser { cmGeneratorExpressionParser(std::vector tokens); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index cff15745698..3be36977471 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 753d6f342cf..3de9b175749 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -17,6 +17,7 @@ #include #include "cmAlgorithms.h" +#include "cmComputeLinkInformation.h" #include "cmLinkItem.h" #include "cmListFileCache.h" #include "cmPolicies.h" @@ -24,7 +25,6 @@ #include "cmValue.h" enum class cmBuildStep; -class cmComputeLinkInformation; class cmCustomCommand; class cmFileSet; class cmGlobalGenerator; diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index a1e0650d208..4475d88199a 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2ee56f17ef4..8a8d2e0bcd3 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -24,6 +25,8 @@ #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" +#include "cm_codecvt_Encoding.hxx" + #include "cmAlgorithms.h" #include "cmCPackPropertiesGenerator.h" #include "cmComputeTargetDepends.h" diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 0815e310aaa..563ebb6c77c 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -19,18 +19,16 @@ #include #include -#include "cm_codecvt_Encoding.hxx" - #include "cmBuildOptions.h" #include "cmCustomCommandLines.h" #include "cmDuration.h" #include "cmExportSet.h" +#include "cmLocalGenerator.h" #include "cmStateSnapshot.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetDepend.h" -#include "cmTransformDepfile.h" #include "cmValue.h" #if !defined(CMAKE_BOOTSTRAP) @@ -41,13 +39,15 @@ #define CMAKE_DIRECTORY_ID_SEP "::@" +enum class cmDepfileFormat; +enum class codecvt_Encoding; + class cmDirectoryId; class cmExportBuildFileGenerator; class cmExternalMakefileProjectGenerator; class cmGeneratorTarget; class cmInstallRuntimeDependencySet; class cmLinkLineComputer; -class cmLocalGenerator; class cmMakefile; class cmOutputConverter; class cmQtAutoGenGlobalInitializer; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 71084ccbdfb..9ca1b2ec383 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/Source/cmInstallCxxModuleBmiGenerator.cxx b/Source/cmInstallCxxModuleBmiGenerator.cxx index 1ef1eaa8fa2..111691ea79c 100644 --- a/Source/cmInstallCxxModuleBmiGenerator.cxx +++ b/Source/cmInstallCxxModuleBmiGenerator.cxx @@ -11,6 +11,7 @@ #include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmOutputConverter.h" +#include "cmScriptGenerator.h" #include "cmStringAlgorithms.h" cmInstallCxxModuleBmiGenerator::cmInstallCxxModuleBmiGenerator( diff --git a/Source/cmInstallCxxModuleBmiGenerator.h b/Source/cmInstallCxxModuleBmiGenerator.h index 21edb2ef25f..23ed02ed179 100644 --- a/Source/cmInstallCxxModuleBmiGenerator.h +++ b/Source/cmInstallCxxModuleBmiGenerator.h @@ -9,7 +9,6 @@ #include #include "cmInstallGenerator.h" -#include "cmScriptGenerator.h" class cmGeneratorTarget; class cmListFileBacktrace; diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 7deb9ba8ce0..96a924fa0d1 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -9,7 +9,6 @@ #include #include "cmInstallGenerator.h" -#include "cmScriptGenerator.h" class cmListFileBacktrace; class cmLocalGenerator; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 1d81b0ba7b3..32196d33075 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -16,6 +16,7 @@ #include "cmInstallType.h" #include "cmListFileCache.h" #include "cmLocalGenerator.h" +#include "cmScriptGenerator.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 346ca67a89a..f2d4a05748c 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -10,7 +10,6 @@ #include #include "cmInstallGenerator.h" -#include "cmScriptGenerator.h" class cmExportInstallFileGenerator; class cmExportSet; diff --git a/Source/cmInstallFileSetGenerator.h b/Source/cmInstallFileSetGenerator.h index 56341d4905f..708cee6b938 100644 --- a/Source/cmInstallFileSetGenerator.h +++ b/Source/cmInstallFileSetGenerator.h @@ -8,7 +8,6 @@ #include #include "cmInstallGenerator.h" -#include "cmScriptGenerator.h" class cmGeneratorTarget; class cmFileSet; diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 53076b3b349..874bde1a458 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -9,7 +9,6 @@ #include #include "cmInstallGenerator.h" -#include "cmScriptGenerator.h" class cmListFileBacktrace; class cmLocalGenerator; diff --git a/Source/cmInstallGetRuntimeDependenciesGenerator.cxx b/Source/cmInstallGetRuntimeDependenciesGenerator.cxx index 3e493bccdf5..3f8a10391d8 100644 --- a/Source/cmInstallGetRuntimeDependenciesGenerator.cxx +++ b/Source/cmInstallGetRuntimeDependenciesGenerator.cxx @@ -19,6 +19,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" +#include "cmScriptGenerator.h" #include "cmStringAlgorithms.h" namespace { diff --git a/Source/cmInstallGetRuntimeDependenciesGenerator.h b/Source/cmInstallGetRuntimeDependenciesGenerator.h index a2d65937639..8e4e8cbe106 100644 --- a/Source/cmInstallGetRuntimeDependenciesGenerator.h +++ b/Source/cmInstallGetRuntimeDependenciesGenerator.h @@ -7,7 +7,6 @@ #include #include "cmInstallGenerator.h" -#include "cmScriptGenerator.h" class cmListFileBacktrace; class cmLocalGenerator; diff --git a/Source/cmInstallImportedRuntimeArtifactsGenerator.h b/Source/cmInstallImportedRuntimeArtifactsGenerator.h index 9e045ee725d..84d3feea00f 100644 --- a/Source/cmInstallImportedRuntimeArtifactsGenerator.h +++ b/Source/cmInstallImportedRuntimeArtifactsGenerator.h @@ -8,7 +8,6 @@ #include "cmInstallGenerator.h" #include "cmListFileCache.h" -#include "cmScriptGenerator.h" class cmGeneratorTarget; class cmLocalGenerator; diff --git a/Source/cmInstallRuntimeDependencySetGenerator.h b/Source/cmInstallRuntimeDependencySetGenerator.h index 680361bc074..1a3c1e472ed 100644 --- a/Source/cmInstallRuntimeDependencySetGenerator.h +++ b/Source/cmInstallRuntimeDependencySetGenerator.h @@ -7,7 +7,6 @@ #include #include "cmInstallGenerator.h" -#include "cmScriptGenerator.h" class cmInstallRuntimeDependencySet; class cmListFileBacktrace; diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index c3a70580ee5..012a4a3ed2e 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -9,7 +9,6 @@ #include "cmInstallGenerator.h" #include "cmListFileCache.h" -#include "cmScriptGenerator.h" class cmLocalGenerator; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 3ac100d6129..e7998ead317 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -23,6 +23,7 @@ #include "cmMessageType.h" #include "cmOutputConverter.h" #include "cmPolicies.h" +#include "cmScriptGenerator.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 2f41163bc7e..11a32649f45 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -11,7 +11,6 @@ #include "cmInstallGenerator.h" #include "cmInstallType.h" #include "cmListFileCache.h" -#include "cmScriptGenerator.h" class cmGeneratorTarget; class cmLocalGenerator; diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index 373c34938ac..e0d7647c0a9 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -9,7 +9,8 @@ #include #include -class cmCompiledGeneratorExpression; +#include "cmGeneratorExpression.h" + class cmMakefile; /** \class cmInstalledFile diff --git a/Source/cmJSONState.cxx b/Source/cmJSONState.cxx index 92bde778a7b..1abdaa6c4d0 100644 --- a/Source/cmJSONState.cxx +++ b/Source/cmJSONState.cxx @@ -3,10 +3,9 @@ #include "cmJSONState.h" +#include #include -#include - #include #include diff --git a/Source/cmJSONState.h b/Source/cmJSONState.h index 4984c81b344..90712680565 100644 --- a/Source/cmJSONState.h +++ b/Source/cmJSONState.h @@ -9,7 +9,6 @@ #include #include -#include "cmJSONState.h" #include "cmStringAlgorithms.h" namespace Json { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index acefedceebf..186b856186a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include "cmLinkLineDeviceComputer.h" #include "cmList.h" #include "cmMakefile.h" +#include "cmMessageType.h" #include "cmRange.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 7734cbe33c2..3d2e5f6b697 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -19,8 +19,9 @@ #include #include "cmCustomCommandTypes.h" +#include "cmGeneratorTarget.h" #include "cmListFileCache.h" -#include "cmMessageType.h" +#include "cmMessageType.h" // IWYU pragma: keep #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmStateSnapshot.h" @@ -31,7 +32,6 @@ class cmComputeLinkInformation; class cmCustomCommand; class cmCustomCommandGenerator; class cmCustomCommandLines; -class cmGeneratorTarget; class cmGlobalGenerator; class cmImplicitDependsList; class cmLinkLineComputer; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 4b0604c55ec..2316fb3f7c5 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -14,6 +14,8 @@ #include "cmsys/FStream.hxx" +#include "cm_codecvt_Encoding.hxx" + #include "cmCryptoHash.h" #include "cmCustomCommand.h" #include "cmCustomCommandGenerator.h" diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 16a51888f76..a96a36dc745 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -32,6 +32,7 @@ #include "cmCommandArgumentParserHelper.h" #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" +#include "cmCustomCommandTypes.h" #include "cmExecutionStatus.h" #include "cmExpandedCommandArgument.h" // IWYU pragma: keep #include "cmExportBuildFileGenerator.h" diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 79a98cd9d38..b81af2f5ec3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -25,9 +25,9 @@ #include "cmAlgorithms.h" #include "cmCustomCommand.h" -#include "cmCustomCommandTypes.h" +#include "cmFunctionBlocker.h" #include "cmListFileCache.h" -#include "cmMessageType.h" +#include "cmMessageType.h" // IWYU pragma: keep #include "cmNewLineStyle.h" #include "cmPolicies.h" #include "cmSourceFileLocationKind.h" @@ -43,12 +43,14 @@ # include "cmSourceGroup.h" #endif +enum class cmCustomCommandType; +enum class cmObjectLibraryCommands; + class cmCompiledGeneratorExpression; class cmCustomCommandLines; class cmExecutionStatus; class cmExpandedCommandArgument; class cmExportBuildFileGenerator; -class cmFunctionBlocker; class cmGeneratorExpressionEvaluationFile; class cmGlobalGenerator; class cmInstallGenerator; diff --git a/Source/cmMakefileProfilingData.cxx b/Source/cmMakefileProfilingData.cxx index e903ae12009..93875824fe3 100644 --- a/Source/cmMakefileProfilingData.cxx +++ b/Source/cmMakefileProfilingData.cxx @@ -4,7 +4,6 @@ #include #include -#include #include #include diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx index 4e975d122fc..b4ea71cf450 100644 --- a/Source/cmMessenger.cxx +++ b/Source/cmMessenger.cxx @@ -4,6 +4,7 @@ #include "cmDocumentationFormatter.h" #include "cmMessageMetadata.h" +#include "cmMessageType.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" diff --git a/Source/cmMessenger.h b/Source/cmMessenger.h index bdefb005ad7..d9462d44497 100644 --- a/Source/cmMessenger.h +++ b/Source/cmMessenger.h @@ -11,7 +11,7 @@ #include #include "cmListFileCache.h" -#include "cmMessageType.h" +#include "cmMessageType.h" // IWYU pragma: keep #ifdef CMake_ENABLE_DEBUGGER namespace cmDebugger { diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a5280fb54db..e41a0c3712a 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d712d719567..6e74d9a2db8 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 37c4afce0a6..a46c87bdbd8 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 02981ae0939..9c30d74a837 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #ifdef _WIN32 # include diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index f147ed22def..6a9a74ce3dc 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -5,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 4d1ccfe9acf..3aef29940d4 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -3,7 +3,6 @@ #include "cmProjectCommand.h" #include -#include #include #include #include diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index e5c7bda669b..c04831293fa 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoGenerator.h" +#include + #include #include "cmsys/FStream.hxx" diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index a101a818ec2..429b7374ca8 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -27,6 +27,7 @@ #include "cmCryptoHash.h" #include "cmFileTime.h" #include "cmGccDepfileReader.h" +#include "cmGccDepfileReaderTypes.h" #include "cmGeneratedFileStream.h" #include "cmQtAutoGen.h" #include "cmQtAutoGenerator.h" diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx index 414a69275d9..e288645ba4a 100644 --- a/Source/cmQtAutoRcc.cxx +++ b/Source/cmQtAutoRcc.cxx @@ -14,7 +14,6 @@ #include "cmFileLockResult.h" #include "cmFileTime.h" #include "cmProcessOutput.h" -#include "cmQtAutoGen.h" #include "cmQtAutoGenerator.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" diff --git a/Source/cmState.h b/Source/cmState.h index 1ebd79a5c0f..b79f3e603bb 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index e2307029267..8217a9c9197 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -10,6 +10,7 @@ #include #include "cmDefinitions.h" +#include "cmLinkedTree.h" #include "cmListFileCache.h" #include "cmPropertyMap.h" #include "cmState.h" diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h index a61ec833741..1796d760b13 100644 --- a/Source/cmStateSnapshot.h +++ b/Source/cmStateSnapshot.h @@ -10,7 +10,6 @@ #include -#include "cmLinkedTree.h" #include "cmPolicies.h" #include "cmStateTypes.h" #include "cmValue.h" diff --git a/Source/cmString.hxx b/Source/cmString.hxx index f1e462bb2cd..86b21c8ef7a 100644 --- a/Source/cmString.hxx +++ b/Source/cmString.hxx @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f014de9d7a5..bf3fcd9d306 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -529,7 +529,7 @@ bool cmSystemTools::SplitProgramFromArgs(std::string const& command, return !in_single && !in_escape && !in_double; } -size_t cmSystemTools::CalculateCommandLineLengthLimit() +std::size_t cmSystemTools::CalculateCommandLineLengthLimit() { size_t sz = #ifdef _WIN32 diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 6592f84eb3b..27d788e6bec 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -305,7 +305,7 @@ class cmSystemTools : public cmsys::SystemTools std::vector::const_iterator argBeg, std::vector::const_iterator argEnd); - static size_t CalculateCommandLineLengthLimit(); + static std::size_t CalculateCommandLineLengthLimit(); static void DisableRunCommandOutput() { s_DisableRunCommandOutput = true; } static void EnableRunCommandOutput() { s_DisableRunCommandOutput = false; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 2d12a702c2c..7c10295cbcc 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -15,7 +15,7 @@ #include #include "cmAlgorithms.h" -#include "cmFileSet.h" +#include "cmListFileCache.h" #include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" @@ -23,20 +23,16 @@ #include "cmValue.h" class cmCustomCommand; +class cmFileSet; class cmGlobalGenerator; class cmInstallTargetGenerator; -class cmListFileBacktrace; -class cmListFileContext; class cmMakefile; class cmPropertyMap; class cmSourceFile; class cmTargetExport; class cmTargetInternals; -template -class BT; -template -class BTs; +enum class cmFileSetVisibility; /** \class cmTarget * \brief Represent a library or executable target loaded from a makefile. diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 03d7c9fea9d..bfd3972b906 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -3,6 +3,7 @@ #include "cmTargetLinkLibrariesCommand.h" #include +#include #include #include #include diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx index 12c121fcf46..914172b6c9e 100644 --- a/Source/cmTransformDepfile.cxx +++ b/Source/cmTransformDepfile.cxx @@ -5,7 +5,6 @@ #include #include #include -#include #include #include diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx index e05b2d526d1..34e6a7091cd 100644 --- a/Source/cmUVHandlePtr.cxx +++ b/Source/cmUVHandlePtr.cxx @@ -11,6 +11,9 @@ namespace cm { +template +struct uv_handle_deleter; + struct uv_loop_deleter { void operator()(uv_loop_t* loop) const; diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index 119851c32fe..655e52aaf6e 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -1,14 +1,11 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmConfigure.h" - #include "cmUVProcessChain.h" #include #include #include #include // IWYU pragma: keep -#include #include #include diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h index 5ba1bf9cdbf..0f37e7d0c84 100644 --- a/Source/cmUVProcessChain.h +++ b/Source/cmUVProcessChain.h @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #pragma once +#include "cmConfigure.h" // IWYU pragma: keep + #include #include // IWYU pragma: keep #include diff --git a/Source/cmValue.h b/Source/cmValue.h index f96d2f5de23..c924dda56df 100644 --- a/Source/cmValue.h +++ b/Source/cmValue.h @@ -4,7 +4,6 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include #include #include diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4af3ebc1ac5..90de51a05e2 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -24,6 +24,7 @@ #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" #include "cmCustomCommandGenerator.h" +#include "cmFileSet.h" #include "cmGeneratedFileStream.h" #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" diff --git a/Source/cmWindowsRegistry.cxx b/Source/cmWindowsRegistry.cxx index 6dba8631eff..a4a1ad60c66 100644 --- a/Source/cmWindowsRegistry.cxx +++ b/Source/cmWindowsRegistry.cxx @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/Source/cmWindowsRegistry.h b/Source/cmWindowsRegistry.h index f4a0e7b8251..42179eda8b7 100644 --- a/Source/cmWindowsRegistry.h +++ b/Source/cmWindowsRegistry.h @@ -5,6 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include // IWYU pragma: keep +#include #include #include diff --git a/Source/cmXcFramework.cxx b/Source/cmXcFramework.cxx index c91e7f2ad70..6435ef99292 100644 --- a/Source/cmXcFramework.cxx +++ b/Source/cmXcFramework.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmXcFramework.h" -#include #include #include diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx index 7b3349b5fdc..60faced2774 100644 --- a/Source/cm_codecvt.cxx +++ b/Source/cm_codecvt.cxx @@ -13,6 +13,8 @@ # include "cm_utf8.h" #endif +#include "cm_codecvt_Encoding.hxx" + codecvt::codecvt(codecvt_Encoding e) #if defined(_WIN32) : m_codepage(0) diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx index eb98e98090a..c25f9ef3e8c 100644 --- a/Source/cm_codecvt.hxx +++ b/Source/cm_codecvt.hxx @@ -7,7 +7,7 @@ #include #include -#include "cm_codecvt_Encoding.hxx" +enum class codecvt_Encoding; class codecvt : public std::codecvt { diff --git a/Source/cmake.h b/Source/cmake.h index 156d061ea3b..58f90c91cd5 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -17,8 +17,9 @@ #include #include -#include "cmDocumentationEntry.h" +#include "cmDocumentationEntry.h" // IWYU pragma: keep #include "cmGeneratedFileStream.h" +#include "cmGlobalGeneratorFactory.h" #include "cmInstalledFile.h" #include "cmListFileCache.h" #include "cmMessageType.h" @@ -48,7 +49,6 @@ class cmExternalMakefileProjectGeneratorFactory; class cmFileAPI; class cmFileTimeCache; class cmGlobalGenerator; -class cmGlobalGeneratorFactory; class cmMakefile; class cmMessenger; class cmVariableWatch; diff --git a/Tests/CMakeLib/testCMExtAlgorithm.cxx b/Tests/CMakeLib/testCMExtAlgorithm.cxx index c909f24d06f..53b0302a096 100644 --- a/Tests/CMakeLib/testCMExtAlgorithm.cxx +++ b/Tests/CMakeLib/testCMExtAlgorithm.cxx @@ -1,6 +1,5 @@ #include #include -#include #include #include diff --git a/Tests/CMakeLib/testEncoding.cxx b/Tests/CMakeLib/testEncoding.cxx index 4936898ed04..460d845f49b 100644 --- a/Tests/CMakeLib/testEncoding.cxx +++ b/Tests/CMakeLib/testEncoding.cxx @@ -1,4 +1,5 @@ #include +#include #include #include "cmsys/FStream.hxx" diff --git a/Tests/CMakeLib/testGccDepfileReader.cxx b/Tests/CMakeLib/testGccDepfileReader.cxx index d46e8f3fe03..fb19c14eaa6 100644 --- a/Tests/CMakeLib/testGccDepfileReader.cxx +++ b/Tests/CMakeLib/testGccDepfileReader.cxx @@ -1,6 +1,5 @@ #include // IWYU pragma: keep #include -#include #include #include #include diff --git a/Tests/CMakeLib/testList.cxx b/Tests/CMakeLib/testList.cxx index f6ec7208ea3..3e99ae86736 100644 --- a/Tests/CMakeLib/testList.cxx +++ b/Tests/CMakeLib/testList.cxx @@ -4,7 +4,6 @@ #include #include #include -#include #include #include diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx index 785f0313b6c..933ab705049 100644 --- a/Tests/CMakeLib/testOptional.cxx +++ b/Tests/CMakeLib/testOptional.cxx @@ -1,5 +1,4 @@ #include -#include #include #include diff --git a/Tests/CMakeLib/testString.cxx b/Tests/CMakeLib/testString.cxx index af34a2f2263..350926620ca 100644 --- a/Tests/CMakeLib/testString.cxx +++ b/Tests/CMakeLib/testString.cxx @@ -1,14 +1,12 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include // IWYU pragma: keep #include #include #include #include #include #include -#include #include #include diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index 22373ef52fa..fc84bb07db1 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -5,7 +5,6 @@ #include #include #include -#include #include #include diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index 0f03c33ff48..e45970d1e42 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -1,4 +1,6 @@ [ + # https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md + # C++ alternatives to C standard headers { include: [ "", public, "", public ] }, { include: [ "", public, "", public ] }, @@ -30,7 +32,7 @@ { include: [ "", private, "", public ] }, { include: [ "", private, "", public ] }, { include: [ "", private, "", public ] }, - { include: [ "", private, "", private ] }, + { include: [ "", private, "", public ] }, { include: [ "", private, "", public ] }, { include: [ "", private, "", public ] }, { include: [ "", private, "", public ] }, @@ -41,70 +43,16 @@ # HACK: check whether this can be removed with next iwyu release. { symbol: [ "__GLIBC__", private, "", public ] }, - { symbol: [ "_Noreturn", private, "", public ] }, # HACK: iwyu wrongly thinks that including is sufficient. { symbol: [ "std::stringstream", private, "", public ] }, { symbol: [ "std::istringstream", private, "", public ] }, { symbol: [ "std::ostringstream", private, "", public ] }, - # HACK: iwyu suggests and each time vector[] is used. - # https://github.com/include-what-you-use/include-what-you-use/issues/166 - { include: [ "", private, "", public ] }, - { symbol: [ "std::allocator_traits >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits > >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits, std::allocator > > >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits, std::allocator > > > >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits, std::allocator >, std::allocator, std::allocator > > > > >::value_type", private, "", public ] }, - { symbol: [ "std::allocator_traits >::value_type", private, "", public ] }, - - # TODO: enable this block and remove some includes? - #{ symbol: [ "std::pair", private, "", public ] }, - #{ symbol: [ "std::pair", private, "", public ] }, - #{ symbol: [ "std::pair", private, "", public ] }, - - # HACK: iwyu wrongly thinks that is needed for std::hash - { symbol: [ "std::hash", private, "", public ] }, - - # HACK: iwyu thinks we use a libstdc++ private type - { symbol: [ "__gnu_cxx::size_t", private, "", public ] }, - - # __decay_and_strip is used internally in the C++11 standard library. - # IWYU does not classify it as internal and suggests to add . - # To ignore it, we simply map it to a file that is included anyway. - # Use 'CMake_IWYU_VERBOSE' to see the fully qualified names that need this. - # TODO: Can this be simplified with an @-expression? - #{ symbol: [ "@std::__decay_and_strip<.*>::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip &>::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip &>::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip<__gnu_cxx::__normal_iterator > > &>::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__decay_and_strip > *, std::vector >, std::allocator > > > > &>::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__success_type > >::type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::__success_type > >::type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::enable_if > >::type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::enable_if > >::type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::enable_if > >::type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "__gnu_cxx::__enable_if::__type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::remove_reference, std::allocator > &>::type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::remove_reference::type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::remove_reference::type", private, "\"cmConfigure.h\"", public ] }, - { symbol: [ "std::remove_reference::type", private, "\"cmConfigure.h\"", public ] }, + # HACK: iwyu attributes vector's usage of std::max to its caller. + # https://github.com/include-what-you-use/include-what-you-use/issues/908 + { symbol: ["std::max", "private", "", "public" ] }, + { symbol: ["std::max", "private", "", "public" ] }, # Wrappers for 3rd-party libraries { include: [ "@<.*curl/curlver.h>", private, "", public ] }, @@ -127,10 +75,10 @@ { include: [ "", public, "\"cmsys/FStream.hxx\"", public ] }, { include: [ "", public, "\"cmsys/FStream.hxx\"", public ] }, - { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, # major and minor are used as macro arguments. Those are false matches. { symbol: [ "major", private, "\"cmVersion.h\"", public ] }, From 9bf8f7de0650a3a904b4947bd5527206e2564724 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Tue, 11 Jul 2023 08:33:37 -0400 Subject: [PATCH 180/627] find_library(): Add support for .xcframework Issue: #21752 --- Help/command/find_library.rst | 4 ++++ Help/release/dev/xcframework-find-library.rst | 5 +++++ Source/cmFindLibraryCommand.cxx | 16 ++++++++++++++++ Tests/RunCMake/XcFramework/RunCMakeTest.cmake | 10 ++++++++++ Tests/RunCMake/XcFramework/find-library.cmake | 5 +++++ 5 files changed, 40 insertions(+) create mode 100644 Help/release/dev/xcframework-find-library.rst create mode 100644 Tests/RunCMake/XcFramework/find-library.cmake diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index 99e36a49b6e..fb2c2f1bb89 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -60,6 +60,10 @@ path to the framework ``/A.framework``. When a full path to a framework is used as a library, CMake will use a ``-framework A``, and a ``-F`` to link the framework to the target. +.. versionadded:: 3.28 + + The library found can now be a ``.xcframework`` folder. + If the :variable:`CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX` variable is set all search paths will be tested as normal, with the suffix appended, and with all matches of ``lib/`` replaced with diff --git a/Help/release/dev/xcframework-find-library.rst b/Help/release/dev/xcframework-find-library.rst new file mode 100644 index 00000000000..527270e5e38 --- /dev/null +++ b/Help/release/dev/xcframework-find-library.rst @@ -0,0 +1,5 @@ +xcframework-find-library +------------------------ + +* The :command:`find_library` command can now find ``.xcframework`` folders on + Apple platforms. diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 6a571b42910..df77ad0e691 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -558,6 +558,14 @@ std::string cmFindLibraryCommand::FindFrameworkLibraryNamesPerDir() // Search for all names in each search path. for (std::string const& d : this->SearchPaths) { for (std::string const& n : this->Names) { + fwPath = cmStrCat(d, n, ".xcframework"); + if (cmSystemTools::FileIsDirectory(fwPath)) { + auto finalPath = cmSystemTools::CollapseFullPath(fwPath); + if (this->Validate(finalPath)) { + return finalPath; + } + } + fwPath = cmStrCat(d, n, ".framework"); if (cmSystemTools::FileIsDirectory(fwPath)) { auto finalPath = cmSystemTools::CollapseFullPath(fwPath); @@ -578,6 +586,14 @@ std::string cmFindLibraryCommand::FindFrameworkLibraryDirsPerName() // Search for each name in all search paths. for (std::string const& n : this->Names) { for (std::string const& d : this->SearchPaths) { + fwPath = cmStrCat(d, n, ".xcframework"); + if (cmSystemTools::FileIsDirectory(fwPath)) { + auto finalPath = cmSystemTools::CollapseFullPath(fwPath); + if (this->Validate(finalPath)) { + return finalPath; + } + } + fwPath = cmStrCat(d, n, ".framework"); if (cmSystemTools::FileIsDirectory(fwPath)) { auto finalPath = cmSystemTools::CollapseFullPath(fwPath); diff --git a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake index dcfaad4db01..95883bf9021 100644 --- a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake @@ -81,3 +81,13 @@ if(RunCMake_GENERATOR STREQUAL "Xcode" AND CMAKE_C_COMPILER_VERSION VERSION_GREA create_executables(target-framework-link-phase framework) run_cmake_with_options(create-executable-target-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) endif() + +# Ensure that .xcframework is found before .framework +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-xcframework-framework-build) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_command(copy-framework ${CMAKE_COMMAND} -E copy_directory ${RunCMake_BINARY_DIR}/create-framework-macos-build/install/lib/mylib.framework ${RunCMake_TEST_BINARY_DIR}/mylib.framework) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) + +run_cmake(find-library) +run_cmake_command(find-library-script ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/find-library.cmake) diff --git a/Tests/RunCMake/XcFramework/find-library.cmake b/Tests/RunCMake/XcFramework/find-library.cmake new file mode 100644 index 00000000000..c5fe8db4fd3 --- /dev/null +++ b/Tests/RunCMake/XcFramework/find-library.cmake @@ -0,0 +1,5 @@ +find_library(MYLIB_XCFRAMEWORK mylib NO_DEFAULT_PATH PATHS "${CMAKE_BINARY_DIR}/../create-xcframework-framework-build") +file(REAL_PATH "${CMAKE_BINARY_DIR}/../create-xcframework-framework-build/mylib.xcframework" expected_path) +if(NOT MYLIB_XCFRAMEWORK STREQUAL expected_path) + message(FATAL_ERROR "Expected value of MYLIB_XCFRAMEWORK:\n ${expected_path}\nActual value:\n ${MYLIB_XCFRAMEWORK}") +endif() From eb092ade48c7ee619f06cec371a45b0141fcf89f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 29 Jul 2023 00:01:13 -0400 Subject: [PATCH 181/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 81e027ed7da..6426d673d40 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230728) +set(CMake_VERSION_PATCH 20230729) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From e53b4c9fb9c40bd13b3df40c2da745db63ac15b0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 12:31:35 -0400 Subject: [PATCH 182/627] Help: fix cross-linking from `Swift_LANGUAGE_VERSION` property --- Help/prop_tgt/Swift_LANGUAGE_VERSION.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst b/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst index afc6b312536..d1d80a86e58 100644 --- a/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst +++ b/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst @@ -4,5 +4,6 @@ Swift_LANGUAGE_VERSION .. versionadded:: 3.16 This property sets the language version for the Swift sources in the target. If -one is not specified, it will default to ```` if -specified, otherwise it is the latest version supported by the compiler. +one is not specified, it will default to +:variable:`CMAKE_Swift_LANGUAGE_VERSION` if specified, otherwise it is the +latest version supported by the compiler. From 1d4a013dd12255f0922aecee5b7b8a2cb7ec9597 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:17:08 -0400 Subject: [PATCH 183/627] Help: fix agreement in `DLL_NAME_WITH_SOVERSION` docs --- Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst b/Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst index 59ef00f0a1e..c86b218eb0e 100644 --- a/Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst +++ b/Help/prop_tgt/DLL_NAME_WITH_SOVERSION.rst @@ -3,8 +3,8 @@ DLL_NAME_WITH_SOVERSION .. versionadded:: 3.27 -This property control whether the :prop_tgt:`SOVERSION` target -property are added to the filename of generated DLL filenames +This property controls whether the :prop_tgt:`SOVERSION` target +property is added to the filename of generated DLL filenames for the Windows platform, which is selected when the :variable:`WIN32` variable is set. From d718262faa262dc2fdaf67294b224743b86c40d0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:17:24 -0400 Subject: [PATCH 184/627] cmTarget: handle `HIP_STANDARD` like other language standards --- Source/cmTarget.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 76a14b8ba7b..593a019c981 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2423,6 +2423,7 @@ cmValue cmTarget::GetProperty(const std::string& prop) const propC_STANDARD, propCXX_STANDARD, propCUDA_STANDARD, + propHIP_STANDARD, propOBJC_STANDARD, propOBJCXX_STANDARD, propLINK_LIBRARIES, @@ -2447,8 +2448,8 @@ cmValue cmTarget::GetProperty(const std::string& prop) const }; if (specialProps.count(prop)) { if (prop == propC_STANDARD || prop == propCXX_STANDARD || - prop == propCUDA_STANDARD || prop == propOBJC_STANDARD || - prop == propOBJCXX_STANDARD) { + prop == propCUDA_STANDARD || prop == propHIP_STANDARD || + prop == propOBJC_STANDARD || prop == propOBJCXX_STANDARD) { auto propertyIter = this->impl->LanguageStandardProperties.find(prop); if (propertyIter == this->impl->LanguageStandardProperties.end()) { return nullptr; From f81351607c343517f3fa48ca93dfaf2a33688c84 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:18:20 -0400 Subject: [PATCH 185/627] Tests/RunCMake/property_init: add skeleton for testing --- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/property_init/CMakeLists.txt | 6 ++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 3 files changed, 8 insertions(+) create mode 100644 Tests/RunCMake/property_init/CMakeLists.txt create mode 100644 Tests/RunCMake/property_init/RunCMakeTest.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 280b81e85c5..f8b84b25a06 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -536,6 +536,7 @@ add_RunCMake_test(option) add_RunCMake_test(PrintHelpers) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) add_RunCMake_test(project_injected) +add_RunCMake_test(property_init) add_RunCMake_test(DependencyProviders) add_RunCMake_test(return) add_RunCMake_test(separate_arguments) diff --git a/Tests/RunCMake/property_init/CMakeLists.txt b/Tests/RunCMake/property_init/CMakeLists.txt new file mode 100644 index 00000000000..9548deb57a9 --- /dev/null +++ b/Tests/RunCMake/property_init/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.12) +project(${RunCMake_TEST} NONE) + +include(util.cmake) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake new file mode 100644 index 00000000000..837e9524883 --- /dev/null +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -0,0 +1 @@ +include(RunCMake) From 16c24cce4775d46787cc27fe49108271d6bcf167 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:20:12 -0400 Subject: [PATCH 186/627] Tests/RunCMake/property_init: add a function to check a property --- Tests/RunCMake/property_init/util.cmake | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Tests/RunCMake/property_init/util.cmake diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake new file mode 100644 index 00000000000..52d0961d60c --- /dev/null +++ b/Tests/RunCMake/property_init/util.cmake @@ -0,0 +1,24 @@ +function (check_property target property expected) + if (NOT TARGET "${target}") + message(SEND_ERROR + "No such target '${target}'") + return () + endif () + + get_property(is_set TARGET "${target}" PROPERTY "${property}" SET) + if (is_set) + get_property(actual TARGET "${target}" PROPERTY "${property}") + endif () + if (expected STREQUAL "") + if (is_set) + message(SEND_ERROR + "Target '${target}' should not have '${property}' set at all, but is '${actual}'") + endif () + elseif (is_set AND NOT expected STREQUAL actual) + message(SEND_ERROR + "Target '${target}' should have '${property}' set to '${expected}', but is '${actual}'") + elseif (NOT is_set) + message(SEND_ERROR + "Target '${target}' should have '${property}' set to '${expected}', but is not set at all") + endif () +endfunction () From 7b9378be43ac244baefb03bd7ab34ae882d3c1f1 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:21:49 -0400 Subject: [PATCH 187/627] Tests/RunCMake/property_init: add a function to parse property tables The tables will be triples of property / value / alias value. Parsing is a bit tricky, but is easier when `foreach (IN ZIP_LISTS)` with the values in their distinct list. --- Tests/RunCMake/property_init/util.cmake | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake index 52d0961d60c..41a200a979d 100644 --- a/Tests/RunCMake/property_init/util.cmake +++ b/Tests/RunCMake/property_init/util.cmake @@ -22,3 +22,32 @@ function (check_property target property expected) "Target '${target}' should have '${property}' set to '${expected}', but is not set at all") endif () endfunction () + +function (prepare_properties table output_properties output_expected output_alias) + set(_properties) + set(_expected) + set(_alias) + + set(variable "_properties") + foreach (item IN LISTS "${table}") + list(APPEND "${variable}" "${item}") + if (variable STREQUAL "_properties") + set(variable "_expected") + elseif (variable STREQUAL "_expected") + set(variable "_alias") + elseif (variable STREQUAL "_alias") + set(variable "_properties") + else () + message(FATAL_ERROR + "Failed to track property table parsing") + endif () + endforeach () + if (NOT variable STREQUAL "_properties") + message(FATAL_ERROR + "Table does not have a multiple of 3 items") + endif () + + set("${output_properties}" "${_properties}" PARENT_SCOPE) + set("${output_expected}" "${_expected}" PARENT_SCOPE) + set("${output_alias}" "${_alias}" PARENT_SCOPE) +endfunction () From 1c0963e9f2cd2b7a5ff5e02fc7c26e47232061f4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:26:53 -0400 Subject: [PATCH 188/627] Tests/RunCMake/property_init: add functions to make example targets --- Tests/RunCMake/property_init/CMakeLists.txt | 5 ++- Tests/RunCMake/property_init/library.c | 4 ++ Tests/RunCMake/property_init/main.c | 4 ++ Tests/RunCMake/property_init/util.cmake | 46 +++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/property_init/library.c create mode 100644 Tests/RunCMake/property_init/main.c diff --git a/Tests/RunCMake/property_init/CMakeLists.txt b/Tests/RunCMake/property_init/CMakeLists.txt index 9548deb57a9..51883afde47 100644 --- a/Tests/RunCMake/property_init/CMakeLists.txt +++ b/Tests/RunCMake/property_init/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.12) -project(${RunCMake_TEST} NONE) +project(${RunCMake_TEST} C) + +set(main_sources main.c) +set(library_sources library.c) include(util.cmake) diff --git a/Tests/RunCMake/property_init/library.c b/Tests/RunCMake/property_init/library.c new file mode 100644 index 00000000000..ad6a649d1ab --- /dev/null +++ b/Tests/RunCMake/property_init/library.c @@ -0,0 +1,4 @@ +int foo(int arg) +{ + return arg; +} diff --git a/Tests/RunCMake/property_init/main.c b/Tests/RunCMake/property_init/main.c new file mode 100644 index 00000000000..14917b75297 --- /dev/null +++ b/Tests/RunCMake/property_init/main.c @@ -0,0 +1,4 @@ +int main(int argc, char* argv[]) +{ + return argc - 1; +} diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake index 41a200a979d..e98c2d5cfff 100644 --- a/Tests/RunCMake/property_init/util.cmake +++ b/Tests/RunCMake/property_init/util.cmake @@ -1,3 +1,49 @@ +set(all_target_types + "EXECUTABLE" + + "IMPORTED_EXECUTABLE" + + "INTERFACE" + "MODULE" + "OBJECT" + "SHARED" + "STATIC" + + "IMPORTED_INTERFACE" + "IMPORTED_MODULE" + "IMPORTED_OBJECT" + "IMPORTED_SHARED" + "IMPORTED_STATIC" + + "CUSTOM") + +function (make_target name type) + if (type STREQUAL "EXECUTABLE") + add_executable("${name}") + target_sources("${name}" PRIVATE ${main_sources}) + elseif (type STREQUAL "IMPORTED_EXECUTABLE") + add_executable("${name}" IMPORTED) + set_property(TARGET "${name}" PROPERTY IMPORTED_LOCATION "${CMAKE_COMMAND}") + elseif (type STREQUAL "CUSTOM") + add_custom_target("${name}" COMMAND "${CMAKE_EXECUTABLE}" -E echo "${name}") + elseif (type MATCHES "IMPORTED_") + string(REPLACE "IMPORTED_" "" type "${type}") + add_library("${name}" IMPORTED ${type}) + if (NOT type STREQUAL "INTERFACE") + set_property(TARGET "${name}" PROPERTY IMPORTED_LOCATION "${default_library_location}") + endif () + else () + add_library("${name}" ${type}) + target_sources("${name}" PRIVATE ${library_sources}) + endif () + + if (type MATCHES "EXECUTABLE") + add_executable("alias::${name}" ALIAS "${name}") + elseif (NOT type STREQUAL "CUSTOM") + add_library("alias::${name}" ALIAS "${name}") + endif () +endfunction () + function (check_property target property expected) if (NOT TARGET "${target}") message(SEND_ERROR From 721f1b608c7c0fffa1b217ff706080ab75af3adc Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:28:39 -0400 Subject: [PATCH 189/627] Tests/RunCMake/property_init: add a function to test properties This function consumes a property table and tests against every kind of target: those for which the initialization happens and those that should ignore them. Also add a function that can build the pairs of target type lists required. --- Tests/RunCMake/property_init/util.cmake | 57 +++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake index e98c2d5cfff..564a2293f64 100644 --- a/Tests/RunCMake/property_init/util.cmake +++ b/Tests/RunCMake/property_init/util.cmake @@ -17,6 +17,12 @@ set(all_target_types "CUSTOM") +function (prepare_target_types name) + set("${name}" "${ARGN}" PARENT_SCOPE) + list(REMOVE_ITEM all_target_types ${ARGN}) + set("not_${name}" "${all_target_types}" PARENT_SCOPE) +endfunction () + function (make_target name type) if (type STREQUAL "EXECUTABLE") add_executable("${name}") @@ -97,3 +103,54 @@ function (prepare_properties table output_properties output_expected output_alia set("${output_expected}" "${_expected}" PARENT_SCOPE) set("${output_alias}" "${_alias}" PARENT_SCOPE) endfunction () + +# Contextual variables: +# iteration: make unique target names +# with_defaults: if set, do not set variables, but instead test internal +# default calculations +function (run_property_tests applied_types property_table) + prepare_properties("${property_table}" expected_properties expected_values expected_alias) + + if (NOT with_defaults) + foreach (property expected IN ZIP_LISTS expected_properties expected_values) + string(REPLACE "" ";" expected "${expected}") + set("CMAKE_${property}" "${expected}") + endforeach () + endif () + + foreach (target_type IN LISTS "${applied_types}") + set(target_name "${RunCMake_TEST}${iteration}-${target_type}") + if (with_defaults) + string(APPEND target_name "-defaults") + endif () + make_target("${target_name}" "${target_type}") + foreach (property expected alias IN ZIP_LISTS expected_properties expected_values expected_alias) + string(REPLACE "" ";" expected "${expected}") + check_property("${target_name}" "${property}" "${expected}") + if (NOT target_type STREQUAL "CUSTOM") + if (alias STREQUAL "") + check_property("alias::${target_name}" "${property}" "${expected}") + elseif (alias STREQUAL "") + check_property("alias::${target_name}" "${property}" "") + else () + message(FATAL_ERROR + "Invalid `alias` entry for property '${property}': '${alias}'") + endif () + endif () + endforeach () + endforeach () + + foreach (target_type IN LISTS "not_${applied_types}") + set(target_name "${RunCMake_TEST}${iteration}-${target_type}-unset") + if (with_defaults) + string(APPEND target_name "-defaults") + endif () + make_target("${target_name}" "${target_type}") + foreach (property IN LISTS expected_properties) + check_property("${target_name}" "${property}" "") + if (NOT target_type STREQUAL "CUSTOM") + check_property("alias::${target_name}" "${property}" "") + endif () + endforeach () + endforeach () +endfunction () From 82507e80eb9060c5e1a3d60c46d42630e0173030 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:30:57 -0400 Subject: [PATCH 190/627] Tests/RunCMake/property_init: test 'always' properties All targets get these targets initialized. --- Tests/RunCMake/property_init/Always.cmake | 15 +++++++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 Tests/RunCMake/property_init/Always.cmake diff --git a/Tests/RunCMake/property_init/Always.cmake b/Tests/RunCMake/property_init/Always.cmake new file mode 100644 index 00000000000..db23563e7d5 --- /dev/null +++ b/Tests/RunCMake/property_init/Always.cmake @@ -0,0 +1,15 @@ +set(properties + # property expected alias + # Test a property which should never be initialized. + "notset" "" "" + + # Build graph properties + "VERIFY_INTERFACE_HEADER_SETS" "TRUE" "" + + # Metadata + "FOLDER" "folder" "" + ) + +prepare_target_types(always ${all_target_types}) + +run_property_tests(always properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 837e9524883..fb3579d41f6 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -1 +1,3 @@ include(RunCMake) + +run_cmake(Always) From 5bad24935cb9f224181c20fc4fc394d58c54921f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:34:11 -0400 Subject: [PATCH 191/627] Tests/RunCMake/property_init: test 'can_compile' properties --- .../property_init/CompileSources.cmake | 274 ++++++++++++++++++ .../RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 275 insertions(+) create mode 100644 Tests/RunCMake/property_init/CompileSources.cmake diff --git a/Tests/RunCMake/property_init/CompileSources.cmake b/Tests/RunCMake/property_init/CompileSources.cmake new file mode 100644 index 00000000000..e8c55546e6e --- /dev/null +++ b/Tests/RunCMake/property_init/CompileSources.cmake @@ -0,0 +1,274 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +set(properties + # property expected alias + # Compilation properties + "COMPILE_WARNING_AS_ERROR" "ON" "" + "INTERPROCEDURAL_OPTIMIZATION" "OFF" "" + "NO_SYSTEM_FROM_IMPORTED" "ON" "" + "VISIBILITY_INLINES_HIDDEN" "ON" "" + ## Features + ### PCH + "DISABLE_PRECOMPILE_HEADERS" "ON" "" + "PCH_WARN_INVALID" "OFF" "" + "PCH_INSTANTIATE_TEMPLATES" "OFF" "" + ## Platforms + ### Android + "ANDROID_API" "9" "" + "ANDROID_API_MIN" "9" "" + "ANDROID_ARCH" "arm64-v8a" "" + "ANDROID_ASSETS_DIRECTORIES" "${dir}" "" + "ANDROID_JAVA_SOURCE_DIR" "${dir}" "" + "ANDROID_STL_TYPE" "system" "" + ### macOS + "OSX_ARCHITECTURES" "arm64" "" + ### Windows + "MSVC_DEBUG_INFORMATION_FORMAT" "Embedded" "" + "MSVC_RUNTIME_LIBRARY" "MultiThreaded" "" + "VS_JUST_MY_CODE_DEBUGGING" "ON" "" + ### OpenWatcom + "WATCOM_RUNTIME_LIBRARY" "MultiThreaded" "" + ## Language + ### CUDA + "CUDA_SEPARABLE_COMPILATION" "ON" "" + "CUDA_ARCHITECTURES" "naive" "" + ### Fortran + "Fortran_FORMAT" "FREE" "" + "Fortran_MODULE_DIRECTORY" "${dir}" "" + "Fortran_COMPILER_LAUNCHER" "ccache" "" + "Fortran_PREPROCESS" "ON" "" + "Fortran_VISIBILITY_PRESET" "hidden" "" + ### HIP + "HIP_ARCHITECTURES" "gfx801" "" + ### ISPC + "ISPC_COMPILER_LAUNCHER" "ccache" "" + "ISPC_HEADER_DIRECTORY" "${dir}" "" + "ISPC_HEADER_SUFFIX" "_i.h" "" + "ISPC_INSTRUCTION_SETS" "avx2-i32x4" "" + ### Swift + "Swift_LANGUAGE_VERSION" "2.3" "" + "Swift_MODULE_DIRECTORY" "${dir}" "" + ### moc + "AUTOMOC" "OFF" "" + "AUTOMOC_COMPILER_PREDEFINES" "OFF" "" + "AUTOMOC_MACRO_NAMES" "MOC_CLASS" "" + "AUTOMOC_MOC_OPTIONS" "-v" "" + "AUTOMOC_PATH_PREFIX" "moc_" "" + "AUTOMOC_EXECUTABLE" "automoc" "" + ### uic + "AUTOUIC" "OFF" "" + "AUTOUIC_OPTIONS" "-v" "" + "AUTOUIC_SEARCH_PATHS" "${dir}" "" + "AUTOUIC_EXECUTABLE" "autouic" "" + ### rcc + "AUTORCC" "OFF" "" + "AUTORCC_OPTIONS" "-v" "" + "AUTORCC_EXECUTABLE" "autorcc" "" + + # Linking properties + "LINK_SEARCH_START_STATIC" "-Bstatic" "" + "LINK_SEARCH_END_STATIC" "-Bdynamic" "" + ## Dependent library lookup + "MACOSX_RPATH" "@loader_path/" "" + ### Build + "BUILD_RPATH" "../lib" "" + "BUILD_RPATH_USE_ORIGIN" "ON" "" + "SKIP_BUILD_RPATH" "ON" "" + "BUILD_WITH_INSTALL_RPATH" "ON" "" + "BUILD_WITH_INSTALL_NAME_DIR" "@rpath/" "" + ### Install + "INSTALL_NAME_DIR" "@rpath/" "" + "INSTALL_REMOVE_ENVIRONMENT_RPATH" "ON" "" + "INSTALL_RPATH" "@rpath/" "" + "INSTALL_RPATH_USE_LINK_PATH" "ON" "" + ## Platforms + ### Android + "ANDROID_JAR_DIRECTORIES" "${dir}" "" + "ANDROID_JAR_DEPENDENCIES" "${dir}/foo.jar" "" + "ANDROID_NATIVE_LIB_DIRECTORIES" "${dir}" "" + "ANDROID_NATIVE_LIB_DEPENDENCIES" "${dir}/native.a" "" + "ANDROID_PROGUARD" "ON" "" + "ANDROID_PROGUARD_CONFIG_PATH" "proguard.props" "" + "ANDROID_SECURE_PROPS_PATH" "secure.props" "" + ### iOS + "IOS_INSTALL_COMBINED" "ON" "" + ### Windows + "GNUtoMS" "ON" "" + "WIN32_EXECUTABLE" "OFF" "" + ## Languages + ### C + "C_LINKER_LAUNCHER" "ccache" "" + ### C++ + "CXX_LINKER_LAUNCHER" "ccache" "" + ### CUDA + "CUDA_RESOLVE_DEVICE_SYMBOLS" "ON" "" + "CUDA_RUNTIME_LIBRARY" "Static" "" + ### HIP + "HIP_RUNTIME_LIBRARY" "SHARED" "" + ### Objective C + "OBJC_LINKER_LAUNCHER" "ccache" "" + ### Objective C++ + "OBJCXX_LINKER_LAUNCHER" "ccache" "" + + # Static analysis + ## C + "C_CLANG_TIDY" "clang-tidy" "" + "C_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "" + "C_CPPLINT" "cpplint" "" + "C_CPPCHECK" "cppcheck" "" + "C_INCLUDE_WHAT_YOU_USE" "iwyu" "" + ## C++ + "CXX_CLANG_TIDY" "clang-tidy" "" + "CXX_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "" + "CXX_CPPLINT" "cpplint" "" + "CXX_CPPCHECK" "cppcheck" "" + "CXX_INCLUDE_WHAT_YOU_USE" "iwyu" "" + ## Objective C + "OBJC_CLANG_TIDY" "clang-tidy" "" + "OBJC_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "" + ## Objective C++ + "OBJCXX_CLANG_TIDY" "clang-tidy" "" + "OBJCXX_CLANG_TIDY_EXPORT_FIXES_DIR" "${dir}" "" + ## Linking + "LINK_WHAT_YOU_USE" "lwyu" "" + + # Build graph properties + "LINK_DEPENDS_NO_SHARED" "OFF" "" + "UNITY_BUILD" "OFF" "" + "UNITY_BUILD_UNIQUE_ID" "unity" "" + "UNITY_BUILD_BATCH_SIZE" "10" "" + "UNITY_BUILD_MODE" "GROUP" "" + "OPTIMIZE_DEPENDENCIES" "ON" "" + ## Android + "ANDROID_ANT_ADDITIONAL_OPTIONS" "-v" "" + "ANDROID_PROCESS_MAX" "2" "" + "ANDROID_SKIP_ANT_STEP" "ON" "" + ## Autogen + "AUTOGEN_ORIGIN_DEPENDS" "OFF" "" + "AUTOGEN_PARALLEL" "ON" "" + "AUTOGEN_USE_SYSTEM_INCLUDE" "ON" "" + ## moc + "AUTOMOC_DEPEND_FILTERS" "FIRSTSECOND" "" + ## C++ + "CXX_SCAN_FOR_MODULES" "ON" "" + ## Ninja + "JOB_POOL_COMPILE" "compile_pool" "" + "JOB_POOL_LINK" "link_pool" "" + "JOB_POOL_PRECOMPILE_HEADER" "pch_pool" "" + ## Visual Studio + "VS_NO_COMPILE_BATCHING" "ON" "" + "VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION" "10.0.10240.0" "" + + # Output location properties + "ARCHIVE_OUTPUT_DIRECTORY" "${dir}" "" + "COMPILE_PDB_OUTPUT_DIRECTORY" "${dir}" "" + "LIBRARY_OUTPUT_DIRECTORY" "${dir}" "" + "PDB_OUTPUT_DIRECTORY" "${dir}" "" + "RUNTIME_OUTPUT_DIRECTORY" "${dir}" "" + + # macOS bundle properties + "FRAMEWORK" "OFF" "" + "FRAMEWORK_MULTI_CONFIG_POSTFIX" ".mcpostfix" "" + "MACOSX_BUNDLE" "OFF" "" + + # Usage requirement properties + "LINK_INTERFACE_LIBRARIES" "c" "" + + # Metadata + "EXPORT_COMPILE_COMMANDS" "OFF" "" + ) + +if (CMAKE_HOST_APPLE) # compile-guarded in CMake + if (CMAKE_GENERATOR STREQUAL "Xcode") + list(APPEND properties + # property expected alias + # Xcode properties + "XCODE_SCHEME_ADDRESS_SANITIZER" "ON" "" + "XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN" "ON" "" + "XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING" "ON" "" + "XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE" "ON" "" + "XCODE_SCHEME_THREAD_SANITIZER" "ON" "" + "XCODE_SCHEME_THREAD_SANITIZER_STOP" "ON" "" + "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER" "ON" "" + "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "ON" "" + "XCODE_SCHEME_LAUNCH_CONFIGURATION" "ON" "" + "XCODE_SCHEME_ENABLE_GPU_API_VALIDATION" "ON" "" + "XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION" "ON" "" + "XCODE_SCHEME_WORKING_DIRECTORY" "ON" "" + "XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER" "ON" "" + "XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP" "ON" "" + "XCODE_SCHEME_MALLOC_SCRIBBLE" "ON" "" + "XCODE_SCHEME_MALLOC_GUARD_EDGES" "ON" "" + "XCODE_SCHEME_GUARD_MALLOC" "ON" "" + "XCODE_SCHEME_LAUNCH_MODE" "ON" "" + "XCODE_SCHEME_ZOMBIE_OBJECTS" "ON" "" + "XCODE_SCHEME_MALLOC_STACK" "ON" "" + "XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE" "ON" "" + "XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS" "ON" "" + "XCODE_SCHEME_ENVIRONMENT" "ON" "" + "XCODE_LINK_BUILD_PHASE_MODE" "BUILT_ONLY" "" + ) + endif () +endif () + +macro (add_language_properties lang std) + list(APPEND properties + # property expected alias + "${lang}_COMPILER_LAUNCHER" "ccache" "" + "${lang}_STANDARD" "${std}" "" + "${lang}_STANDARD_REQUIRED" "TRUE" "" + "${lang}_EXTENSIONS" "FALSE" "" + "${lang}_VISIBILITY_PRESET" "hidden" "" + ) +endmacro () + +# Mock up knowing the standard flag. This doesn't actually build, so nothing +# should care at this point. +set(CMAKE_Cc_std_11_STANDARD_COMPILE_OPTION "-std=c11") + +add_language_properties(C c_std_11) +add_language_properties(CXX cxx_std_11) +add_language_properties(CUDA cuda_std_11) +add_language_properties(HIP hip_std_11) +add_language_properties(OBJC c_std_99) +add_language_properties(OBJCXX cxx_std_11) + +# Set up pools for properties set above. +if (CMAKE_GENERATOR MATCHES "Ninja") + set_property(GLOBAL APPEND + PROPERTY + JOB_POOLS + compile_pool=1 + link_pool=1 + pch_pool=1) +endif () + +prepare_target_types(can_compile_sources + EXECUTABLE SHARED STATIC MODULE OBJECT) + +run_property_tests(can_compile_sources properties) + +set(properties_with_defaults + # property expected alias + "PCH_WARN_INVALID" "ON" "" + "PCH_INSTANTIATE_TEMPLATES" "ON" "" + "ISPC_HEADER_SUFFIX" "_ispc.h" "" + "SKIP_BUILD_RPATH" "OFF" "" + "BUILD_WITH_INSTALL_RPATH" "OFF" "" + "INSTALL_RPATH" "" "" + "INSTALL_RPATH_USE_LINK_PATH" "OFF" "" + "UNITY_BUILD_BATCH_SIZE" "8" "" + "UNITY_BUILD_MODE" "BATCH" "" + ) + +if (CMAKE_HOST_APPLE) + if (CMAKE_GENERATOR STREQUAL "Xcode") + list(APPEND properties_with_defaults + # property expected alias + "XCODE_LINK_BUILD_PHASE_MODE" "NONE" "" + ) + endif () +endif () + +set(with_defaults 1) +run_property_tests(can_compile_sources properties_with_defaults) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index fb3579d41f6..ce66ff1cf19 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake(Always) +run_cmake(CompileSources) From a6ebd68aa7917fda6afd06064b862118ef26f6dd Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:35:19 -0400 Subject: [PATCH 192/627] Tests/RunCMake/property_init: test 'executable' properties --- Tests/RunCMake/property_init/Executable.cmake | 25 +++++++++++++++++++ .../RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 26 insertions(+) create mode 100644 Tests/RunCMake/property_init/Executable.cmake diff --git a/Tests/RunCMake/property_init/Executable.cmake b/Tests/RunCMake/property_init/Executable.cmake new file mode 100644 index 00000000000..ede0e4bb588 --- /dev/null +++ b/Tests/RunCMake/property_init/Executable.cmake @@ -0,0 +1,25 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +set(properties + # property expected alias + # Compilation properties + ## Platforms + ### Windows + "VS_DEBUGGER_COMMAND" "vsdbg" "" + "VS_DEBUGGER_COMMAND_ARGUMENTS" "/?" "" + "VS_DEBUGGER_ENVIRONMENT" "env=val" "" + "VS_DEBUGGER_WORKING_DIRECTORY" "${dir}" "" + + # Linking properties + ## Platforms + ### Android + "ANDROID_GUI" "OFF" "" + + # Metadata + "CROSSCOMPILING_EMULATOR" "emu" "" + ) + +prepare_target_types(executable + EXECUTABLE + IMPORTED_EXECUTABLE) +run_property_tests(executable properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index ce66ff1cf19..b8c155fd6ca 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -2,3 +2,4 @@ include(RunCMake) run_cmake(Always) run_cmake(CompileSources) +run_cmake(Executable) From a048be7e3a3c25afd87bd999916e23f541c3db38 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:36:05 -0400 Subject: [PATCH 193/627] Tests/RunCMake/property_init: test 'imported' properties --- Tests/RunCMake/property_init/ImportedTargets.cmake | 9 +++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 10 insertions(+) create mode 100644 Tests/RunCMake/property_init/ImportedTargets.cmake diff --git a/Tests/RunCMake/property_init/ImportedTargets.cmake b/Tests/RunCMake/property_init/ImportedTargets.cmake new file mode 100644 index 00000000000..0b519980e2f --- /dev/null +++ b/Tests/RunCMake/property_init/ImportedTargets.cmake @@ -0,0 +1,9 @@ +set(properties + # property expected alias + "SYSTEM" "ON" "" + ) + +prepare_target_types(imported + IMPORTED_EXECUTABLE IMPORTED_INTERFACE IMPORTED_MODULE IMPORTED_OBJECT IMPORTED_SHARED IMPORTED_STATIC) +set(with_defaults 1) +run_property_tests(imported properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index b8c155fd6ca..6ac4ceb8d0b 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -3,3 +3,4 @@ include(RunCMake) run_cmake(Always) run_cmake(CompileSources) run_cmake(Executable) +run_cmake(ImportedTargets) From bb469aef2d4aceaf347962ec790e486e71108963 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:45:07 -0400 Subject: [PATCH 194/627] Tests/RunCMake/property_init: add `per_config` table builder helper --- Tests/RunCMake/property_init/util.cmake | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Tests/RunCMake/property_init/util.cmake b/Tests/RunCMake/property_init/util.cmake index 564a2293f64..7edc6f9eae0 100644 --- a/Tests/RunCMake/property_init/util.cmake +++ b/Tests/RunCMake/property_init/util.cmake @@ -23,6 +23,41 @@ function (prepare_target_types name) set("not_${name}" "${all_target_types}" PARENT_SCOPE) endfunction () +function (per_config variable) + prepare_properties("${property_table}" properties expected_values expected_alias) + + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if (is_multi_config) + set(configs "${CMAKE_CONFIGURATION_TYPES}") + else () + if (NOT CMAKE_BUILD_TYPE STREQUAL "") + set(configs "${CMAKE_BUILD_TYPE}") + endif () + endif () + + foreach (property expected alias IN ZIP_LISTS expected_properties expected_values expected_alias) + if (property MATCHES "^_") + set(prepend 1) + elseif (property MATCHES "_$") + set(prepend 0) + else () + message(SEND_ERROR + "Per-config properties must have a `_` at one end of their name: '${property}'") + endif () + foreach (config IN LISTS configs) + if (prepend) + list(APPEND "${variable}" + "${config}_${property}" "${value}/${config}" "${alias}") + else () + list(APPEND "${variable}" + "${property}_${config}" "${value}/${config}" "${alias}") + endif () + endforeach () + endforeach () + + set("${variable}" "${${variable}}" PARENT_SCOPE) +endfunction () + function (make_target name type) if (type STREQUAL "EXECUTABLE") add_executable("${name}") From 313c6a9c7435626d1cfbf1e7dd57a22b56c795a4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:36:52 -0400 Subject: [PATCH 195/627] Tests/RunCMake/property_init: test 'library_with_artifact' properties --- Tests/RunCMake/property_init/LibraryArtifact.cmake | 10 ++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 11 insertions(+) create mode 100644 Tests/RunCMake/property_init/LibraryArtifact.cmake diff --git a/Tests/RunCMake/property_init/LibraryArtifact.cmake b/Tests/RunCMake/property_init/LibraryArtifact.cmake new file mode 100644 index 00000000000..942b43392b0 --- /dev/null +++ b/Tests/RunCMake/property_init/LibraryArtifact.cmake @@ -0,0 +1,10 @@ +per_config(properties + # property expected alias + # Linking properties + "_POSTFIX" "test" "" + ) + +prepare_target_types(library_with_artifact + MODULE SHARED STATIC + IMPORTED_MODULE IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(library_with_artifact properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 6ac4ceb8d0b..4a54db4c3e9 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -4,3 +4,4 @@ run_cmake(Always) run_cmake(CompileSources) run_cmake(Executable) run_cmake(ImportedTargets) +run_cmake(LibraryArtifact) From c1ff120e420006575d21aa937d9a26e3fe4e4943 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:37:27 -0400 Subject: [PATCH 196/627] Tests/RunCMake/property_init: test 'linkable' properties --- Tests/RunCMake/property_init/Linkable.cmake | 12 ++++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 13 insertions(+) create mode 100644 Tests/RunCMake/property_init/Linkable.cmake diff --git a/Tests/RunCMake/property_init/Linkable.cmake b/Tests/RunCMake/property_init/Linkable.cmake new file mode 100644 index 00000000000..e5d75d1151d --- /dev/null +++ b/Tests/RunCMake/property_init/Linkable.cmake @@ -0,0 +1,12 @@ +per_config(properties + # property expected alias + # Linking properties + ## Platforms + ### macOS + "FRAMEWORK_MULTI_CONFIG_POSTFIX_" ".fw" "" + ) + +prepare_target_types(linkable + EXECUTABLE SHARED STATIC + IMPORTED_EXECUTABLE IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(linkable properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 4a54db4c3e9..dde6a9f68b8 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -5,3 +5,4 @@ run_cmake(CompileSources) run_cmake(Executable) run_cmake(ImportedTargets) run_cmake(LibraryArtifact) +run_cmake(Linkable) From 0b56e3fedd25e76de344baf1d5c2249e475afe9a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:39:12 -0400 Subject: [PATCH 197/627] Tests/RunCMake/property_init: test 'normal_non_imported' properties --- .../RunCMake/property_init/NonImportedNormalTarget.cmake | 9 +++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 10 insertions(+) create mode 100644 Tests/RunCMake/property_init/NonImportedNormalTarget.cmake diff --git a/Tests/RunCMake/property_init/NonImportedNormalTarget.cmake b/Tests/RunCMake/property_init/NonImportedNormalTarget.cmake new file mode 100644 index 00000000000..cf3b726ab23 --- /dev/null +++ b/Tests/RunCMake/property_init/NonImportedNormalTarget.cmake @@ -0,0 +1,9 @@ +set(properties + # property expected alias + # Linking properties + "LINK_LIBRARIES_ONLY_TARGETS" "OFF" "" + ) + +prepare_target_types(normal_non_imported + EXECUTABLE SHARED STATIC MODULE OBJECT INTERFACE) +run_property_tests(normal_non_imported properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index dde6a9f68b8..c76957d9850 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -6,3 +6,4 @@ run_cmake(Executable) run_cmake(ImportedTargets) run_cmake(LibraryArtifact) run_cmake(Linkable) +run_cmake(NonImportedNormalTarget) From bc318ceb7f8a046edddd0288e085e6323ba7da4f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:39:42 -0400 Subject: [PATCH 198/627] Tests/RunCMake/property_init: test 'non_imported' properties --- Tests/RunCMake/property_init/NonImportedTarget.cmake | 11 +++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 12 insertions(+) create mode 100644 Tests/RunCMake/property_init/NonImportedTarget.cmake diff --git a/Tests/RunCMake/property_init/NonImportedTarget.cmake b/Tests/RunCMake/property_init/NonImportedTarget.cmake new file mode 100644 index 00000000000..7e2e22c34f1 --- /dev/null +++ b/Tests/RunCMake/property_init/NonImportedTarget.cmake @@ -0,0 +1,11 @@ +set(properties + # property expected alias + # Compilation properties + ## Language + ### CSharp + "DOTNET_SDK" "Microsoft.NET.Sdk" "" + ) + +prepare_target_types(non_imported + EXECUTABLE SHARED STATIC MODULE OBJECT INTERFACE CUSTOM) +run_property_tests(non_imported properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index c76957d9850..8aff7de3638 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -7,3 +7,4 @@ run_cmake(ImportedTargets) run_cmake(LibraryArtifact) run_cmake(Linkable) run_cmake(NonImportedNormalTarget) +run_cmake(NonImportedTarget) From 141049cf1654410efd961f424b65a5df6dd6fd5a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:40:18 -0400 Subject: [PATCH 199/627] Tests/RunCMake/property_init: test 'normal' properties --- Tests/RunCMake/property_init/NormalTarget.cmake | 10 ++++++++++ Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 11 insertions(+) create mode 100644 Tests/RunCMake/property_init/NormalTarget.cmake diff --git a/Tests/RunCMake/property_init/NormalTarget.cmake b/Tests/RunCMake/property_init/NormalTarget.cmake new file mode 100644 index 00000000000..99507cfabb4 --- /dev/null +++ b/Tests/RunCMake/property_init/NormalTarget.cmake @@ -0,0 +1,10 @@ +per_config(properties + # property expected alias + # Usage requirement properties + "MAP_IMPORTED_CONFIG_" "Release" "" + ) + +prepare_target_types(normal + EXECUTABLE INTERFACE MODULE OBJECT SHARED STATIC + IMPORTED_EXECUTABLE IMPORTED_INTERFACE IMPORTED_MODULE IMPORTED_OBJECT IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(normal properties) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 8aff7de3638..be531db529c 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -8,3 +8,4 @@ run_cmake(LibraryArtifact) run_cmake(Linkable) run_cmake(NonImportedNormalTarget) run_cmake(NonImportedTarget) +run_cmake(NormalTarget) From 653a32aa72ab1191d281a05b966eb599d473eedb Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:40:57 -0400 Subject: [PATCH 200/627] Tests/RunCMake/property_init: test 'pic_targets' properties --- Tests/RunCMake/property_init/PICTargets.cmake | 21 +++++++++++++++++++ .../RunCMake/property_init/RunCMakeTest.cmake | 1 + 2 files changed, 22 insertions(+) create mode 100644 Tests/RunCMake/property_init/PICTargets.cmake diff --git a/Tests/RunCMake/property_init/PICTargets.cmake b/Tests/RunCMake/property_init/PICTargets.cmake new file mode 100644 index 00000000000..6c9950537fc --- /dev/null +++ b/Tests/RunCMake/property_init/PICTargets.cmake @@ -0,0 +1,21 @@ +set(properties + # property expected alias + # Compilation properties + "POSITION_INDEPENDENT_CODE" "True" "" + ) + +prepare_target_types(pic_targets + EXECUTABLE MODULE OBJECT SHARED STATIC + IMPORTED_MODULE IMPORTED_SHARED) +run_property_tests(pic_targets properties) + +set(APPEND properties_with_defaults + # property expected alias + "POSITION_INDEPENDENT_CODE" "True" "" + ) + +prepare_target_types(pic_default_targets + MODULE SHARED + IMPORTED_MODULE IMPORTED_SHARED) +set(with_defaults 1) +run_property_tests(pic_default_targets properties_with_defaults) diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index be531db529c..6b4475ca8ef 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -9,3 +9,4 @@ run_cmake(Linkable) run_cmake(NonImportedNormalTarget) run_cmake(NonImportedTarget) run_cmake(NormalTarget) +run_cmake(PICTargets) From 02972ed9e830929a1a719e619e492de4b6b0f72e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:41:40 -0400 Subject: [PATCH 201/627] Tests/RunCMake/property_init: test 'shared_library' properties --- Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + Tests/RunCMake/property_init/SharedLibrary.cmake | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 Tests/RunCMake/property_init/SharedLibrary.cmake diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 6b4475ca8ef..214f279b953 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -10,3 +10,4 @@ run_cmake(NonImportedNormalTarget) run_cmake(NonImportedTarget) run_cmake(NormalTarget) run_cmake(PICTargets) +run_cmake(SharedLibrary) diff --git a/Tests/RunCMake/property_init/SharedLibrary.cmake b/Tests/RunCMake/property_init/SharedLibrary.cmake new file mode 100644 index 00000000000..49715a49f08 --- /dev/null +++ b/Tests/RunCMake/property_init/SharedLibrary.cmake @@ -0,0 +1,12 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +set(properties + # property expected alias + # Linking properties + "DLL_NAME_WITH_SOVERSION" "OFF" "" + ) + +prepare_target_types(shared_library + SHARED + IMPORTED_SHARED) +run_property_tests(shared_library properties) From 5f1bf85f84991ea3e5973ddb904b5b0419303d89 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:43:29 -0400 Subject: [PATCH 202/627] Tests/RunCMake/property_init: test 'with_artifact' properties --- .../RunCMake/property_init/RunCMakeTest.cmake | 1 + .../property_init/TargetsWithArtifact.cmake | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 Tests/RunCMake/property_init/TargetsWithArtifact.cmake diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 214f279b953..791d71927b4 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -11,3 +11,4 @@ run_cmake(NonImportedTarget) run_cmake(NormalTarget) run_cmake(PICTargets) run_cmake(SharedLibrary) +run_cmake(TargetsWithArtifact) diff --git a/Tests/RunCMake/property_init/TargetsWithArtifact.cmake b/Tests/RunCMake/property_init/TargetsWithArtifact.cmake new file mode 100644 index 00000000000..0c19ea386f3 --- /dev/null +++ b/Tests/RunCMake/property_init/TargetsWithArtifact.cmake @@ -0,0 +1,19 @@ +set(dir "${CMAKE_CURRENT_BINARY_DIR}") + +per_config(properties + # property expected alias + # Compilation properties + "INTERPROCEDURAL_OPTIMIZATION_" "OFF" "" + + # Output location properties + "ARCHIVE_OUTPUT_DIRECTORY_" "${dir}" "" + "COMPILE_PDB_OUTPUT_DIRECTORY_" "${dir}" "" + "LIBRARY_OUTPUT_DIRECTORY_" "${dir}" "" + "PDB_OUTPUT_DIRECTORY_" "${dir}" "" + "RUNTIME_OUTPUT_DIRECTORY_" "${dir}" "" + ) + +prepare_target_types(with_artifact + EXECUTABLE MODULE SHARED STATIC + IMPORTED_EXECUTABLE IMPORTED_MODULE IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(with_artifact properties) From efad4391e58175d36dc1b12611e504b0a339aae0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:43:41 -0400 Subject: [PATCH 203/627] Tests/RunCMake/property_init: test 'with_commands' properties --- Tests/RunCMake/property_init/RunCMakeTest.cmake | 1 + .../property_init/TargetsWithCommands.cmake | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 Tests/RunCMake/property_init/TargetsWithCommands.cmake diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 791d71927b4..02b48c886dc 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -12,3 +12,4 @@ run_cmake(NormalTarget) run_cmake(PICTargets) run_cmake(SharedLibrary) run_cmake(TargetsWithArtifact) +run_cmake(TargetsWithCommands) diff --git a/Tests/RunCMake/property_init/TargetsWithCommands.cmake b/Tests/RunCMake/property_init/TargetsWithCommands.cmake new file mode 100644 index 00000000000..4db0ca36842 --- /dev/null +++ b/Tests/RunCMake/property_init/TargetsWithCommands.cmake @@ -0,0 +1,13 @@ +set(properties + # property expected alias + # Compilation properties + ## Language + ### CSharp + "DOTNET_TARGET_FRAMEWORK" "netcoreapp2.1" "" + "DOTNET_TARGET_FRAMEWORK_VERSION" "v4.5" "" + ) + +prepare_target_types(with_commands + EXECUTABLE MODULE OBJECT SHARED STATIC CUSTOM + IMPORTED_EXECUTABLE IMPORTED_MODULE IMPORTED_OBJECT IMPORTED_SHARED IMPORTED_STATIC) +run_property_tests(with_commands properties) From b66c494ca465766a6a46fc508d0ddd02b667873c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Jul 2023 14:44:42 -0400 Subject: [PATCH 204/627] Tests/RunCMake/property_init: test 'with_exports' properties --- .../RunCMake/property_init/RunCMakeTest.cmake | 1 + .../property_init/TargetsWithExports.cmake | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Tests/RunCMake/property_init/TargetsWithExports.cmake diff --git a/Tests/RunCMake/property_init/RunCMakeTest.cmake b/Tests/RunCMake/property_init/RunCMakeTest.cmake index 02b48c886dc..310da72be54 100644 --- a/Tests/RunCMake/property_init/RunCMakeTest.cmake +++ b/Tests/RunCMake/property_init/RunCMakeTest.cmake @@ -13,3 +13,4 @@ run_cmake(PICTargets) run_cmake(SharedLibrary) run_cmake(TargetsWithArtifact) run_cmake(TargetsWithCommands) +run_cmake(TargetsWithExports) diff --git a/Tests/RunCMake/property_init/TargetsWithExports.cmake b/Tests/RunCMake/property_init/TargetsWithExports.cmake new file mode 100644 index 00000000000..9b2e2136e43 --- /dev/null +++ b/Tests/RunCMake/property_init/TargetsWithExports.cmake @@ -0,0 +1,51 @@ +set(properties + # property expected alias + # Linking properties + ## Platforms + ### AIX + "AIX_EXPORT_ALL_SYMBOLS" "OFF" "" + ### Windows + "WINDOWS_EXPORT_ALL_SYMBOLS" "OFF" "" + ) + +prepare_target_types(symbol_export_target + EXECUTABLE SHARED + IMPORTED_EXECUTABLE IMPORTED_SHARED) +run_property_tests(symbol_export_target properties) + +# `ENABLE_EXPORTS` has a more complicated initialization. +set(properties + # property expected alias + # Linking properties + "ENABLE_EXPORTS" "OFF" "" + ) + +prepare_target_types(executable + EXECUTABLE + IMPORTED_EXECUTABLE) +set(iteration "-ENABLE_EXPORTS") +run_property_tests(executable_target properties) + +set(with_defaults 1) + +set(CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS OFF) +set(properties + # property expected alias + # Linking properties + "ENABLE_EXPORTS" "OFF" "" + ) + +set(iteration "-SHARED_LIBRARY_ENABLE_EXPORTS") +run_property_tests(shared_library_target properties) +unset(CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS) + +set(CMAKE_EXECUTABLE_ENABLE_EXPORTS OFF) +set(properties + # property expected alias + # Linking properties + "ENABLE_EXPORTS" "OFF" "" + ) + +set(iteration "-EXECUTABLE_ENABLE_EXPORTS") +run_property_tests(executable_target properties) +unset(CMAKE_EXECUTABLE_ENABLE_EXPORTS) From 49e2a4a0a734f0e42e2d5717ab7c4bf4210af635 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 30 Jul 2023 00:01:07 -0400 Subject: [PATCH 205/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6426d673d40..e9fc7748397 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230729) +set(CMake_VERSION_PATCH 20230730) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From 3ce4e9523cda9738c634fab54a0fe482571c63d1 Mon Sep 17 00:00:00 2001 From: Vitaly Stakhovsky Date: Sun, 30 Jul 2023 15:00:00 -0400 Subject: [PATCH 206/627] testUTF8: Improve using string_view --- Tests/CMakeLib/testUTF8.cxx | 107 +++++++++++++++++------------------- 1 file changed, 49 insertions(+), 58 deletions(-) diff --git a/Tests/CMakeLib/testUTF8.cxx b/Tests/CMakeLib/testUTF8.cxx index fc0b5397edf..180d29d1c58 100644 --- a/Tests/CMakeLib/testUTF8.cxx +++ b/Tests/CMakeLib/testUTF8.cxx @@ -1,67 +1,57 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ +#include + #include #include -typedef char test_utf8_char[5]; - -static void test_utf8_char_print(test_utf8_char const c) -{ - unsigned char const* d = reinterpret_cast(c); -#ifndef __clang_analyzer__ // somehow thinks arguments are not initialized - printf("[0x%02X,0x%02X,0x%02X,0x%02X]", static_cast(d[0]), - static_cast(d[1]), static_cast(d[2]), - static_cast(d[3])); -#endif -} +using test_utf8_char = const cm::string_view; -static void byte_array_print(char const* s) +static void byte_array_print(test_utf8_char s) { - unsigned char const* d = reinterpret_cast(s); bool started = false; printf("["); - for (; *d; ++d) { + for (char c : s) { if (started) { printf(","); } started = true; - printf("0x%02X", static_cast(*d)); + printf("0x%02X", static_cast(c)); } printf("]"); } struct test_utf8_entry { - int n; test_utf8_char str; unsigned int chr; }; static test_utf8_entry const good_entry[] = { - { 1, "\x20\x00\x00\x00", 0x0020 }, /* Space. */ - { 2, "\xC2\xA9\x00\x00", 0x00A9 }, /* Copyright. */ - { 3, "\xE2\x80\x98\x00", 0x2018 }, /* Open-single-quote. */ - { 3, "\xE2\x80\x99\x00", 0x2019 }, /* Close-single-quote. */ - { 4, "\xF0\xA3\x8E\xB4", 0x233B4 }, /* Example from RFC 3629. */ - { 3, "\xED\x80\x80\x00", 0xD000 }, /* Valid 0xED prefixed codepoint. */ - { 4, "\xF4\x8F\xBF\xBF", 0x10FFFF }, /* Highest valid RFC codepoint. */ - { 0, { 0, 0, 0, 0, 0 }, 0 } + { "\x20", 0x0020 }, /* Space. */ + { "\xC2\xA9", 0x00A9 }, /* Copyright. */ + { "\xE2\x80\x98", 0x2018 }, /* Open-single-quote. */ + { "\xE2\x80\x99", 0x2019 }, /* Close-single-quote. */ + { "\xF0\xA3\x8E\xB4", 0x233B4 }, /* Example from RFC 3629. */ + { "\xED\x80\x80", 0xD000 }, /* Valid 0xED prefixed codepoint. */ + { "\xF4\x8F\xBF\xBF", 0x10FFFF }, /* Highest valid RFC codepoint. */ + { {}, 0 } }; static test_utf8_char const bad_chars[] = { - "\x80\x00\x00\x00", /* Leading continuation byte. */ - "\xC0\x80\x00\x00", /* Overlong encoding. */ - "\xC1\x80\x00\x00", /* Overlong encoding. */ - "\xC2\x00\x00\x00", /* Missing continuation byte. */ - "\xE0\x00\x00\x00", /* Missing continuation bytes. */ - "\xE0\x80\x80\x00", /* Overlong encoding. */ + "\x80", /* Leading continuation byte. */ + "\xC0\x80", /* Overlong encoding. */ + "\xC1\x80", /* Overlong encoding. */ + "\xC2", /* Missing continuation byte. */ + "\xE0", /* Missing continuation bytes. */ + "\xE0\x80\x80", /* Overlong encoding. */ "\xF0\x80\x80\x80", /* Overlong encoding. */ - "\xED\xA0\x80\x00", /* UTF-16 surrogate half. */ - "\xED\xBF\xBF\x00", /* UTF-16 surrogate half. */ + "\xED\xA0\x80", /* UTF-16 surrogate half. */ + "\xED\xBF\xBF", /* UTF-16 surrogate half. */ "\xF4\x90\x80\x80", /* Lowest out-of-range codepoint. */ "\xF5\x80\x80\x80", /* Prefix forces out-of-range codepoints. */ - { 0, 0, 0, 0, 0 } + {} }; static char const* good_strings[] = { "", "ASCII", "\xC2\xA9 Kitware", 0 }; @@ -71,49 +61,50 @@ static char const* bad_strings[] = { 0 }; -static void report_good(bool passed, test_utf8_char const c) +static void report_good(bool passed, test_utf8_char c) { printf("%s: decoding good ", passed ? "pass" : "FAIL"); - test_utf8_char_print(c); - printf(" (%s) ", c); + byte_array_print(c); + printf(" (%s) ", c.data()); } -static void report_bad(bool passed, test_utf8_char const c) +static void report_bad(bool passed, test_utf8_char c) { printf("%s: decoding bad ", passed ? "pass" : "FAIL"); - test_utf8_char_print(c); + byte_array_print(c); printf(" "); } -static bool decode_good(test_utf8_entry const entry) +static bool decode_good(test_utf8_entry const& entry) { + const auto& s = entry.str; unsigned int uc; if (const char* e = - cm_utf8_decode_character(entry.str, entry.str + 4, &uc)) { - int used = static_cast(e - entry.str); + cm_utf8_decode_character(s.data(), s.data() + s.size(), &uc)) { + int used = static_cast(e - s.data()); if (uc != entry.chr) { - report_good(false, entry.str); + report_good(false, s); printf("expected 0x%04X, got 0x%04X\n", entry.chr, uc); return false; } - if (used != entry.n) { - report_good(false, entry.str); - printf("had %d bytes, used %d\n", entry.n, used); + if (used != int(s.size())) { + report_good(false, s); + printf("had %d bytes, used %d\n", int(s.size()), used); return false; } - report_good(true, entry.str); + report_good(true, s); printf("got 0x%04X\n", uc); return true; } - report_good(false, entry.str); + report_good(false, s); printf("failed\n"); return false; } -static bool decode_bad(test_utf8_char const s) +static bool decode_bad(test_utf8_char s) { unsigned int uc = 0xFFFFu; - const char* e = cm_utf8_decode_character(s, s + 4, &uc); + const char* e = cm_utf8_decode_character(s.data(), s.data() + s.size(), &uc); if (e) { report_bad(false, s); printf("expected failure, got 0x%04X\n", uc); @@ -124,23 +115,23 @@ static bool decode_bad(test_utf8_char const s) return true; } -static void report_valid(bool passed, char const* s) +static void report_valid(bool passed, test_utf8_char s) { printf("%s: validity good ", passed ? "pass" : "FAIL"); byte_array_print(s); - printf(" (%s) ", s); + printf(" (%s) ", s.data()); } -static void report_invalid(bool passed, char const* s) +static void report_invalid(bool passed, test_utf8_char s) { printf("%s: validity bad ", passed ? "pass" : "FAIL"); byte_array_print(s); printf(" "); } -static bool is_valid(const char* s) +static bool is_valid(test_utf8_char s) { - bool valid = cm_utf8_is_valid(s) != 0; + bool valid = cm_utf8_is_valid(s.data()) != 0; if (!valid) { report_valid(false, s); printf("expected valid, reported as invalid\n"); @@ -151,9 +142,9 @@ static bool is_valid(const char* s) return true; } -static bool is_invalid(const char* s) +static bool is_invalid(test_utf8_char s) { - bool valid = cm_utf8_is_valid(s) != 0; + bool valid = cm_utf8_is_valid(s.data()) != 0; if (valid) { report_invalid(false, s); printf("expected invalid, reported as valid\n"); @@ -167,7 +158,7 @@ static bool is_invalid(const char* s) int testUTF8(int /*unused*/, char* /*unused*/[]) { int result = 0; - for (test_utf8_entry const* e = good_entry; e->n; ++e) { + for (test_utf8_entry const* e = good_entry; !e->str.empty(); ++e) { if (!decode_good(*e)) { result = 1; } @@ -175,7 +166,7 @@ int testUTF8(int /*unused*/, char* /*unused*/[]) result = 1; } } - for (test_utf8_char const* c = bad_chars; (*c)[0]; ++c) { + for (test_utf8_char* c = bad_chars; !(*c).empty(); ++c) { if (!decode_bad(*c)) { result = 1; } From 084aa40ecb4ce50029db61b19b7ed614d59d0a0d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:41:12 -0400 Subject: [PATCH 207/627] clang-tidy: fix `modernize-loop-convert` lints --- Source/CPack/cmCPackDragNDropGenerator.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 768bfbe08d7..aa63ff72147 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -574,16 +574,18 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, header_data.push_back(0); header_data.push_back(languages.size()); + // NOLINTNEXTLINE(modernize-loop-convert): `HAVE_CoreServices` needs `i` for (cmList::size_type i = 0; i < languages.size(); ++i) { + auto const& language = languages[i]; CFStringRef language_cfstring = CFStringCreateWithCString( - nullptr, languages[i].c_str(), kCFStringEncodingUTF8); + nullptr, language.c_str(), kCFStringEncodingUTF8); CFStringRef iso_language = CFLocaleCreateCanonicalLanguageIdentifierFromString( nullptr, language_cfstring); if (!iso_language) { cmCPackLogger(cmCPackLog::LOG_ERROR, - languages[i] << " is not a recognized language" - << std::endl); + language << " is not a recognized language" + << std::endl); } char iso_language_cstr[65]; CFStringGetCString(iso_language, iso_language_cstr, From efd9398844eb38b8e0f2faa0fd684a8b4cb1b741 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:42:35 -0400 Subject: [PATCH 208/627] clang-tidy: fix `modernize-use-default-member-init` lints --- Source/cmGlobalXCodeGenerator.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 68955aeda78..aad1fe68c8b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -105,15 +105,13 @@ class cmXcodeVersionParser : public cmXMLParser class cmGlobalXCodeGenerator::BuildObjectListOrString { cmGlobalXCodeGenerator* Generator; - cmXCodeObject* Group; - bool Empty; + cmXCodeObject* Group = nullptr; + bool Empty = true; std::string String; public: BuildObjectListOrString(cmGlobalXCodeGenerator* gen, bool buildObjectList) : Generator(gen) - , Group(nullptr) - , Empty(true) { if (buildObjectList) { this->Group = this->Generator->CreateObject(cmXCodeObject::OBJECT_LIST); From 709c185d8f850451d13d282c050d9d1c6a106a1a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:42:45 -0400 Subject: [PATCH 209/627] clang-tidy: fix `bugprone-branch-clone` lints --- Source/cmGlobalXCodeGenerator.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index aad1fe68c8b..2ce872a6462 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1107,8 +1107,10 @@ std::string GetSourcecodeValueFromFileExtension( } else if (ext == "storyboard") { keepLastKnownFileType = true; sourcecode = "file.storyboard"; + // NOLINTNEXTLINE(bugprone-branch-clone) } else if (ext == "mm" && !cm::contains(enabled_langs, "OBJCXX")) { sourcecode += ".cpp.objcpp"; + // NOLINTNEXTLINE(bugprone-branch-clone) } else if (ext == "m" && !cm::contains(enabled_langs, "OBJC")) { sourcecode += ".c.objc"; } else if (ext == "swift") { From 1c334644851fd5e5ac92748d1355da3bfdc6f85f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:43:06 -0400 Subject: [PATCH 210/627] clang-tidy: fix `readability-else-after-return` lints --- Source/cmGlobalXCodeGenerator.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 2ce872a6462..14fe83299df 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1179,11 +1179,11 @@ std::string GetTargetObjectDirArch(T const& target, cmList archs{ target.GetSafeProperty("OSX_ARCHITECTURES") }; if (archs.size() > 1) { return "$(CURRENT_ARCH)"; - } else if (archs.size() == 1) { + } + if (archs.size() == 1) { return archs.front(); - } else { - return defaultVal; } + return defaultVal; } } // anonymous From e98088ef7551f2fef31204a0a0b1dabd9ee10928 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:43:20 -0400 Subject: [PATCH 211/627] clang-tidy: fix `modernize-use-override` lints --- Source/cmGlobalXCodeGenerator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 1fdd18929d9..efde755b0d3 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -120,7 +120,7 @@ class cmGlobalXCodeGenerator : public cmGlobalGenerator * Used to determine if this generator supports DEPFILE option. */ bool SupportsCustomCommandDepfile() const override { return true; } - virtual cm::optional DepfileFormat() const override + cm::optional DepfileFormat() const override { return this->XcodeBuildSystem == BuildSystem::One ? cmDepfileFormat::MakeDepfile From 22bc92fbc1bfe0bbee310c8eecf08e4eb5982b6d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:43:33 -0400 Subject: [PATCH 212/627] clang-tidy: fix `readability-braces-around-statements` lints --- Source/cmGlobalXCodeGenerator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 14fe83299df..f1131fe78b3 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1680,8 +1680,9 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) if (const char* productType = GetTargetProductType(gtgt)) { if (strcmp(productType, "com.apple.product-type.app-extension.messages-sticker-pack") == - 0) + 0) { return; + } } // Add an empty source file to the target that compiles with the From e48dbbf048604397ec00a2f95600e57b57634577 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 09:16:02 -0400 Subject: [PATCH 213/627] cmCPackDragNDropGenerator: remove unnecessary string construction --- Source/CPack/cmCPackDragNDropGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index aa63ff72147..bd928393db9 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -198,7 +198,7 @@ int cmCPackDragNDropGenerator::PackageFiles() } else { full_package_name += package_file; } - full_package_name += std::string(GetOutputExtension()); + full_package_name += GetOutputExtension(); packageFileNames.push_back(full_package_name); std::string src_dir = cmStrCat(toplevel, '/', package_file); From ce549909fbed7ae5567099d0f9ea2e452119181b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:42:08 -0400 Subject: [PATCH 214/627] cmCPackPKGGenerator: remove unnecessary `.c_str()` calls --- Source/CPack/cmCPackPKGGenerator.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 76ef091fdfd..554cfcdb7c3 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -385,11 +385,10 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name, cmValue inFileName = this->GetOption(cpackVar); if (!inFileName) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "CPack option: " << cpackVar.c_str() - << " not specified. It should point to " - << (!name.empty() ? name : "") - << ".rtf, " << name << ".html, or " << name - << ".txt file" << std::endl); + "CPack option: " + << cpackVar << " not specified. It should point to " + << (!name.empty() ? name : "") << ".rtf, " << name + << ".html, or " << name << ".txt file" << std::endl); return false; } if (!cmSystemTools::FileExists(inFileName)) { @@ -454,7 +453,7 @@ int cmCPackPKGGenerator::CopyInstallScript(const std::string& resdir, { std::string dst = cmStrCat(resdir, '/', name); cmSystemTools::CopyFileAlways(script, dst); - cmSystemTools::SetPermissions(dst.c_str(), 0777); + cmSystemTools::SetPermissions(dst, 0777); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "copy script : " << script << "\ninto " << dst << std::endl); From c4f751604b1f76ad8d5215fb14c2838ed8c8a330 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 09:16:13 -0400 Subject: [PATCH 215/627] cmLocalXCodeGenerator: return a default string Instead of using the `strlen`-based constructor. --- Source/cmLocalXCodeGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index eb05424486d..9646e66a60e 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -31,7 +31,7 @@ std::string cmLocalXCodeGenerator::GetTargetDirectory( cmGeneratorTarget const*) const { // No per-target directory for this generator (yet). - return ""; + return std::string{}; } void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags, From 3af822cd8f2197d176fa918f08f10e22dc3d4730 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 09:16:26 -0400 Subject: [PATCH 216/627] cmXCode21Object: simplify streaming expression --- Source/cmXCode21Object.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx index 9b0dc58b203..7a40eaa0b06 100644 --- a/Source/cmXCode21Object.cxx +++ b/Source/cmXCode21Object.cxx @@ -26,9 +26,7 @@ void cmXCode21Object::PrintComment(std::ostream& out) if (this->Comment.empty()) { return; } - out << " /* "; - out << this->Comment; - out << " */"; + out << " /* " << this->Comment << " */"; } void cmXCode21Object::PrintList( From f5d04b5bf0c1b610ab80209f313996f050cd5979 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:39:34 -0400 Subject: [PATCH 217/627] cmStrCat: use where possible in Apple-specific sources --- Source/CPack/cmCPackDragNDropGenerator.cxx | 28 ++++---- Source/CPack/cmCPackPKGGenerator.cxx | 27 +++---- Source/CPack/cmCPackProductBuildGenerator.cxx | 26 ++++--- Source/cmGlobalXCodeGenerator.cxx | 72 +++++++++---------- Source/cmXCodeScheme.cxx | 2 +- 5 files changed, 82 insertions(+), 73 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index bd928393db9..82f58a268f3 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -136,8 +136,10 @@ int cmCPackDragNDropGenerator::InitializeInternal() return 0; } for (auto const& language : languages) { - std::string license = slaDirectory + "/" + language + ".license.txt"; - std::string license_rtf = slaDirectory + "/" + language + ".license.rtf"; + std::string license = + cmStrCat(slaDirectory, "/", language, ".license.txt"); + std::string license_rtf = + cmStrCat(slaDirectory, "/", language, ".license.rtf"); if (!singleLicense) { if (!cmSystemTools::FileExists(license) && !cmSystemTools::FileExists(license_rtf)) { @@ -148,7 +150,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() return 0; } } - std::string menu = slaDirectory + "/" + language + ".menu.txt"; + std::string menu = cmStrCat(slaDirectory, "/", language, ".menu.txt"); if (!cmSystemTools::FileExists(menu)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing menu file " << language << ".menu.txt" @@ -192,7 +194,7 @@ int cmCPackDragNDropGenerator::PackageFiles() // loop to create dmg files packageFileNames.clear(); for (auto const& package_file : package_files) { - std::string full_package_name = std::string(toplevel) + std::string("/"); + std::string full_package_name = cmStrCat(toplevel, "/"); if (package_file == "ALL_IN_ONE") { full_package_name += this->GetOption("CPACK_PACKAGE_FILE_NAME"); } else { @@ -711,8 +713,8 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( if (this->componentPackageMethod == ONE_PACKAGE_PER_GROUP) { // We have to find the name of the COMPONENT GROUP // the current COMPONENT belongs to. - std::string groupVar = - "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; + std::string groupVar = cmStrCat( + "CPACK_COMPONENT_", cmSystemTools::UpperCase(componentName), "_GROUP"); cmValue _groupName = this->GetOption(groupVar); if (_groupName) { std::string groupName = _groupName; @@ -723,8 +725,8 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( } } - std::string componentFileName = - "CPACK_DMG_" + cmSystemTools::UpperCase(componentName) + "_FILE_NAME"; + std::string componentFileName = cmStrCat( + "CPACK_DMG_", cmSystemTools::UpperCase(componentName), "_FILE_NAME"); if (this->IsSet(componentFileName)) { return this->GetOption(componentFileName); } @@ -808,12 +810,12 @@ bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber, actual_license = licenseFile; } else { std::string license_wo_ext = - slaDirectory + "/" + licenseLanguage + ".license"; - if (cmSystemTools::FileExists(license_wo_ext + ".txt")) { - actual_license = license_wo_ext + ".txt"; + cmStrCat(slaDirectory, "/", licenseLanguage, ".license"); + if (cmSystemTools::FileExists(cmStrCat(license_wo_ext, ".txt"))) { + actual_license = cmStrCat(license_wo_ext, ".txt"); } else { licenseArray = &rez.RTF; - actual_license = license_wo_ext + ".rtf"; + actual_license = cmStrCat(license_wo_ext, ".rtf"); } } @@ -836,7 +838,7 @@ bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber, } else { std::vector lines; std::string actual_menu = - slaDirectory + "/" + licenseLanguage + ".menu.txt"; + cmStrCat(slaDirectory, "/", licenseLanguage, ".menu.txt"); if (!this->ReadFile(actual_menu, lines, error)) { return false; } diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 554cfcdb7c3..f113ff4566a 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -38,13 +38,12 @@ std::string cmCPackPKGGenerator::GetPackageName( if (component.ArchiveFile.empty()) { std::string packagesDir = cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), ".dummy"); - std::ostringstream out; - out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-" - << component.Name << ".pkg"; - return out.str(); + return cmStrCat( + cmSystemTools::GetFilenameWithoutLastExtension(packagesDir), "-", + component.Name, ".pkg"); } - return component.ArchiveFile + ".pkg"; + return cmStrCat(component.ArchiveFile, ".pkg"); } void cmCPackPKGGenerator::CreateBackground(const char* themeName, @@ -160,14 +159,15 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile, for (auto const& comp : this->Components) { if (!comp.second.Group) { xChoiceOut.StartElement("line"); - xChoiceOut.Attribute("choice", comp.first + "Choice"); + xChoiceOut.Attribute("choice", cmStrCat(comp.first, "Choice")); xChoiceOut.Content(""); // Avoid self-closing tag. xChoiceOut.EndElement(); } } if (!this->PostFlightComponent.Name.empty()) { xChoiceOut.StartElement("line"); - xChoiceOut.Attribute("choice", PostFlightComponent.Name + "Choice"); + xChoiceOut.Attribute("choice", + cmStrCat(PostFlightComponent.Name, "Choice")); xChoiceOut.Content(""); // Avoid self-closing tag. xChoiceOut.EndElement(); } @@ -207,14 +207,14 @@ void cmCPackPKGGenerator::CreateChoiceOutline( const cmCPackComponentGroup& group, cmXMLWriter& xout) { xout.StartElement("line"); - xout.Attribute("choice", group.Name + "Choice"); + xout.Attribute("choice", cmStrCat(group.Name, "Choice")); for (cmCPackComponentGroup* subgroup : group.Subgroups) { CreateChoiceOutline(*subgroup, xout); } for (cmCPackComponent* comp : group.Components) { xout.StartElement("line"); - xout.Attribute("choice", comp->Name + "Choice"); + xout.Attribute("choice", cmStrCat(comp->Name, "Choice")); xout.Content(""); // Avoid self-closing tag. xout.EndElement(); } @@ -225,7 +225,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout) { xout.StartElement("choice"); - xout.Attribute("id", group.Name + "Choice"); + xout.Attribute("id", cmStrCat(group.Name, "Choice")); xout.Attribute("title", group.DisplayName); xout.Attribute("start_selected", "true"); xout.Attribute("start_enabled", "true"); @@ -249,7 +249,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component, } xout.StartElement("choice"); - xout.Attribute("id", component.Name + "Choice"); + xout.Attribute("id", cmStrCat(component.Name, "Choice")); xout.Attribute("title", component.DisplayName); xout.Attribute( "start_selected", @@ -381,7 +381,7 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name, const std::string& dirName) { std::string uname = cmSystemTools::UpperCase(name); - std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; + std::string cpackVar = cmStrCat("CPACK_RESOURCE_FILE_", uname); cmValue inFileName = this->GetOption(cpackVar); if (!inFileName) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -413,7 +413,8 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name, // Set this so that distribution.dist gets the right name (without // the path). - this->SetOption("CPACK_RESOURCE_FILE_" + uname + "_NOPATH", (name + ext)); + this->SetOption(cmStrCat("CPACK_RESOURCE_FILE_", uname, "_NOPATH"), + cmStrCat(name, ext)); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << (inFileName ? *inFileName : "(NULL)") diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index 4ad616dc28c..843219dbbd4 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -58,7 +58,7 @@ int cmCPackProductBuildGenerator::PackageFiles() } } - std::string resDir = packageDirFileName + "/Contents"; + std::string resDir = cmStrCat(packageDirFileName, "/Contents"); if (this->IsSet("CPACK_PRODUCTBUILD_RESOURCES_DIR")) { std::string userResDir = @@ -106,10 +106,14 @@ int cmCPackProductBuildGenerator::PackageFiles() << "\"" << " --resources \"" << resDir << "\"" << " --version \"" << version << "\"" - << (identifier.empty() ? "" : " --identifier \"" + identifier + "\"") - << (identityName.empty() ? "" : " --sign \"" + identityName + "\"") - << (keychainPath.empty() ? "" - : " --keychain \"" + keychainPath + "\"") + << (identifier.empty() + ? std::string{} + : cmStrCat(" --identifier \"", identifier, '"')) + << (identityName.empty() ? std::string{} + : cmStrCat(" --sign \"", identityName, '"')) + << (keychainPath.empty() + ? std::string{} + : cmStrCat(" --keychain \"", keychainPath, '"')) << " \"" << packageFileNames[0] << "\""; // Run ProductBuild @@ -187,7 +191,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( resDir += "/"; resDir += component->Name; } - std::string scriptDir = resDir + "/scripts"; + std::string scriptDir = cmStrCat(resDir, "/scripts"); if (!cmsys::SystemTools::MakeDirectory(scriptDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -237,9 +241,11 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( << " --scripts \"" << scriptDir << "\"" << " --version \"" << version << "\"" << " --install-location \"/\"" - << (identityName.empty() ? "" : " --sign \"" + identityName + "\"") - << (keychainPath.empty() ? "" - : " --keychain \"" + keychainPath + "\"") + << (identityName.empty() ? std::string{} + : cmStrCat(" --sign \"", identityName, "\"")) + << (keychainPath.empty() + ? std::string{} + : cmStrCat(" --keychain \"", keychainPath, "\"")) << " \"" << packageFile << "\""; if (component && !component->Plist.empty()) { @@ -253,7 +259,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( cmValue cmCPackProductBuildGenerator::GetComponentScript( const char* script, const char* component_name) { - std::string scriptname = std::string("CPACK_") + script + "_"; + std::string scriptname = cmStrCat("CPACK_", script, "_"); if (component_name) { scriptname += cmSystemTools::UpperCase(component_name); scriptname += "_"; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f1131fe78b3..b7766dc8ad9 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -226,7 +226,8 @@ cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name, if (commandResult) { std::string::size_type pos = out.find(".app/"); if (pos != std::string::npos) { - versionFile = out.substr(0, pos + 5) + "Contents/version.plist"; + versionFile = + cmStrCat(out.substr(0, pos + 5), "Contents/version.plist"); } } } @@ -248,7 +249,7 @@ cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name, if (version_number < 50) { cm->IssueMessage(MessageType::FATAL_ERROR, - "Xcode " + version_string + " not supported."); + cmStrCat("Xcode ", version_string, " not supported.")); return std::unique_ptr(); } @@ -450,7 +451,7 @@ bool cmGlobalXCodeGenerator::Open(const std::string& bindir, bool ret = false; #ifdef HAVE_APPLICATION_SERVICES - std::string url = bindir + "/" + projectName + ".xcodeproj"; + std::string url = cmStrCat(bindir, "/", projectName, ".xcodeproj"); if (dryRun) { return cmSystemTools::FileExists(url, false); @@ -852,10 +853,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateFlatClone(cmXCodeObject* orig) static std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target, const std::string& fullpath) { - std::string key(target->GetName()); - key += "-"; - key += fullpath; - return key; + return cmStrCat(target->GetName(), "-", fullpath); } cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeBuildFileFromPath( @@ -943,10 +941,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( std::string const& srcfmt = sf->GetSafeProperty("Fortran_FORMAT"); switch (cmOutputConverter::GetFortranFormat(srcfmt)) { case cmOutputConverter::FortranFormatFixed: - flags = "-fixed " + flags; + flags = cmStrCat("-fixed ", flags); break; case cmOutputConverter::FortranFormatFree: - flags = "-free " + flags; + flags = cmStrCat("-free ", flags); break; default: break; @@ -1278,7 +1276,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( this->GroupMap[key] = group; } if (!group) { - cmSystemTools::Error("Could not find a PBX group for " + key); + cmSystemTools::Error(cmStrCat("Could not find a PBX group for ", key)); return nullptr; } cmXCodeObject* children = group->GetAttribute("children"); @@ -2202,10 +2200,10 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase( std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); cdir = this->ConvertToRelativeForMake(cdir); - std::string makecmd = - cmStrCat("make -C ", cdir, " -f ", - this->ConvertToRelativeForMake((makefile + "$CONFIGURATION")), - " OBJDIR=$(basename \"$OBJECT_FILE_DIR_normal\") all"); + std::string makecmd = cmStrCat( + "make -C ", cdir, " -f ", + this->ConvertToRelativeForMake(cmStrCat(makefile, "$CONFIGURATION")), + " OBJDIR=$(basename \"$OBJECT_FILE_DIR_normal\") all"); buildphase->AddAttribute("shellScript", this->CreateString(makecmd)); buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0")); } @@ -2243,7 +2241,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( } else { std::ostringstream str; str << "_buildpart_" << count++; - tname[&ccg.GetCC()] = target->GetName() + str.str(); + tname[&ccg.GetCC()] = cmStrCat(target->GetName(), str.str()); makefileStream << "\\\n\t" << tname[&ccg.GetCC()]; } } @@ -2407,8 +2405,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string llang = gtgt->GetLinkerLanguage(configName); if (binary && llang.empty()) { cmSystemTools::Error( - "CMake can not determine linker language for target: " + - gtgt->GetName()); + cmStrCat("CMake can not determine linker language for target: ", + gtgt->GetName())); return; } @@ -2472,7 +2470,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::set defines(targetSwiftDefines.begin(), targetSwiftDefines.end()); this->CurrentLocalGenerator->JoinDefines(defines, defineString, "Swift"); - cflags["Swift"] += " " + defineString; + cflags["Swift"] += cmStrCat(" ", defineString); } else { BuildObjectListOrString swiftDefs(this, true); this->AppendDefines(swiftDefs, targetSwiftDefines); @@ -2831,7 +2829,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, includes, gtgt, language, configName); if (!includeFlags.empty()) { - cflags[language] += " " + includeFlags; + cflags[language] += cmStrCat(" ", includeFlags); } } } @@ -2909,7 +2907,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CreateString("NO")); for (auto const& language : languages) { - std::string flags = cflags[language] + " " + defFlags; + std::string flags = cmStrCat(cflags[language], " ", defFlags); if (language == "CXX" || language == "OBJCXX") { if (language == "CXX" || !buildSettings->GetAttribute("OTHER_CPLUSPLUSFLAGS")) { @@ -3459,8 +3457,8 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute( { if (value->GetType() != cmXCodeObject::OBJECT_LIST && value->GetType() != cmXCodeObject::STRING) { - cmSystemTools::Error("Unsupported value type for appending: " + - std::string(attribute)); + cmSystemTools::Error( + cmStrCat("Unsupported value type for appending: ", attribute)); return; } if (attr->GetType() == cmXCodeObject::OBJECT_LIST) { @@ -3483,8 +3481,8 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute( attr->SetString(newValue); } } else { - cmSystemTools::Error("Unsupported attribute type for appending: " + - std::string(attribute)); + cmSystemTools::Error( + cmStrCat("Unsupported attribute type for appending: ", attribute)); } } @@ -3581,8 +3579,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) useLinkPhase = true; forceLinkPhase = true; } else if (*prop != "NONE") { - cmSystemTools::Error("Invalid value for XCODE_LINK_BUILD_PHASE_MODE: " + - *prop); + cmSystemTools::Error( + cmStrCat("Invalid value for XCODE_LINK_BUILD_PHASE_MODE: ", *prop)); return; } } @@ -3874,8 +3872,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) cmPolicies::PolicyStatus cmp0142 = target->GetTarget()->GetPolicyStatusCMP0142(); if (cmp0142 == cmPolicies::OLD || cmp0142 == cmPolicies::WARN) { - libSearchPaths.Add(this->XCodeEscapePath( - libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)")); + libSearchPaths.Add(this->XCodeEscapePath(cmStrCat( + libDir, "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"))); } libSearchPaths.Add(this->XCodeEscapePath(libDir)); } @@ -4087,16 +4085,16 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( // This is a target - get it's product path reference auto* xcTarget = this->FindXCodeTarget(genTarget); if (!xcTarget) { - cmSystemTools::Error("Can not find a target for " + - genTarget->GetName()); + cmSystemTools::Error( + cmStrCat("Can not find a target for ", genTarget->GetName())); continue; } // Add the target output file as a build reference for other targets // to link against auto* fileRefObject = xcTarget->GetAttribute("productReference"); if (!fileRefObject) { - cmSystemTools::Error("Target " + genTarget->GetName() + - " is missing product reference"); + cmSystemTools::Error(cmStrCat("Target ", genTarget->GetName(), + " is missing product reference")); continue; } auto it = this->FileRefToEmbedBuildFileMap.find(fileRefObject); @@ -4121,7 +4119,8 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( this->CreateObjectReference(fileRef)); } if (!buildFile) { - cmSystemTools::Error("Can't create build file for " + relFile); + cmSystemTools::Error( + cmStrCat("Can't create build file for ", relFile)); continue; } this->EmbeddedLibRefs.emplace(filePath, buildFile); @@ -4130,7 +4129,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( } } if (!buildFile) { - cmSystemTools::Error("Can't find a build file for " + relFile); + cmSystemTools::Error(cmStrCat("Can't find a build file for ", relFile)); continue; } // Set build file configuration @@ -4689,7 +4688,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( { cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile); if (!makefileStream) { - cmSystemTools::Error("Could not create " + this->CurrentXCodeHackMakefile); + cmSystemTools::Error( + cmStrCat("Could not create ", this->CurrentXCodeHackMakefile)); return; } makefileStream.SetCopyIfDifferent(true); @@ -4817,7 +4817,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( std::string xcodeDir = cmStrCat(root->GetCurrentBinaryDirectory(), '/', root->GetProjectName(), ".xcodeproj"); cmSystemTools::MakeDirectory(xcodeDir); - std::string xcodeProjFile = xcodeDir + "/project.pbxproj"; + std::string xcodeProjFile = cmStrCat(xcodeDir, "/project.pbxproj"); cmGeneratedFileStream fout(xcodeProjFile); fout.SetCopyIfDifferent(true); if (!fout) { diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index 217ac6100b2..0019278b901 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -447,7 +447,7 @@ void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout, std::string const noConfig; // FIXME: What config to use here? xout.Attribute("BuildableName", xcObj->GetTarget()->GetFullName(noConfig)); xout.Attribute("BlueprintName", xcObj->GetTarget()->GetName()); - xout.Attribute("ReferencedContainer", "container:" + container); + xout.Attribute("ReferencedContainer", cmStrCat("container:", container)); xout.EndElement(); } From e1b70d7286d8a53b5046b1fb5e2b042333f5b736 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:40:26 -0400 Subject: [PATCH 218/627] cmCPackDragNDropGenerator: use a string instead of a stream for commands --- Source/CPack/cmCPackBundleGenerator.cxx | 36 ++++---- Source/CPack/cmCPackDragNDropGenerator.cxx | 97 ++++++++++++---------- Source/CPack/cmCPackDragNDropGenerator.h | 2 +- 3 files changed, 70 insertions(+), 65 deletions(-) diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 7e6e4737dd6..dad404adf7a 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -196,15 +196,11 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) // sign the files supplied by the user, ie. frameworks. for (auto const& file : relFiles) { - std::ostringstream temp_sign_file_cmd; - temp_sign_file_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); - temp_sign_file_cmd << " " << sign_parameter << " -s \"" - << cpack_apple_cert_app; - temp_sign_file_cmd << "\" -i "; - temp_sign_file_cmd << this->GetOption("CPACK_APPLE_BUNDLE_ID"); - temp_sign_file_cmd << " \""; - temp_sign_file_cmd << bundle_path; - temp_sign_file_cmd << file << "\""; + auto temp_sign_file_cmd = + cmStrCat(this->GetOption("CPACK_COMMAND_CODESIGN"), ' ', + sign_parameter, " -s \"", cpack_apple_cert_app, "\" -i ", + this->GetOption("CPACK_APPLE_BUNDLE_ID"), " \"", bundle_path, + file, '"'); if (!this->RunCommand(temp_sign_file_cmd, &output)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -216,11 +212,9 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) } // sign main binary - std::ostringstream temp_sign_binary_cmd; - temp_sign_binary_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); - temp_sign_binary_cmd << " " << sign_parameter << " -s \"" - << cpack_apple_cert_app; - temp_sign_binary_cmd << "\" \"" << bundle_path << "\""; + auto temp_sign_binary_cmd = + cmStrCat(this->GetOption("CPACK_COMMAND_CODESIGN"), ' ', sign_parameter, + " -s \"", cpack_apple_cert_app, "\" \"", bundle_path, '"'); if (!this->RunCommand(temp_sign_binary_cmd, &output)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -232,15 +226,15 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) } // sign app bundle - std::ostringstream temp_codesign_cmd; - temp_codesign_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); - temp_codesign_cmd << " " << sign_parameter << " -s \"" - << cpack_apple_cert_app << "\""; + auto temp_codesign_cmd = + cmStrCat(this->GetOption("CPACK_COMMAND_CODESIGN"), ' ', sign_parameter, + " -s \"", cpack_apple_cert_app, "\""); if (this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS")) { - temp_codesign_cmd << " --entitlements "; - temp_codesign_cmd << this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS"); + temp_codesign_cmd += + cmStrCat(" --entitlements ", + this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS")); } - temp_codesign_cmd << " \"" << bundle_path << "\""; + temp_codesign_cmd += cmStrCat(" \"", bundle_path, '"'); if (!this->RunCommand(temp_codesign_cmd, &output)) { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 82f58a268f3..3beba6457d5 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -243,18 +243,18 @@ bool cmCPackDragNDropGenerator::CreateEmptyFile(std::ostringstream& target, return true; } -bool cmCPackDragNDropGenerator::RunCommand(std::ostringstream& command, +bool cmCPackDragNDropGenerator::RunCommand(std::string const& command, std::string* output) { int exit_code = 1; bool result = cmSystemTools::RunSingleCommand( - command.str(), output, output, &exit_code, nullptr, this->GeneratorVerbose, + command, output, output, &exit_code, nullptr, this->GeneratorVerbose, cmDuration::zero()); if (!result || exit_code) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error executing: " << command.str() << std::endl); + "Error executing: " << command << std::endl); return false; } @@ -412,15 +412,21 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/temp.dmg"); std::string create_error; - std::ostringstream temp_image_command; - temp_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); - temp_image_command << " create"; - temp_image_command << " -ov"; - temp_image_command << " -srcfolder \"" << staging.str() << "\""; - temp_image_command << " -volname \"" << cpack_dmg_volume_name << "\""; - temp_image_command << " -fs \"" << cpack_dmg_filesystem << "\""; - temp_image_command << " -format " << temp_image_format; - temp_image_command << " \"" << temp_image << "\""; + auto temp_image_command = + cmStrCat(this->GetOption("CPACK_COMMAND_HDIUTIL"), + " create" + " -ov" + " -srcfolder \"", + staging.str(), + "\"" + " -volname \"", + cpack_dmg_volume_name, + "\"" + " -fs \"", + cpack_dmg_filesystem, + "\"" + " -format ", + temp_image_format, " \"", temp_image, "\""); if (!this->RunCommand(temp_image_command, &create_error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -436,10 +442,10 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // before we exit. bool had_error = false; - std::ostringstream attach_command; - attach_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); - attach_command << " attach"; - attach_command << " \"" << temp_image << "\""; + auto attach_command = cmStrCat(this->GetOption("CPACK_COMMAND_HDIUTIL"), + " attach" + " \"", + temp_image, "\""); std::string attach_output; if (!this->RunCommand(attach_command, &attach_output)) { @@ -468,10 +474,10 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // Optionally set the custom icon flag for the image ... if (!had_error && !cpack_package_icon->empty()) { std::string error; - std::ostringstream setfile_command; - setfile_command << this->GetOption("CPACK_COMMAND_SETFILE"); - setfile_command << " -a C"; - setfile_command << " \"" << temp_mount << "\""; + auto setfile_command = cmStrCat(this->GetOption("CPACK_COMMAND_SETFILE"), + " -a C" + " \"", + temp_mount, "\""); if (!this->RunCommand(setfile_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -486,10 +492,12 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // Optionally we can execute a custom apple script to generate // the .DS_Store for the volume folder ... if (!had_error && !cpack_dmg_ds_store_setup_script->empty()) { - std::ostringstream setup_script_command; - setup_script_command << "osascript" - << " \"" << cpack_dmg_ds_store_setup_script << "\"" - << " \"" << temp_mount_name << "\""; + auto setup_script_command = cmStrCat("osascript" + " \"", + cpack_dmg_ds_store_setup_script, + "\"" + " \"", + temp_mount_name, "\""); std::string error; if (!this->RunCommand(setup_script_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -501,10 +509,10 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, } } - std::ostringstream detach_command; - detach_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); - detach_command << " detach"; - detach_command << " \"" << temp_mount << "\""; + auto detach_command = cmStrCat(this->GetOption("CPACK_COMMAND_HDIUTIL"), + " detach" + " \"", + temp_mount, '\"'); if (!this->RunCommand(detach_command)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -519,14 +527,15 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, } // Create the final compressed read-only disk image ... - std::ostringstream final_image_command; - final_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); - final_image_command << " convert \"" << temp_image << "\""; - final_image_command << " -format "; - final_image_command << cpack_dmg_format; - final_image_command << " -imagekey"; - final_image_command << " zlib-level=9"; - final_image_command << " -o \"" << output_file << "\""; + auto final_image_command = cmStrCat(this->GetOption("CPACK_COMMAND_HDIUTIL"), + " convert \"", temp_image, + "\"" + " -format ", + cpack_dmg_format, + " -imagekey" + " zlib-level=9" + " -o \"", + output_file, "\""); std::string convert_error; @@ -667,13 +676,15 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, this->WriteRezXML(sla_xml, rez); // Create the final compressed read-only disk image ... - std::ostringstream embed_sla_command; - embed_sla_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); - embed_sla_command << " udifrez"; - embed_sla_command << " -xml"; - embed_sla_command << " \"" << sla_xml << "\""; - embed_sla_command << " FIXME_WHY_IS_THIS_ARGUMENT_NEEDED"; - embed_sla_command << " \"" << output_file << "\""; + auto embed_sla_command = cmStrCat(this->GetOption("CPACK_COMMAND_HDIUTIL"), + " udifrez" + " -xml" + " \"", + sla_xml, + "\"" + " FIXME_WHY_IS_THIS_ARGUMENT_NEEDED" + " \"", + output_file, "\""); std::string embed_error; if (!this->RunCommand(embed_sla_command, &embed_error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 6d1267b0cc3..6089ae5ae04 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -33,7 +33,7 @@ class cmCPackDragNDropGenerator : public cmCPackGenerator bool CopyFile(std::ostringstream& source, std::ostringstream& target); bool CreateEmptyFile(std::ostringstream& target, size_t size); - bool RunCommand(std::ostringstream& command, std::string* output = nullptr); + bool RunCommand(std::string const& command, std::string* output = nullptr); std::string GetComponentInstallDirNameSuffix( const std::string& componentName) override; From 1b60137b98b26866c84ca29aee62031d429f34a5 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 Jul 2023 15:40:56 -0400 Subject: [PATCH 219/627] strings: combine string literals --- Source/CPack/cmCPackBundleGenerator.cxx | 20 ++++--- Source/CPack/cmCPackProductBuildGenerator.cxx | 28 +++++++--- Source/cmGlobalXCodeGenerator.cxx | 52 ++++++++++--------- 3 files changed, 59 insertions(+), 41 deletions(-) diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index dad404adf7a..37be798faf3 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -86,24 +86,28 @@ int cmCPackBundleGenerator::ConstructBundle() std::string const staging = toplevel; std::ostringstream contents; - contents << staging << "/" << cpack_bundle_name << ".app/" - << "Contents"; + contents << staging << "/" << cpack_bundle_name + << ".app/" + "Contents"; std::ostringstream application; - application << contents.str() << "/" - << "MacOS"; + application << contents.str() + << "/" + "MacOS"; std::ostringstream resources; - resources << contents.str() << "/" - << "Resources"; + resources << contents.str() + << "/" + "Resources"; // Install a required, user-provided bundle metadata file ... std::ostringstream plist_source; plist_source << cpack_bundle_plist; std::ostringstream plist_target; - plist_target << contents.str() << "/" - << "Info.plist"; + plist_target << contents.str() + << "/" + "Info.plist"; if (!this->CopyFile(plist_source, plist_target)) { cmCPackLogger( diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index 843219dbbd4..fd3c65923a3 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -102,10 +102,15 @@ int cmCPackProductBuildGenerator::PackageFiles() pkgCmd << productbuild << " --distribution \"" << packageDirFileName << "/Contents/distribution.dist\"" - << " --package-path \"" << packageDirFileName << "/Contents/Packages" + " --package-path \"" + << packageDirFileName + << "/Contents/Packages" + "\"" + " --resources \"" + << resDir << "\"" - << " --resources \"" << resDir << "\"" - << " --version \"" << version << "\"" + " --version \"" + << version << "\"" << (identifier.empty() ? std::string{} : cmStrCat(" --identifier \"", identifier, '"')) @@ -236,11 +241,18 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( keychainPath = p; } - pkgCmd << pkgbuild << " --root \"" << packageDir << "\"" - << " --identifier \"" << pkgId << "\"" - << " --scripts \"" << scriptDir << "\"" - << " --version \"" << version << "\"" - << " --install-location \"/\"" + pkgCmd << pkgbuild << " --root \"" << packageDir + << "\"" + " --identifier \"" + << pkgId + << "\"" + " --scripts \"" + << scriptDir + << "\"" + " --version \"" + << version + << "\"" + " --install-location \"/\"" << (identityName.empty() ? std::string{} : cmStrCat(" --sign \"", identityName, "\"")) << (keychainPath.empty() diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b7766dc8ad9..5411a230926 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -721,12 +721,12 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( this->CurrentReRunCMakeMakefile += "/ReRunCMake.make"; cmGeneratedFileStream makefileStream(this->CurrentReRunCMakeMakefile); makefileStream.SetCopyIfDifferent(true); - makefileStream << "# Generated by CMake, DO NOT EDIT\n\n"; + makefileStream << "# Generated by CMake, DO NOT EDIT\n\n" - makefileStream << "TARGETS:= \n"; - makefileStream << "empty:= \n"; - makefileStream << "space:= $(empty) $(empty)\n"; - makefileStream << "spaceplus:= $(empty)\\ $(empty)\n\n"; + "TARGETS:= \n" + "empty:= \n" + "space:= $(empty) $(empty)\n" + "spaceplus:= $(empty)\\ $(empty)\n\n"; for (const auto& lfile : lfiles) { makefileStream << "TARGETS += $(subst $(space),$(spaceplus),$(wildcard " @@ -738,12 +738,13 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( cmStrCat(root->GetBinaryDirectory(), "/CMakeFiles/cmake.check_cache"); if (cm->DoWriteGlobVerifyTarget()) { - makefileStream << ".NOTPARALLEL:\n\n"; - makefileStream << ".PHONY: all VERIFY_GLOBS\n\n"; - makefileStream << "all: VERIFY_GLOBS " - << this->ConvertToRelativeForMake(checkCache) << "\n\n"; - makefileStream << "VERIFY_GLOBS:\n"; - makefileStream << "\t" + makefileStream << ".NOTPARALLEL:\n\n" + ".PHONY: all VERIFY_GLOBS\n\n" + "all: VERIFY_GLOBS " + << this->ConvertToRelativeForMake(checkCache) + << "\n\n" + "VERIFY_GLOBS:\n" + "\t" << this->ConvertToRelativeForMake( cmSystemTools::GetCMakeCommand()) << " -P " @@ -2218,12 +2219,13 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( return; } makefileStream.SetCopyIfDifferent(true); - makefileStream << "# Generated by CMake, DO NOT EDIT\n"; - makefileStream << "# Custom rules for " << target->GetName() << "\n"; + makefileStream << "# Generated by CMake, DO NOT EDIT\n" + "# Custom rules for " + << target->GetName() << '\n'; // disable the implicit rules makefileStream << ".SUFFIXES: " - << "\n"; + "\n"; // have all depend on all outputs makefileStream << "all: "; @@ -4696,9 +4698,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( // one more pass for external depend information not handled // correctly by xcode /* clang-format off */ - makefileStream << "# DO NOT EDIT\n"; - makefileStream << "# This makefile makes sure all linkable targets are\n"; - makefileStream << "# up-to-date with anything they link to\n" + makefileStream << "# DO NOT EDIT\n" + "# This makefile makes sure all linkable targets are\n" + "# up-to-date with anything they link to\n" "default:\n" "\techo \"Do not invoke directly\"\n" "\n"; @@ -4776,8 +4778,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( } // Write the action to remove the target if it is out of date. - makefileStream << "\n"; - makefileStream << "\t/bin/rm -f " + makefileStream << "\n" + "\t/bin/rm -f " << this->ConvertToRelativeForMake(tfull) << "\n"; // if building for more than one architecture // then remove those executables as well @@ -4798,8 +4800,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( } makefileStream << "\n\n" - << "# For each target create a dummy rule" - << "so the target does not have to exist\n"; + "# For each target create a dummy rule" + "so the target does not have to exist\n"; for (auto const& dummyRule : dummyRules) { makefileStream << dummyRule << ":\n"; } @@ -4942,8 +4944,8 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, { SortXCodeObjects(); - fout << "// !$*UTF8*$!\n"; - fout << "{\n"; + fout << "// !$*UTF8*$!\n" + "{\n"; cmXCodeObject::Indent(1, fout); fout << "archiveVersion = 1;\n"; cmXCodeObject::Indent(1, fout); @@ -4955,8 +4957,8 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmXCode21Object::PrintList(this->XCodeObjects, fout); cmXCodeObject::Indent(1, fout); fout << "rootObject = " << this->RootObject->GetId() - << " /* Project object */;\n"; - fout << "}\n"; + << " /* Project object */;\n" + "}\n"; } const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const From 6aa90237006f1c4556e0cd18ae0e493650e7515c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 09:06:36 -0400 Subject: [PATCH 220/627] string_view: use string_view literals in comparisons --- Source/CPack/cmCPackDragNDropGenerator.cxx | 5 +- Source/CPack/cmCPackPKGGenerator.cxx | 5 +- Source/cmGlobalXCodeGenerator.cxx | 126 ++++++++++----------- Source/cmXCodeObject.cxx | 10 +- Source/cmXCodeScheme.cxx | 3 +- Source/cmXcFramework.cxx | 15 +-- 6 files changed, 87 insertions(+), 77 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 3beba6457d5..c7b8bfeee13 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -7,6 +7,9 @@ #include #include +#include +#include + #include #include @@ -195,7 +198,7 @@ int cmCPackDragNDropGenerator::PackageFiles() packageFileNames.clear(); for (auto const& package_file : package_files) { std::string full_package_name = cmStrCat(toplevel, "/"); - if (package_file == "ALL_IN_ONE") { + if (package_file == "ALL_IN_ONE"_s) { full_package_name += this->GetOption("CPACK_PACKAGE_FILE_NAME"); } else { full_package_name += package_file; diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index f113ff4566a..13135f5520d 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -4,6 +4,8 @@ #include +#include + #include "cmCPackComponentGroup.h" #include "cmCPackGenerator.h" #include "cmCPackLog.h" @@ -399,7 +401,8 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name, return false; } std::string ext = cmSystemTools::GetFilenameLastExtension(inFileName); - if (ext != ".rtfd" && ext != ".rtf" && ext != ".html" && ext != ".txt") { + if (ext != ".rtfd"_s && ext != ".rtf"_s && ext != ".html"_s && + ext != ".txt"_s) { cmCPackLogger( cmCPackLog::LOG_ERROR, "Bad file extension specified: " diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 5411a230926..3b19808801d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -82,10 +82,10 @@ class cmXcodeVersionParser : public cmXMLParser } void EndElement(const std::string& name) override { - if (name == "key") { + if (name == "key"_s) { this->Key = this->Data; - } else if (name == "string") { - if (this->Key == "CFBundleShortVersionString") { + } else if (name == "string"_s) { + if (this->Key == "CFBundleShortVersionString"_s) { this->Version = this->Data; } } @@ -389,7 +389,7 @@ bool cmGlobalXCodeGenerator::ParseGeneratorToolset(std::string const& ts, bool cmGlobalXCodeGenerator::ProcessGeneratorToolsetField( std::string const& key, std::string const& value, cmMakefile* mf) { - if (key == "buildsystem") { + if (key == "buildsystem"_s) { if (value == "1"_s) { this->XcodeBuildSystem = BuildSystem::One; } else if (value == "12"_s) { @@ -1059,30 +1059,30 @@ bool IsLinkPhaseLibraryExtension(const std::string& fileExt) { // Empty file extension is a special case for paths to framework's // internal binary which could be MyFw.framework/Versions/*/MyFw - return (fileExt == ".framework" || fileExt == ".xcframework" || - fileExt == ".a" || fileExt == ".o" || fileExt == ".dylib" || - fileExt == ".tbd" || fileExt.empty()); + return (fileExt == ".framework"_s || fileExt == ".xcframework"_s || + fileExt == ".a"_s || fileExt == ".o"_s || fileExt == ".dylib"_s || + fileExt == ".tbd"_s || fileExt.empty()); } bool IsLibraryType(const std::string& fileType) { - return (fileType == "wrapper.framework" || - fileType == "wrapper.xcframework" || fileType == "archive.ar" || - fileType == "compiled.mach-o.objfile" || - fileType == "compiled.mach-o.dylib" || - fileType == "compiled.mach-o.executable" || - fileType == "sourcecode.text-based-dylib-definition"); + return (fileType == "wrapper.framework"_s || + fileType == "wrapper.xcframework"_s || fileType == "archive.ar"_s || + fileType == "compiled.mach-o.objfile"_s || + fileType == "compiled.mach-o.dylib"_s || + fileType == "compiled.mach-o.executable"_s || + fileType == "sourcecode.text-based-dylib-definition"_s); } std::string GetDirectoryValueFromFileExtension(const std::string& dirExt) { std::string ext = cmSystemTools::LowerCase(dirExt); - if (ext == "framework") { + if (ext == "framework"_s) { return "wrapper.framework"; } - if (ext == "xcframework") { + if (ext == "xcframework"_s) { return "wrapper.xcframework"; } - if (ext == "xcassets") { + if (ext == "xcassets"_s) { return "folder.assetcatalog"; } return "folder"; @@ -1095,68 +1095,68 @@ std::string GetSourcecodeValueFromFileExtension( std::string ext = cmSystemTools::LowerCase(_ext); std::string sourcecode = "sourcecode"; - if (ext == "o") { + if (ext == "o"_s) { keepLastKnownFileType = true; sourcecode = "compiled.mach-o.objfile"; - } else if (ext == "xctest") { + } else if (ext == "xctest"_s) { sourcecode = "wrapper.cfbundle"; - } else if (ext == "xib") { + } else if (ext == "xib"_s) { keepLastKnownFileType = true; sourcecode = "file.xib"; - } else if (ext == "storyboard") { + } else if (ext == "storyboard"_s) { keepLastKnownFileType = true; sourcecode = "file.storyboard"; // NOLINTNEXTLINE(bugprone-branch-clone) - } else if (ext == "mm" && !cm::contains(enabled_langs, "OBJCXX")) { + } else if (ext == "mm"_s && !cm::contains(enabled_langs, "OBJCXX")) { sourcecode += ".cpp.objcpp"; // NOLINTNEXTLINE(bugprone-branch-clone) - } else if (ext == "m" && !cm::contains(enabled_langs, "OBJC")) { + } else if (ext == "m"_s && !cm::contains(enabled_langs, "OBJC")) { sourcecode += ".c.objc"; - } else if (ext == "swift") { + } else if (ext == "swift"_s) { sourcecode += ".swift"; - } else if (ext == "plist") { + } else if (ext == "plist"_s) { sourcecode += ".text.plist"; - } else if (ext == "h") { + } else if (ext == "h"_s) { sourcecode += ".c.h"; - } else if (ext == "hxx" || ext == "hpp" || ext == "txx" || ext == "pch" || - ext == "hh" || ext == "inl") { + } else if (ext == "hxx"_s || ext == "hpp"_s || ext == "txx"_s || + ext == "pch"_s || ext == "hh"_s || ext == "inl"_s) { sourcecode += ".cpp.h"; - } else if (ext == "png" || ext == "gif" || ext == "jpg") { + } else if (ext == "png"_s || ext == "gif"_s || ext == "jpg"_s) { keepLastKnownFileType = true; sourcecode = "image"; - } else if (ext == "txt") { + } else if (ext == "txt"_s) { sourcecode += ".text"; - } else if (lang == "CXX") { + } else if (lang == "CXX"_s) { sourcecode += ".cpp.cpp"; - } else if (lang == "C") { + } else if (lang == "C"_s) { sourcecode += ".c.c"; - } else if (lang == "OBJCXX") { + } else if (lang == "OBJCXX"_s) { sourcecode += ".cpp.objcpp"; - } else if (lang == "OBJC") { + } else if (lang == "OBJC"_s) { sourcecode += ".c.objc"; - } else if (lang == "Fortran") { + } else if (lang == "Fortran"_s) { sourcecode += ".fortran.f90"; - } else if (lang == "ASM") { + } else if (lang == "ASM"_s) { sourcecode += ".asm"; - } else if (ext == "metal") { + } else if (ext == "metal"_s) { sourcecode += ".metal"; - } else if (ext == "mig") { + } else if (ext == "mig"_s) { sourcecode += ".mig"; - } else if (ext == "tbd") { + } else if (ext == "tbd"_s) { sourcecode += ".text-based-dylib-definition"; - } else if (ext == "a") { + } else if (ext == "a"_s) { keepLastKnownFileType = true; sourcecode = "archive.ar"; - } else if (ext == "dylib") { + } else if (ext == "dylib"_s) { keepLastKnownFileType = true; sourcecode = "compiled.mach-o.dylib"; - } else if (ext == "framework") { + } else if (ext == "framework"_s) { keepLastKnownFileType = true; sourcecode = "wrapper.framework"; - } else if (ext == "xcassets") { + } else if (ext == "xcassets"_s) { keepLastKnownFileType = true; sourcecode = "folder.assetcatalog"; - } else if (ext == "xcconfig") { + } else if (ext == "xcconfig"_s) { keepLastKnownFileType = true; sourcecode = "text.xcconfig"; } @@ -1298,8 +1298,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReference( bool cmGlobalXCodeGenerator::SpecialTargetEmitted(std::string const& tname) { - if (tname == "ALL_BUILD" || tname == "install" || tname == "package" || - tname == "RUN_TESTS" || tname == CMAKE_CHECK_BUILD_SYSTEM_TARGET) { + if (tname == "ALL_BUILD"_s || tname == "install"_s || tname == "package"_s || + tname == "RUN_TESTS"_s || tname == CMAKE_CHECK_BUILD_SYSTEM_TARGET) { if (this->TargetDoneSet.find(tname) != this->TargetDoneSet.end()) { return true; } @@ -1333,10 +1333,10 @@ struct cmCompareTargets { std::string const& a = l->GetTarget()->GetName(); std::string const& b = r->GetTarget()->GetName(); - if (a == "ALL_BUILD") { + if (a == "ALL_BUILD"_s) { return true; } - if (b == "ALL_BUILD") { + if (b == "ALL_BUILD"_s) { return false; } return a < b; @@ -1444,7 +1444,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( cmGeneratorTarget::SourceFileFlags tsFlags = gtgt->GetTargetSourceFileFlags(sourceFile); - if (filetype && filetype->GetString() == "compiled.mach-o.objfile") { + if (filetype && filetype->GetString() == "compiled.mach-o.objfile"_s) { if (sourceFile->GetObjectLibrary().empty()) { externalObjFiles.push_back(xsf); } @@ -1553,7 +1553,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( if (gtgt->IsFrameworkOnApple()) { // dstPath in frameworks is relative to Versions/ ostr << keySources.first; - } else if (keySources.first != "MacOS") { + } else if (keySources.first != "MacOS"_s) { if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { ostr << keySources.first; } else { @@ -2855,7 +2855,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, gflag = this->ExtractFlag("-g", flags); // put back gdwarf-2 if used since there is no way // to represent it in the gui, but we still want debug yes - if (gflag == "-gdwarf-2") { + if (gflag == "-gdwarf-2"_s) { flags += " "; flags += gflag; } @@ -2874,13 +2874,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, cflags[language] += gflags[language]; } debugStr = "NO"; - } else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0")) { + } else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0"_s)) { debugStr = "NO"; } // extract C++ stdlib for (auto const& language : languages) { - if (language != "CXX" && language != "OBJCXX") { + if (language != "CXX"_s && language != "OBJCXX"_s) { continue; } std::string& flags = cflags[language]; @@ -2889,7 +2889,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->ExtractFlagRegex("(^| )(-stdlib=[^ ]+)( |$)", 2, flags); if (stdlib.size() > 8) { const auto cxxLibrary = stdlib.substr(8); - if (language == "CXX" || + if (language == "CXX"_s || !buildSettings->GetAttribute("CLANG_CXX_LIBRARY")) { buildSettings->AddAttribute("CLANG_CXX_LIBRARY", this->CreateString(cxxLibrary)); @@ -2910,20 +2910,20 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, for (auto const& language : languages) { std::string flags = cmStrCat(cflags[language], " ", defFlags); - if (language == "CXX" || language == "OBJCXX") { - if (language == "CXX" || + if (language == "CXX"_s || language == "OBJCXX"_s) { + if (language == "CXX"_s || !buildSettings->GetAttribute("OTHER_CPLUSPLUSFLAGS")) { buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS", this->CreateString(flags)); } - } else if (language == "Fortran") { + } else if (language == "Fortran"_s) { buildSettings->AddAttribute("IFORT_OTHER_FLAGS", this->CreateString(flags)); - } else if (language == "C" || language == "OBJC") { - if (language == "C" || !buildSettings->GetAttribute("OTHER_CFLAGS")) { + } else if (language == "C"_s || language == "OBJC"_s) { + if (language == "C"_s || !buildSettings->GetAttribute("OTHER_CFLAGS")) { buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags)); } - } else if (language == "Swift") { + } else if (language == "Swift"_s) { buildSettings->AddAttribute("OTHER_SWIFT_FLAGS", this->CreateString(flags)); } @@ -3575,12 +3575,12 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) cmValue prop = target->GetTarget()->GetProperty("XCODE_LINK_BUILD_PHASE_MODE"); if (prop) { - if (*prop == "BUILT_ONLY") { + if (*prop == "BUILT_ONLY"_s) { useLinkPhase = true; - } else if (*prop == "KNOWN_LOCATION") { + } else if (*prop == "KNOWN_LOCATION"_s) { useLinkPhase = true; forceLinkPhase = true; - } else if (*prop != "NONE") { + } else if (*prop != "NONE"_s) { cmSystemTools::Error( cmStrCat("Invalid value for XCODE_LINK_BUILD_PHASE_MODE: ", *prop)); return; @@ -3870,7 +3870,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) std::string linkDirs; for (auto const& libDir : cli->GetDirectories()) { - if (!libDir.empty() && libDir != "/usr/lib") { + if (!libDir.empty() && libDir != "/usr/lib"_s) { cmPolicies::PolicyStatus cmp0142 = target->GetTarget()->GetPolicyStatusCMP0142(); if (cmp0142 == cmPolicies::OLD || cmp0142 == cmPolicies::WARN) { diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 73f0992d376..ddd96693351 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -4,6 +4,8 @@ #include +#include + #include const char* cmXCodeObject::PBXTypeNames[] = { @@ -91,13 +93,13 @@ void cmXCodeObject::Print(std::ostream& out) out << this->Id; this->PrintComment(out); out << " = {"; - if (separator == "\n") { + if (separator == "\n"_s) { out << separator; } cmXCodeObject::Indent(3 * indentFactor, out); out << "isa = " << PBXTypeNames[this->IsA] << ";" << separator; for (const auto& keyVal : this->ObjectAttributes) { - if (keyVal.first == "isa") { + if (keyVal.first == "isa"_s) { continue; } @@ -142,7 +144,7 @@ void cmXCodeObject::PrintAttribute(std::ostream& out, int level, case ATTRIBUTE_GROUP: { out << name << " = {"; - if (separator == "\n") { + if (separator == "\n"_s) { out << separator; } for (const auto& keyVal : object->ObjectAttributes) { @@ -156,7 +158,7 @@ void cmXCodeObject::PrintAttribute(std::ostream& out, int level, case OBJECT_REF: { cmXCodeObject::PrintString(out, name); out << " = " << object->Object->Id; - if (object->Object->HasComment() && name != "remoteGlobalIDString") { + if (object->Object->HasComment() && name != "remoteGlobalIDString"_s) { object->Object->PrintComment(out); } out << ";" << separator; diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index 0019278b901..80327e4301b 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -7,6 +7,7 @@ #include #include +#include #include "cmsys/String.h" @@ -157,7 +158,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, cmValue launchMode = this->Target->GetTarget()->GetProperty("XCODE_SCHEME_LAUNCH_MODE"); std::string value = "0"; // == 'AUTO' - if (launchMode && *launchMode == "WAIT") { + if (launchMode && *launchMode == "WAIT"_s) { value = "1"; } xout.Attribute("launchStyle", value); diff --git a/Source/cmXcFramework.cxx b/Source/cmXcFramework.cxx index c91e7f2ad70..a45bf2b8365 100644 --- a/Source/cmXcFramework.cxx +++ b/Source/cmXcFramework.cxx @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -44,23 +45,23 @@ bool PlistSupportedPlatformHelper( return false; } - if (value->asString() == "macos") { + if (value->asString() == "macos"_s) { platform = cmXcFrameworkPlistSupportedPlatform::macOS; return true; } - if (value->asString() == "ios") { + if (value->asString() == "ios"_s) { platform = cmXcFrameworkPlistSupportedPlatform::iOS; return true; } - if (value->asString() == "tvos") { + if (value->asString() == "tvos"_s) { platform = cmXcFrameworkPlistSupportedPlatform::tvOS; return true; } - if (value->asString() == "watchos") { + if (value->asString() == "watchos"_s) { platform = cmXcFrameworkPlistSupportedPlatform::watchOS; return true; } - if (value->asString() == "xros") { + if (value->asString() == "xros"_s) { platform = cmXcFrameworkPlistSupportedPlatform::visionOS; return true; } @@ -113,8 +114,8 @@ cm::optional cmParseXcFrameworkPlist( cmStrCat("Invalid xcframework .plist file:\n ", plistPath), bt); return cm::nullopt; } - if (metadata.CFBundlePackageType != "XFWK" || - metadata.XCFrameworkFormatVersion != "1.0") { + if (metadata.CFBundlePackageType != "XFWK"_s || + metadata.XCFrameworkFormatVersion != "1.0"_s) { mf.GetCMakeInstance()->IssueMessage( MessageType::FATAL_ERROR, cmStrCat("Expected:\n ", plistPath, From 09b7ac7f6781fcf665cadf08a19a274bfc8c3521 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 09:10:04 -0400 Subject: [PATCH 221/627] strings: use single characters where possible --- Source/CPack/cmCPackDragNDropGenerator.cxx | 24 +++--- Source/CPack/cmCPackPKGGenerator.cxx | 2 +- Source/CPack/cmCPackProductBuildGenerator.cxx | 10 +-- Source/cmGlobalXCodeGenerator.cxx | 82 +++++++++---------- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index c7b8bfeee13..b4cada3112f 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -140,9 +140,9 @@ int cmCPackDragNDropGenerator::InitializeInternal() } for (auto const& language : languages) { std::string license = - cmStrCat(slaDirectory, "/", language, ".license.txt"); + cmStrCat(slaDirectory, '/', language, ".license.txt"); std::string license_rtf = - cmStrCat(slaDirectory, "/", language, ".license.rtf"); + cmStrCat(slaDirectory, '/', language, ".license.rtf"); if (!singleLicense) { if (!cmSystemTools::FileExists(license) && !cmSystemTools::FileExists(license_rtf)) { @@ -153,7 +153,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() return 0; } } - std::string menu = cmStrCat(slaDirectory, "/", language, ".menu.txt"); + std::string menu = cmStrCat(slaDirectory, '/', language, ".menu.txt"); if (!cmSystemTools::FileExists(menu)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing menu file " << language << ".menu.txt" @@ -197,7 +197,7 @@ int cmCPackDragNDropGenerator::PackageFiles() // loop to create dmg files packageFileNames.clear(); for (auto const& package_file : package_files) { - std::string full_package_name = cmStrCat(toplevel, "/"); + std::string full_package_name = cmStrCat(toplevel, '/'); if (package_file == "ALL_IN_ONE"_s) { full_package_name += this->GetOption("CPACK_PACKAGE_FILE_NAME"); } else { @@ -429,7 +429,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cpack_dmg_filesystem, "\"" " -format ", - temp_image_format, " \"", temp_image, "\""); + temp_image_format, " \"", temp_image, '"'); if (!this->RunCommand(temp_image_command, &create_error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -448,7 +448,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, auto attach_command = cmStrCat(this->GetOption("CPACK_COMMAND_HDIUTIL"), " attach" " \"", - temp_image, "\""); + temp_image, '"'); std::string attach_output; if (!this->RunCommand(attach_command, &attach_output)) { @@ -480,7 +480,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, auto setfile_command = cmStrCat(this->GetOption("CPACK_COMMAND_SETFILE"), " -a C" " \"", - temp_mount, "\""); + temp_mount, '"'); if (!this->RunCommand(setfile_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -500,7 +500,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cpack_dmg_ds_store_setup_script, "\"" " \"", - temp_mount_name, "\""); + temp_mount_name, '"'); std::string error; if (!this->RunCommand(setup_script_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -538,7 +538,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, " -imagekey" " zlib-level=9" " -o \"", - output_file, "\""); + output_file, '"'); std::string convert_error; @@ -687,7 +687,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, "\"" " FIXME_WHY_IS_THIS_ARGUMENT_NEEDED" " \"", - output_file, "\""); + output_file, '"'); std::string embed_error; if (!this->RunCommand(embed_sla_command, &embed_error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -824,7 +824,7 @@ bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber, actual_license = licenseFile; } else { std::string license_wo_ext = - cmStrCat(slaDirectory, "/", licenseLanguage, ".license"); + cmStrCat(slaDirectory, '/', licenseLanguage, ".license"); if (cmSystemTools::FileExists(cmStrCat(license_wo_ext, ".txt"))) { actual_license = cmStrCat(license_wo_ext, ".txt"); } else { @@ -852,7 +852,7 @@ bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber, } else { std::vector lines; std::string actual_menu = - cmStrCat(slaDirectory, "/", licenseLanguage, ".menu.txt"); + cmStrCat(slaDirectory, '/', licenseLanguage, ".menu.txt"); if (!this->ReadFile(actual_menu, lines, error)) { return false; } diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 13135f5520d..4d60c6cee84 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -41,7 +41,7 @@ std::string cmCPackPKGGenerator::GetPackageName( std::string packagesDir = cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), ".dummy"); return cmStrCat( - cmSystemTools::GetFilenameWithoutLastExtension(packagesDir), "-", + cmSystemTools::GetFilenameWithoutLastExtension(packagesDir), '-', component.Name, ".pkg"); } diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index fd3c65923a3..ae3c50e543a 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -119,7 +119,7 @@ int cmCPackProductBuildGenerator::PackageFiles() << (keychainPath.empty() ? std::string{} : cmStrCat(" --keychain \"", keychainPath, '"')) - << " \"" << packageFileNames[0] << "\""; + << " \"" << packageFileNames[0] << '"'; // Run ProductBuild return RunProductBuild(pkgCmd.str()); @@ -193,7 +193,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( std::string resDir = packageFileDir; if (component) { - resDir += "/"; + resDir += '/'; resDir += component->Name; } std::string scriptDir = cmStrCat(resDir, "/scripts"); @@ -258,7 +258,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( << (keychainPath.empty() ? std::string{} : cmStrCat(" --keychain \"", keychainPath, "\"")) - << " \"" << packageFile << "\""; + << " \"" << packageFile << '"'; if (component && !component->Plist.empty()) { pkgCmd << " --component-plist \"" << component->Plist << "\""; @@ -271,10 +271,10 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( cmValue cmCPackProductBuildGenerator::GetComponentScript( const char* script, const char* component_name) { - std::string scriptname = cmStrCat("CPACK_", script, "_"); + std::string scriptname = cmStrCat("CPACK_", script, '_'); if (component_name) { scriptname += cmSystemTools::UpperCase(component_name); - scriptname += "_"; + scriptname += '_'; } scriptname += "SCRIPT"; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3b19808801d..52977496547 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -451,7 +451,7 @@ bool cmGlobalXCodeGenerator::Open(const std::string& bindir, bool ret = false; #ifdef HAVE_APPLICATION_SERVICES - std::string url = cmStrCat(bindir, "/", projectName, ".xcodeproj"); + std::string url = cmStrCat(bindir, '/', projectName, ".xcodeproj"); if (dryRun) { return cmSystemTools::FileExists(url, false); @@ -732,7 +732,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( makefileStream << "TARGETS += $(subst $(space),$(spaceplus),$(wildcard " << this->ConvertToRelativeForMake(lfile) << "))\n"; } - makefileStream << "\n"; + makefileStream << '\n'; std::string checkCache = cmStrCat(root->GetBinaryDirectory(), "/CMakeFiles/cmake.check_cache"); @@ -755,11 +755,11 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( makefileStream << this->ConvertToRelativeForMake(checkCache) << ": $(TARGETS)\n"; makefileStream - << "\t" << this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand()) + << '\t' << this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand()) << " -S" << this->ConvertToRelativeForMake(root->GetSourceDirectory()) << " -B" << this->ConvertToRelativeForMake(root->GetBinaryDirectory()) << (cm->GetIgnoreWarningAsError() ? " --compile-no-warning-as-error" : "") - << "\n"; + << '\n'; } static bool objectIdLessThan(const std::unique_ptr& l, @@ -854,7 +854,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateFlatClone(cmXCodeObject* orig) static std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target, const std::string& fullpath) { - return cmStrCat(target->GetName(), "-", fullpath); + return cmStrCat(target->GetName(), '-', fullpath); } cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeBuildFileFromPath( @@ -918,7 +918,7 @@ class XCodeGeneratorExpressionInterpreter "Xcode does not support per-config per-source " << property << ":\n" " " << expression << "\n" "specified for source:\n" - " " << this->SourceFile->ResolveFullPath() << "\n"; + " " << this->SourceFile->ResolveFullPath() << '\n'; /* clang-format on */ this->LocalGenerator->IssueMessage(MessageType::FATAL_ERROR, e.str()); } @@ -1693,7 +1693,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) gtgt->GetName(), "-CMakeForceLinker.", cmSystemTools::LowerCase(llang)); { cmGeneratedFileStream fout(fname); - fout << "\n"; + fout << '\n'; } if (cmSourceFile* sf = mf->GetOrCreateSource(fname)) { sf->SetProperty("LANGUAGE", llang); @@ -1906,7 +1906,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase( auto depfilesDirectory = cmStrCat( gt->GetLocalGenerator()->GetCurrentBinaryDirectory(), "/CMakeFiles/d/"); - auto depfilesPrefix = cmStrCat(depfilesDirectory, buildPhase->GetId(), "."); + auto depfilesPrefix = cmStrCat(depfilesDirectory, buildPhase->GetId(), '.'); std::string shellScript = "set -e\n"; for (std::string const& configName : this->CurrentConfigurationTypes) { @@ -2076,7 +2076,7 @@ std::string cmGlobalXCodeGenerator::ConstructScript( } wd = lg->ConvertToOutputFormat(wd, cmOutputConverter::SHELL); ReplaceScriptVars(wd); - script = cmStrCat(script, " cd ", wd, "\n"); + script = cmStrCat(script, " cd ", wd, '\n'); for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { std::string cmd = ccg.GetCommand(c); if (cmd.empty()) { @@ -2262,7 +2262,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( return cmStrCat( depfilesDirectory, this->GetObjectId(cmXCodeObject::PBXShellScriptBuildPhase, file), - ".", config, ".d"); + '.', config, ".d"); }); auto depfile = ccg.GetInternalDepfile(); @@ -2286,7 +2286,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( } if (ccg.GetNumberOfCommands() > 0) { - makefileStream << "\n"; + makefileStream << '\n'; const std::vector& outputs = ccg.GetOutputs(); if (!outputs.empty()) { // There is at least one output, start the rule for it @@ -2303,14 +2303,14 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( for (auto const& dep : realDepends) { makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep); } - makefileStream << "\n"; + makefileStream << '\n'; if (cm::optional comment = ccg.GetComment()) { std::string echo_cmd = cmStrCat("echo ", (this->CurrentLocalGenerator->EscapeForShell( *comment, ccg.GetCC().GetEscapeAllowMakeVars()))); - makefileStream << "\t" << echo_cmd << "\n"; + makefileStream << '\t' << echo_cmd << '\n'; } // Add each command line to the set of commands. @@ -2328,7 +2328,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( } cmd += cmd2; ccg.AppendArguments(c, cmd); - makefileStream << "\t" << cmd << "\n"; + makefileStream << '\t' << cmd << '\n'; } // Symbolic inputs are not expected to exist, so add dummy rules. @@ -2472,7 +2472,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::set defines(targetSwiftDefines.begin(), targetSwiftDefines.end()); this->CurrentLocalGenerator->JoinDefines(defines, defineString, "Swift"); - cflags["Swift"] += cmStrCat(" ", defineString); + cflags["Swift"] += cmStrCat(' ', defineString); } else { BuildObjectListOrString swiftDefs(this, true); this->AppendDefines(swiftDefs, targetSwiftDefines); @@ -2559,9 +2559,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string realName = components.base; std::string soName = components.base; if (version && soversion) { - realName += "."; + realName += '.'; realName += *version; - soName += "."; + soName += '.'; soName += *soversion; } @@ -2646,7 +2646,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags( "CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS", "-bundle"); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } cmValue ext = gtgt->GetProperty("BUNDLE_EXTENSION"); @@ -2672,7 +2672,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", ""); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } } @@ -2702,7 +2702,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags( "CMAKE_SHARED_LIBRARY_CREATE_", llang, "_FLAGS", "-dynamiclib"); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } } @@ -2722,7 +2722,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", ""); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } @@ -2831,7 +2831,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, includes, gtgt, language, configName); if (!includeFlags.empty()) { - cflags[language] += cmStrCat(" ", includeFlags); + cflags[language] += cmStrCat(' ', includeFlags); } } } @@ -2856,7 +2856,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // put back gdwarf-2 if used since there is no way // to represent it in the gui, but we still want debug yes if (gflag == "-gdwarf-2"_s) { - flags += " "; + flags += ' '; flags += gflag; } if (last_gflag && *last_gflag != gflag) { @@ -2870,7 +2870,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // We can't set the Xcode flag differently depending on the language, // so put them back in this case. for (auto const& language : languages) { - cflags[language] += " "; + cflags[language] += ' '; cflags[language] += gflags[language]; } debugStr = "NO"; @@ -2909,7 +2909,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CreateString("NO")); for (auto const& language : languages) { - std::string flags = cmStrCat(cflags[language], " ", defFlags); + std::string flags = cmStrCat(cflags[language], ' ', defFlags); if (language == "CXX"_s || language == "OBJCXX"_s) { if (language == "CXX"_s || !buildSettings->GetAttribute("OTHER_CPLUSPLUSFLAGS")) { @@ -2962,7 +2962,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Convert to a path for the native build tool. cmSystemTools::ConvertToUnixSlashes(install_name_dir); install_name += install_name_dir; - install_name += "/"; + install_name += '/'; } install_name += gtgt->GetSOName(configName); @@ -2990,7 +2990,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if (unique_dirs.find(runpath) == unique_dirs.end()) { unique_dirs.insert(runpath); if (!search_paths.empty()) { - search_paths += " "; + search_paths += ' '; } search_paths += this->XCodeEscapePath(runpath); } @@ -3025,7 +3025,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Xcode always wants at least 1.0.0 or nothing if (!(major == 0 && minor == 0 && patch == 0)) { - v << major << "." << minor << "." << patch; + v << major << '.' << minor << '.' << patch; } buildSettings->AddAttribute("DYLIB_CURRENT_VERSION", this->CreateString(v.str())); @@ -3037,7 +3037,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Xcode always wants at least 1.0.0 or nothing if (!(major == 0 && minor == 0 && patch == 0)) { - vso << major << "." << minor << "." << patch; + vso << major << '.' << minor << '.' << patch; } buildSettings->AddAttribute("DYLIB_COMPATIBILITY_VERSION", this->CreateString(vso.str())); @@ -3183,7 +3183,7 @@ void cmGlobalXCodeGenerator::CreateGlobalXCConfigSettings( if (!sf) { cmSystemTools::Error( cmStrCat("sources for ALL_BUILD do not contain xcconfig file: '", - xcconfig, "' (configuration: ", configName, ")")); + xcconfig, "' (configuration: ", configName, ')')); return; } @@ -3216,7 +3216,7 @@ void cmGlobalXCodeGenerator::CreateTargetXCConfigSettings( cmSystemTools::Error(cmStrCat("target sources for target ", target->Target->GetName(), " do not contain xcconfig file: '", xcconfig, - "' (configuration: ", configName, ")")); + "' (configuration: ", configName, ')')); return; } @@ -4313,7 +4313,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup( for (std::vector::size_type i = 0; i < tgt_folders.size(); i++) { if (i != 0) { - curr_tgt_folder += "/"; + curr_tgt_folder += '/'; } curr_tgt_folder += tgt_folders[i]; it = this->TargetGroup.find(curr_tgt_folder); @@ -4352,7 +4352,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup( } else { tgroup = i_folder->second; } - curr_folder += "\\"; + curr_folder += '\\'; } return tgroup; } @@ -4741,7 +4741,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( if (y != target->GetDependTargets().end()) { for (auto const& deptgt : y->second) { makefileStream << this->PostBuildMakeTarget(deptgt, configName) - << ": " << trel << "\n"; + << ": " << trel << '\n'; } } @@ -4750,11 +4750,11 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( for (auto* objLib : objlibs) { makefileStream << this->PostBuildMakeTarget(objLib->GetName(), configName) - << ": " << trel << "\n"; + << ": " << trel << '\n'; } // Create a rule for this target. - makefileStream << trel << ":"; + makefileStream << trel << ':'; // List dependencies if any exist. auto const x = target->GetDependLibraries().find(configName); @@ -4780,7 +4780,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( // Write the action to remove the target if it is out of date. makefileStream << "\n" "\t/bin/rm -f " - << this->ConvertToRelativeForMake(tfull) << "\n"; + << this->ConvertToRelativeForMake(tfull) << '\n'; // if building for more than one architecture // then remove those executables as well if (this->Architectures.size() > 1) { @@ -4791,7 +4791,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( gt->GetFullName(configName)); makefileStream << "\t/bin/rm -f " << this->ConvertToRelativeForMake(universalFile) - << "\n"; + << '\n'; } } makefileStream << "\n\n"; @@ -5097,7 +5097,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, // Separate from previous flags. if (!flags.empty()) { - flags += " "; + flags += ' '; } // Check if the flag needs quoting. @@ -5116,7 +5116,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, if (quoteFlag) { // Open single quote. - flags += "'"; + flags += '\''; } // Flag value with escaped quotes and backslashes. @@ -5132,7 +5132,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, if (quoteFlag) { // Close single quote. - flags += "'"; + flags += '\''; } } From 7eaab9a957fd8c86641d8400c37c40f27e70c215 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:22:28 -0400 Subject: [PATCH 222/627] clang-tidy: fix `modernize-raw-string-literal` lints --- Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx | 2 +- Source/CPack/WiX/cmWIXSourceWriter.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx index 3246e98995d..78c22088d0b 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx @@ -19,7 +19,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( AddAttribute("Guid", CreateGuidFromComponentId("CM_PACKAGE_REGISTRY")); std::string registryKey = - cmStrCat("Software\\Kitware\\CMake\\Packages\\", package); + cmStrCat(R"(Software\Kitware\CMake\Packages\)", package); BeginElement("RegistryValue"); AddAttribute("Root", "HKLM"); diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index e13a3e00064..54fa011e764 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -144,7 +144,7 @@ std::string cmWIXSourceWriter::CreateGuidFromComponentId( void cmWIXSourceWriter::WriteXMLDeclaration() { - File << "" << std::endl; + File << R"()" << std::endl; } void cmWIXSourceWriter::Indent(size_t count) From 32fe862b8cf35de9221f7ccc8145fcbf80c7041d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:22:41 -0400 Subject: [PATCH 223/627] clang-tidy: fix `readability-container-size-empty` lints --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 31ddb0e072e..2853ab9810b 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -803,7 +803,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( } std::string componentId = "CM_SHORTCUT"; - if (idPrefix.size()) { + if (!idPrefix.empty()) { componentId += cmStrCat('_', idPrefix); } From 1df29567ac28b3738bf30e4aa40e95c4b155bef0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:22:58 -0400 Subject: [PATCH 224/627] clang-tidy: fix `modernize-use-equals-default` lints --- Source/CPack/WiX/cmWIXPatchParser.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 6a44d63924e..136eaac41a1 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -21,9 +21,7 @@ cmWIXPatchNode::Type cmWIXPatchElement::type() return cmWIXPatchNode::ELEMENT; } -cmWIXPatchNode::~cmWIXPatchNode() -{ -} +cmWIXPatchNode::~cmWIXPatchNode() = default; cmWIXPatchElement::cmWIXPatchElement() = default; cmWIXPatchElement::~cmWIXPatchElement() = default; From 3d03629f20977bd137765e1d03ebbd53a349553c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:23:15 -0400 Subject: [PATCH 225/627] cmWIXRichTextFormatWriter: remove identity cast --- Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx index cef2da9cb28..8a632399da7 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx @@ -182,6 +182,6 @@ void cmWIXRichTextFormatWriter::EmitUnicodeSurrogate(int c) void cmWIXRichTextFormatWriter::EmitInvalidCodepoint(int c) { ControlWord("cf1 "); - File << "[INVALID-BYTE-" << int(c) << ']'; + File << "[INVALID-BYTE-" << c << ']'; ControlWord("cf0 "); } From a19ec77200ccd2157d936bec6472329464937b67 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:23:30 -0400 Subject: [PATCH 226/627] clang-tidy: fix `readability-static-accessed-through-instance` lints --- Source/CPack/WiX/cmWIXSourceWriter.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index 54fa011e764..82dc019a7ce 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -97,7 +97,7 @@ void cmWIXSourceWriter::AddTextNode(std::string const& text) return; } - File << this->EscapeAttributeValue(text); + File << cmWIXSourceWriter::EscapeAttributeValue(text); State = DEFAULT; } From d58253d155b43b8af1d0b64412145625907e3d9e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 18:23:46 -0400 Subject: [PATCH 227/627] clang-tidy: fix `performance-faster-string-find` lints --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 2853ab9810b..5077596c4e1 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -1050,7 +1050,7 @@ std::string cmCPackWIXGenerator::GetRightmostExtension( { std::string extension; - std::string::size_type i = filename.rfind("."); + std::string::size_type i = filename.rfind('.'); if (i != std::string::npos) { extension = filename.substr(i); } From e40d2cb3afe44ba3f47aecf38db7a56b8ad36a16 Mon Sep 17 00:00:00 2001 From: halx99 Date: Mon, 31 Jul 2023 09:08:10 +0800 Subject: [PATCH 228/627] Xcode: Add embed resources support --- Help/prop_tgt/XCODE_EMBED_type.rst | 6 ++++ Help/prop_tgt/XCODE_EMBED_type_PATH.rst | 3 ++ Help/release/dev/xcode-embed-resources.rst | 6 ++++ Source/cmGlobalXCodeGenerator.cxx | 34 ++++++++++++++++--- Source/cmGlobalXCodeGenerator.h | 2 ++ .../EmbedPlugIns-macOS-check.cmake | 1 - .../XcodeProject-Embed/EmbedPlugIns.cmake | 2 +- .../EmbedResources-iOS-check.cmake | 3 ++ .../EmbedResources-iOS.cmake | 1 + .../EmbedResources-macOS-check.cmake | 3 ++ .../EmbedResources-macOS.cmake | 1 + .../XcodeProject-Embed/EmbedResources.cmake | 18 ++++++++++ .../XcodeProject-Embed/RunCMakeTest.cmake | 22 ++++++++++++ 13 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 Help/release/dev/xcode-embed-resources.rst create mode 100644 Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS-check.cmake create mode 100644 Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS.cmake create mode 100644 Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS-check.cmake create mode 100644 Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS.cmake create mode 100644 Tests/RunCMake/XcodeProject-Embed/EmbedResources.cmake diff --git a/Help/prop_tgt/XCODE_EMBED_type.rst b/Help/prop_tgt/XCODE_EMBED_type.rst index da744c2e106..76b0e3dcc7b 100644 --- a/Help/prop_tgt/XCODE_EMBED_type.rst +++ b/Help/prop_tgt/XCODE_EMBED_type.rst @@ -37,6 +37,12 @@ The supported values for ```` are: The specified items will be added to the ``Embed PlugIns`` build phase. They must be CMake target names. +``RESOURCES`` + .. versionadded:: 3.28 + + The specified items will be added to the ``Embed Resources`` build phase. + They must be CMake target names. + See also :prop_tgt:`XCODE_EMBED__PATH`, :prop_tgt:`XCODE_EMBED__REMOVE_HEADERS_ON_COPY` and :prop_tgt:`XCODE_EMBED__CODE_SIGN_ON_COPY`. diff --git a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst index 5a5c65f30f5..ef04d14e61c 100644 --- a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst +++ b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst @@ -22,3 +22,6 @@ The supported values for ```` are: ``PLUGINS`` .. versionadded:: 3.23 + +``RESOURCES`` + .. versionadded:: 3.28 diff --git a/Help/release/dev/xcode-embed-resources.rst b/Help/release/dev/xcode-embed-resources.rst new file mode 100644 index 00000000000..2678cfd25f2 --- /dev/null +++ b/Help/release/dev/xcode-embed-resources.rst @@ -0,0 +1,6 @@ +xcode-embed-resources +--------------------- + +* The :prop_tgt:`XCODE_EMBED_RESOURCES >` target property + was added to tell the :generator:`Xcode` generator what targets to put in + the ``Embed Resources`` build phase. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0472631ed04..7691bfffb01 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1267,10 +1267,16 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( fileRef->AddAttribute("sourceTree", this->CreateString(sourceTree)); cmXCodeObject* group = this->GroupMap[key]; - if (!group && IsLibraryType(fileType)) { - group = this->FrameworkGroup; - this->GroupMap[key] = group; + if (!group) { + if (IsLibraryType(fileType)) { + group = this->FrameworkGroup; + } else if (fileType == "folder") { + group = this->ResourcesGroup; + } + if (group) + this->GroupMap[key] = group; } + if (!group) { cmSystemTools::Error("Could not find a PBX group for " + key); return nullptr; @@ -4056,7 +4062,8 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( buildFile = it->second; } } else if (cmSystemTools::IsPathToFramework(relFile) || - cmSystemTools::IsPathToMacOSSharedLibrary(relFile)) { + cmSystemTools::IsPathToMacOSSharedLibrary(relFile) || + cmSystemTools::FileIsDirectory(filePath)) { // This is a regular string path - create file reference auto it = this->EmbeddedLibRefs.find(relFile); if (it == this->EmbeddedLibRefs.end()) { @@ -4157,6 +4164,15 @@ void cmGlobalXCodeGenerator::AddEmbeddedExtensionKitExtensions( "$(EXTENSIONS_FOLDER_PATH)"); } +void cmGlobalXCodeGenerator::AddEmbeddedResources(cmXCodeObject* target) +{ + static const auto dstSubfolderSpec = "7"; + + this->AddEmbeddedObjects(target, "Embed Resources", + "XCODE_EMBED_RESOURCES_PATH", dstSubfolderSpec, + NoActionOnCopyByDefault); +} + bool cmGlobalXCodeGenerator::CreateGroups( std::vector& generators) { @@ -4358,6 +4374,15 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->FrameworkGroup->AddAttribute("children", frameworkGroupChildren); this->MainGroupChildren->AddObject(this->FrameworkGroup); + this->ResourcesGroup = this->CreateObject(cmXCodeObject::PBXGroup); + this->ResourcesGroup->AddAttribute("name", this->CreateString("Resources")); + this->ResourcesGroup->AddAttribute("sourceTree", + this->CreateString("")); + cmXCodeObject* ResourcesGroupChildren = + this->CreateObject(cmXCodeObject::OBJECT_LIST); + this->ResourcesGroup->AddAttribute("children", ResourcesGroupChildren); + this->MainGroupChildren->AddObject(this->ResourcesGroup); + this->RootObject = this->CreateObject(cmXCodeObject::PBXProject); this->RootObject->SetComment("Project object"); @@ -4549,6 +4574,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->AddEmbeddedPlugIns(t); this->AddEmbeddedAppExtensions(t); this->AddEmbeddedExtensionKitExtensions(t); + this->AddEmbeddedResources(t); // Inherit project-wide values for any target-specific search paths. this->InheritBuildSettingAttribute(t, "HEADER_SEARCH_PATHS"); this->InheritBuildSettingAttribute(t, "SYSTEM_HEADER_SEARCH_PATHS"); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 1fdd18929d9..9fff1732c5c 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -224,6 +224,7 @@ class cmGlobalXCodeGenerator : public cmGlobalGenerator void AddEmbeddedPlugIns(cmXCodeObject* target); void AddEmbeddedAppExtensions(cmXCodeObject* target); void AddEmbeddedExtensionKitExtensions(cmXCodeObject* target); + void AddEmbeddedResources(cmXCodeObject* target); void AddPositionIndependentLinkAttribute(cmGeneratorTarget* target, cmXCodeObject* buildSettings, const std::string& configName); @@ -355,6 +356,7 @@ class cmGlobalXCodeGenerator : public cmGlobalGenerator std::string const& configName); cmXCodeObject* MainGroupChildren; cmXCodeObject* FrameworkGroup; + cmXCodeObject* ResourcesGroup; cmMakefile* CurrentMakefile; cmLocalGenerator* CurrentLocalGenerator; cmLocalGenerator* CurrentRootGenerator = nullptr; diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake index 576be11f0a7..66db44eb3a1 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns-macOS-check.cmake @@ -1,4 +1,3 @@ include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) -findAttribute(${test} "RemoveHeadersOnCopy" TRUE) findAttribute(${test} "CodeSignOnCopy" FALSE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake index 1bd1bd0d0aa..f5c9364bf89 100644 --- a/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedPlugIns.cmake @@ -1,4 +1,4 @@ -add_executable(plug_in MACOS_BUNDLE Empty.txt) +add_executable(plug_in MACOSX_BUNDLE Empty.txt) set_target_properties(plug_in PROPERTIES LINKER_LANGUAGE CXX XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS-check.cmake new file mode 100644 index 00000000000..75aaa91187a --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS-check.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "Embed Resources" TRUE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS.cmake new file mode 100644 index 00000000000..54f9fc825e6 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-iOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedResources.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS-check.cmake new file mode 100644 index 00000000000..75aaa91187a --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS-check.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/findAttribute.cmake) + +findAttribute(${test} "Embed Resources" TRUE) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS.cmake new file mode 100644 index 00000000000..54f9fc825e6 --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources-macOS.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/EmbedResources.cmake) diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedResources.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedResources.cmake new file mode 100644 index 00000000000..0638037aa8e --- /dev/null +++ b/Tests/RunCMake/XcodeProject-Embed/EmbedResources.cmake @@ -0,0 +1,18 @@ +add_executable(app MACOSX_BUNDLE main.m) + +set(EMBED_RESOURCES_FOLDER ${CMAKE_BINARY_DIR}/runtime/shaders) + +# ensure embed resources folder exists +if (NOT (IS_DIRECTORY ${EMBED_RESOURCES_FOLDER})) + file(MAKE_DIRECTORY ${EMBED_RESOURCES_FOLDER}) +endif() + +set_target_properties(app PROPERTIES + XCODE_EMBED_RESOURCES_PATH ${EMBED_RESOURCES_FOLDER} +) + +set_target_properties(app PROPERTIES + XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO" + XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" + MACOSX_BUNDLE_GUI_IDENTIFIER "com.example.app" +) diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake index a7bcceea3af..3798ddcb41d 100644 --- a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake @@ -83,6 +83,25 @@ function(TestExtensionKitExtension platform) ) endfunction() +function(TestEmbedCommon what platform) + set(testName Embed${what}-${platform}) + if(NOT platform STREQUAL "macOS") + set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=${platform}) + endif() + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(${testName}) + run_cmake_command(${testName}-build + ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} + --config Debug + --target app + ) +endfunction() + # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) @@ -100,4 +119,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 14.1) # defaults, which is to remove headers on copy, but not code sign. TestAppExtension(macOS) TestAppExtension(iOS) + TestEmbedCommon(Resources macOS) + TestEmbedCommon(Resources iOS) + TestEmbedCommon(PlugIns macOS) endif() From beebc77992eb8e3bded59c33530b0831098b8d23 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 31 Jul 2023 00:01:56 -0400 Subject: [PATCH 229/627] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e9fc7748397..b9d68925d39 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 20230730) +set(CMake_VERSION_PATCH 20230731) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) From cfd92dece3df698e432bb628f15c432142bc662f Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 28 Jul 2023 15:08:51 -0400 Subject: [PATCH 230/627] CheckLanguage: Modernize documentation formatting --- Modules/CheckLanguage.cmake | 39 ++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index 69913a334c2..4c49d9a321c 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -5,26 +5,37 @@ CheckLanguage ------------- -Check if a language can be enabled +Check whether a language can be enabled by the :command:`enable_language` +or :command:`project` commands: -Usage: +.. command:: check_language -:: + .. code-block:: cmake - check_language() + check_language() -where ```` is a language that may be passed to :command:`enable_language` -such as ``Fortran``. If :variable:`CMAKE__COMPILER` is already defined -the check does nothing. Otherwise it tries enabling the language in a -test project. The result is cached in :variable:`CMAKE__COMPILER` -as the compiler that was found, or ``NOTFOUND`` if the language cannot be -enabled. For CUDA which can have an explicit host compiler, the cache -:variable:`CMAKE_CUDA_HOST_COMPILER` variable will be set if it was required -for compilation (and cleared if it was not). + Try enabling language ```` in a test project and record results + in the cache: -Example: + :variable:`CMAKE__COMPILER` + If the language can be enabled, this variable is set to the compiler + that was found. If the language cannot be enabled, this variable is + set to ``NOTFOUND``. -:: + If this variable is already set, either explicitly or cached by + a previous call, the check is skipped. + + :variable:`CMAKE_CUDA_HOST_COMPILER` + This variable is set when ```` is ``CUDA``. + + If the check detects an explicit host compiler that is required for + compilation, this variable will be set to that compiler. + If the check detects that no explicit host compiler is needed, + this variable will be cleared. + +For example: + +.. code-block:: cmake check_language(Fortran) if(CMAKE_Fortran_COMPILER) From 13d78bbf16fdf27f0bd1fcc366817510540e0f1d Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 28 Jul 2023 15:09:26 -0400 Subject: [PATCH 231/627] CheckLanguage: Document that CMAKE_CUDA_HOST_COMPILER should not be set alone Follow up commit 7968d9d442 (Help: Document CMAKE_CUDA_HOST_COMPILER as specific to NVIDIA nvcc, 2020-07-14, v3.19.0-rc1~501^2) with an explicit note in `CheckLanguage`. Issue: #25093 --- Modules/CheckLanguage.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index 4c49d9a321c..04e721cbed7 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -33,6 +33,14 @@ or :command:`project` commands: If the check detects that no explicit host compiler is needed, this variable will be cleared. + If this variable is already set, its value is preserved only if + :variable:`CMAKE_CUDA_COMPILER _COMPILER>` is also set. + Otherwise, the check runs and overwrites + :variable:`CMAKE_CUDA_HOST_COMPILER` with a new result. + Note that :variable:`CMAKE_CUDA_HOST_COMPILER` documents it should + not be set without also setting + :variable:`CMAKE_CUDA_COMPILER _COMPILER>` to a NVCC compiler. + For example: .. code-block:: cmake From be03265fa0e9134f84466e4aa92e62afb78cbc83 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 28 Jul 2023 15:20:14 -0400 Subject: [PATCH 232/627] Help: Explicitly note that projects should not set CMAKE_CUDA_HOST_COMPILER Issue: #25093 --- Help/variable/CMAKE_CUDA_HOST_COMPILER.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst index 9817b1a1207..6e2d75600ae 100644 --- a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst +++ b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst @@ -24,6 +24,13 @@ is read-only and changes to it are undefined behavior. it does not make sense to set ``CMAKE_CUDA_HOST_COMPILER`` without also setting ``CMAKE_CUDA_COMPILER`` to NVCC. +.. note:: + + Projects should not try to set ``CMAKE_CUDA_HOST_COMPILER`` to match + :variable:`CMAKE_CXX_COMPILER _COMPILER>` themselves. + It is the end-user's responsibility, not the project's, to ensure that + the C++ and CUDA compilers target the same ABI. + .. note:: Ignored when using :ref:`Visual Studio Generators`. From 6828b9df5aac1848766a75f675770224d41d22d6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 31 Jul 2023 11:20:19 -0400 Subject: [PATCH 233/627] Help/dev: Extend documentation guide with another section nesting level --- Help/dev/documentation.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Help/dev/documentation.rst b/Help/dev/documentation.rst index c6fb7a653ca..65c0ccf619a 100644 --- a/Help/dev/documentation.rst +++ b/Help/dev/documentation.rst @@ -431,6 +431,7 @@ The section header underline character hierarchy is * ``-``: Subsection or `CMake Domain`_ object document title * ``^``: Subsubsection or `CMake Domain`_ object document section * ``"``: Paragraph or `CMake Domain`_ object document subsection +* ``~``: `CMake Domain`_ object document subsubsection Style: Whitespace ^^^^^^^^^^^^^^^^^ From c949a8742e58887a29bb6c66b76f31d39f8dcb3d Mon Sep 17 00:00:00 2001 From: scivision Date: Wed, 26 Jul 2023 12:44:03 -0400 Subject: [PATCH 234/627] ExternalProject: Add option subsection anchors for accessibility from TOC Use RST subsections for each major step of `ExternalProject_Add()`. This makes finding options easier with less scrolling. For example, finding important Download vs. Test options etc. Fixes: #25129 --- Modules/ExternalProject.cmake | 1755 +++++++++++++++++---------------- 1 file changed, 893 insertions(+), 862 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 605908d771e..bec5c8ef9e2 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -11,11 +11,8 @@ ExternalProject .. contents:: -Commands -^^^^^^^^ - External Project Definition -""""""""""""""""""""""""""" +^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. command:: ExternalProject_Add @@ -34,866 +31,900 @@ External Project Definition customized. The function supports a large number of options which can be used to tailor the external project behavior. - **Directory Options:** - Most of the time, the default directory layout is sufficient. It is largely - an implementation detail that the main project usually doesn't need to - change. In some circumstances, however, control over the directory layout - can be useful or necessary. The directory options are potentially more - useful from the point of view that the main build can use the - :command:`ExternalProject_Get_Property` command to retrieve their values, - thereby allowing the main project to refer to build artifacts of the - external project. - - ``PREFIX `` - Root directory for the external project. Unless otherwise noted below, - all other directories associated with the external project will be - created under here. - - ``TMP_DIR `` - Directory in which to store temporary files. - - ``STAMP_DIR `` - Directory in which to store the timestamps of each step. Log files from - individual steps are also created in here unless overridden by LOG_DIR - (see *Logging Options* below). - - ``LOG_DIR `` - .. versionadded:: 3.14 - - Directory in which to store the logs of each step. - - ``DOWNLOAD_DIR `` - Directory in which to store downloaded files before unpacking them. This - directory is only used by the URL download method, all other download - methods use ``SOURCE_DIR`` directly instead. - - ``SOURCE_DIR `` - Source directory into which downloaded contents will be unpacked, or for - non-URL download methods, the directory in which the repository should be - checked out, cloned, etc. If no download method is specified, this must - point to an existing directory where the external project has already - been unpacked or cloned/checked out. - - .. note:: - If a download method is specified, any existing contents of the source - directory may be deleted. Only the URL download method checks whether - this directory is either missing or empty before initiating the - download, stopping with an error if it is not empty. All other - download methods silently discard any previous contents of the source - directory. - - ``BINARY_DIR `` - Specify the build directory location. This option is ignored if - ``BUILD_IN_SOURCE`` is enabled. - - ``INSTALL_DIR `` - Installation prefix to be placed in the ```` placeholder. - This does not actually configure the external project to install to - the given prefix. That must be done by passing appropriate arguments - to the external project configuration step, e.g. using ````. - - If any of the above ``..._DIR`` options are not specified, their defaults - are computed as follows. If the ``PREFIX`` option is given or the - ``EP_PREFIX`` directory property is set, then an external project is built - and installed under the specified prefix:: - - TMP_DIR = /tmp - STAMP_DIR = /src/-stamp - DOWNLOAD_DIR = /src - SOURCE_DIR = /src/ - BINARY_DIR = /src/-build - INSTALL_DIR = - LOG_DIR = - - Otherwise, if the ``EP_BASE`` directory property is set then components - of an external project are stored under the specified base:: - - TMP_DIR = /tmp/ - STAMP_DIR = /Stamp/ - DOWNLOAD_DIR = /Download/ - SOURCE_DIR = /Source/ - BINARY_DIR = /Build/ - INSTALL_DIR = /Install/ - LOG_DIR = - - If no ``PREFIX``, ``EP_PREFIX``, or ``EP_BASE`` is specified, then the - default is to set ``PREFIX`` to ``-prefix``. Relative paths are - interpreted with respect to :variable:`CMAKE_CURRENT_BINARY_DIR` at the - point where ``ExternalProject_Add()`` is called. - - **Download Step Options:** - A download method can be omitted if the ``SOURCE_DIR`` option is used to - point to an existing non-empty directory. Otherwise, one of the download - methods below must be specified (multiple download methods should not be - given) or a custom ``DOWNLOAD_COMMAND`` provided. - - ``DOWNLOAD_COMMAND ...`` - Overrides the command used for the download step - (:manual:`generator expressions ` are - supported). If this option is specified, all other download options will - be ignored. Providing an empty string for ```` effectively disables - the download step. - - *URL Download* - ``URL [...]`` - List of paths and/or URL(s) of the external project's source. When more - than one URL is given, they are tried in turn until one succeeds. A URL - may be an ordinary path in the local file system (in which case it - must be the only URL provided) or any downloadable URL supported by the - :command:`file(DOWNLOAD)` command. A local filesystem path may refer to - either an existing directory or to an archive file, whereas a URL is - expected to point to a file which can be treated as an archive. When an - archive is used, it will be unpacked automatically unless the - ``DOWNLOAD_NO_EXTRACT`` option is set to prevent it. The archive type - is determined by inspecting the actual content rather than using logic - based on the file extension. - - .. versionchanged:: 3.7 - Multiple URLs are allowed. - - ``URL_HASH =`` - Hash of the archive file to be downloaded. The argument should be of - the form ``=`` where ``algo`` can be any of the hashing - algorithms supported by the :command:`file()` command. Specifying this - option is strongly recommended for URL downloads, as it ensures the - integrity of the downloaded content. It is also used as a check for a - previously downloaded file, allowing connection to the remote location - to be avoided altogether if the local directory already has a file from - an earlier download that matches the specified hash. - - ``URL_MD5 `` - Equivalent to ``URL_HASH MD5=``. - - ``DOWNLOAD_NAME `` - File name to use for the downloaded file. If not given, the end of the - URL is used to determine the file name. This option is rarely needed, - the default name is generally suitable and is not normally used outside - of code internal to the ``ExternalProject`` module. - - ``DOWNLOAD_EXTRACT_TIMESTAMP `` - .. versionadded:: 3.24 - - When specified with a true value, the timestamps of the extracted - files will match those in the archive. When false, the timestamps of - the extracted files will reflect the time at which the extraction - was performed. If the download URL changes, timestamps based off - those in the archive can result in dependent targets not being rebuilt - when they potentially should have been. Therefore, unless the file - timestamps are significant to the project in some way, use a false - value for this option. If ``DOWNLOAD_EXTRACT_TIMESTAMP`` is not given, - the default is false. See policy :policy:`CMP0135`. - - ``DOWNLOAD_NO_EXTRACT `` - .. versionadded:: 3.6 - - Allows the extraction part of the download step to be disabled by - passing a boolean true value for this option. If this option is not - given, the downloaded contents will be unpacked automatically if - required. If extraction has been disabled, the full path to the - downloaded file is available as ```` in subsequent - steps or as the property ``DOWNLOADED_FILE`` with the - :command:`ExternalProject_Get_Property` command. - - ``DOWNLOAD_NO_PROGRESS `` - Can be used to disable logging the download progress. If this option is - not given, download progress messages will be logged. - - ``TIMEOUT `` - Maximum time allowed for file download operations. - - ``INACTIVITY_TIMEOUT `` - .. versionadded:: 3.19 - - Terminate the operation after a period of inactivity. - - ``HTTP_USERNAME `` - .. versionadded:: 3.7 - - Username for the download operation if authentication is required. - - ``HTTP_PASSWORD `` - .. versionadded:: 3.7 - - Password for the download operation if authentication is required. - - ``HTTP_HEADER [...]`` - .. versionadded:: 3.7 - - Provides an arbitrary list of HTTP headers for the download operation. - This can be useful for accessing content in systems like AWS, etc. - - ``TLS_VERIFY `` - Specifies whether certificate verification should be performed for - https URLs. If this option is not provided, the default behavior is - determined by the :variable:`CMAKE_TLS_VERIFY` variable (see - :command:`file(DOWNLOAD)`). If that is also not set, certificate - verification will not be performed. In situations where ``URL_HASH`` - cannot be provided, this option can be an alternative verification - measure. - - .. versionchanged:: 3.6 - This option also applies to ``git clone`` invocations, although the - default behavior is different. If ``TLS_VERIFY`` is not given and - :variable:`CMAKE_TLS_VERIFY` is not set, the behavior will be - determined by git's defaults. Normally, the ``sslVerify`` git - config setting defaults to true, but the user may have overridden - this at a global level. - - ``TLS_CAINFO `` - Specify a custom certificate authority file to use if ``TLS_VERIFY`` - is enabled. If this option is not specified, the value of the - :variable:`CMAKE_TLS_CAINFO` variable will be used instead (see - :command:`file(DOWNLOAD)`) - - ``NETRC `` - .. versionadded:: 3.11 - - Specify whether the ``.netrc`` file is to be used for operation. - If this option is not specified, the value of the - :variable:`CMAKE_NETRC` variable will be used instead - (see :command:`file(DOWNLOAD)`). Valid levels are: - - ``IGNORED`` - The ``.netrc`` file is ignored. - This is the default. - ``OPTIONAL`` - The ``.netrc`` file is optional, and information in the URL - is preferred. The file will be scanned to find which ever - information is not specified in the URL. - ``REQUIRED`` - The ``.netrc`` file is required, and information in the URL - is ignored. - - ``NETRC_FILE `` - .. versionadded:: 3.11 - - Specify an alternative ``.netrc`` file to the one in your home directory - if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option - is not specified, the value of the :variable:`CMAKE_NETRC_FILE` variable - will be used instead (see :command:`file(DOWNLOAD)`) - - .. versionadded:: 3.1 - Added support for `tbz2`, `.tar.xz`, `.txz`, and `.7z` extensions. - - *Git* - NOTE: A git version of 1.6.5 or later is required if this download method - is used. - - ``GIT_REPOSITORY `` - URL of the git repository. Any URL understood by the ``git`` command - may be used. - - .. versionchanged:: 3.27 - A relative URL will be resolved based on the parent project's - remote, subject to :policy:`CMP0150`. See the policy documentation - for how the remote is selected, including conditions where the - remote selection can fail. Local filesystem remotes should - always use absolute paths. - - ``GIT_TAG `` - Git branch name, tag or commit hash. Note that branch names and tags - should generally be specified as remote names (i.e. ``origin/myBranch`` - rather than simply ``myBranch``). This ensures that if the remote end - has its tag moved or branch rebased or history rewritten, the local - clone will still be updated correctly. In general, however, specifying - a commit hash should be preferred for a number of reasons: - - - If the local clone already has the commit corresponding to the hash, - no ``git fetch`` needs to be performed to check for changes each time - CMake is re-run. This can result in a significant speed up if many - external projects are being used. - - Using a specific git hash ensures that the main project's own history - is fully traceable to a specific point in the external project's - evolution. If a branch or tag name is used instead, then checking out - a specific commit of the main project doesn't necessarily pin the - whole build to a specific point in the life of the external project. - The lack of such deterministic behavior makes the main project lose - traceability and repeatability. - - If ``GIT_SHALLOW`` is enabled then ``GIT_TAG`` works only with - branch names and tags. A commit hash is not allowed. - - Note that if not provided, ``GIT_TAG`` defaults to ``master``, not the - default Git branch name. - - ``GIT_REMOTE_NAME `` - The optional name of the remote. If this option is not specified, it - defaults to ``origin``. - - ``GIT_SUBMODULES ...`` - Specific git submodules that should also be updated. If this option is - not provided, all git submodules will be updated. - - .. versionchanged:: 3.16 - When :policy:`CMP0097` is set to ``NEW``, if this value is set - to an empty string then no submodules are initialized or updated. - - ``GIT_SUBMODULES_RECURSE `` - .. versionadded:: 3.17 - - Specify whether git submodules (if any) should update recursively by - passing the ``--recursive`` flag to ``git submodule update``. - If not specified, the default is on. - - ``GIT_SHALLOW `` - .. versionadded:: 3.6 - - When this option is enabled, the ``git clone`` operation will be given - the ``--depth 1`` option. This performs a shallow clone, which avoids - downloading the whole history and instead retrieves just the commit - denoted by the ``GIT_TAG`` option. - - ``GIT_PROGRESS `` - .. versionadded:: 3.8 - - When enabled, this option instructs the ``git clone`` operation to - report its progress by passing it the ``--progress`` option. Without - this option, the clone step for large projects may appear to make the - build stall, since nothing will be logged until the clone operation - finishes. While this option can be used to provide progress to prevent - the appearance of the build having stalled, it may also make the build - overly noisy if lots of external projects are used. - - ``GIT_CONFIG [...]`` - .. versionadded:: 3.8 - - Specify a list of config options to pass to ``git clone``. Each option - listed will be transformed into its own ``--config