From kwrobot at kitware.com Sun Mar 1 00:01:13 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 1 Mar 2015 00:01:13 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-346-g1c29a55 Message-ID: <20150301050113.18D77AA698@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 1c29a5583c55f5388f0be230f9cffa660398968e (commit) from ae09fce8319112f8a401a843d4297e7c157a112a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c29a5583c55f5388f0be230f9cffa660398968e commit 1c29a5583c55f5388f0be230f9cffa660398968e Author: Kitware Robot AuthorDate: Sun Mar 1 00:01:09 2015 -0500 Commit: Kitware Robot CommitDate: Sun Mar 1 00:01:09 2015 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e7ce8dd..1521c21 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150228) +set(CMake_VERSION_PATCH 20150301) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 2 00:01:10 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 2 Mar 2015 00:01:10 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-347-ga8b2224 Message-ID: <20150302050110.4EADDAA9CE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a8b2224eb64e9a8b55634ba40dc1354bd3880d3d (commit) from 1c29a5583c55f5388f0be230f9cffa660398968e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a8b2224eb64e9a8b55634ba40dc1354bd3880d3d commit a8b2224eb64e9a8b55634ba40dc1354bd3880d3d Author: Kitware Robot AuthorDate: Mon Mar 2 00:01:08 2015 -0500 Commit: Kitware Robot CommitDate: Mon Mar 2 00:01:08 2015 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1521c21..22af221 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150301) +set(CMake_VERSION_PATCH 20150302) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 08:36:26 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 08:36:26 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-349-g17b4423 Message-ID: <20150302133626.338D8AB1E1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 17b4423c4509e747814f2c5564239ec72659b6f0 (commit) via 00d66557d49989f9813ba9f04beaa0a984699cf0 (commit) from a8b2224eb64e9a8b55634ba40dc1354bd3880d3d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=17b4423c4509e747814f2c5564239ec72659b6f0 commit 17b4423c4509e747814f2c5564239ec72659b6f0 Merge: a8b2224 00d6655 Author: Brad King AuthorDate: Mon Mar 2 08:36:24 2015 -0500 Commit: CMake Topic Stage CommitDate: Mon Mar 2 08:36:24 2015 -0500 Merge topic 'fix-crash-on-bad-LANG_STANDARD' 00d66557 Diagnose invalid _STANDARD value instead of crashing (#15426) ----------------------------------------------------------------------- Summary of changes: Source/cmLocalGenerator.cxx | 9 ++++++++- .../NotAStandard-result.txt} | 0 Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt | 4 ++++ Tests/RunCMake/CompileFeatures/NotAStandard.cmake | 2 ++ Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake | 2 ++ 5 files changed, 16 insertions(+), 1 deletion(-) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompileFeatures/NotAStandard-result.txt} (100%) create mode 100644 Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt create mode 100644 Tests/RunCMake/CompileFeatures/NotAStandard.cmake hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 08:36:28 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 08:36:28 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-351-ge2055b1 Message-ID: <20150302133628.B6117AAD75@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e2055b172eb4ed40893bc2e110a5640d078eef22 (commit) via 6a661f06030b85b4484733375bbb0aa23eca7446 (commit) from 17b4423c4509e747814f2c5564239ec72659b6f0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e2055b172eb4ed40893bc2e110a5640d078eef22 commit e2055b172eb4ed40893bc2e110a5640d078eef22 Merge: 17b4423 6a661f0 Author: Brad King AuthorDate: Mon Mar 2 08:36:26 2015 -0500 Commit: CMake Topic Stage CommitDate: Mon Mar 2 08:36:26 2015 -0500 Merge topic 'fix-ctest-update-locale' 6a661f06 CTest: To enforce the C locale use LC_ALL instead of LC_MESSAGES. ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestUpdateHandler.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 08:36:30 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 08:36:30 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-353-gb3381c5 Message-ID: <20150302133630.75224AB1E3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via b3381c5c79e2b7ef57a1d035e73d37ec2ee0aa45 (commit) via a7631fc4e026f2e330b10eae73f473f240c3d0c1 (commit) from e2055b172eb4ed40893bc2e110a5640d078eef22 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b3381c5c79e2b7ef57a1d035e73d37ec2ee0aa45 commit b3381c5c79e2b7ef57a1d035e73d37ec2ee0aa45 Merge: e2055b1 a7631fc Author: Brad King AuthorDate: Mon Mar 2 08:36:29 2015 -0500 Commit: CMake Topic Stage CommitDate: Mon Mar 2 08:36:29 2015 -0500 Merge topic 'modules-check-ARGC' a7631fc4 Modules: Check for ARGC before using ARGV# ----------------------------------------------------------------------- Summary of changes: Modules/BundleUtilities.cmake | 6 ++- Modules/DeployQt4.cmake | 90 ++++++++++++++++++++++++++++-------- Modules/ExternalProject.cmake | 2 +- Modules/FeatureSummary.cmake | 10 +++- Modules/FindPkgConfig.cmake | 2 +- Modules/GenerateExportHeader.cmake | 2 +- Modules/GetPrerequisites.cmake | 36 ++++++++++----- Modules/Qt4Macros.cmake | 12 +++-- 8 files changed, 121 insertions(+), 39 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 08:36:32 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 08:36:32 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-355-g5261c35 Message-ID: <20150302133632.230B2AB1EA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5261c357aef02f63a44060a6bea3e7f614758e08 (commit) via cfb22354b8bff1f7eddc117616a80774d456f467 (commit) from b3381c5c79e2b7ef57a1d035e73d37ec2ee0aa45 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5261c357aef02f63a44060a6bea3e7f614758e08 commit 5261c357aef02f63a44060a6bea3e7f614758e08 Merge: b3381c5 cfb2235 Author: Brad King AuthorDate: Mon Mar 2 08:36:31 2015 -0500 Commit: CMake Topic Stage CommitDate: Mon Mar 2 08:36:31 2015 -0500 Merge topic 'locale-agnostic-findhg' cfb22354 FindHg: Run hg with C locale when querying its version. ----------------------------------------------------------------------- Summary of changes: Modules/FindHg.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 08:36:51 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 08:36:51 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-807-gae266f0 Message-ID: <20150302133651.3D452AB1EF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ae266f05ef6da227ba295ed22291e1fe746aaf05 (commit) via 5261c357aef02f63a44060a6bea3e7f614758e08 (commit) via b3381c5c79e2b7ef57a1d035e73d37ec2ee0aa45 (commit) via e2055b172eb4ed40893bc2e110a5640d078eef22 (commit) via 17b4423c4509e747814f2c5564239ec72659b6f0 (commit) via a8b2224eb64e9a8b55634ba40dc1354bd3880d3d (commit) via 1c29a5583c55f5388f0be230f9cffa660398968e (commit) from 7f827ece69940026a557f7906ac6436d24962f57 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae266f05ef6da227ba295ed22291e1fe746aaf05 commit ae266f05ef6da227ba295ed22291e1fe746aaf05 Merge: 7f827ec 5261c35 Author: Brad King AuthorDate: Mon Mar 2 08:36:39 2015 -0500 Commit: Brad King CommitDate: Mon Mar 2 08:36:39 2015 -0500 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 08:38:01 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 08:38:01 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-357-g56be75b Message-ID: <20150302133801.EE9C4AB204@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 56be75b3107b210631919c13496060d648f97b14 (commit) via 6b6852a0ebe6d2c05ea500f78349e4fdbadcecd9 (commit) from 5261c357aef02f63a44060a6bea3e7f614758e08 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 08:38:02 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 08:38:02 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-810-gac5440e Message-ID: <20150302133802.1410DAB205@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ac5440e7341faeac3598711f62eee8039462f72b (commit) via 56be75b3107b210631919c13496060d648f97b14 (commit) via 6b6852a0ebe6d2c05ea500f78349e4fdbadcecd9 (commit) from ae266f05ef6da227ba295ed22291e1fe746aaf05 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac5440e7341faeac3598711f62eee8039462f72b commit ac5440e7341faeac3598711f62eee8039462f72b Merge: ae266f0 56be75b Author: Brad King AuthorDate: Mon Mar 2 08:37:35 2015 -0500 Commit: Brad King CommitDate: Mon Mar 2 08:37:35 2015 -0500 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 08:38:02 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 08:38:02 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.2.0-rc2-8-g6b6852a Message-ID: <20150302133802.5F403AB1F6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 6b6852a0ebe6d2c05ea500f78349e4fdbadcecd9 (commit) via 00d66557d49989f9813ba9f04beaa0a984699cf0 (commit) from 4932f59b4cd903169f691f708949ea2afb595492 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmLocalGenerator.cxx | 9 ++++++++- .../NotAStandard-result.txt} | 0 Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt | 4 ++++ Tests/RunCMake/CompileFeatures/NotAStandard.cmake | 2 ++ Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake | 2 ++ 5 files changed, 16 insertions(+), 1 deletion(-) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompileFeatures/NotAStandard-result.txt} (100%) create mode 100644 Tests/RunCMake/CompileFeatures/NotAStandard-stderr.txt create mode 100644 Tests/RunCMake/CompileFeatures/NotAStandard.cmake hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 08:54:29 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 08:54:29 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-813-g0c438b9 Message-ID: <20150302135429.C7311AAF05@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0c438b962c6585043dc055d3e4b6aaa2e99e090e (commit) via e88f3b3bcc18ec04e567025872f0008eea00c3a9 (commit) via 7c9afb573844fdef0a8c29bb7f8c4474b910d83f (commit) from ac5440e7341faeac3598711f62eee8039462f72b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c438b962c6585043dc055d3e4b6aaa2e99e090e commit 0c438b962c6585043dc055d3e4b6aaa2e99e090e Merge: ac5440e e88f3b3 Author: Brad King AuthorDate: Mon Mar 2 08:54:28 2015 -0500 Commit: CMake Topic Stage CommitDate: Mon Mar 2 08:54:28 2015 -0500 Merge topic 'update-kwsys' into next e88f3b3b Merge branch 'upstream-kwsys' into update-kwsys 7c9afb57 KWSys 2015-02-27 (d2aa1afd) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e88f3b3bcc18ec04e567025872f0008eea00c3a9 commit e88f3b3bcc18ec04e567025872f0008eea00c3a9 Merge: 56be75b 7c9afb5 Author: Brad King AuthorDate: Mon Mar 2 08:41:17 2015 -0500 Commit: Brad King CommitDate: Mon Mar 2 08:41:17 2015 -0500 Merge branch 'upstream-kwsys' into update-kwsys http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7c9afb573844fdef0a8c29bb7f8c4474b910d83f commit 7c9afb573844fdef0a8c29bb7f8c4474b910d83f Author: KWSys Robot AuthorDate: Fri Feb 27 11:12:18 2015 -0500 Commit: Brad King CommitDate: Mon Mar 2 08:41:11 2015 -0500 KWSys 2015-02-27 (d2aa1afd) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ d2aa1afd | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 1b75ad3d..d2aa1afd Paul Martin (1): d2aa1afd SystemTools: Update CopyFileAlways stream library workarounds Change-Id: I676f2f11ac0d52f7ffc3af5bb444d3726c121be0 diff --git a/SystemTools.cxx b/SystemTools.cxx index bf6f458..8a481d6 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -2375,6 +2375,10 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st { fout.write(buffer, fin.gcount()); } + else + { + break; + } } // Make sure the operating system has finished writing the file ----------------------------------------------------------------------- Summary of changes: Source/kwsys/SystemTools.cxx | 4 ++++ 1 file changed, 4 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 09:06:04 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 09:06:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-815-gb80f57d Message-ID: <20150302140604.B3504AB26F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b80f57d14676b2f639554496c0b9d19c67e0aa2b (commit) via 3b9f963f3fb1db05e90cfad606c62a7b3e9b18dc (commit) from 0c438b962c6585043dc055d3e4b6aaa2e99e090e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b80f57d14676b2f639554496c0b9d19c67e0aa2b commit b80f57d14676b2f639554496c0b9d19c67e0aa2b Merge: 0c438b9 3b9f963 Author: Brad King AuthorDate: Mon Mar 2 09:06:04 2015 -0500 Commit: CMake Topic Stage CommitDate: Mon Mar 2 09:06:04 2015 -0500 Merge topic 'cpack-strict-variable-selection' into next 3b9f963f CPack: be more stringent when selecting variables to encode http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b9f963f3fb1db05e90cfad606c62a7b3e9b18dc commit 3b9f963f3fb1db05e90cfad606c62a7b3e9b18dc Author: ????? ???????? AuthorDate: Sun Mar 1 02:38:52 2015 +0300 Commit: Brad King CommitDate: Mon Mar 2 09:01:31 2015 -0500 CPack: be more stringent when selecting variables to encode The old version would admit, for example, a variable named "xxxCPACK". diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index ce1536e..532596d 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -314,7 +314,7 @@ macro(cpack_encode_variables) set(_CPACK_OTHER_VARIABLES_) get_cmake_property(res VARIABLES) foreach(var ${res}) - if("xxx${var}" MATCHES "xxxCPACK") + if(var MATCHES "^CPACK") set(_CPACK_OTHER_VARIABLES_ "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")") endif() ----------------------------------------------------------------------- Summary of changes: Modules/CPack.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 2 10:11:40 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 2 Mar 2015 10:11:40 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-817-gcf240df Message-ID: <20150302151140.288E2A274B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via cf240dfa5d985e5ac8f7e11abf1bc2646b8b0a9e (commit) via 3e98ebbaef9cfa1544f960320ebc4258e82909bd (commit) from b80f57d14676b2f639554496c0b9d19c67e0aa2b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf240dfa5d985e5ac8f7e11abf1bc2646b8b0a9e commit cf240dfa5d985e5ac8f7e11abf1bc2646b8b0a9e Merge: b80f57d 3e98ebb Author: Brad King AuthorDate: Mon Mar 2 10:11:39 2015 -0500 Commit: CMake Topic Stage CommitDate: Mon Mar 2 10:11:39 2015 -0500 Merge topic 'fix-JOM-quiet-make' into next 3e98ebba JOM: Pass /NOLOGO when driving builds as is done for NMake http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e98ebbaef9cfa1544f960320ebc4258e82909bd commit 3e98ebbaef9cfa1544f960320ebc4258e82909bd Author: Brad King AuthorDate: Mon Mar 2 10:08:09 2015 -0500 Commit: Brad King CommitDate: Mon Mar 2 10:08:09 2015 -0500 JOM: Pass /NOLOGO when driving builds as is done for NMake This fixes RunCMake.(Configure|configure_file|try_compile) test failures that failed to match empty stderr due to jom printing its identification line. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 1d2dd34..5701564 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -563,7 +563,7 @@ void cmGlobalUnixMakefileGenerator3 // Since we have full control over the invocation of nmake, let us // make it quiet. - if ( this->GetName() == "NMake Makefiles" ) + if (cmHasLiteralPrefix(this->GetName(), "NMake Makefiles")) { makeCommand.push_back("/NOLOGO"); } ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 3 00:01:10 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 3 Mar 2015 00:01:10 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-358-g0261198 Message-ID: <20150303050111.026BAAAF0D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 02611986539366644661138153ebf816a0febd61 (commit) from 56be75b3107b210631919c13496060d648f97b14 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=02611986539366644661138153ebf816a0febd61 commit 02611986539366644661138153ebf816a0febd61 Author: Kitware Robot AuthorDate: Tue Mar 3 00:01:09 2015 -0500 Commit: Kitware Robot CommitDate: Tue Mar 3 00:01:09 2015 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 22af221..e4956c8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150302) +set(CMake_VERSION_PATCH 20150303) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 08:32:55 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 08:32:55 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-361-g9babde4 Message-ID: <20150303133255.7DDF2AB1B5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 9babde423cfdbb06d154f4fa1c7b7ac795154aff (commit) via e88f3b3bcc18ec04e567025872f0008eea00c3a9 (commit) via 7c9afb573844fdef0a8c29bb7f8c4474b910d83f (commit) from 02611986539366644661138153ebf816a0febd61 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9babde423cfdbb06d154f4fa1c7b7ac795154aff commit 9babde423cfdbb06d154f4fa1c7b7ac795154aff Merge: 0261198 e88f3b3 Author: Brad King AuthorDate: Tue Mar 3 08:32:54 2015 -0500 Commit: CMake Topic Stage CommitDate: Tue Mar 3 08:32:54 2015 -0500 Merge topic 'update-kwsys' e88f3b3b Merge branch 'upstream-kwsys' into update-kwsys 7c9afb57 KWSys 2015-02-27 (d2aa1afd) ----------------------------------------------------------------------- Summary of changes: Source/kwsys/SystemTools.cxx | 4 ++++ 1 file changed, 4 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 08:32:57 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 08:32:57 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-363-gad16220 Message-ID: <20150303133257.79687AAC7F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ad162206f02d9d726543a73c02ab5ed10f5e6522 (commit) via 3b9f963f3fb1db05e90cfad606c62a7b3e9b18dc (commit) from 9babde423cfdbb06d154f4fa1c7b7ac795154aff (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad162206f02d9d726543a73c02ab5ed10f5e6522 commit ad162206f02d9d726543a73c02ab5ed10f5e6522 Merge: 9babde4 3b9f963 Author: Brad King AuthorDate: Tue Mar 3 08:32:56 2015 -0500 Commit: CMake Topic Stage CommitDate: Tue Mar 3 08:32:56 2015 -0500 Merge topic 'cpack-strict-variable-selection' 3b9f963f CPack: be more stringent when selecting variables to encode ----------------------------------------------------------------------- Summary of changes: Modules/CPack.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 08:33:12 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 08:33:12 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-821-gd4bdfa2 Message-ID: <20150303133312.913CDAB1F1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d4bdfa2ed8c9e0011aa42880f263ea41d91a3cba (commit) via ad162206f02d9d726543a73c02ab5ed10f5e6522 (commit) via 9babde423cfdbb06d154f4fa1c7b7ac795154aff (commit) via 02611986539366644661138153ebf816a0febd61 (commit) from cf240dfa5d985e5ac8f7e11abf1bc2646b8b0a9e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4bdfa2ed8c9e0011aa42880f263ea41d91a3cba commit d4bdfa2ed8c9e0011aa42880f263ea41d91a3cba Merge: cf240df ad16220 Author: Brad King AuthorDate: Tue Mar 3 08:33:04 2015 -0500 Commit: Brad King CommitDate: Tue Mar 3 08:33:04 2015 -0500 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 08:34:18 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 08:34:18 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-823-g6e32c9d Message-ID: <20150303133418.44442AB213@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6e32c9dc34b4fcb61586e8045777db19bac77b17 (commit) via b8ea771b13989f353c2762abd40a65b6d33a1eb7 (commit) from d4bdfa2ed8c9e0011aa42880f263ea41d91a3cba (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e32c9dc34b4fcb61586e8045777db19bac77b17 commit 6e32c9dc34b4fcb61586e8045777db19bac77b17 Merge: d4bdfa2 b8ea771 Author: Brad King AuthorDate: Tue Mar 3 08:34:17 2015 -0500 Commit: CMake Topic Stage CommitDate: Tue Mar 3 08:34:17 2015 -0500 Merge topic 'backport-KWSys-SystemTools-CopyFileAlways-fix' into next b8ea771b KWSys SystemTools: Update CopyFileAlways stream library workarounds http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b8ea771b13989f353c2762abd40a65b6d33a1eb7 commit b8ea771b13989f353c2762abd40a65b6d33a1eb7 Author: Paul Martin AuthorDate: Fri Feb 27 10:45:26 2015 -0500 Commit: Brad King CommitDate: Mon Mar 2 08:55:13 2015 -0500 KWSys SystemTools: Update CopyFileAlways stream library workarounds On some stream libraries failbit is not set when trying to read past EOF. Instead, always exit the copy loop when gcount() is zero. diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 2708211..b03e7b0 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2330,6 +2330,10 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st { fout.write(buffer, fin.gcount()); } + else + { + break; + } } // Make sure the operating system has finished writing the file ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 08:34:32 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 08:34:32 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-365-g687065e Message-ID: <20150303133432.F21BBAB218@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 687065e22a4d6856e5cf15c5797074bc13bbdbcf (commit) via b8ea771b13989f353c2762abd40a65b6d33a1eb7 (commit) from ad162206f02d9d726543a73c02ab5ed10f5e6522 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=687065e22a4d6856e5cf15c5797074bc13bbdbcf commit 687065e22a4d6856e5cf15c5797074bc13bbdbcf Merge: ad16220 b8ea771 Author: Brad King AuthorDate: Tue Mar 3 08:34:31 2015 -0500 Commit: CMake Topic Stage CommitDate: Tue Mar 3 08:34:31 2015 -0500 Merge topic 'backport-KWSys-SystemTools-CopyFileAlways-fix' b8ea771b KWSys SystemTools: Update CopyFileAlways stream library workarounds ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 08:35:25 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 08:35:25 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-367-g1049fea Message-ID: <20150303133525.39494AB229@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 1049feaab6829427a53057ca44ac3a786a6ef9cb (commit) via eb3bced50fe7da40015a1d32dae96f0abf401ff6 (commit) from 687065e22a4d6856e5cf15c5797074bc13bbdbcf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 08:35:25 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 08:35:25 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-827-g48d907b Message-ID: <20150303133525.5298FAB22A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 48d907b94766068e145e7cbf6d8886061037a0ab (commit) via 1049feaab6829427a53057ca44ac3a786a6ef9cb (commit) via 687065e22a4d6856e5cf15c5797074bc13bbdbcf (commit) via eb3bced50fe7da40015a1d32dae96f0abf401ff6 (commit) from 6e32c9dc34b4fcb61586e8045777db19bac77b17 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=48d907b94766068e145e7cbf6d8886061037a0ab commit 48d907b94766068e145e7cbf6d8886061037a0ab Merge: 6e32c9d 1049fea Author: Brad King AuthorDate: Tue Mar 3 08:34:53 2015 -0500 Commit: Brad King CommitDate: Tue Mar 3 08:34:53 2015 -0500 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 08:35:25 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 08:35:25 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.2.0-rc2-10-geb3bced Message-ID: <20150303133525.6A0BAAB22B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via eb3bced50fe7da40015a1d32dae96f0abf401ff6 (commit) via b8ea771b13989f353c2762abd40a65b6d33a1eb7 (commit) from 6b6852a0ebe6d2c05ea500f78349e4fdbadcecd9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/kwsys/SystemTools.cxx | 4 ++++ 1 file changed, 4 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 08:40:44 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 08:40:44 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-830-gbce2428 Message-ID: <20150303134044.AE88C49CB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via bce2428ee4f1634bf32ff23666f14177334dfdb6 (commit) via 285ce5413c950ed3704995de3a4d951744d3940e (commit) via a49a467fd02dded8e8976008082659054484b8fe (commit) from 48d907b94766068e145e7cbf6d8886061037a0ab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bce2428ee4f1634bf32ff23666f14177334dfdb6 commit bce2428ee4f1634bf32ff23666f14177334dfdb6 Merge: 48d907b 285ce54 Author: Brad King AuthorDate: Tue Mar 3 08:40:44 2015 -0500 Commit: CMake Topic Stage CommitDate: Tue Mar 3 08:40:44 2015 -0500 Merge topic 'test-release' into next 285ce541 Merge branch 'release' into test-release a49a467f CMake 3.2.0 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=285ce5413c950ed3704995de3a4d951744d3940e commit 285ce5413c950ed3704995de3a4d951744d3940e Merge: 1049fea a49a467 Author: Brad King AuthorDate: Tue Mar 3 08:38:51 2015 -0500 Commit: Brad King CommitDate: Tue Mar 3 08:38:51 2015 -0500 Merge branch 'release' into test-release http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a49a467fd02dded8e8976008082659054484b8fe commit a49a467fd02dded8e8976008082659054484b8fe Author: Brad King AuthorDate: Tue Mar 3 08:38:36 2015 -0500 Commit: Brad King CommitDate: Tue Mar 3 08:38:36 2015 -0500 CMake 3.2.0 diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0ab2a58..006e65a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,4 +2,4 @@ set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 2) +#set(CMake_VERSION_RC 0) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 3 09:21:00 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 3 Mar 2015 09:21:00 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-833-gf26b6a1 Message-ID: <20150303142100.095E9AAB55@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f26b6a12367b7626d332499b418151338cb751da (commit) via e97141c2bc11d1cda3adc2579eeab53620d3b921 (commit) via d6a320ab5ef12459b98fae2711b9a386b4a01466 (commit) from bce2428ee4f1634bf32ff23666f14177334dfdb6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f26b6a12367b7626d332499b418151338cb751da commit f26b6a12367b7626d332499b418151338cb751da Merge: bce2428 e97141c Author: Brad King AuthorDate: Tue Mar 3 09:20:59 2015 -0500 Commit: CMake Topic Stage CommitDate: Tue Mar 3 09:20:59 2015 -0500 Merge topic 'InstallRequiredSystemLibraries-COMPONENT' into next e97141c2 InstallRequiredSystemLibraries: Add option to specify install COMPONENT d6a320ab InstallRequiredSystemLibraries: Format documentation http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e97141c2bc11d1cda3adc2579eeab53620d3b921 commit e97141c2bc11d1cda3adc2579eeab53620d3b921 Author: Johan Andruejol AuthorDate: Mon Mar 2 14:28:14 2015 -0500 Commit: Brad King CommitDate: Tue Mar 3 09:17:47 2015 -0500 InstallRequiredSystemLibraries: Add option to specify install COMPONENT Previously the module did not support projects using installation components because install(PROGRAMS) was never called with COMPONENT. Add an option to specify the COMPONENT so that projects doing this do not have to resort to using CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP and writing the install rule by hand. diff --git a/Help/release/dev/InstallRequiredSystemLibraries-COMPONENT.rst b/Help/release/dev/InstallRequiredSystemLibraries-COMPONENT.rst new file mode 100644 index 0000000..e6ebc2d --- /dev/null +++ b/Help/release/dev/InstallRequiredSystemLibraries-COMPONENT.rst @@ -0,0 +1,6 @@ +InstallRequiredSystemLibraries-COMPONENT +---------------------------------------- + +* The :module:`InstallRequiredSystemLibraries` module learned a new + ``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT`` option to specify the + installation component. diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index bd7f5b2..c7e88ba 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -38,9 +38,13 @@ # Set to TRUE to disable warnings about required library files that # do not exist. (For example, Visual Studio Express editions may # not provide the redistributable files.) +# +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT`` +# Specify the :command:`install(PROGRAMS)` command ``COMPONENT`` +# option. If not specified, no such option will be used. #============================================================================= -# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2015 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -486,7 +490,13 @@ if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib) endif() endif() + if(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT) + set(_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT + COMPONENT ${CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT}) + endif() install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} - DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}) + DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION} + ${_CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT} + ) endif() endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d6a320ab5ef12459b98fae2711b9a386b4a01466 commit d6a320ab5ef12459b98fae2711b9a386b4a01466 Author: Brad King AuthorDate: Tue Mar 3 09:14:29 2015 -0500 Commit: Brad King CommitDate: Tue Mar 3 09:14:29 2015 -0500 InstallRequiredSystemLibraries: Format documentation diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 5afb517..bd7f5b2 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -2,33 +2,42 @@ # InstallRequiredSystemLibraries # ------------------------------ # +# Include this module to search for compiler-provided system runtime +# libraries and add install rules for them. Some optional variables +# may be set prior to including the module to adjust behavior: # +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS`` +# Specify additional runtime libraries that may not be detected. +# After inclusion any detected libraries will be appended to this. # -# By including this file, all library files listed in the variable -# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS will be installed with -# install(PROGRAMS ...) into bin for WIN32 and lib for non-WIN32. If -# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP is set to TRUE before including -# this file, then the INSTALL command is not called. The user can use -# the variable CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to use a custom install -# command and install them however they want. If it is the MSVC -# compiler, then the microsoft run time libraries will be found and -# automatically added to the CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS, and -# installed. If CMAKE_INSTALL_DEBUG_LIBRARIES is set and it is the MSVC -# compiler, then the debug libraries are installed when available. If -# CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY is set then only the debug -# libraries are installed when both debug and release are available. If -# CMAKE_INSTALL_MFC_LIBRARIES is set then the MFC run time libraries are -# installed as well as the CRT run time libraries. If -# CMAKE_INSTALL_OPENMP_LIBRARIES is set then the OpenMP run time libraries -# are installed as well. If -# CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set then the libraries are -# installed to that directory rather than the default. If -# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS is NOT set, then this -# file warns about required files that do not exist. You can set this -# variable to ON before including this file to avoid the warning. For -# example, the Visual Studio Express editions do not include the -# redistributable files, so if you include this file on a machine with -# only VS Express installed, you'll get the warning. +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP`` +# Set to TRUE to skip calling the :command:`install(PROGRAMS)` command to +# allow the includer to specify its own install rule, using the value of +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS`` to get the list of libraries. +# +# ``CMAKE_INSTALL_DEBUG_LIBRARIES`` +# Set to TRUE to install the debug runtime libraries when available +# with MSVC tools. +# +# ``CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY`` +# Set to TRUE to install only the debug runtime libraries with MSVC +# tools even if the release runtime libraries are also available. +# +# ``CMAKE_INSTALL_MFC_LIBRARIES`` +# Set to TRUE to install the MSVC MFC runtime libraries. +# +# ``CMAKE_INSTALL_OPENMP_LIBRARIES`` +# Set to TRUE to install the MSVC OpenMP runtime libraries +# +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION`` +# Specify the :command:`install(PROGRAMS)` command ``DESTINATION`` +# option. If not specified, the default is ``bin`` on Windows +# and ``lib`` elsewhere. +# +# ``CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS`` +# Set to TRUE to disable warnings about required library files that +# do not exist. (For example, Visual Studio Express editions may +# not provide the redistributable files.) #============================================================================= # Copyright 2006-2009 Kitware, Inc. ----------------------------------------------------------------------- Summary of changes: .../InstallRequiredSystemLibraries-COMPONENT.rst | 6 ++ Modules/InstallRequiredSystemLibraries.cmake | 73 ++++++++++++-------- 2 files changed, 52 insertions(+), 27 deletions(-) create mode 100644 Help/release/dev/InstallRequiredSystemLibraries-COMPONENT.rst hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 4 00:01:12 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 4 Mar 2015 00:01:12 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-368-gebcb75e Message-ID: <20150304050112.492E0AB020@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ebcb75e62658ac5060a71f3153f1de72c9c613e1 (commit) from 1049feaab6829427a53057ca44ac3a786a6ef9cb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ebcb75e62658ac5060a71f3153f1de72c9c613e1 commit ebcb75e62658ac5060a71f3153f1de72c9c613e1 Author: Kitware Robot AuthorDate: Wed Mar 4 00:01:09 2015 -0500 Commit: Kitware Robot CommitDate: Wed Mar 4 00:01:09 2015 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e4956c8..1dc8712 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150303) +set(CMake_VERSION_PATCH 20150304) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 4 08:43:43 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 4 Mar 2015 08:43:43 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-rc2-370-g49ce2c9 Message-ID: <20150304134343.647FAA8DB2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 49ce2c999f797cb6490bc52c2e8d6d2fb431f175 (commit) via a49a467fd02dded8e8976008082659054484b8fe (commit) from ebcb75e62658ac5060a71f3153f1de72c9c613e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 4 08:43:43 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 4 Mar 2015 08:43:43 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-837-gb53b796 Message-ID: <20150304134343.9023FA90EA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b53b796e150debced88e8268c045740123c1508e (commit) via 49ce2c999f797cb6490bc52c2e8d6d2fb431f175 (commit) via 2d111925eda60eebebe4764865fe57f49928396b (commit) via ebcb75e62658ac5060a71f3153f1de72c9c613e1 (commit) from f26b6a12367b7626d332499b418151338cb751da (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b53b796e150debced88e8268c045740123c1508e commit b53b796e150debced88e8268c045740123c1508e Merge: 2d11192 49ce2c9 Author: Brad King AuthorDate: Wed Mar 4 08:43:22 2015 -0500 Commit: Brad King CommitDate: Wed Mar 4 08:43:22 2015 -0500 Merge branch 'master' into next http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d111925eda60eebebe4764865fe57f49928396b commit 2d111925eda60eebebe4764865fe57f49928396b Merge: f26b6a1 ebcb75e Author: Brad King AuthorDate: Wed Mar 4 08:42:37 2015 -0500 Commit: Brad King CommitDate: Wed Mar 4 08:42:37 2015 -0500 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 4 08:43:43 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 4 Mar 2015 08:43:43 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.2.0-rc2-11-ga49a467 Message-ID: <20150304134343.A8A33A9226@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via a49a467fd02dded8e8976008082659054484b8fe (commit) from eb3bced50fe7da40015a1d32dae96f0abf401ff6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 4 08:50:28 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 4 Mar 2015 08:50:28 -0500 (EST) Subject: [Cmake-commits] CMake annotated tag, v3.2.0, created. v3.2.0 Message-ID: <20150304135028.6168EAAC36@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The annotated tag, v3.2.0 has been created at 9100a1389c4a781e151f5932e8a28bd2b25c70db (tag) tagging a49a467fd02dded8e8976008082659054484b8fe (commit) replaces v3.2.0-rc2 tagged by Brad King on Wed Mar 4 08:40:50 2015 -0500 - Log ----------------------------------------------------------------- CMake 3.2.0 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJU9wtiAAoJEOyP7zp7+07aD8AP/2rBuM2BL5A75P2RcJcLMsKL VOdZXAUFG+QGR9WRLqUIxOdRys4n1JT/Bxj3lujSMt6QCGjlpv7n0SZL58Ow+wrz Kmb0cCbgoRF/o5GwE/ZXGIXQZFOC+p6U7IzO4Qif1dmV8oIOT6TmBIYVa7BOBftt gu9i36gfnKQ56kAO/AsRvCLQaq3hORhC87YoqpTmBa1D4gppM2iFEQDnGk7YQ0xB VcyibhKGyZkh5S2fFJdCInn7sYdT7jhRvfKp7LpXvnCEiJjFrr27rWJXr6m1pJ38 +VUfKaVwy/z/6/bSY5WOf0P7TgND1+DcirTVRtPIBWUq6Cakro3ffLMH+vDNZKrn oOWgaArfDvHZDwog7oA47WUZKfk1+ZCbI1sdOzg2K/lNODxKQuQQZ+Gfj+sYXZPa sqJmsj5ATDEGRCW7bFh9KDFvkctlSUAsRqLXh23AHrTjCaw81bbq/popMJPm4RaO V+p/RMWS4dZ0Nos8q091eTZROeTK8dxdeFNOKhC6QqcE30KAWLycpRYIuATmO+Qx sSPDaie3IgTMOdYp5n852QGaVT6M++qczGzmo7HZZiSOQ+6iP0cHT14Hb/hfdbZE NBUjqLhz3OMay75IKJXSfze81itEBXvvqDuNzi6E+/apblkrLrl0q7VofEg62u7Y 8rxvbV43mxwGB44g2px0 =jVop -----END PGP SIGNATURE----- Brad King (8): VS: Do not generate a BOM in .sln files Merge branch 'sln-no-bom' into release Merge branch 'install-manifest-optimize' into release Merge branch 'cpack_rpm_mulit_prefix_fixup' into release Diagnose invalid _STANDARD value instead of crashing (#15426) Merge branch 'fix-crash-on-bad-LANG_STANDARD' into release Merge branch 'backport-KWSys-SystemTools-CopyFileAlways-fix' into release CMake 3.2.0 Domen Vrankar (1): CPackRPM: Fix handling of relocation prefix parent directories Paul Martin (1): KWSys SystemTools: Update CopyFileAlways stream library workarounds Robert Goulet (1): install: Write the entire installation manifest at once ----------------------------------------------------------------------- hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 4 08:52:14 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 4 Mar 2015 08:52:14 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-361-g4ef2120 Message-ID: <20150304135214.13E32AAE35@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 4ef21206e66cc993669b0fb532039d84c990c82e (commit) via 3e98ebbaef9cfa1544f960320ebc4258e82909bd (commit) from 49ce2c999f797cb6490bc52c2e8d6d2fb431f175 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4ef21206e66cc993669b0fb532039d84c990c82e commit 4ef21206e66cc993669b0fb532039d84c990c82e Merge: 49ce2c9 3e98ebb Author: Brad King AuthorDate: Wed Mar 4 08:52:12 2015 -0500 Commit: CMake Topic Stage CommitDate: Wed Mar 4 08:52:12 2015 -0500 Merge topic 'fix-JOM-quiet-make' 3e98ebba JOM: Pass /NOLOGO when driving builds as is done for NMake ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 4 08:52:15 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 4 Mar 2015 08:52:15 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-364-gdf5def5 Message-ID: <20150304135215.F21FAAAE29@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via df5def5334249eb01195c1f24f3e728519dc742c (commit) via e97141c2bc11d1cda3adc2579eeab53620d3b921 (commit) via d6a320ab5ef12459b98fae2711b9a386b4a01466 (commit) from 4ef21206e66cc993669b0fb532039d84c990c82e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df5def5334249eb01195c1f24f3e728519dc742c commit df5def5334249eb01195c1f24f3e728519dc742c Merge: 4ef2120 e97141c Author: Brad King AuthorDate: Wed Mar 4 08:52:14 2015 -0500 Commit: CMake Topic Stage CommitDate: Wed Mar 4 08:52:14 2015 -0500 Merge topic 'InstallRequiredSystemLibraries-COMPONENT' e97141c2 InstallRequiredSystemLibraries: Add option to specify install COMPONENT d6a320ab InstallRequiredSystemLibraries: Format documentation ----------------------------------------------------------------------- Summary of changes: .../InstallRequiredSystemLibraries-COMPONENT.rst | 6 ++ Modules/InstallRequiredSystemLibraries.cmake | 73 ++++++++++++-------- 2 files changed, 52 insertions(+), 27 deletions(-) create mode 100644 Help/release/dev/InstallRequiredSystemLibraries-COMPONENT.rst hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 4 08:52:37 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 4 Mar 2015 08:52:37 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-829-gc1cef9d Message-ID: <20150304135237.91F19AAE75@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c1cef9db1cadef2baeac082acaef9f80338cbfc1 (commit) via df5def5334249eb01195c1f24f3e728519dc742c (commit) via 4ef21206e66cc993669b0fb532039d84c990c82e (commit) from b53b796e150debced88e8268c045740123c1508e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1cef9db1cadef2baeac082acaef9f80338cbfc1 commit c1cef9db1cadef2baeac082acaef9f80338cbfc1 Merge: b53b796 df5def5 Author: Brad King AuthorDate: Wed Mar 4 08:52:30 2015 -0500 Commit: Brad King CommitDate: Wed Mar 4 08:52:30 2015 -0500 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 4 09:09:55 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 4 Mar 2015 09:09:55 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-832-g2b10088 Message-ID: <20150304140955.01BFF2276@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2b10088142730c946c2ec4d85ba59fa65921bff6 (commit) via 44ef47000eb4f4ac7b4fc041afd3579ebe355469 (commit) via aa84d26e631e11d73328c24ac0301c43f661869b (commit) from c1cef9db1cadef2baeac082acaef9f80338cbfc1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2b10088142730c946c2ec4d85ba59fa65921bff6 commit 2b10088142730c946c2ec4d85ba59fa65921bff6 Merge: c1cef9d 44ef470 Author: Brad King AuthorDate: Wed Mar 4 09:09:54 2015 -0500 Commit: CMake Topic Stage CommitDate: Wed Mar 4 09:09:54 2015 -0500 Merge topic 'update-kwsys' into next 44ef4700 Merge branch 'upstream-kwsys' into update-kwsys aa84d26e KWSys 2015-03-03 (4890f30c) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44ef47000eb4f4ac7b4fc041afd3579ebe355469 commit 44ef47000eb4f4ac7b4fc041afd3579ebe355469 Merge: df5def5 aa84d26 Author: Brad King AuthorDate: Wed Mar 4 08:53:24 2015 -0500 Commit: Brad King CommitDate: Wed Mar 4 08:53:24 2015 -0500 Merge branch 'upstream-kwsys' into update-kwsys http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aa84d26e631e11d73328c24ac0301c43f661869b commit aa84d26e631e11d73328c24ac0301c43f661869b Author: KWSys Robot AuthorDate: Tue Mar 3 08:50:09 2015 -0500 Commit: Brad King CommitDate: Wed Mar 4 08:53:20 2015 -0500 KWSys 2015-03-03 (4890f30c) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 4890f30c | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' d2aa1afd..4890f30c Domen Vrankar (2): 5d6204e9 Glob: Handle symlink cycles in directory paths 4890f30c Glob: Add support for directory listing Change-Id: Id8b77dabf8f50efeffdeaf1c826154fd2a25e17b diff --git a/Glob.cxx b/Glob.cxx index 1476c25..11bfd16 100644 --- a/Glob.cxx +++ b/Glob.cxx @@ -19,6 +19,7 @@ #include KWSYS_HEADER(Directory.hxx) #include KWSYS_HEADER(stl/string) #include KWSYS_HEADER(stl/vector) +#include KWSYS_HEADER(stl/algorithm) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. @@ -30,6 +31,8 @@ # include "SystemTools.hxx.in" # include "kwsys_stl.hxx.in" # include "kwsys_stl_string.hxx.in" +# include "kwsys_stl_vector.hxx.in" +# include "kwsys_stl_algorithm.hxx.in" #endif #include @@ -66,6 +69,10 @@ Glob::Glob() // RecurseThroughSymlinks is true by default for backwards compatibility, // not because it's a good idea... this->FollowedSymlinkCount = 0; + + // Keep separate variables for directory listing for back compatibility + this->ListDirs = true; + this->RecurseListDirs = false; } //---------------------------------------------------------------------------- @@ -214,13 +221,13 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern, } //---------------------------------------------------------------------------- -void Glob::RecurseDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir) +bool Glob::RecurseDirectory(kwsys_stl::string::size_type start, + const kwsys_stl::string& dir, GlobMessages* messages) { kwsys::Directory d; if ( !d.Load(dir) ) { - return; + return true; } unsigned long cc; kwsys_stl::string realname; @@ -255,8 +262,67 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start, if (isSymLink) { ++this->FollowedSymlinkCount; + kwsys_stl::string realPathErrorMessage; + kwsys_stl::string canonicalPath(SystemTools::GetRealPath(dir, + &realPathErrorMessage)); + + if(!realPathErrorMessage.empty()) + { + if(messages) + { + messages->push_back(Message( + Glob::error, "Canonical path generation from path '" + + dir + "' failed! Reason: '" + realPathErrorMessage + "'")); + } + return false; + } + + if(kwsys_stl::find(this->VisitedSymlinks.begin(), + this->VisitedSymlinks.end(), + canonicalPath) == this->VisitedSymlinks.end()) + { + if(this->RecurseListDirs) + { + // symlinks are treated as directories + this->AddFile(this->Internals->Files, realname); + } + + this->VisitedSymlinks.push_back(canonicalPath); + if(!this->RecurseDirectory(start+1, realname, messages)) + { + this->VisitedSymlinks.pop_back(); + + return false; + } + this->VisitedSymlinks.pop_back(); + } + // else we have already visited this symlink - prevent cyclic recursion + else if(messages) + { + kwsys_stl::string message; + for(kwsys_stl::vector::const_iterator + pathIt = kwsys_stl::find(this->VisitedSymlinks.begin(), + this->VisitedSymlinks.end(), + canonicalPath); + pathIt != this->VisitedSymlinks.end(); ++pathIt) + { + message += *pathIt + "\n"; + } + message += canonicalPath + "/" + fname; + messages->push_back(Message(Glob::cyclicRecursion, message)); + } + } + else + { + if(this->RecurseListDirs) + { + this->AddFile(this->Internals->Files, realname); + } + if(!this->RecurseDirectory(start+1, realname, messages)) + { + return false; + } } - this->RecurseDirectory(start+1, realname); } else { @@ -267,17 +333,19 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start, } } } + + return true; } //---------------------------------------------------------------------------- void Glob::ProcessDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir) + const kwsys_stl::string& dir, GlobMessages* messages) { //kwsys_ios::cout << "ProcessDirectory: " << dir << kwsys_ios::endl; bool last = ( start == this->Internals->Expressions.size()-1 ); if ( last && this->Recurse ) { - this->RecurseDirectory(start, dir); + this->RecurseDirectory(start, dir, messages); return; } @@ -321,8 +389,9 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start, // << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl; //kwsys_ios::cout << "Real name: " << realname << kwsys_ios::endl; - if ( !last && - !kwsys::SystemTools::FileIsDirectory(realname) ) + if( (!last && !kwsys::SystemTools::FileIsDirectory(realname)) + || (!this->ListDirs && last && + kwsys::SystemTools::FileIsDirectory(realname)) ) { continue; } @@ -335,14 +404,14 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start, } else { - this->ProcessDirectory(start+1, realname); + this->ProcessDirectory(start+1, realname, messages); } } } } //---------------------------------------------------------------------------- -bool Glob::FindFiles(const kwsys_stl::string& inexpr) +bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages) { kwsys_stl::string cexpr; kwsys_stl::string::size_type cc; @@ -438,11 +507,11 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr) // Handle network paths if ( skip > 0 ) { - this->ProcessDirectory(0, fexpr.substr(0, skip) + "/"); + this->ProcessDirectory(0, fexpr.substr(0, skip) + "/", messages); } else { - this->ProcessDirectory(0, "/"); + this->ProcessDirectory(0, "/", messages); } return true; } diff --git a/Glob.hxx.in b/Glob.hxx.in index d8b8491..39b7ce7 100644 --- a/Glob.hxx.in +++ b/Glob.hxx.in @@ -40,11 +40,36 @@ class GlobInternals; class @KWSYS_NAMESPACE at _EXPORT Glob { public: + enum MessageType + { + error, + cyclicRecursion + }; + + struct Message + { + MessageType type; + kwsys_stl::string content; + + Message(MessageType t, const kwsys_stl::string& c) : + type(t), + content(c) + {} + Message(const Message& msg) : + type(msg.type), + content(msg.content) + {} + }; + + typedef kwsys_stl::vector GlobMessages; + typedef kwsys_stl::vector::iterator GlobMessagesIterator; +public: Glob(); ~Glob(); //! Find all files that match the pattern. - bool FindFiles(const kwsys_stl::string& inexpr); + bool FindFiles(const kwsys_stl::string& inexpr, + GlobMessages* messages = 0); //! Return the list of files that matched. kwsys_stl::vector& GetFiles(); @@ -80,15 +105,26 @@ public: bool require_whole_string = true, bool preserve_case = false); + /** Getters and setters for enabling and disabling directory + listing in recursive and non recursive globbing mode. + If listing is enabled in recursive mode it also lists + directory symbolic links even if follow symlinks is enabled. */ + void SetListDirs(bool list) { this->ListDirs=list; } + bool GetListDirs() const { return this->ListDirs; } + void SetRecurseListDirs(bool list) { this->RecurseListDirs=list; } + bool GetRecurseListDirs() const { return this->RecurseListDirs; } + protected: //! Process directory void ProcessDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir); + const kwsys_stl::string& dir, + GlobMessages* messages); //! Process last directory, but only when recurse flags is on. That is // effectively like saying: /path/to/file/**/file - void RecurseDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir); + bool RecurseDirectory(kwsys_stl::string::size_type start, + const kwsys_stl::string& dir, + GlobMessages* messages); //! Add regular expression void AddExpression(const kwsys_stl::string& expr); @@ -101,6 +137,9 @@ protected: kwsys_stl::string Relative; bool RecurseThroughSymlinks; unsigned int FollowedSymlinkCount; + kwsys_stl::vector VisitedSymlinks; + bool ListDirs; + bool RecurseListDirs; private: Glob(const Glob&); // Not implemented. ----------------------------------------------------------------------- Summary of changes: Source/kwsys/Glob.cxx | 93 ++++++++++++++++++++++++++++++++++++++++------ Source/kwsys/Glob.hxx.in | 47 +++++++++++++++++++++-- 2 files changed, 124 insertions(+), 16 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Wed Mar 4 17:24:00 2015 From: steveire at gmail.com (Stephen Kelly) Date: Wed, 4 Mar 2015 17:24:00 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-838-g6f6181e Message-ID: <20150304222400.D1A7EAAEAC@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6f6181e6fabf21ef75054f18c888bc9f7ab4b337 (commit) via 807f894540524fa0a8be4e5e8d6825854e137d41 (commit) via 3200e8d1dc2e0e16afbc7d362bd1a8c86fcbca87 (commit) via 220c36067e8949914b6fd882c1043bdef43aa14f (commit) via d2487b06ce93634c81b9d5c5240af7a4fb14f91c (commit) via f32438efbf1c303e080b7b1f3e86ffbc7fc2bf3e (commit) from 2b10088142730c946c2ec4d85ba59fa65921bff6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f6181e6fabf21ef75054f18c888bc9f7ab4b337 commit 6f6181e6fabf21ef75054f18c888bc9f7ab4b337 Merge: 2b10088 807f894 Author: Stephen Kelly AuthorDate: Wed Mar 4 17:23:58 2015 -0500 Commit: CMake Topic Stage CommitDate: Wed Mar 4 17:23:58 2015 -0500 Merge topic 'target-language-genex' into next 807f8945 File(GENERATE): Process genex evaluation files for each language. 3200e8d1 Genex: Allow COMPILE_LANGUAGE when processing include directories. 220c3606 Genex: Allow COMPILE_LANGUAGE when processing compile definitions. d2487b06 Genex: Enable use of COMPILE_LANGUAGE for compile options. f32438ef Genex: Add a COMPILE_LANGUAGE generator expression. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=807f894540524fa0a8be4e5e8d6825854e137d41 commit 807f894540524fa0a8be4e5e8d6825854e137d41 Author: Stephen Kelly AuthorDate: Sun Feb 22 17:44:59 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 4 23:16:11 2015 +0100 File(GENERATE): Process genex evaluation files for each language. diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 4e2a868..fa00283 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -38,13 +38,15 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( //---------------------------------------------------------------------------- void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, + const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm) { std::string rawCondition = this->Condition->GetInput(); if (!rawCondition.empty()) { - std::string condResult = this->Condition->Evaluate(this->Makefile, config); + std::string condResult = this->Condition->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); if (condResult == "0") { return; @@ -60,9 +62,11 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } const std::string outputFileName - = this->OutputFileExpr->Evaluate(this->Makefile, config); + = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); const std::string outputContent - = inputExpression->Evaluate(this->Makefile, config); + = inputExpression->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); std::map::iterator it = outputFiles.find(outputFileName); @@ -75,7 +79,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } std::ostringstream e; e << "Evaluation file to be written multiple times for different " - "configurations with different content:\n " << outputFileName; + "configurations or languages with different content:\n " + << outputFileName; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -97,14 +102,22 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, void cmGeneratorExpressionEvaluationFile::CreateOutputFile( std::string const& config) { - std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config); - cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); - sf->SetProperty("GENERATED", "1"); - + std::vector enabledLanguages; cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->SetFilenameTargetDepends(sf, + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) + { + std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, *le); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); + sf->SetProperty("GENERATED", "1"); + + gg->SetFilenameTargetDepends(sf, this->OutputFileExpr->GetSourceSensitiveTargets()); + } } //---------------------------------------------------------------------------- @@ -153,13 +166,23 @@ void cmGeneratorExpressionEvaluationFile::Generate() { allConfigs.push_back(""); } - for(std::vector::const_iterator li = allConfigs.begin(); - li != allConfigs.end(); ++li) + + std::vector enabledLanguages; + cmGlobalGenerator *gg + = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) { - this->Generate(*li, inputExpression.get(), outputFiles, perm); - if(cmSystemTools::GetFatalErrorOccured()) + for(std::vector::const_iterator li = allConfigs.begin(); + li != allConfigs.end(); ++li) { - return; + this->Generate(*li, *le, inputExpression.get(), outputFiles, perm); + if(cmSystemTools::GetFatalErrorOccured()) + { + return; + } } } } diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 3394ade..4424bec 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -34,7 +34,7 @@ public: void CreateOutputFile(std::string const& config); private: - void Generate(const std::string& config, + void Generate(const std::string& config, const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm); diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake new file mode 100644 index 0000000..e2b081d --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -0,0 +1,12 @@ + +enable_language(CXX C) + +add_library(empty empty.cpp empty.c) +target_compile_options(empty + PRIVATE LANG_IS_$ +) + +file(GENERATE + OUTPUT opts-$.txt + CONTENT "$\n" +) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 97f93d5..db344ef 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -17,6 +17,16 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() +if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") + run_cmake(COMPILE_LANGUAGE-genex) + foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() + endforeach() +endif() + set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") diff --git a/Tests/RunCMake/File_Generate/empty.c b/Tests/RunCMake/File_Generate/empty.c new file mode 100644 index 0000000..563eef0 --- /dev/null +++ b/Tests/RunCMake/File_Generate/empty.c @@ -0,0 +1,8 @@ + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty_c() +{ + return 0; +} http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3200e8d1dc2e0e16afbc7d362bd1a8c86fcbca87 commit 3200e8d1dc2e0e16afbc7d362bd1a8c86fcbca87 Author: Stephen Kelly AuthorDate: Wed Mar 4 21:53:15 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 4 23:14:10 2015 +0100 Genex: Allow COMPILE_LANGUAGE when processing include directories. Issue an error if this is encountered by an IDE generator. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b6d97d1..d38cf7e 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -121,7 +121,8 @@ Available logical expressions are: target_link_libraries(myapp myapp_c myapp_cxx) The ``Makefile`` and ``Ninja`` based generators can also use this - expression to specify compile-language specific compile definitions: + expression to specify compile-language specific compile definitions + and include directories: .. code-block:: cmake @@ -129,6 +130,9 @@ Available logical expressions are: target_compile_definitions(myapp PRIVATE $<$:COMPILING_CXX> ) + target_include_directories(myapp + PRIVATE $<$:/opt/foo/cxx_headers> + ) Informational Expressions ========================= diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 26ee7af..f289ead 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -850,7 +850,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } else if (gg->GetName().find("Xcode") != std::string::npos) { - if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() + || dagChecker->EvaluatingIncludeDirectories())) { reportError(context, content->GetOriginalExpression(), "$ may only be used with COMPILE_OPTIONS " diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 44c9e9a..b7b2eff 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -960,9 +960,10 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang, //---------------------------------------------------------------------------- std::vector -cmGeneratorTarget::GetIncludeDirectories(const std::string& config) const +cmGeneratorTarget::GetIncludeDirectories(const std::string& config, + const std::string& lang) const { - return this->Target->GetIncludeDirectories(config); + return this->Target->GetIncludeDirectories(config, lang); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2083b88..c329cf5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -85,7 +85,7 @@ public: /** Get the include directories for this target. */ std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, const std::string& lang) const; bool IsSystemIncludeDirectory(const std::string& dir, const std::string& config) const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 735dfa9..37cc2c6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1600,7 +1600,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // Get the target-specific include directories. std::vector includes; - includes = target->GetIncludeDirectories(config); + includes = target->GetIncludeDirectories(config, lang); // Support putting all the in-project include directories first if // it is requested by the project. diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9ecb029..50491af 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2114,6 +2114,32 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << " )\n"; } + + // Target-specific include directories: + cmakefileStream + << "\n" + << "# The include file search paths:\n"; + cmakefileStream + << "set(CMAKE_" << l->first << "_TARGET_INCLUDE_PATH\n"; + std::vector includes; + + cmGeneratorTarget* gt = this->GetGlobalGenerator() + ->GetGeneratorTarget(&target); + + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->GetIncludeDirectories(includes, gt, + l->first, config); + for(std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) + { + cmakefileStream + << " \"" + << this->Convert(*i, cmLocalGenerator::HOME_OUTPUT) + << "\"\n"; + } + cmakefileStream + << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 57c49f1..c7a7110 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1056,40 +1056,6 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; } - // Target-specific include directories: - *this->InfoFileStream - << "\n" - << "# The include file search paths:\n"; - *this->InfoFileStream - << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; - std::vector includes; - - const std::string& config = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->LocalGenerator->GetIncludeDirectories(includes, - this->GeneratorTarget, - "C", config); - for(std::vector::iterator i = includes.begin(); - i != includes.end(); ++i) - { - *this->InfoFileStream - << " \"" - << this->LocalGenerator->Convert(*i, - cmLocalGenerator::HOME_OUTPUT) - << "\"\n"; - } - *this->InfoFileStream - << " )\n"; - *this->InfoFileStream - << "set(CMAKE_CXX_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_ASM_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - // and now write the rule to use it std::vector depends; std::vector commands; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 87dcc99..7a6ad8b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1979,7 +1979,8 @@ static void processIncludeDirectories(cmTarget const* tgt, std::vector &includes, UNORDERED_SET &uniqueIncludes, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugIncludes) + const std::string& config, bool debugIncludes, + const std::string& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -1995,7 +1996,7 @@ static void processIncludeDirectories(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, language), entryIncludes); std::string usedIncludes; @@ -2106,7 +2107,8 @@ static void processIncludeDirectories(cmTarget const* tgt, //---------------------------------------------------------------------------- std::vector -cmTarget::GetIncludeDirectories(const std::string& config) const +cmTarget::GetIncludeDirectories(const std::string& config, + const std::string& language) const { std::vector includes; UNORDERED_SET uniqueIncludes; @@ -2139,7 +2141,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); std::vector linkInterfaceIncludeDirectoriesEntries; @@ -2179,7 +2182,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); deleteAndClear(linkInterfaceIncludeDirectoriesEntries); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0356c1e..5170b31 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -568,7 +568,8 @@ public: bool contentOnly) const; std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, + const std::string& language) const; void InsertInclude(const cmValueWithOrigin &entry, bool before = false); void InsertCompileOption(const cmValueWithOrigin &entry, diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 661bbaa..cfc74fb 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -42,6 +42,17 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_include_directories(consumer + PRIVATE + $<$:${CMAKE_CURRENT_SOURCE_DIR}/cxx_only> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/c_only> + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_include_directories(consumer PRIVATE $ diff --git a/Tests/CMakeCommands/target_include_directories/c_only/c_only.h b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h new file mode 100644 index 0000000..29f68ee --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h @@ -0,0 +1,2 @@ + +#define C_ONLY_DEFINE diff --git a/Tests/CMakeCommands/target_include_directories/consumer.c b/Tests/CMakeCommands/target_include_directories/consumer.c new file mode 100644 index 0000000..8821f5b --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/consumer.c @@ -0,0 +1,10 @@ + +#ifdef TEST_LANG_DEFINES + #include "c_only.h" + + #ifndef C_ONLY_DEFINE + #error Expected C_ONLY_DEFINE + #endif +#endif + +int consumer_c() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp index 7e3443e..649510c 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.cpp +++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp @@ -4,6 +4,9 @@ #include "interfaceinclude.h" #include "relative_dir.h" #include "consumer.h" +#ifdef TEST_LANG_DEFINES + #include "cxx_only.h" +#endif #ifdef PRIVATEINCLUDE_DEFINE #error Unexpected PRIVATEINCLUDE_DEFINE @@ -29,4 +32,10 @@ #error Expected CONSUMER_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CXX_ONLY_DEFINE + #error Expected CXX_ONLY_DEFINE + #endif +#endif + int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h new file mode 100644 index 0000000..67289a4 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h @@ -0,0 +1,2 @@ + +#define CXX_ONLY_DEFINE diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt new file mode 100644 index 0000000..ec15068 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt new file mode 100644 index 0000000..fdf92b2 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake new file mode 100644 index 0000000..31771f6 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_include_directories(main PRIVATE $<$:anydir>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 8a32aef..5e0a5f5 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -11,3 +11,10 @@ elseif (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) run_cmake(CompileDefinitions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file IncludeDirectories-stderr-Xcode.txt) + run_cmake(IncludeDirectories) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file IncludeDirectories-stderr-VS.txt) + run_cmake(IncludeDirectories) +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=220c36067e8949914b6fd882c1043bdef43aa14f commit 220c36067e8949914b6fd882c1043bdef43aa14f Author: Stephen Kelly AuthorDate: Wed Mar 4 21:46:42 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 4 23:12:33 2015 +0100 Genex: Allow COMPILE_LANGUAGE when processing compile definitions. Issue an error if this is encountered by an IDE generator. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b1b1102..b6d97d1 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -120,6 +120,16 @@ Available logical expressions are: add_executable(myapp main.cpp) target_link_libraries(myapp myapp_c myapp_cxx) + The ``Makefile`` and ``Ninja`` based generators can also use this + expression to specify compile-language specific compile definitions: + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_definitions(myapp + PRIVATE $<$:COMPILING_CXX> + ) + Informational Expressions ========================= diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 69857ef..614e7d9 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -599,7 +599,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, // the compilerdefines for this target std::vector cdefs; - target->GetCompileDefinitions(cdefs, buildType); + target->GetCompileDefinitions(cdefs, buildType, "C"); // Expand the list. for(std::vector::const_iterator di = cdefs.begin(); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 5fff0fb..25f9005 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -436,7 +436,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, } // Add preprocessor definitions for this target and configuration. - lg->AddCompileDefinitions(defines, target, config); + lg->AddCompileDefinitions(defines, target, config, language); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); { std::string defPropName = "COMPILE_DEFINITIONS_"; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 89bdb5b..26ee7af 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -817,7 +817,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector ¶meters, cmGeneratorExpressionContext *context, const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const + cmGeneratorExpressionDAGChecker *dagChecker) const { if(context->Language.empty()) { @@ -848,11 +848,20 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "generators."); return std::string(); } + else if (gg->GetName().find("Xcode") != std::string::npos) + { + if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with COMPILE_OPTIONS " + "with the Xcode generator."); + return std::string(); + } + } else { if(gg->GetName().find("Makefiles") == std::string::npos && - gg->GetName().find("Ninja") == std::string::npos && - gg->GetName().find("Xcode") == std::string::npos) + gg->GetName().find("Ninja") == std::string::npos) { reportError(context, content->GetOriginalExpression(), "$ not supported for this generator."); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e89161d..bd8a1f5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1803,7 +1803,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "C"); this->AppendDefines(ppDefs, targetDefines); buildSettings->AddAttribute ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index be82085..735dfa9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1428,11 +1428,11 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config) + const std::string& config, + const std::string& lang) { std::vector targetDefines; - target->GetCompileDefinitions(targetDefines, - config); + target->GetCompileDefinitions(targetDefines, config, lang); this->AppendDefines(defines, targetDefines); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3a9d5be..f1f0da1 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -239,7 +239,8 @@ public: const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config); + const std::string& config, + const std::string& lang); /** Compute the language used to compile the given source file. */ std::string GetSourceFileLanguage(const cmSourceFile& source); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 432cb3a..9ecb029 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2094,26 +2094,26 @@ void cmLocalUnixMakefileGenerator3 << "set(CMAKE_" << l->first << "_COMPILER_ID \"" << cid << "\")\n"; } - } - // Build a list of preprocessor definitions for the target. - std::set defines; - this->AddCompileDefinitions(defines, &target, - this->ConfigurationName); - if(!defines.empty()) - { - cmakefileStream - << "\n" - << "# Preprocessor definitions for this target.\n" - << "set(CMAKE_TARGET_DEFINITIONS\n"; - for(std::set::const_iterator di = defines.begin(); - di != defines.end(); ++di) + // Build a list of preprocessor definitions for the target. + std::set defines; + this->AddCompileDefinitions(defines, &target, + this->ConfigurationName, l->first); + if(!defines.empty()) { cmakefileStream - << " " << this->EscapeForCMake(*di) << "\n"; + << "\n" + << "# Preprocessor definitions for this target.\n" + << "set(CMAKE_TARGET_DEFINITIONS_" << l->first << "\n"; + for(std::set::const_iterator di = defines.begin(); + di != defines.end(); ++di) + { + cmakefileStream + << " " << this->EscapeForCMake(*di) << "\n"; + } + cmakefileStream + << " )\n"; } - cmakefileStream - << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1d62093..1a08dc3 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1779,11 +1779,12 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, ""); - this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG"); - this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE"); - this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL"); - this->AddCompileDefinitions(debugrelDefinesSet, &target, "RELWITHDEBINFO"); + this->AddCompileDefinitions(definesSet, &target, "", ""); + this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG", ""); + this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE", ""); + this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL", ""); + this->AddCompileDefinitions(debugrelDefinesSet, &target, + "RELWITHDEBINFO", ""); std::string defines = " "; std::string debugDefines = " "; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ed560aa..f53f825 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -775,7 +775,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "CXX"); targetOptions.AddDefines(targetDefines); targetOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 20207f5..57c49f1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -329,7 +329,7 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->ConfigurationName); + this->LocalGenerator->ConfigurationName, l); std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, lang); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index cfd8937..92fccd3 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -231,7 +231,7 @@ ComputeDefines(cmSourceFile const* source, const std::string& language) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->GetConfigName()); + this->GetConfigName(), language); this->LocalGenerator->AppendDefines (defines, source->GetProperty("COMPILE_DEFINITIONS")); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e18e757..844d708 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -507,7 +507,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, incs = cmJoin(includeDirs, ";"); std::set defines; - localGen->AddCompileDefinitions(defines, target, config); + localGen->AddCompileDefinitions(defines, target, config, "CXX"); defs += cmJoin(defines, ";"); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c54d694..87dcc99 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2336,16 +2336,18 @@ static void processCompileDefinitions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions", std::string()); + "definitions", language); } //---------------------------------------------------------------------------- void cmTarget::GetCompileDefinitions(std::vector &list, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2377,7 +2379,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); std::vector linkInterfaceCompileDefinitionsEntries; @@ -2424,7 +2427,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); deleteAndClear(linkInterfaceCompileDefinitionsEntries); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 56db22e..0356c1e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -496,7 +496,8 @@ public: const char* GetExportMacro() const; void GetCompileDefinitions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; // Compute the set of languages compiled by the target. This is // computed every time it is called because the languages can change diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 04d1487..19444ed 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1876,7 +1876,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); std::vector targetDefines; - this->Target->GetCompileDefinitions(targetDefines, configName.c_str()); + this->Target->GetCompileDefinitions(targetDefines, + configName.c_str(), "CXX"); clOptions.AddDefines(targetDefines); if(this->MSTools) { diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 14d40aa..8c4fed2 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -14,6 +14,7 @@ target_compile_definitions(target_compile_definitions add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" ) target_compile_definitions(consumer @@ -26,6 +27,18 @@ target_compile_definitions(consumer PRIVATE ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_compile_definitions(consumer + PRIVATE + CONSUMER_LANG_$ + LANG_IS_CXX=$ + LANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + add_definitions(-DSOME_DEF) add_library(imp UNKNOWN IMPORTED) get_target_property(_res imp COMPILE_DEFINITIONS) diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c new file mode 100644 index 0000000..5796d96 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp index a391114..778f57e 100644 --- a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp @@ -15,4 +15,22 @@ #error Expected DASH_D_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt new file mode 100644 index 0000000..73b66ac --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt new file mode 100644 index 0000000..a1ed633 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake new file mode 100644 index 0000000..7935d88 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_definitions(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 2c5d9ae..8a32aef 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -4,3 +4,10 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) run_cmake(CompileOptions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt) + run_cmake(CompileDefinitions) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) + run_cmake(CompileDefinitions) +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d2487b06ce93634c81b9d5c5240af7a4fb14f91c commit d2487b06ce93634c81b9d5c5240af7a4fb14f91c Author: Stephen Kelly AuthorDate: Tue Nov 25 22:47:44 2014 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 4 23:11:10 2015 +0100 Genex: Enable use of COMPILE_LANGUAGE for compile options. Follow-ups will allow the use of the generator expression for compile definitions and include directories for non-IDE generators. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index c47a7c4..b1b1102 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -93,6 +93,32 @@ Available logical expressions are: for the 'head' target, an error is reported. See the :manual:`cmake-compile-features(7)` manual for information on compile features. +``$`` + ``1`` when the language used for compilation unit matches ``lang``, + otherwise ``0``. This expression used to specify compile options for + source files of a particular language in a target. For example, to specify + the use of the ``-fno-exceptions`` compile option (compiler id checks + elided): + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_options(myapp + PRIVATE $<$:-fno-exceptions> + ) + + This generator expression has limited use because it is not possible to + use it with the Visual Studio generators. Portable buildsystems would + not use this expression, and would create separate libraries for each + source file language instead: + + .. code-block:: cmake + + add_library(myapp_c foo.c) + add_library(myapp_cxx foo.c) + target_compile_options(myapp_cxx PUBLIC -fno-exceptions) + add_executable(myapp main.cpp) + target_link_libraries(myapp myapp_c myapp_cxx) Informational Expressions ========================= @@ -174,6 +200,10 @@ Available informational expressions are: ``$`` Content of the install prefix when the target is exported via :command:`install(EXPORT)` and empty otherwise. +``$`` + The compile language of source files when evaluating compile options. See + the unary version for notes about portability of this generator + expression. Output Expressions ================== diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 63a46f2..89bdb5b 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -827,6 +827,38 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "components of the file(GENERATE) command."); return std::string(); } + + std::vector enabledLanguages; + cmGlobalGenerator* gg + = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + if (!parameters.empty() && + std::find(enabledLanguages.begin(), enabledLanguages.end(), + parameters.front()) == enabledLanguages.end()) + { + reportError(context, content->GetOriginalExpression(), + "$ Unknown language."); + return std::string(); + } + + if (gg->GetName().find("Visual Studio") != std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ may not be used with Visual Studio " + "generators."); + return std::string(); + } + else + { + if(gg->GetName().find("Makefiles") == std::string::npos && + gg->GetName().find("Ninja") == std::string::npos && + gg->GetName().find("Xcode") == std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ not supported for this generator."); + return std::string(); + } + } if (parameters.empty()) { return context->Language; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7c83f27..be82085 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1453,7 +1453,7 @@ void cmLocalGenerator::AddCompileOptions( { cmSystemTools::ParseWindowsCommandLine(targetFlags, opts); } - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { @@ -1474,7 +1474,7 @@ void cmLocalGenerator::AddCompileOptions( this->AppendFlags(flags, targetFlags); } std::vector opts; - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e046bef..c54d694 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2192,7 +2192,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions, const char *logName) + const std::string& config, bool debugOptions, const char *logName, + std::string const& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -2204,7 +2205,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, + language), entryOptions); std::string usedOptions; for(std::vector::iterator @@ -2238,10 +2240,12 @@ static void processCompileOptions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "options"); + dagChecker, config, debugOptions, "options", + language); } //---------------------------------------------------------------------------- @@ -2271,7 +2275,8 @@ void cmTarget::GetAutoUicOptions(std::vector &result, //---------------------------------------------------------------------------- void cmTarget::GetCompileOptions(std::vector &result, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2303,7 +2308,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); std::vector linkInterfaceCompileOptionsEntries; @@ -2318,7 +2324,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); deleteAndClear(linkInterfaceCompileOptionsEntries); } @@ -2333,7 +2340,7 @@ static void processCompileDefinitions(cmTarget const* tgt, { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions"); + "definitions", std::string()); } //---------------------------------------------------------------------------- @@ -2431,7 +2438,8 @@ static void processCompileFeatures(cmTarget const* tgt, const std::string& config, bool debugOptions) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "features"); + dagChecker, config, debugOptions, "features", + std::string()); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ddd9859..56db22e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -577,7 +577,8 @@ public: void AppendBuildInterfaceIncludes(); void GetCompileOptions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; void GetAutoUicOptions(std::vector &result, const std::string& config) const; void GetCompileFeatures(std::vector &features, diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 1d04639..6ac3ea0 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -21,8 +21,21 @@ endif() add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" ) +if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") + target_compile_options(consumer + PRIVATE + -DCONSUMER_LANG_$ + -DLANG_IS_CXX=$ + -DLANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_compile_options(consumer PRIVATE $<$:$> ) diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c new file mode 100644 index 0000000..5796d96 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 1299606..c5882a5 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -15,4 +15,22 @@ #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057..9f1256e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -208,3 +208,5 @@ add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) if(RPMBUILD_EXECUTABLE) add_RunCMake_test(CPackRPM) endif() + +add_RunCMake_test(COMPILE_LANGUAGE-genex) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt new file mode 100644 index 0000000..e9e8e9f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileOptions.cmake:5 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake new file mode 100644 index 0000000..6c92abc --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_options(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake new file mode 100644 index 0000000..2c5d9ae --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +if (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) + run_cmake(CompileOptions) +endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp new file mode 100644 index 0000000..31a1337 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt new file mode 100644 index 0000000..444da45 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at COMPILE_LANGUAGE-unknown-lang.cmake:4 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ Unknown language. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake new file mode 100644 index 0000000..cec12a3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<$:-Wall>) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index f591c3d..542b7fc 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -23,6 +23,7 @@ run_cmake(COMPILE_LANGUAGE-target_sources) run_cmake(COMPILE_LANGUAGE-add_executable) run_cmake(COMPILE_LANGUAGE-add_library) run_cmake(COMPILE_LANGUAGE-add_test) +run_cmake(COMPILE_LANGUAGE-unknown-lang) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f32438efbf1c303e080b7b1f3e86ffbc7fc2bf3e commit f32438efbf1c303e080b7b1f3e86ffbc7fc2bf3e Author: Stephen Kelly AuthorDate: Sun Feb 22 17:43:13 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 4 21:44:41 2015 +0100 Genex: Add a COMPILE_LANGUAGE generator expression. diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index bf96951..0a27016 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -52,14 +52,16 @@ cmGeneratorExpression::~cmGeneratorExpression() const char *cmCompiledGeneratorExpression::Evaluate( cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, - cmGeneratorExpressionDAGChecker *dagChecker) const + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& language) const { return this->Evaluate(mf, config, quiet, headTarget, headTarget, - dagChecker); + dagChecker, + language); } //---------------------------------------------------------------------------- @@ -67,7 +69,8 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker) const + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& language) const { if (!this->NeedsEvaluation) { @@ -93,6 +96,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; context.CurrentTarget = currentTarget ? currentTarget : headTarget; context.Backtrace = this->Backtrace; + context.Language = language; for ( ; it != end; ++it) { diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 57f78c5..55d9691 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -80,11 +80,13 @@ public: bool quiet = false, cmTarget const* headTarget = 0, cmTarget const* currentTarget = 0, - cmGeneratorExpressionDAGChecker *dagChecker = 0) const; + cmGeneratorExpressionDAGChecker *dagChecker = 0, + std::string const& language = std::string()) const; const char* Evaluate(cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, - cmGeneratorExpressionDAGChecker *dagChecker) const; + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& language = std::string()) const; /** Get set of targets found during evaluations. */ std::set const& GetTargets() const diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index ba18faa..63a46f2 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -16,6 +16,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpression.h" #include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" #include "cmSourceFile.h" #include @@ -89,7 +90,8 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( context->Quiet, headTarget, currentTarget, - dagChecker); + dagChecker, + context->Language); if (cge->GetHadContextSensitiveCondition()) { context->HadContextSensitiveCondition = true; @@ -806,6 +808,33 @@ static const struct JoinNode : public cmGeneratorExpressionNode } } joinNode; +static const struct CompileLanguageNode : public cmGeneratorExpressionNode +{ + CompileLanguageNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if(context->Language.empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used to specify include " + "directories compile definitions, compile options and to evaluate " + "components of the file(GENERATE) command."); + return std::string(); + } + if (parameters.empty()) + { + return context->Language; + } + return context->Language == parameters.front() ? "1" : "0"; + } +} languageNode; + #define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ , "INTERFACE_" #PROPERTY @@ -1829,6 +1858,7 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["INSTALL_PREFIX"] = &installPrefixNode; nodeMap["JOIN"] = &joinNode; nodeMap["LINK_ONLY"] = &linkOnlyNode; + nodeMap["COMPILE_LANGUAGE"] = &languageNode; } NodeMap::const_iterator i = nodeMap.find(identifier); if (i == nodeMap.end()) diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0bf1797..b1fec0b 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -36,6 +36,7 @@ struct cmGeneratorExpressionContext MaxLanguageStandard; cmMakefile *Makefile; std::string Config; + std::string Language; cmTarget const* HeadTarget; // The target whose property is being evaluated. cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears // directly or indirectly in the property. diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt new file mode 100644 index 0000000..789b4d0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_custom_command.cmake:6 \(add_custom_command\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake new file mode 100644 index 0000000..f4ba261 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake @@ -0,0 +1,8 @@ + +enable_language(C) + +add_library(empty empty.c) + +add_custom_command(TARGET empty PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $ +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt new file mode 100644 index 0000000..400fbc0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_custom_target.cmake:4 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake new file mode 100644 index 0000000..4102623 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake @@ -0,0 +1,6 @@ + +enable_language(C) + +add_custom_target(empty + COMMAND ${CMAKE_COMMAND} -E echo $ +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt new file mode 100644 index 0000000..e45bb02 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_executable.cmake:4 \(add_executable\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake new file mode 100644 index 0000000..5c2ff35 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake @@ -0,0 +1,4 @@ + +enable_language(C) + +add_executable(empty empty.$) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt new file mode 100644 index 0000000..c9ee6fe --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_library.cmake:4 \(add_library\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake new file mode 100644 index 0000000..dd9f824 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake @@ -0,0 +1,4 @@ + +enable_language(C) + +add_library(empty empty.$) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt new file mode 100644 index 0000000..9955f5d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_test.cmake:5 \(add_test\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake new file mode 100644 index 0000000..deedf65 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt new file mode 100644 index 0000000..eca700f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake new file mode 100644 index 0000000..92c20e3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + empty.$ + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt new file mode 100644 index 0000000..2d324e2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-target_sources.cmake:5 \(target_sources\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake new file mode 100644 index 0000000..0c78acd --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake @@ -0,0 +1,5 @@ + +enable_language(C) + +add_library(empty empty.c) +target_sources(empty PRIVATE empty.$) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 6c32393..f591c3d 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -16,6 +16,13 @@ run_cmake(NonValidTarget-C_COMPILER_VERSION) run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) +run_cmake(COMPILE_LANGUAGE-add_custom_target) +run_cmake(COMPILE_LANGUAGE-add_custom_command) +run_cmake(COMPILE_LANGUAGE-install) +run_cmake(COMPILE_LANGUAGE-target_sources) +run_cmake(COMPILE_LANGUAGE-add_executable) +run_cmake(COMPILE_LANGUAGE-add_library) +run_cmake(COMPILE_LANGUAGE-add_test) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 44 ++++++++++++ Source/cmExtraCodeBlocksGenerator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 2 +- Source/cmGeneratorExpression.cxx | 10 ++- Source/cmGeneratorExpression.h | 6 +- Source/cmGeneratorExpressionEvaluationFile.cxx | 51 ++++++++++---- Source/cmGeneratorExpressionEvaluationFile.h | 2 +- Source/cmGeneratorExpressionEvaluator.cxx | 74 +++++++++++++++++++- Source/cmGeneratorExpressionEvaluator.h | 1 + Source/cmGeneratorTarget.cxx | 5 +- Source/cmGeneratorTarget.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 12 ++-- Source/cmLocalGenerator.h | 3 +- Source/cmLocalUnixMakefileGenerator3.cxx | 50 +++++++++---- Source/cmLocalVisualStudio6Generator.cxx | 11 +-- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 36 +--------- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmTarget.cxx | 52 +++++++++----- Source/cmTarget.h | 9 ++- Source/cmVisualStudio10TargetGenerator.cxx | 3 +- .../target_compile_definitions/CMakeLists.txt | 13 ++++ .../target_compile_definitions/consumer.c | 23 ++++++ .../target_compile_definitions/consumer.cpp | 18 +++++ .../target_compile_options/CMakeLists.txt | 13 ++++ .../target_compile_options/consumer.c | 23 ++++++ .../target_compile_options/consumer.cpp | 18 +++++ .../target_include_directories/CMakeLists.txt | 11 +++ .../target_include_directories/c_only/c_only.h | 2 + .../target_include_directories/consumer.c | 10 +++ .../target_include_directories/consumer.cpp | 9 +++ .../target_include_directories/cxx_only/cxx_only.h | 2 + Tests/RunCMake/CMakeLists.txt | 2 + .../CMakeLists.txt | 0 .../CompileDefinitions-result.txt} | 0 .../CompileDefinitions-stderr-VS.txt | 8 +++ .../CompileDefinitions-stderr-Xcode.txt | 9 +++ .../CompileDefinitions.cmake | 5 ++ .../CompileOptions-result.txt} | 0 .../CompileOptions-stderr-VS.txt | 8 +++ .../COMPILE_LANGUAGE-genex/CompileOptions.cmake | 5 ++ .../IncludeDirectories-result.txt} | 0 .../IncludeDirectories-stderr-VS.txt | 8 +++ .../IncludeDirectories-stderr-Xcode.txt | 9 +++ .../IncludeDirectories.cmake | 5 ++ .../COMPILE_LANGUAGE-genex/RunCMakeTest.cmake | 20 ++++++ Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp | 5 ++ .../COMPILE_LANGUAGE-genex-result.txt} | 0 .../File_Generate/COMPILE_LANGUAGE-genex.cmake | 12 ++++ Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 10 +++ Tests/RunCMake/File_Generate/empty.c | 8 +++ ...COMPILE_LANGUAGE-add_custom_command-result.txt} | 0 .../COMPILE_LANGUAGE-add_custom_command-stderr.txt | 10 +++ .../COMPILE_LANGUAGE-add_custom_command.cmake | 8 +++ .../COMPILE_LANGUAGE-add_custom_target-result.txt} | 0 .../COMPILE_LANGUAGE-add_custom_target-stderr.txt | 10 +++ .../COMPILE_LANGUAGE-add_custom_target.cmake | 6 ++ .../COMPILE_LANGUAGE-add_executable-result.txt} | 0 .../COMPILE_LANGUAGE-add_executable-stderr.txt | 10 +++ .../COMPILE_LANGUAGE-add_executable.cmake | 4 ++ .../COMPILE_LANGUAGE-add_library-result.txt} | 0 .../COMPILE_LANGUAGE-add_library-stderr.txt | 10 +++ .../COMPILE_LANGUAGE-add_library.cmake | 4 ++ .../COMPILE_LANGUAGE-add_test-result.txt} | 0 .../COMPILE_LANGUAGE-add_test-stderr.txt | 10 +++ .../COMPILE_LANGUAGE-add_test.cmake | 5 ++ .../COMPILE_LANGUAGE-install-result.txt} | 0 .../COMPILE_LANGUAGE-install-stderr.txt | 8 +++ .../COMPILE_LANGUAGE-install.cmake | 5 ++ .../COMPILE_LANGUAGE-target_sources-result.txt} | 0 .../COMPILE_LANGUAGE-target_sources-stderr.txt | 10 +++ .../COMPILE_LANGUAGE-target_sources.cmake | 5 ++ .../COMPILE_LANGUAGE-unknown-lang-result.txt} | 0 .../COMPILE_LANGUAGE-unknown-lang-stderr.txt | 8 +++ .../COMPILE_LANGUAGE-unknown-lang.cmake | 4 ++ .../GeneratorExpression/RunCMakeTest.cmake | 8 +++ 78 files changed, 653 insertions(+), 111 deletions(-) create mode 100644 Tests/CMakeCommands/target_compile_definitions/consumer.c create mode 100644 Tests/CMakeCommands/target_compile_options/consumer.c create mode 100644 Tests/CMakeCommands/target_include_directories/c_only/c_only.h create mode 100644 Tests/CMakeCommands/target_include_directories/consumer.c create mode 100644 Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h copy Tests/RunCMake/{CMP0055 => COMPILE_LANGUAGE-genex}/CMakeLists.txt (100%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt} (100%) create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => COMPILE_LANGUAGE-genex/CompileOptions-result.txt} (100%) create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt} (100%) create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => File_Generate/COMPILE_LANGUAGE-genex-result.txt} (100%) create mode 100644 Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake create mode 100644 Tests/RunCMake/File_Generate/empty.c copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-install-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake hooks/post-receive -- CMake From steveire at gmail.com Wed Mar 4 18:13:28 2015 From: steveire at gmail.com (Stephen Kelly) Date: Wed, 4 Mar 2015 18:13:28 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-840-g38305a8 Message-ID: <20150304231328.4DEEBA8075@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 38305a812e6d79ce60b67130f9b6f5c37e32b39a (commit) via fd2875d12dbc891b0d6faa6c84e813f12bcd9c2f (commit) from 6f6181e6fabf21ef75054f18c888bc9f7ab4b337 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=38305a812e6d79ce60b67130f9b6f5c37e32b39a commit 38305a812e6d79ce60b67130f9b6f5c37e32b39a Merge: 6f6181e fd2875d Author: Stephen Kelly AuthorDate: Wed Mar 4 18:13:27 2015 -0500 Commit: CMake Topic Stage CommitDate: Wed Mar 4 18:13:27 2015 -0500 Merge topic 'target-language-genex' into next fd2875d1 Fix test expections. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd2875d12dbc891b0d6faa6c84e813f12bcd9c2f commit fd2875d12dbc891b0d6faa6c84e813f12bcd9c2f Author: Stephen Kelly AuthorDate: Thu Mar 5 00:12:41 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 00:12:41 2015 +0100 Fix test expections. diff --git a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt index dbd39de..0abb7df 100644 --- a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt +++ b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt @@ -1,5 +1,5 @@ CMake Error in CMakeLists.txt: Evaluation file to be written multiple times for different configurations - with different content: + or languages with different content: .*output.txt ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/File_Generate/OutputConflict-stderr.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 5 00:01:11 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 5 Mar 2015 00:01:11 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-365-g67a74c4 Message-ID: <20150305050111.D59E1AB1B8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 67a74c44541ed42b6898e98c87f4a9f625f9a458 (commit) from df5def5334249eb01195c1f24f3e728519dc742c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67a74c44541ed42b6898e98c87f4a9f625f9a458 commit 67a74c44541ed42b6898e98c87f4a9f625f9a458 Author: Kitware Robot AuthorDate: Thu Mar 5 00:01:09 2015 -0500 Commit: Kitware Robot CommitDate: Thu Mar 5 00:01:09 2015 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1dc8712..1660cd8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150304) +set(CMake_VERSION_PATCH 20150305) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Thu Mar 5 02:56:40 2015 From: steveire at gmail.com (Stephen Kelly) Date: Thu, 5 Mar 2015 02:56:40 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-842-g7c6a5fe Message-ID: <20150305075640.1F120AB039@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 7c6a5fe2a078438b5850a75a22549f280a16f3e0 (commit) via 3f1362b1303554c452f953e5fdae1bb44e55f3c2 (commit) from 38305a812e6d79ce60b67130f9b6f5c37e32b39a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7c6a5fe2a078438b5850a75a22549f280a16f3e0 commit 7c6a5fe2a078438b5850a75a22549f280a16f3e0 Merge: 38305a8 3f1362b Author: Stephen Kelly AuthorDate: Thu Mar 5 02:56:38 2015 -0500 Commit: CMake Topic Stage CommitDate: Thu Mar 5 02:56:38 2015 -0500 Merge topic 'target-language-genex' into next 3f1362b1 Fix VS6 tests. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f1362b1303554c452f953e5fdae1bb44e55f3c2 commit 3f1362b1303554c452f953e5fdae1bb44e55f3c2 Author: Stephen Kelly AuthorDate: Thu Mar 5 08:50:01 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 08:54:50 2015 +0100 Fix VS6 tests. diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1a08dc3..5c43f46 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1779,12 +1779,12 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, "", ""); - this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG", ""); - this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE", ""); - this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL", ""); + this->AddCompileDefinitions(definesSet, &target, "", "C"); + this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG", "C"); + this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE", "C"); + this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL", "C"); this->AddCompileDefinitions(debugrelDefinesSet, &target, - "RELWITHDEBINFO", ""); + "RELWITHDEBINFO", "C"); std::string defines = " "; std::string debugDefines = " "; diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 8c4fed2..f96283d 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -14,7 +14,6 @@ target_compile_definitions(target_compile_definitions add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" ) target_compile_definitions(consumer @@ -28,6 +27,9 @@ target_compile_definitions(consumer ) if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) target_compile_definitions(consumer PRIVATE CONSUMER_LANG_$ diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 6ac3ea0..35dd276 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -21,10 +21,12 @@ endif() add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" ) if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) target_compile_options(consumer PRIVATE -DCONSUMER_LANG_$ diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index cfc74fb..d57556a 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -43,6 +43,9 @@ add_executable(consumer ) if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) target_include_directories(consumer PRIVATE $<$:${CMAKE_CURRENT_SOURCE_DIR}/cxx_only> ----------------------------------------------------------------------- Summary of changes: Source/cmLocalVisualStudio6Generator.cxx | 10 +++++----- .../CMakeCommands/target_compile_definitions/CMakeLists.txt | 4 +++- Tests/CMakeCommands/target_compile_options/CMakeLists.txt | 4 +++- .../CMakeCommands/target_include_directories/CMakeLists.txt | 3 +++ 4 files changed, 14 insertions(+), 7 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 5 10:01:37 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 5 Mar 2015 10:01:37 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-844-g4f61b2a Message-ID: <20150305150137.A9733AB3D1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4f61b2ad49cc88e7a6a256cad88abba01f3b0b12 (commit) via 9921df6e84a0a634a45dd925a0a11a6ee182d1e2 (commit) from 7c6a5fe2a078438b5850a75a22549f280a16f3e0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4f61b2ad49cc88e7a6a256cad88abba01f3b0b12 commit 4f61b2ad49cc88e7a6a256cad88abba01f3b0b12 Merge: 7c6a5fe 9921df6 Author: Brad King AuthorDate: Thu Mar 5 10:01:36 2015 -0500 Commit: CMake Topic Stage CommitDate: Thu Mar 5 10:01:36 2015 -0500 Merge topic 'FPHSA-ExactCase-name' into next 9921df6e Revert "FPHSA: Always populate the ExactCase_FOUND variable (#15412)." http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9921df6e84a0a634a45dd925a0a11a6ee182d1e2 commit 9921df6e84a0a634a45dd925a0a11a6ee182d1e2 Author: Brad King AuthorDate: Thu Mar 5 10:00:56 2015 -0500 Commit: Brad King CommitDate: Thu Mar 5 10:00:56 2015 -0500 Revert "FPHSA: Always populate the ExactCase_FOUND variable (#15412)." This reverts commit f6cb72e00bd813e4878902a414272a4d036b6f22. This will be replaced with a change that does not drop the enforcement of valid FOUND_VAR values. diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index c6a1942..2de1fb3 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -8,9 +8,9 @@ # # This function is intended to be used in FindXXX.cmake modules files. # It handles the REQUIRED, QUIET and version-related arguments to -# find_package(PackageName). It also sets the _FOUND -# variable. The package is considered found if all variables ... -# listed contain valid results, e.g. valid filepaths. +# find_package(). It also sets the _FOUND variable. The +# package is considered found if all variables ... listed contain +# valid results, e.g. valid filepaths. # # There are two modes of this function. The first argument in both # modes is the name of the Find-module where it is called (in original @@ -24,7 +24,7 @@ # (DEFAULT_MSG|"Custom failure message") ... ) # # If the variables to are all valid, then -# _FOUND will be set to TRUE. If DEFAULT_MSG is given +# _FOUND will be set to TRUE. If DEFAULT_MSG is given # as second argument, then the function will generate itself useful # success and error messages. You can also supply a custom error # message for the failure case. This is not recommended. @@ -41,12 +41,16 @@ # [CONFIG_MODE] # [FAIL_MESSAGE "Custom failure message"] ) # -# The FOUND_VAR option is obsolete. ``FIND_PACKAGE_HANDLE_STANDARD_ARGS`` -# always populates ``_FOUND``. For backward compatibility, -# it also always populates ``_FOUND``. +# In this mode, the name of the result-variable can be set either to +# either _FOUND or _FOUND using the +# FOUND_VAR option. Other names for the result-variable are not +# allowed. So for a Find-module named FindFooBar.cmake, the two +# possible names are FooBar_FOUND and FOOBAR_FOUND. It is recommended +# to use the original case version. If the FOUND_VAR option is not +# used, the default is _FOUND. # # As in the simple mode, if through are all valid, -# _FOUND will be set to TRUE. After REQUIRED_VARS the +# _FOUND will be set to TRUE. After REQUIRED_VARS the # variables which are required for this package are listed. Following # VERSION_VAR the name of the variable can be specified which holds the # version of the package which has been found. If this is done, this @@ -57,7 +61,7 @@ # version is ok or not. If the package supports components, use the # HANDLE_COMPONENTS option to enable handling them. In this case, # find_package_handle_standard_args() will report which components have -# been found and which are missing, and the _FOUND variable +# been found and which are missing, and the _FOUND variable # will be set to FALSE if any of the required components (i.e. not the # ones listed after OPTIONAL_COMPONENTS) are missing. Use the option # CONFIG_MODE if your FindXXX.cmake module is a wrapper for a @@ -77,7 +81,7 @@ # # # LibXml2 is considered to be found, if both LIBXML2_LIBRARY and -# LIBXML2_INCLUDE_DIR are valid. Then also LibXml2_FOUND is set to +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to # TRUE. If it is not found and REQUIRED was used, it fails with # FATAL_ERROR, independent whether QUIET was used or not. If it is # found, success will be reported, including the content of . On @@ -88,14 +92,16 @@ # :: # # find_package_handle_standard_args(LibXslt +# FOUND_VAR LibXslt_FOUND # REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS # VERSION_VAR LibXslt_VERSION_STRING) # # In this case, LibXslt is considered to be found if the variable(s) # listed after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and -# LibXslt_INCLUDE_DIRS in this case. Also the version of LibXslt will be -# checked by using the version contained in LibXslt_VERSION_STRING. Since -# no FAIL_MESSAGE is given, the default messages will be printed. +# LibXslt_INCLUDE_DIRS in this case. The result will then be stored in +# LibXslt_FOUND . Also the version of LibXslt will be checked by using +# the version contained in LibXslt_VERSION_STRING. Since no +# FAIL_MESSAGE is given, the default messages will be printed. # # Another example for mode 2: # @@ -105,8 +111,9 @@ # find_package_handle_standard_args(Automoc4 CONFIG_MODE) # # In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4 -# NO_MODULE) and adds an additional search directory for automoc4. The -# following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper +# NO_MODULE) and adds an additional search directory for automoc4. Here +# the result will be stored in AUTOMOC4_FOUND. The following +# FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper # success/error message. #============================================================================= @@ -217,23 +224,32 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) string(TOUPPER ${_NAME} _NAME_UPPER) string(TOLOWER ${_NAME} _NAME_LOWER) + if(FPHSA_FOUND_VAR) + if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") + set(_FOUND_VAR ${FPHSA_FOUND_VAR}) + else() + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") + endif() + else() + set(_FOUND_VAR ${_NAME_UPPER}_FOUND) + endif() + # collect all variables which were not found, so they can be printed, so the # user knows better what went wrong (#6375) set(MISSING_VARS "") set(DETAILS "") # check if all passed variables are valid - unset(${_NAME}_FOUND) - unset(${_NAME_UPPER}_FOUND) + unset(${_FOUND_VAR}) foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) if(NOT ${_CURRENT_VAR}) - set(${_NAME}_FOUND FALSE) + set(${_FOUND_VAR} FALSE) set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") else() set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") endif() endforeach() - if(NOT "${${_NAME}_FOUND}" STREQUAL "FALSE") - set(${_NAME}_FOUND TRUE) + if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE") + set(${_FOUND_VAR} TRUE) endif() # component handling @@ -257,7 +273,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) + set(${_FOUND_VAR} FALSE) set(MISSING_VARS "${MISSING_VARS} ${comp}") endif() @@ -340,12 +356,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) if(VERSION_OK) set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") else() - set(${_NAME}_FOUND FALSE) + set(${_FOUND_VAR} FALSE) endif() # print the result: - if (${_NAME}_FOUND) + if (${_FOUND_VAR}) FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") else () @@ -361,6 +377,6 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) endif () - set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) - set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) + set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE) + endfunction() diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 8fafa3b..f311fb9 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -45,18 +45,12 @@ endif() find_package(SomePackage) if(NOT SomePackage_FOUND) - message(SEND_ERROR "SomePackage not found !") -endif() -if(NOT SOMEPACKAGE_FOUND) - message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!") + message(SEND_ERROR "SomePackage with FOUND_VAR SomePackage_FOUND not found !") endif() find_package(UpperCasePackage) -if(NOT UpperCasePackage_FOUND) - message(SEND_ERROR "UpperCasePackage not found!") -endif() if(NOT UPPERCASEPACKAGE_FOUND) - message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!") + message(SEND_ERROR "UpperCasePackage with FOUND_VAR UPPERCASEPACKAGE_FOUND not found !") endif() #----------------------------------------------------------------------------- diff --git a/Tests/FindPackageTest/FindSomePackage.cmake b/Tests/FindPackageTest/FindSomePackage.cmake index 746c087..7283d24 100644 --- a/Tests/FindPackageTest/FindSomePackage.cmake +++ b/Tests/FindPackageTest/FindSomePackage.cmake @@ -2,4 +2,5 @@ set(SOP_FOO TRUE) include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO) +find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO + FOUND_VAR SomePackage_FOUND ) diff --git a/Tests/FindPackageTest/FindUpperCasePackage.cmake b/Tests/FindPackageTest/FindUpperCasePackage.cmake index 5e349da..425d417 100644 --- a/Tests/FindPackageTest/FindUpperCasePackage.cmake +++ b/Tests/FindPackageTest/FindUpperCasePackage.cmake @@ -2,4 +2,5 @@ set(UCP_FOO TRUE) include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO) +find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO + FOUND_VAR UPPERCASEPACKAGE_FOUND ) diff --git a/Tests/RunCMake/FPHSA/BadFoundVar-result.txt b/Tests/RunCMake/FPHSA/BadFoundVar-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FPHSA/BadFoundVar-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt new file mode 100644 index 0000000..4c739d8 --- /dev/null +++ b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\): + The argument for FOUND_VAR is "badfoundvar_FOUND", but only + "BadFoundVar_FOUND" and "BADFOUNDVAR_FOUND" are valid names. +Call Stack \(most recent call first\): + FindBadFoundVar.cmake:5 \(find_package_handle_standard_args\) + BadFoundVar.cmake:3 \(find_package\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/FPHSA/BadFoundVar.cmake b/Tests/RunCMake/FPHSA/BadFoundVar.cmake new file mode 100644 index 0000000..07d4322 --- /dev/null +++ b/Tests/RunCMake/FPHSA/BadFoundVar.cmake @@ -0,0 +1,3 @@ +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +find_package(BadFoundVar REQUIRED) diff --git a/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake b/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake new file mode 100644 index 0000000..152df5c --- /dev/null +++ b/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake @@ -0,0 +1,6 @@ +set(BFV_FOO TRUE) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(BadFoundVar REQUIRED_VARS BFV_FOO + FOUND_VAR badfoundvar_FOUND ) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake index b63cfa7..e9b2a7a 100644 --- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(BadFoundVar) + # The pseudo module will "find" a package with the given version. Check if the # version selection code in FPHSA works correctly. set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=1.2.3.4.5") ----------------------------------------------------------------------- Summary of changes: Modules/FindPackageHandleStandardArgs.cmake | 66 ++++++++++++-------- Tests/FindPackageTest/CMakeLists.txt | 10 +-- Tests/FindPackageTest/FindSomePackage.cmake | 3 +- Tests/FindPackageTest/FindUpperCasePackage.cmake | 3 +- .../BadFoundVar-result.txt} | 0 Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt | 7 +++ Tests/RunCMake/FPHSA/BadFoundVar.cmake | 3 + Tests/RunCMake/FPHSA/FindBadFoundVar.cmake | 6 ++ Tests/RunCMake/FPHSA/RunCMakeTest.cmake | 2 + 9 files changed, 65 insertions(+), 35 deletions(-) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => FPHSA/BadFoundVar-result.txt} (100%) create mode 100644 Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt create mode 100644 Tests/RunCMake/FPHSA/BadFoundVar.cmake create mode 100644 Tests/RunCMake/FPHSA/FindBadFoundVar.cmake hooks/post-receive -- CMake From steveire at gmail.com Thu Mar 5 13:57:51 2015 From: steveire at gmail.com (Stephen Kelly) Date: Thu, 5 Mar 2015 13:57:51 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-846-gdc6cebe Message-ID: <20150305185753.1DAE7AB7E4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via dc6cebe35f74b2fbc1b99434d04e454bdb6525f7 (commit) via 95a6a4bdc8736745e129e510c91a76f41d1cb0d7 (commit) from 4f61b2ad49cc88e7a6a256cad88abba01f3b0b12 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc6cebe35f74b2fbc1b99434d04e454bdb6525f7 commit dc6cebe35f74b2fbc1b99434d04e454bdb6525f7 Merge: 4f61b2a 95a6a4b Author: Stephen Kelly AuthorDate: Thu Mar 5 13:57:48 2015 -0500 Commit: CMake Topic Stage CommitDate: Thu Mar 5 13:57:48 2015 -0500 Merge topic 'target-language-genex' into next 95a6a4bd Use link language. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95a6a4bdc8736745e129e510c91a76f41d1cb0d7 commit 95a6a4bdc8736745e129e510c91a76f41d1cb0d7 Author: Stephen Kelly AuthorDate: Thu Mar 5 19:57:15 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 19:57:15 2015 +0100 Use link language. diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 5c43f46..db59da9 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1779,12 +1779,15 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, "", "C"); - this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG", "C"); - this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE", "C"); - this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL", "C"); + this->AddCompileDefinitions(definesSet, &target, "", linkLanguage); + this->AddCompileDefinitions(debugDefinesSet, &target, + "DEBUG", linkLanguage); + this->AddCompileDefinitions(releaseDefinesSet, &target, + "RELEASE", linkLanguage); + this->AddCompileDefinitions(minsizeDefinesSet, &target, + "MINSIZEREL", linkLanguage); this->AddCompileDefinitions(debugrelDefinesSet, &target, - "RELWITHDEBINFO", "C"); + "RELWITHDEBINFO", linkLanguage); std::string defines = " "; std::string debugDefines = " "; ----------------------------------------------------------------------- Summary of changes: Source/cmLocalVisualStudio6Generator.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Thu Mar 5 14:03:05 2015 From: steveire at gmail.com (Stephen Kelly) Date: Thu, 5 Mar 2015 14:03:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-851-g3ea132e Message-ID: <20150305190307.9D9E6AB3DB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3ea132eb29448001cf27544e3fd1e35fc4b0574b (commit) via ccb0cd8aa281c21fc7d52f6ff02fba6ff22b80a4 (commit) via c9c01afafa13d18be066442a88be86db42035b38 (commit) via 4b05997f20c68a689672a916ab635593cb6e5eed (commit) via 89e59bb7837fc98f30ef55e021196125b10faaa4 (commit) from dc6cebe35f74b2fbc1b99434d04e454bdb6525f7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3ea132eb29448001cf27544e3fd1e35fc4b0574b commit 3ea132eb29448001cf27544e3fd1e35fc4b0574b Merge: dc6cebe ccb0cd8 Author: Stephen Kelly AuthorDate: Thu Mar 5 14:03:01 2015 -0500 Commit: CMake Topic Stage CommitDate: Thu Mar 5 14:03:01 2015 -0500 Merge topic 'target-language-genex' into next ccb0cd8a File(GENERATE): Process genex evaluation files for each language. c9c01afa Genex: Allow COMPILE_LANGUAGE when processing include directories. 4b05997f Genex: Allow COMPILE_LANGUAGE when processing compile definitions. 89e59bb7 Genex: Enable use of COMPILE_LANGUAGE for compile options. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ccb0cd8aa281c21fc7d52f6ff02fba6ff22b80a4 commit ccb0cd8aa281c21fc7d52f6ff02fba6ff22b80a4 Author: Stephen Kelly AuthorDate: Sun Feb 22 17:44:59 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 20:00:46 2015 +0100 File(GENERATE): Process genex evaluation files for each language. diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 4e2a868..fa00283 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -38,13 +38,15 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( //---------------------------------------------------------------------------- void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, + const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm) { std::string rawCondition = this->Condition->GetInput(); if (!rawCondition.empty()) { - std::string condResult = this->Condition->Evaluate(this->Makefile, config); + std::string condResult = this->Condition->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); if (condResult == "0") { return; @@ -60,9 +62,11 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } const std::string outputFileName - = this->OutputFileExpr->Evaluate(this->Makefile, config); + = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); const std::string outputContent - = inputExpression->Evaluate(this->Makefile, config); + = inputExpression->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); std::map::iterator it = outputFiles.find(outputFileName); @@ -75,7 +79,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } std::ostringstream e; e << "Evaluation file to be written multiple times for different " - "configurations with different content:\n " << outputFileName; + "configurations or languages with different content:\n " + << outputFileName; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -97,14 +102,22 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, void cmGeneratorExpressionEvaluationFile::CreateOutputFile( std::string const& config) { - std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config); - cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); - sf->SetProperty("GENERATED", "1"); - + std::vector enabledLanguages; cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->SetFilenameTargetDepends(sf, + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) + { + std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, *le); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); + sf->SetProperty("GENERATED", "1"); + + gg->SetFilenameTargetDepends(sf, this->OutputFileExpr->GetSourceSensitiveTargets()); + } } //---------------------------------------------------------------------------- @@ -153,13 +166,23 @@ void cmGeneratorExpressionEvaluationFile::Generate() { allConfigs.push_back(""); } - for(std::vector::const_iterator li = allConfigs.begin(); - li != allConfigs.end(); ++li) + + std::vector enabledLanguages; + cmGlobalGenerator *gg + = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) { - this->Generate(*li, inputExpression.get(), outputFiles, perm); - if(cmSystemTools::GetFatalErrorOccured()) + for(std::vector::const_iterator li = allConfigs.begin(); + li != allConfigs.end(); ++li) { - return; + this->Generate(*li, *le, inputExpression.get(), outputFiles, perm); + if(cmSystemTools::GetFatalErrorOccured()) + { + return; + } } } } diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 3394ade..4424bec 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -34,7 +34,7 @@ public: void CreateOutputFile(std::string const& config); private: - void Generate(const std::string& config, + void Generate(const std::string& config, const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm); diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake new file mode 100644 index 0000000..e2b081d --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -0,0 +1,12 @@ + +enable_language(CXX C) + +add_library(empty empty.cpp empty.c) +target_compile_options(empty + PRIVATE LANG_IS_$ +) + +file(GENERATE + OUTPUT opts-$.txt + CONTENT "$\n" +) diff --git a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt index dbd39de..0abb7df 100644 --- a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt +++ b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt @@ -1,5 +1,5 @@ CMake Error in CMakeLists.txt: Evaluation file to be written multiple times for different configurations - with different content: + or languages with different content: .*output.txt diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 97f93d5..db344ef 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -17,6 +17,16 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() +if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") + run_cmake(COMPILE_LANGUAGE-genex) + foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() + endforeach() +endif() + set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") diff --git a/Tests/RunCMake/File_Generate/empty.c b/Tests/RunCMake/File_Generate/empty.c new file mode 100644 index 0000000..563eef0 --- /dev/null +++ b/Tests/RunCMake/File_Generate/empty.c @@ -0,0 +1,8 @@ + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty_c() +{ + return 0; +} http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9c01afafa13d18be066442a88be86db42035b38 commit c9c01afafa13d18be066442a88be86db42035b38 Author: Stephen Kelly AuthorDate: Wed Mar 4 21:53:15 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 20:00:46 2015 +0100 Genex: Allow COMPILE_LANGUAGE when processing include directories. Issue an error if this is encountered by an IDE generator. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b6d97d1..d38cf7e 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -121,7 +121,8 @@ Available logical expressions are: target_link_libraries(myapp myapp_c myapp_cxx) The ``Makefile`` and ``Ninja`` based generators can also use this - expression to specify compile-language specific compile definitions: + expression to specify compile-language specific compile definitions + and include directories: .. code-block:: cmake @@ -129,6 +130,9 @@ Available logical expressions are: target_compile_definitions(myapp PRIVATE $<$:COMPILING_CXX> ) + target_include_directories(myapp + PRIVATE $<$:/opt/foo/cxx_headers> + ) Informational Expressions ========================= diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 26ee7af..f289ead 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -850,7 +850,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } else if (gg->GetName().find("Xcode") != std::string::npos) { - if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() + || dagChecker->EvaluatingIncludeDirectories())) { reportError(context, content->GetOriginalExpression(), "$ may only be used with COMPILE_OPTIONS " diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 44c9e9a..b7b2eff 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -960,9 +960,10 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang, //---------------------------------------------------------------------------- std::vector -cmGeneratorTarget::GetIncludeDirectories(const std::string& config) const +cmGeneratorTarget::GetIncludeDirectories(const std::string& config, + const std::string& lang) const { - return this->Target->GetIncludeDirectories(config); + return this->Target->GetIncludeDirectories(config, lang); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2083b88..c329cf5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -85,7 +85,7 @@ public: /** Get the include directories for this target. */ std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, const std::string& lang) const; bool IsSystemIncludeDirectory(const std::string& dir, const std::string& config) const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 735dfa9..37cc2c6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1600,7 +1600,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // Get the target-specific include directories. std::vector includes; - includes = target->GetIncludeDirectories(config); + includes = target->GetIncludeDirectories(config, lang); // Support putting all the in-project include directories first if // it is requested by the project. diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9ecb029..50491af 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2114,6 +2114,32 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << " )\n"; } + + // Target-specific include directories: + cmakefileStream + << "\n" + << "# The include file search paths:\n"; + cmakefileStream + << "set(CMAKE_" << l->first << "_TARGET_INCLUDE_PATH\n"; + std::vector includes; + + cmGeneratorTarget* gt = this->GetGlobalGenerator() + ->GetGeneratorTarget(&target); + + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->GetIncludeDirectories(includes, gt, + l->first, config); + for(std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) + { + cmakefileStream + << " \"" + << this->Convert(*i, cmLocalGenerator::HOME_OUTPUT) + << "\"\n"; + } + cmakefileStream + << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 57c49f1..c7a7110 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1056,40 +1056,6 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; } - // Target-specific include directories: - *this->InfoFileStream - << "\n" - << "# The include file search paths:\n"; - *this->InfoFileStream - << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; - std::vector includes; - - const std::string& config = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->LocalGenerator->GetIncludeDirectories(includes, - this->GeneratorTarget, - "C", config); - for(std::vector::iterator i = includes.begin(); - i != includes.end(); ++i) - { - *this->InfoFileStream - << " \"" - << this->LocalGenerator->Convert(*i, - cmLocalGenerator::HOME_OUTPUT) - << "\"\n"; - } - *this->InfoFileStream - << " )\n"; - *this->InfoFileStream - << "set(CMAKE_CXX_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_ASM_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - // and now write the rule to use it std::vector depends; std::vector commands; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 87dcc99..7a6ad8b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1979,7 +1979,8 @@ static void processIncludeDirectories(cmTarget const* tgt, std::vector &includes, UNORDERED_SET &uniqueIncludes, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugIncludes) + const std::string& config, bool debugIncludes, + const std::string& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -1995,7 +1996,7 @@ static void processIncludeDirectories(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, language), entryIncludes); std::string usedIncludes; @@ -2106,7 +2107,8 @@ static void processIncludeDirectories(cmTarget const* tgt, //---------------------------------------------------------------------------- std::vector -cmTarget::GetIncludeDirectories(const std::string& config) const +cmTarget::GetIncludeDirectories(const std::string& config, + const std::string& language) const { std::vector includes; UNORDERED_SET uniqueIncludes; @@ -2139,7 +2141,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); std::vector linkInterfaceIncludeDirectoriesEntries; @@ -2179,7 +2182,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); deleteAndClear(linkInterfaceIncludeDirectoriesEntries); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0356c1e..5170b31 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -568,7 +568,8 @@ public: bool contentOnly) const; std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, + const std::string& language) const; void InsertInclude(const cmValueWithOrigin &entry, bool before = false); void InsertCompileOption(const cmValueWithOrigin &entry, diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 661bbaa..d57556a 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -42,6 +42,20 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_include_directories(consumer + PRIVATE + $<$:${CMAKE_CURRENT_SOURCE_DIR}/cxx_only> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/c_only> + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_include_directories(consumer PRIVATE $ diff --git a/Tests/CMakeCommands/target_include_directories/c_only/c_only.h b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h new file mode 100644 index 0000000..29f68ee --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h @@ -0,0 +1,2 @@ + +#define C_ONLY_DEFINE diff --git a/Tests/CMakeCommands/target_include_directories/consumer.c b/Tests/CMakeCommands/target_include_directories/consumer.c new file mode 100644 index 0000000..8821f5b --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/consumer.c @@ -0,0 +1,10 @@ + +#ifdef TEST_LANG_DEFINES + #include "c_only.h" + + #ifndef C_ONLY_DEFINE + #error Expected C_ONLY_DEFINE + #endif +#endif + +int consumer_c() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp index 7e3443e..649510c 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.cpp +++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp @@ -4,6 +4,9 @@ #include "interfaceinclude.h" #include "relative_dir.h" #include "consumer.h" +#ifdef TEST_LANG_DEFINES + #include "cxx_only.h" +#endif #ifdef PRIVATEINCLUDE_DEFINE #error Unexpected PRIVATEINCLUDE_DEFINE @@ -29,4 +32,10 @@ #error Expected CONSUMER_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CXX_ONLY_DEFINE + #error Expected CXX_ONLY_DEFINE + #endif +#endif + int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h new file mode 100644 index 0000000..67289a4 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h @@ -0,0 +1,2 @@ + +#define CXX_ONLY_DEFINE diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt new file mode 100644 index 0000000..ec15068 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt new file mode 100644 index 0000000..fdf92b2 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake new file mode 100644 index 0000000..31771f6 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_include_directories(main PRIVATE $<$:anydir>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 8a32aef..5e0a5f5 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -11,3 +11,10 @@ elseif (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) run_cmake(CompileDefinitions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file IncludeDirectories-stderr-Xcode.txt) + run_cmake(IncludeDirectories) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file IncludeDirectories-stderr-VS.txt) + run_cmake(IncludeDirectories) +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b05997f20c68a689672a916ab635593cb6e5eed commit 4b05997f20c68a689672a916ab635593cb6e5eed Author: Stephen Kelly AuthorDate: Wed Mar 4 21:46:42 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 20:00:46 2015 +0100 Genex: Allow COMPILE_LANGUAGE when processing compile definitions. Issue an error if this is encountered by an IDE generator. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b1b1102..b6d97d1 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -120,6 +120,16 @@ Available logical expressions are: add_executable(myapp main.cpp) target_link_libraries(myapp myapp_c myapp_cxx) + The ``Makefile`` and ``Ninja`` based generators can also use this + expression to specify compile-language specific compile definitions: + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_definitions(myapp + PRIVATE $<$:COMPILING_CXX> + ) + Informational Expressions ========================= diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 69857ef..614e7d9 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -599,7 +599,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, // the compilerdefines for this target std::vector cdefs; - target->GetCompileDefinitions(cdefs, buildType); + target->GetCompileDefinitions(cdefs, buildType, "C"); // Expand the list. for(std::vector::const_iterator di = cdefs.begin(); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 5fff0fb..25f9005 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -436,7 +436,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, } // Add preprocessor definitions for this target and configuration. - lg->AddCompileDefinitions(defines, target, config); + lg->AddCompileDefinitions(defines, target, config, language); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); { std::string defPropName = "COMPILE_DEFINITIONS_"; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 89bdb5b..26ee7af 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -817,7 +817,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector ¶meters, cmGeneratorExpressionContext *context, const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const + cmGeneratorExpressionDAGChecker *dagChecker) const { if(context->Language.empty()) { @@ -848,11 +848,20 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "generators."); return std::string(); } + else if (gg->GetName().find("Xcode") != std::string::npos) + { + if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with COMPILE_OPTIONS " + "with the Xcode generator."); + return std::string(); + } + } else { if(gg->GetName().find("Makefiles") == std::string::npos && - gg->GetName().find("Ninja") == std::string::npos && - gg->GetName().find("Xcode") == std::string::npos) + gg->GetName().find("Ninja") == std::string::npos) { reportError(context, content->GetOriginalExpression(), "$ not supported for this generator."); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e89161d..bd8a1f5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1803,7 +1803,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "C"); this->AppendDefines(ppDefs, targetDefines); buildSettings->AddAttribute ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index be82085..735dfa9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1428,11 +1428,11 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config) + const std::string& config, + const std::string& lang) { std::vector targetDefines; - target->GetCompileDefinitions(targetDefines, - config); + target->GetCompileDefinitions(targetDefines, config, lang); this->AppendDefines(defines, targetDefines); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3a9d5be..f1f0da1 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -239,7 +239,8 @@ public: const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config); + const std::string& config, + const std::string& lang); /** Compute the language used to compile the given source file. */ std::string GetSourceFileLanguage(const cmSourceFile& source); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 432cb3a..9ecb029 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2094,26 +2094,26 @@ void cmLocalUnixMakefileGenerator3 << "set(CMAKE_" << l->first << "_COMPILER_ID \"" << cid << "\")\n"; } - } - // Build a list of preprocessor definitions for the target. - std::set defines; - this->AddCompileDefinitions(defines, &target, - this->ConfigurationName); - if(!defines.empty()) - { - cmakefileStream - << "\n" - << "# Preprocessor definitions for this target.\n" - << "set(CMAKE_TARGET_DEFINITIONS\n"; - for(std::set::const_iterator di = defines.begin(); - di != defines.end(); ++di) + // Build a list of preprocessor definitions for the target. + std::set defines; + this->AddCompileDefinitions(defines, &target, + this->ConfigurationName, l->first); + if(!defines.empty()) { cmakefileStream - << " " << this->EscapeForCMake(*di) << "\n"; + << "\n" + << "# Preprocessor definitions for this target.\n" + << "set(CMAKE_TARGET_DEFINITIONS_" << l->first << "\n"; + for(std::set::const_iterator di = defines.begin(); + di != defines.end(); ++di) + { + cmakefileStream + << " " << this->EscapeForCMake(*di) << "\n"; + } + cmakefileStream + << " )\n"; } - cmakefileStream - << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1d62093..db59da9 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1779,11 +1779,15 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, ""); - this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG"); - this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE"); - this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL"); - this->AddCompileDefinitions(debugrelDefinesSet, &target, "RELWITHDEBINFO"); + this->AddCompileDefinitions(definesSet, &target, "", linkLanguage); + this->AddCompileDefinitions(debugDefinesSet, &target, + "DEBUG", linkLanguage); + this->AddCompileDefinitions(releaseDefinesSet, &target, + "RELEASE", linkLanguage); + this->AddCompileDefinitions(minsizeDefinesSet, &target, + "MINSIZEREL", linkLanguage); + this->AddCompileDefinitions(debugrelDefinesSet, &target, + "RELWITHDEBINFO", linkLanguage); std::string defines = " "; std::string debugDefines = " "; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ed560aa..f53f825 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -775,7 +775,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "CXX"); targetOptions.AddDefines(targetDefines); targetOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 20207f5..57c49f1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -329,7 +329,7 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->ConfigurationName); + this->LocalGenerator->ConfigurationName, l); std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, lang); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index cfd8937..92fccd3 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -231,7 +231,7 @@ ComputeDefines(cmSourceFile const* source, const std::string& language) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->GetConfigName()); + this->GetConfigName(), language); this->LocalGenerator->AppendDefines (defines, source->GetProperty("COMPILE_DEFINITIONS")); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e18e757..844d708 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -507,7 +507,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, incs = cmJoin(includeDirs, ";"); std::set defines; - localGen->AddCompileDefinitions(defines, target, config); + localGen->AddCompileDefinitions(defines, target, config, "CXX"); defs += cmJoin(defines, ";"); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c54d694..87dcc99 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2336,16 +2336,18 @@ static void processCompileDefinitions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions", std::string()); + "definitions", language); } //---------------------------------------------------------------------------- void cmTarget::GetCompileDefinitions(std::vector &list, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2377,7 +2379,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); std::vector linkInterfaceCompileDefinitionsEntries; @@ -2424,7 +2427,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); deleteAndClear(linkInterfaceCompileDefinitionsEntries); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 56db22e..0356c1e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -496,7 +496,8 @@ public: const char* GetExportMacro() const; void GetCompileDefinitions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; // Compute the set of languages compiled by the target. This is // computed every time it is called because the languages can change diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 04d1487..19444ed 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1876,7 +1876,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); std::vector targetDefines; - this->Target->GetCompileDefinitions(targetDefines, configName.c_str()); + this->Target->GetCompileDefinitions(targetDefines, + configName.c_str(), "CXX"); clOptions.AddDefines(targetDefines); if(this->MSTools) { diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 14d40aa..f96283d 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -26,6 +26,21 @@ target_compile_definitions(consumer PRIVATE ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_compile_definitions(consumer + PRIVATE + CONSUMER_LANG_$ + LANG_IS_CXX=$ + LANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + add_definitions(-DSOME_DEF) add_library(imp UNKNOWN IMPORTED) get_target_property(_res imp COMPILE_DEFINITIONS) diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c new file mode 100644 index 0000000..5796d96 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp index a391114..778f57e 100644 --- a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp @@ -15,4 +15,22 @@ #error Expected DASH_D_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt new file mode 100644 index 0000000..73b66ac --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt new file mode 100644 index 0000000..a1ed633 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake new file mode 100644 index 0000000..7935d88 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_definitions(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 2c5d9ae..8a32aef 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -4,3 +4,10 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) run_cmake(CompileOptions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt) + run_cmake(CompileDefinitions) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) + run_cmake(CompileDefinitions) +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89e59bb7837fc98f30ef55e021196125b10faaa4 commit 89e59bb7837fc98f30ef55e021196125b10faaa4 Author: Stephen Kelly AuthorDate: Tue Nov 25 22:47:44 2014 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 20:00:46 2015 +0100 Genex: Enable use of COMPILE_LANGUAGE for compile options. Follow-ups will allow the use of the generator expression for compile definitions and include directories for non-IDE generators. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index c47a7c4..b1b1102 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -93,6 +93,32 @@ Available logical expressions are: for the 'head' target, an error is reported. See the :manual:`cmake-compile-features(7)` manual for information on compile features. +``$`` + ``1`` when the language used for compilation unit matches ``lang``, + otherwise ``0``. This expression used to specify compile options for + source files of a particular language in a target. For example, to specify + the use of the ``-fno-exceptions`` compile option (compiler id checks + elided): + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_options(myapp + PRIVATE $<$:-fno-exceptions> + ) + + This generator expression has limited use because it is not possible to + use it with the Visual Studio generators. Portable buildsystems would + not use this expression, and would create separate libraries for each + source file language instead: + + .. code-block:: cmake + + add_library(myapp_c foo.c) + add_library(myapp_cxx foo.c) + target_compile_options(myapp_cxx PUBLIC -fno-exceptions) + add_executable(myapp main.cpp) + target_link_libraries(myapp myapp_c myapp_cxx) Informational Expressions ========================= @@ -174,6 +200,10 @@ Available informational expressions are: ``$`` Content of the install prefix when the target is exported via :command:`install(EXPORT)` and empty otherwise. +``$`` + The compile language of source files when evaluating compile options. See + the unary version for notes about portability of this generator + expression. Output Expressions ================== diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 63a46f2..89bdb5b 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -827,6 +827,38 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "components of the file(GENERATE) command."); return std::string(); } + + std::vector enabledLanguages; + cmGlobalGenerator* gg + = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + if (!parameters.empty() && + std::find(enabledLanguages.begin(), enabledLanguages.end(), + parameters.front()) == enabledLanguages.end()) + { + reportError(context, content->GetOriginalExpression(), + "$ Unknown language."); + return std::string(); + } + + if (gg->GetName().find("Visual Studio") != std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ may not be used with Visual Studio " + "generators."); + return std::string(); + } + else + { + if(gg->GetName().find("Makefiles") == std::string::npos && + gg->GetName().find("Ninja") == std::string::npos && + gg->GetName().find("Xcode") == std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ not supported for this generator."); + return std::string(); + } + } if (parameters.empty()) { return context->Language; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7c83f27..be82085 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1453,7 +1453,7 @@ void cmLocalGenerator::AddCompileOptions( { cmSystemTools::ParseWindowsCommandLine(targetFlags, opts); } - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { @@ -1474,7 +1474,7 @@ void cmLocalGenerator::AddCompileOptions( this->AppendFlags(flags, targetFlags); } std::vector opts; - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e046bef..c54d694 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2192,7 +2192,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions, const char *logName) + const std::string& config, bool debugOptions, const char *logName, + std::string const& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -2204,7 +2205,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, + language), entryOptions); std::string usedOptions; for(std::vector::iterator @@ -2238,10 +2240,12 @@ static void processCompileOptions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "options"); + dagChecker, config, debugOptions, "options", + language); } //---------------------------------------------------------------------------- @@ -2271,7 +2275,8 @@ void cmTarget::GetAutoUicOptions(std::vector &result, //---------------------------------------------------------------------------- void cmTarget::GetCompileOptions(std::vector &result, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2303,7 +2308,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); std::vector linkInterfaceCompileOptionsEntries; @@ -2318,7 +2324,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); deleteAndClear(linkInterfaceCompileOptionsEntries); } @@ -2333,7 +2340,7 @@ static void processCompileDefinitions(cmTarget const* tgt, { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions"); + "definitions", std::string()); } //---------------------------------------------------------------------------- @@ -2431,7 +2438,8 @@ static void processCompileFeatures(cmTarget const* tgt, const std::string& config, bool debugOptions) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "features"); + dagChecker, config, debugOptions, "features", + std::string()); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ddd9859..56db22e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -577,7 +577,8 @@ public: void AppendBuildInterfaceIncludes(); void GetCompileOptions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; void GetAutoUicOptions(std::vector &result, const std::string& config) const; void GetCompileFeatures(std::vector &features, diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 1d04639..35dd276 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -23,6 +23,21 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) +if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_compile_options(consumer + PRIVATE + -DCONSUMER_LANG_$ + -DLANG_IS_CXX=$ + -DLANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_compile_options(consumer PRIVATE $<$:$> ) diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c new file mode 100644 index 0000000..5796d96 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 1299606..c5882a5 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -15,4 +15,22 @@ #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057..9f1256e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -208,3 +208,5 @@ add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) if(RPMBUILD_EXECUTABLE) add_RunCMake_test(CPackRPM) endif() + +add_RunCMake_test(COMPILE_LANGUAGE-genex) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt new file mode 100644 index 0000000..e9e8e9f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileOptions.cmake:5 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake new file mode 100644 index 0000000..6c92abc --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_options(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake new file mode 100644 index 0000000..2c5d9ae --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +if (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) + run_cmake(CompileOptions) +endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp new file mode 100644 index 0000000..31a1337 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt new file mode 100644 index 0000000..444da45 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at COMPILE_LANGUAGE-unknown-lang.cmake:4 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ Unknown language. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake new file mode 100644 index 0000000..cec12a3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<$:-Wall>) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index f591c3d..542b7fc 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -23,6 +23,7 @@ run_cmake(COMPILE_LANGUAGE-target_sources) run_cmake(COMPILE_LANGUAGE-add_executable) run_cmake(COMPILE_LANGUAGE-add_library) run_cmake(COMPILE_LANGUAGE-add_test) +run_cmake(COMPILE_LANGUAGE-unknown-lang) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 5 16:52:56 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 5 Mar 2015 16:52:56 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-853-gaa18ddf Message-ID: <20150305215256.C0EE1AB271@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via aa18ddf66c2c8fa245e3e514eff15f005f1308c1 (commit) via 0aeb283c958ef98888ddbf5f2ae7afada69bc76f (commit) from 3ea132eb29448001cf27544e3fd1e35fc4b0574b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aa18ddf66c2c8fa245e3e514eff15f005f1308c1 commit aa18ddf66c2c8fa245e3e514eff15f005f1308c1 Merge: 3ea132e 0aeb283 Author: Brad King AuthorDate: Thu Mar 5 16:52:55 2015 -0500 Commit: CMake Topic Stage CommitDate: Thu Mar 5 16:52:55 2015 -0500 Merge topic 'target-language-genex' into next 0aeb283c VS6: Compute CMAKE_*_FLAGS and COMPILE_DEFINITIONS* only when needed http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0aeb283c958ef98888ddbf5f2ae7afada69bc76f commit 0aeb283c958ef98888ddbf5f2ae7afada69bc76f Author: Brad King AuthorDate: Thu Mar 5 16:50:07 2015 -0500 Commit: Brad King CommitDate: Thu Mar 5 16:51:37 2015 -0500 VS6: Compute CMAKE_*_FLAGS and COMPILE_DEFINITIONS* only when needed These placeholders are used only in the .dsp templates for targets that actually compile sources. diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index db59da9..2b999eb 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1701,15 +1701,15 @@ void cmLocalVisualStudio6Generator = this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX"); cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX", debugPostfix?debugPostfix:""); - // store flags for each configuration - std::string flags = " "; - std::string flagsRelease = " "; - std::string flagsMinSizeRel = " "; - std::string flagsDebug = " "; - std::string flagsRelWithDebInfo = " "; if(target.GetType() >= cmTarget::EXECUTABLE && target.GetType() <= cmTarget::OBJECT_LIBRARY) { + // store flags for each configuration + std::string flags = " "; + std::string flagsRelease = " "; + std::string flagsMinSizeRel = " "; + std::string flagsDebug = " "; + std::string flagsRelWithDebInfo = " "; std::vector configs; target.GetMakefile()->GetConfigurations(configs); std::vector::const_iterator it = configs.begin(); @@ -1760,76 +1760,77 @@ void cmLocalVisualStudio6Generator "MinSizeRel"); this->AddCompileOptions(flagsRelWithDebInfo, &target, linkLanguage, "RelWithDebInfo"); - } - // if _UNICODE and _SBCS are not found, then add -D_MBCS - std::string defs = this->Makefile->GetDefineFlags(); - if(flags.find("D_UNICODE") == flags.npos && - defs.find("D_UNICODE") == flags.npos && - flags.find("D_SBCS") == flags.npos && - defs.find("D_SBCS") == flags.npos) - { - flags += " /D \"_MBCS\""; - } + // if _UNICODE and _SBCS are not found, then add -D_MBCS + std::string defs = this->Makefile->GetDefineFlags(); + if(flags.find("D_UNICODE") == flags.npos && + defs.find("D_UNICODE") == flags.npos && + flags.find("D_SBCS") == flags.npos && + defs.find("D_SBCS") == flags.npos) + { + flags += " /D \"_MBCS\""; + } - // Add per-target and per-configuration preprocessor definitions. - std::set definesSet; - std::set debugDefinesSet; - std::set releaseDefinesSet; - std::set minsizeDefinesSet; - std::set debugrelDefinesSet; - - this->AddCompileDefinitions(definesSet, &target, "", linkLanguage); - this->AddCompileDefinitions(debugDefinesSet, &target, - "DEBUG", linkLanguage); - this->AddCompileDefinitions(releaseDefinesSet, &target, - "RELEASE", linkLanguage); - this->AddCompileDefinitions(minsizeDefinesSet, &target, - "MINSIZEREL", linkLanguage); - this->AddCompileDefinitions(debugrelDefinesSet, &target, - "RELWITHDEBINFO", linkLanguage); - - std::string defines = " "; - std::string debugDefines = " "; - std::string releaseDefines = " "; - std::string minsizeDefines = " "; - std::string debugrelDefines = " "; - - this->JoinDefines(definesSet, defines, ""); - this->JoinDefines(debugDefinesSet, debugDefines, ""); - this->JoinDefines(releaseDefinesSet, releaseDefines, ""); - this->JoinDefines(minsizeDefinesSet, minsizeDefines, ""); - this->JoinDefines(debugrelDefinesSet, debugrelDefines, ""); - - flags += defines; - flagsDebug += debugDefines; - flagsRelease += releaseDefines; - flagsMinSizeRel += minsizeDefines; - flagsRelWithDebInfo += debugrelDefines; - - // The template files have CXX FLAGS in them, that need to be replaced. - // There are not separate CXX and C template files, so we use the same - // variable names. The previous code sets up flags* variables to contain - // the correct C or CXX flags - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", - flagsMinSizeRel.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", - flagsDebug.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", - flagsRelWithDebInfo.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", - flagsRelease.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); - - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL", - minsizeDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", - debugDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO", - debugrelDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE", - releaseDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", defines.c_str()); + // Add per-target and per-configuration preprocessor definitions. + std::set definesSet; + std::set debugDefinesSet; + std::set releaseDefinesSet; + std::set minsizeDefinesSet; + std::set debugrelDefinesSet; + + this->AddCompileDefinitions(definesSet, &target, "", linkLanguage); + this->AddCompileDefinitions(debugDefinesSet, &target, + "DEBUG", linkLanguage); + this->AddCompileDefinitions(releaseDefinesSet, &target, + "RELEASE", linkLanguage); + this->AddCompileDefinitions(minsizeDefinesSet, &target, + "MINSIZEREL", linkLanguage); + this->AddCompileDefinitions(debugrelDefinesSet, &target, + "RELWITHDEBINFO", linkLanguage); + + std::string defines = " "; + std::string debugDefines = " "; + std::string releaseDefines = " "; + std::string minsizeDefines = " "; + std::string debugrelDefines = " "; + + this->JoinDefines(definesSet, defines, ""); + this->JoinDefines(debugDefinesSet, debugDefines, ""); + this->JoinDefines(releaseDefinesSet, releaseDefines, ""); + this->JoinDefines(minsizeDefinesSet, minsizeDefines, ""); + this->JoinDefines(debugrelDefinesSet, debugrelDefines, ""); + + flags += defines; + flagsDebug += debugDefines; + flagsRelease += releaseDefines; + flagsMinSizeRel += minsizeDefines; + flagsRelWithDebInfo += debugrelDefines; + + // The template files have CXX FLAGS in them, that need to be replaced. + // There are not separate CXX and C template files, so we use the same + // variable names. The previous code sets up flags* variables to + // contain the correct C or CXX flags + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", + flagsMinSizeRel.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", + flagsDebug.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", + flagsRelWithDebInfo.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", + flagsRelease.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); + + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL", + minsizeDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", + debugDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO", + debugrelDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE", + releaseDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", + defines.c_str()); + } fout << line.c_str() << std::endl; } ----------------------------------------------------------------------- Summary of changes: Source/cmLocalVisualStudio6Generator.cxx | 149 +++++++++++++++--------------- 1 file changed, 75 insertions(+), 74 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Thu Mar 5 17:33:26 2015 From: steveire at gmail.com (Stephen Kelly) Date: Thu, 5 Mar 2015 17:33:26 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-859-g67f87e6 Message-ID: <20150305223326.4DD05AB6B2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 67f87e683f8845b688cccf663ae7454d96e6dfe3 (commit) via 37820a8f5a8bc3ee186fa8c6e0a30991b245c36e (commit) via da79119d0d6c3f5e582ab75b95f0c1f9c020a866 (commit) via f41e3d250966827dd205b7b2bad71a92536ae6f6 (commit) via cc79c8aed0dd5a9fe3d757ff9ce6d62a9210820c (commit) via 5af5028a17c37727a4fdacfa6e422d3bf53abfed (commit) from aa18ddf66c2c8fa245e3e514eff15f005f1308c1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67f87e683f8845b688cccf663ae7454d96e6dfe3 commit 67f87e683f8845b688cccf663ae7454d96e6dfe3 Merge: aa18ddf 37820a8 Author: Stephen Kelly AuthorDate: Thu Mar 5 17:33:24 2015 -0500 Commit: CMake Topic Stage CommitDate: Thu Mar 5 17:33:24 2015 -0500 Merge topic 'refactor-GeneratorExpression' into next 37820a8f Genex: Extend cmGeneratorExpressionContext constructor. da79119d Genex: Split cmGeneratorExpressionContext into own file. f41e3d25 Genex: Split cmGeneratorExpressionNode into own file. cc79c8ae Genex: Extract an evaluateWithContext method. 5af5028a Help: Move docs of $<0:...> and $<1:...> to output section. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=37820a8f5a8bc3ee186fa8c6e0a30991b245c36e commit 37820a8f5a8bc3ee186fa8c6e0a30991b245c36e Author: Stephen Kelly AuthorDate: Sun Feb 22 21:41:06 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 23:32:59 2015 +0100 Genex: Extend cmGeneratorExpressionContext constructor. Initialize the members in the appropriate place. diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index a4990dc..2d795cb 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -72,19 +72,10 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmGeneratorExpressionDAGChecker *dagChecker, std::string const& language) const { - cmGeneratorExpressionContext context; - context.Makefile = mf; - context.Config = config; - context.Quiet = quiet; - context.HadError = false; - context.HadContextSensitiveCondition = false; - context.HadHeadSensitiveCondition = false; - context.SourceSensitiveTargets.clear(); - context.HeadTarget = headTarget; - context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; - context.CurrentTarget = currentTarget ? currentTarget : headTarget; - context.Backtrace = this->Backtrace; - context.Language = language; + cmGeneratorExpressionContext context(mf, config, quiet, headTarget, + currentTarget ? currentTarget : headTarget, + this->EvaluateForBuildsystem, + this->Backtrace, language); return this->EvaluateWithContext(context, dagChecker); } diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx index 4ed8ff2..9722d11 100644 --- a/Source/cmGeneratorExpressionContext.cxx +++ b/Source/cmGeneratorExpressionContext.cxx @@ -12,7 +12,23 @@ #include "cmGeneratorExpressionContext.h" -cmGeneratorExpressionContext::cmGeneratorExpressionContext(); - : Backtrace(NULL) +cmGeneratorExpressionContext::cmGeneratorExpressionContext( + cmMakefile* mf, std::string const& config, + bool quiet, cmTarget const* headTarget, + cmTarget const* currentTarget, + bool evaluateForBuildsystem, + cmListFileBacktrace const& backtrace, + std::string const& language) + : Backtrace(backtrace), + Makefile(mf), + Config(config), + HeadTarget(headTarget), + CurrentTarget(currentTarget), + Quiet(quiet), + HadError(false), + HadContextSensitiveCondition(false), + HadHeadSensitiveCondition(false), + EvaluateForBuildsystem(evaluateForBuildsystem), + Language(language) { } diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h index 595378a..c02994f 100644 --- a/Source/cmGeneratorExpressionContext.h +++ b/Source/cmGeneratorExpressionContext.h @@ -23,7 +23,13 @@ class cmTarget; //---------------------------------------------------------------------------- struct cmGeneratorExpressionContext { - cmGeneratorExpressionContext(); + cmGeneratorExpressionContext(cmMakefile* mf, std::string const& config, + bool quiet, cmTarget const* headTarget, + cmTarget const* currentTarget, + bool evaluateForBuildsystem, + cmListFileBacktrace const& backtrace, + std::string const& language); + cmListFileBacktrace Backtrace; std::set DependTargets; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=da79119d0d6c3f5e582ab75b95f0c1f9c020a866 commit da79119d0d6c3f5e582ab75b95f0c1f9c020a866 Author: Stephen Kelly AuthorDate: Wed Mar 4 23:53:22 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 23:32:59 2015 +0100 Genex: Split cmGeneratorExpressionContext into own file. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8d0d484..482bd39 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -238,6 +238,8 @@ set(SRCS cmFileTimeComparison.cxx cmFileTimeComparison.h cmGeneratedFileStream.cxx + cmGeneratorExpressionContext.cxx + cmGeneratorExpressionContext.h cmGeneratorExpressionDAGChecker.cxx cmGeneratorExpressionDAGChecker.h cmGeneratorExpressionEvaluator.cxx diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx new file mode 100644 index 0000000..4ed8ff2 --- /dev/null +++ b/Source/cmGeneratorExpressionContext.cxx @@ -0,0 +1,18 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmGeneratorExpressionContext.h" + +cmGeneratorExpressionContext::cmGeneratorExpressionContext(); + : Backtrace(NULL) +{ +} diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h new file mode 100644 index 0000000..595378a --- /dev/null +++ b/Source/cmGeneratorExpressionContext.h @@ -0,0 +1,48 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionContext_h +#define cmGeneratorExpressionContext_h + +#include +#include +#include + +#include "cmListFileCache.h" + +class cmTarget; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionContext +{ + cmGeneratorExpressionContext(); + + cmListFileBacktrace Backtrace; + std::set DependTargets; + std::set AllTargets; + std::set SeenTargetProperties; + std::set SourceSensitiveTargets; + std::map > + MaxLanguageStandard; + cmMakefile *Makefile; + std::string Config; + std::string Language; + cmTarget const* HeadTarget; // The target whose property is being evaluated. + cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears + // directly or indirectly in the property. + bool Quiet; + bool HadError; + bool HadContextSensitiveCondition; + bool HadHeadSensitiveCondition; + bool EvaluateForBuildsystem; +}; + +#endif diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index b1fec0b..7c1bd8c 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -16,37 +16,10 @@ #include #include "cmListFileCache.h" +#include "cmGeneratorExpressionContext.h" class cmTarget; -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionContext -{ - cmGeneratorExpressionContext() - : Backtrace(NULL) - { - } - - cmListFileBacktrace Backtrace; - std::set DependTargets; - std::set AllTargets; - std::set SeenTargetProperties; - std::set SourceSensitiveTargets; - std::map > - MaxLanguageStandard; - cmMakefile *Makefile; - std::string Config; - std::string Language; - cmTarget const* HeadTarget; // The target whose property is being evaluated. - cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears - // directly or indirectly in the property. - bool Quiet; - bool HadError; - bool HadContextSensitiveCondition; - bool HadHeadSensitiveCondition; - bool EvaluateForBuildsystem; -}; - struct cmGeneratorExpressionDAGChecker; struct cmGeneratorExpressionNode; diff --git a/bootstrap b/bootstrap index 6bc87ed..4239802 100755 --- a/bootstrap +++ b/bootstrap @@ -267,6 +267,7 @@ CMAKE_CXX_SOURCES="\ cmInstallDirectoryGenerator \ cmGeneratedFileStream \ cmGeneratorTarget \ + cmGeneratorExpressionContext \ cmGeneratorExpressionDAGChecker \ cmGeneratorExpressionEvaluator \ cmGeneratorExpressionLexer \ http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f41e3d250966827dd205b7b2bad71a92536ae6f6 commit f41e3d250966827dd205b7b2bad71a92536ae6f6 Author: Stephen Kelly AuthorDate: Sun Feb 22 23:32:11 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 23:32:58 2015 +0100 Genex: Split cmGeneratorExpressionNode into own file. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 5b518b8..8d0d484 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -244,6 +244,8 @@ set(SRCS cmGeneratorExpressionEvaluator.h cmGeneratorExpressionLexer.cxx cmGeneratorExpressionLexer.h + cmGeneratorExpressionNode.cxx + cmGeneratorExpressionNode.h cmGeneratorExpressionParser.cxx cmGeneratorExpressionParser.h cmGeneratorExpression.cxx diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index f289ead..f2ffeef 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -24,1892 +24,7 @@ #include #include -//---------------------------------------------------------------------------- -static void reportError(cmGeneratorExpressionContext *context, - const std::string &expr, const std::string &result) -{ - context->HadError = true; - if (context->Quiet) - { - return; - } - - std::ostringstream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); -} - -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionNode -{ - enum { - DynamicParameters = 0, - OneOrMoreParameters = -1, - OneOrZeroParameters = -2 - }; - virtual ~cmGeneratorExpressionNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool RequiresLiteralInput() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const - { return false; } - - virtual int NumExpectedParameters() const { return 1; } - - virtual std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker - ) const = 0; - - static std::string EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker); -}; - -//---------------------------------------------------------------------------- -std::string cmGeneratorExpressionNode::EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker) -{ - cmGeneratorExpression ge(&context->Backtrace); - cmsys::auto_ptr cge = ge.Parse(prop); - cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); - std::string result = cge->Evaluate(makefile, - context->Config, - context->Quiet, - headTarget, - currentTarget, - dagChecker, - context->Language); - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } - if (cge->GetHadHeadSensitiveCondition()) - { - context->HadHeadSensitiveCondition = true; - } - return result; -} - -//---------------------------------------------------------------------------- -static const struct ZeroNode : public cmGeneratorExpressionNode -{ - ZeroNode() {} - - virtual bool GeneratesContent() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return std::string(); - } -} zeroNode; - -//---------------------------------------------------------------------------- -static const struct OneNode : public cmGeneratorExpressionNode -{ - OneNode() {} - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } -} oneNode; - -//---------------------------------------------------------------------------- -static const struct OneNode buildInterfaceNode; - -//---------------------------------------------------------------------------- -static const struct ZeroNode installInterfaceNode; - -//---------------------------------------------------------------------------- -#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ -static const struct OP ## Node : public cmGeneratorExpressionNode \ -{ \ - OP ## Node () {} \ - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \ - \ - std::string Evaluate(const std::vector ¶meters, \ - cmGeneratorExpressionContext *context, \ - const GeneratorExpressionContent *content, \ - cmGeneratorExpressionDAGChecker *) const \ - { \ - std::vector::const_iterator it = parameters.begin(); \ - const std::vector::const_iterator end = parameters.end(); \ - for ( ; it != end; ++it) \ - { \ - if (*it == #FAILURE_VALUE) \ - { \ - return #FAILURE_VALUE; \ - } \ - else if (*it != #SUCCESS_VALUE) \ - { \ - reportError(context, content->GetOriginalExpression(), \ - "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ - return std::string(); \ - } \ - } \ - return #SUCCESS_VALUE; \ - } \ -} OPNAME; - -BOOLEAN_OP_NODE(andNode, AND, 1, 0) -BOOLEAN_OP_NODE(orNode, OR, 0, 1) - -#undef BOOLEAN_OP_NODE - -//---------------------------------------------------------------------------- -static const struct NotNode : public cmGeneratorExpressionNode -{ - NotNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (*parameters.begin() != "0" && *parameters.begin() != "1") - { - reportError(context, content->GetOriginalExpression(), - "$ parameter must resolve to exactly one '0' or '1' value."); - return std::string(); - } - return *parameters.begin() == "0" ? "1" : "0"; - } -} notNode; - -//---------------------------------------------------------------------------- -static const struct BoolNode : public cmGeneratorExpressionNode -{ - BoolNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; - } -} boolNode; - -//---------------------------------------------------------------------------- -static const struct StrEqualNode : public cmGeneratorExpressionNode -{ - StrEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return *parameters.begin() == parameters[1] ? "1" : "0"; - } -} strEqualNode; - -//---------------------------------------------------------------------------- -static const struct EqualNode : public cmGeneratorExpressionNode -{ - EqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - char *pEnd; - - int base = 0; - bool flipSign = false; - - const char *lhs = parameters[0].c_str(); - if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B")) - { - base = 2; - lhs += 2; - } - if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B")) - { - base = 2; - lhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B")) - { - base = 2; - lhs += 3; - } - - long lnum = strtol(lhs, &pEnd, base); - if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[0] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - lnum = -lnum; - } - - base = 0; - flipSign = false; - - const char *rhs = parameters[1].c_str(); - if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B")) - { - base = 2; - rhs += 2; - } - if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B")) - { - base = 2; - rhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B")) - { - base = 2; - rhs += 3; - } - - long rnum = strtol(rhs, &pEnd, base); - if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[1] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - rnum = -rnum; - } - - return lnum == rnum ? "1" : "0"; - } -} equalNode; - -//---------------------------------------------------------------------------- -static const struct LowerCaseNode : public cmGeneratorExpressionNode -{ - LowerCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::LowerCase(parameters.front()); - } -} lowerCaseNode; - -//---------------------------------------------------------------------------- -static const struct UpperCaseNode : public cmGeneratorExpressionNode -{ - UpperCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::UpperCase(parameters.front()); - } -} upperCaseNode; - -//---------------------------------------------------------------------------- -static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode -{ - MakeCIdentifierNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::MakeCidentifier(parameters.front()); - } -} makeCIdentifierNode; - -//---------------------------------------------------------------------------- -static const struct Angle_RNode : public cmGeneratorExpressionNode -{ - Angle_RNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ">"; - } -} angle_rNode; - -//---------------------------------------------------------------------------- -static const struct CommaNode : public cmGeneratorExpressionNode -{ - CommaNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ","; - } -} commaNode; - -//---------------------------------------------------------------------------- -static const struct SemicolonNode : public cmGeneratorExpressionNode -{ - SemicolonNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ";"; - } -} semicolonNode; - -//---------------------------------------------------------------------------- -struct CompilerIdNode : public cmGeneratorExpressionNode -{ - CompilerIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerId = - context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID"); - if (parameters.empty()) - { - return compilerId ? compilerId : ""; - } - static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), compilerId) == 0) - { - return "1"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) - { - switch(context->Makefile->GetPolicyStatus(cmPolicies::CMP0044)) - { - case cmPolicies::WARN: - { - std::ostringstream e; - e << context->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0044); - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::AUTHOR_WARNING, - e.str(), context->Backtrace); - } - case cmPolicies::OLD: - return "1"; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; - } - } - return "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerIdNode : public CompilerIdNode -{ - CCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerIdNode; - -//---------------------------------------------------------------------------- -static const struct CXXCompilerIdNode : public CompilerIdNode -{ - CXXCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerIdNode; - -//---------------------------------------------------------------------------- -struct CompilerVersionNode : public cmGeneratorExpressionNode -{ - CompilerVersionNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerVersion = context->Makefile->GetSafeDefinition( - "CMAKE_" + lang + "_COMPILER_VERSION"); - if (parameters.empty()) - { - return compilerVersion ? compilerVersion : ""; - } - - static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerVersion) - { - return parameters.front().empty() ? "1" : "0"; - } - - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.begin()->c_str(), - compilerVersion) ? "1" : "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerVersionNode : public CompilerVersionNode -{ - CCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerVersionNode; - -//---------------------------------------------------------------------------- -static const struct CxxCompilerVersionNode : public CompilerVersionNode -{ - CxxCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerVersionNode; - - -//---------------------------------------------------------------------------- -struct PlatformIdNode : public cmGeneratorExpressionNode -{ - PlatformIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - const char *platformId = - context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); - if (parameters.empty()) - { - return platformId ? platformId : ""; - } - - if (!platformId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), platformId) == 0) - { - return "1"; - } - return "0"; - } -} platformIdNode; - -//---------------------------------------------------------------------------- -static const struct VersionGreaterNode : public cmGeneratorExpressionNode -{ - VersionGreaterNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionGreaterNode; - -//---------------------------------------------------------------------------- -static const struct VersionLessNode : public cmGeneratorExpressionNode -{ - VersionLessNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionLessNode; - -//---------------------------------------------------------------------------- -static const struct VersionEqualNode : public cmGeneratorExpressionNode -{ - VersionEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionEqualNode; - -//---------------------------------------------------------------------------- -static const struct LinkOnlyNode : public cmGeneratorExpressionNode -{ - LinkOnlyNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(!dagChecker->GetTransitivePropertiesOnly()) - { - return parameters.front(); - } - return ""; - } -} linkOnlyNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationNode : public cmGeneratorExpressionNode -{ - ConfigurationNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - context->HadContextSensitiveCondition = true; - return context->Config; - } -} configurationNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationTestNode : public cmGeneratorExpressionNode -{ - ConfigurationTestNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (parameters.empty()) - { - return configurationNode.Evaluate(parameters, context, content, 0); - } - static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$"); - if (!configValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - context->HadContextSensitiveCondition = true; - if (context->Config.empty()) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), - context->Config.c_str()) == 0) - { - return "1"; - } - - if (context->CurrentTarget - && context->CurrentTarget->IsImported()) - { - const char* loc = 0; - const char* imp = 0; - std::string suffix; - if (context->CurrentTarget->GetMappedConfig(context->Config, - &loc, - &imp, - suffix)) - { - // This imported target has an appropriate location - // for this (possibly mapped) config. - // Check if there is a proper config mapping for the tested config. - std::vector mappedConfigs; - std::string mapProp = "MAP_IMPORTED_CONFIG_"; - mapProp += cmSystemTools::UpperCase(context->Config); - if(const char* mapValue = - context->CurrentTarget->GetProperty(mapProp)) - { - cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), - mappedConfigs); - return std::find(mappedConfigs.begin(), mappedConfigs.end(), - cmSystemTools::UpperCase(parameters.front())) - != mappedConfigs.end() ? "1" : "0"; - } - } - } - return "0"; - } -} configurationTestNode; - -static const struct JoinNode : public cmGeneratorExpressionNode -{ - JoinNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - std::vector list; - cmSystemTools::ExpandListArgument(parameters.front(), list); - return cmJoin(list, parameters[1]); - } -} joinNode; - -static const struct CompileLanguageNode : public cmGeneratorExpressionNode -{ - CompileLanguageNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(context->Language.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used to specify include " - "directories compile definitions, compile options and to evaluate " - "components of the file(GENERATE) command."); - return std::string(); - } - - std::vector enabledLanguages; - cmGlobalGenerator* gg - = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->GetEnabledLanguages(enabledLanguages); - if (!parameters.empty() && - std::find(enabledLanguages.begin(), enabledLanguages.end(), - parameters.front()) == enabledLanguages.end()) - { - reportError(context, content->GetOriginalExpression(), - "$ Unknown language."); - return std::string(); - } - - if (gg->GetName().find("Visual Studio") != std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ may not be used with Visual Studio " - "generators."); - return std::string(); - } - else if (gg->GetName().find("Xcode") != std::string::npos) - { - if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() - || dagChecker->EvaluatingIncludeDirectories())) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with COMPILE_OPTIONS " - "with the Xcode generator."); - return std::string(); - } - } - else - { - if(gg->GetName().find("Makefiles") == std::string::npos && - gg->GetName().find("Ninja") == std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ not supported for this generator."); - return std::string(); - } - } - if (parameters.empty()) - { - return context->Language; - } - return context->Language == parameters.front() ? "1" : "0"; - } -} languageNode; - -#define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ - , "INTERFACE_" #PROPERTY - -//---------------------------------------------------------------------------- -static const char* targetPropertyTransitiveWhitelist[] = { - 0 - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME) -}; - -#undef TRANSITIVE_PROPERTY_NAME - -template -std::string -getLinkedTargetsContent( - std::vector const &libraries, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) -{ - std::string linkedTargetsContent; - std::string sep; - std::string depString; - for (typename std::vector::const_iterator it = libraries.begin(); - it != libraries.end(); ++it) - { - // Broken code can have a target in its own link interface. - // Don't follow such link interface entries so as not to create a - // self-referencing loop. - if (it->Target && it->Target != target) - { - depString += - sep + "$Target->GetName() + "," + interfacePropertyName + ">"; - sep = ";"; - } - } - if(!depString.empty()) - { - linkedTargetsContent = - cmGeneratorExpressionNode::EvaluateDependentExpression(depString, - target->GetMakefile(), context, - headTarget, target, dagChecker); - } - linkedTargetsContent = - cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); - return linkedTargetsContent; -} - -//---------------------------------------------------------------------------- -static const struct TargetPropertyNode : public cmGeneratorExpressionNode -{ - TargetPropertyNode() {} - - // This node handles errors on parameter count itself. - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagCheckerParent - ) const - { - if (parameters.size() != 1 && parameters.size() != 2) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires one or two parameters"); - return std::string(); - } - static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); - - cmTarget const* target = context->HeadTarget; - std::string propertyName = *parameters.begin(); - - if (parameters.size() == 1) - { - context->HadHeadSensitiveCondition = true; - } - if (!target && parameters.size() == 1) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. " - "It may not be used with add_custom_command or add_custom_target. " - "Specify the target to read a property from using the " - "$ signature instead."); - return std::string(); - } - - if (parameters.size() == 2) - { - if (parameters.begin()->empty() && parameters[1].empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name and property name."); - return std::string(); - } - if (parameters.begin()->empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name."); - return std::string(); - } - - std::string targetName = parameters.front(); - propertyName = parameters[1]; - if (!cmGeneratorExpression::IsValidTargetName(targetName)) - { - if (!propertyNameValidator.find(propertyName.c_str())) - { - ::reportError(context, content->GetOriginalExpression(), - "Target name and property name not supported."); - return std::string(); - } - ::reportError(context, content->GetOriginalExpression(), - "Target name not supported."); - return std::string(); - } - if(propertyName == "ALIASED_TARGET") - { - if(context->Makefile->IsAlias(targetName)) - { - if(cmTarget* tgt = context->Makefile->FindTargetToUse(targetName)) - { - return tgt->GetName(); - } - } - return ""; - } - target = context->Makefile->FindTargetToUse(targetName); - - if (!target) - { - std::ostringstream e; - e << "Target \"" - << targetName - << "\" not found."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - context->AllTargets.insert(target); - } - - if (target == context->HeadTarget) - { - // Keep track of the properties seen while processing. - // The evaluation of the LINK_LIBRARIES generator expressions - // will check this to ensure that properties have one consistent - // value for all evaluations. - context->SeenTargetProperties.insert(propertyName); - } - if (propertyName == "SOURCES") - { - context->SourceSensitiveTargets.insert(target); - } - - if (propertyName.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty property " - "name."); - return std::string(); - } - - if (!propertyNameValidator.find(propertyName)) - { - ::reportError(context, content->GetOriginalExpression(), - "Property name not supported."); - return std::string(); - } - - assert(target); - - if (propertyName == "LINKER_LANGUAGE") - { - if (target->LinkLanguagePropagatesToDependents() && - dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries() - || dagCheckerParent->EvaluatingSources())) - { - reportError(context, content->GetOriginalExpression(), - "LINKER_LANGUAGE target property can not be used while evaluating " - "link libraries for a static library"); - return std::string(); - } - return target->GetLinkerLanguage(context->Config); - } - - cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, - target->GetName(), - propertyName, - content, - dagCheckerParent); - - switch (dagChecker.Check()) - { - case cmGeneratorExpressionDAGChecker::SELF_REFERENCE: - dagChecker.ReportError(context, content->GetOriginalExpression()); - return std::string(); - case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: - // No error. We just skip cyclic references. - return std::string(); - case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: - for (size_t i = 1; - i < cmArraySize(targetPropertyTransitiveWhitelist); - ++i) - { - if (targetPropertyTransitiveWhitelist[i] == propertyName) - { - // No error. We're not going to find anything new here. - return std::string(); - } - } - case cmGeneratorExpressionDAGChecker::DAG: - break; - } - - const char *prop = target->GetProperty(propertyName); - - if (dagCheckerParent) - { - if (dagCheckerParent->EvaluatingLinkLibraries()) - { -#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ - (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || - if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE) - false) - { - reportError(context, content->GetOriginalExpression(), - "$ expression in link libraries " - "evaluation depends on target property which is transitive " - "over the link libraries, creating a recursion."); - return std::string(); - } -#undef TRANSITIVE_PROPERTY_COMPARE - - if(!prop) - { - return std::string(); - } - } - else - { -#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) \ - dagCheckerParent->METHOD () || - - assert( - CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( - ASSERT_TRANSITIVE_PROPERTY_METHOD) - false); -#undef ASSERT_TRANSITIVE_PROPERTY_METHOD - } - } - - std::string linkedTargetsContent; - - std::string interfacePropertyName; - bool isInterfaceProperty = false; - -#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \ - if (propertyName == #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - } \ - else if (propertyName == "INTERFACE_" #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - isInterfaceProperty = true; \ - } \ - else - - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME) - // Note that the above macro terminates with an else - /* else */ if (cmHasLiteralPrefix(propertyName.c_str(), - "COMPILE_DEFINITIONS_")) - { - cmPolicies::PolicyStatus polSt = - context->Makefile->GetPolicyStatus(cmPolicies::CMP0043); - if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) - { - interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; - } - } -#undef POPULATE_INTERFACE_PROPERTY_NAME - cmTarget const* headTarget = context->HeadTarget && isInterfaceProperty - ? context->HeadTarget : target; - - if(isInterfaceProperty) - { - if(cmTarget::LinkInterfaceLibraries const* iface = - target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) - { - linkedTargetsContent = - getLinkedTargetsContent(iface->Libraries, target, - headTarget, - context, &dagChecker, - interfacePropertyName); - } - } - else if(!interfacePropertyName.empty()) - { - if(cmTarget::LinkImplementationLibraries const* impl = - target->GetLinkImplementationLibraries(context->Config)) - { - linkedTargetsContent = - getLinkedTargetsContent(impl->Libraries, target, - target, - context, &dagChecker, - interfacePropertyName); - } - } - - if (!prop) - { - if (target->IsImported() - || target->GetType() == cmTarget::INTERFACE_LIBRARY) - { - return linkedTargetsContent; - } - if (target->IsLinkInterfaceDependentBoolProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - return target->GetLinkInterfaceDependentBoolProperty( - propertyName, - context->Config) ? "1" : "0"; - } - if (target->IsLinkInterfaceDependentStringProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentStringProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - - return linkedTargetsContent; - } - - if (!target->IsImported() - && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) - { - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - } - if(!interfacePropertyName.empty()) - { - std::string result = this->EvaluateDependentExpression(prop, - context->Makefile, context, - headTarget, target, &dagChecker); - if (!linkedTargetsContent.empty()) - { - result += (result.empty() ? "" : ";") + linkedTargetsContent; - } - return result; - } - return prop; - } -} targetPropertyNode; - -//---------------------------------------------------------------------------- -static const struct TargetNameNode : public cmGeneratorExpressionNode -{ - TargetNameNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - virtual bool RequiresLiteralInput() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } - - virtual int NumExpectedParameters() const { return 1; } - -} targetNameNode; - -//---------------------------------------------------------------------------- -static const struct TargetObjectsNode : public cmGeneratorExpressionNode -{ - TargetObjectsNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->EvaluateForBuildsystem) - { - std::ostringstream e; - e << "The evaluation of the TARGET_OBJECTS generator expression " - "is only suitable for consumption by CMake. It is not suitable " - "for writing out elsewhere."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::string tgtName = parameters.front(); - cmGeneratorTarget* gt = - context->Makefile->FindGeneratorTargetToUse(tgtName); - if (!gt) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but no such target exists."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - if (gt->GetType() != cmTarget::OBJECT_LIBRARY) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but is not an OBJECT library."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::vector objectSources; - gt->GetObjectSources(objectSources, context->Config); - std::map mapping; - - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - mapping[*it]; - } - - gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - - std::string obj_dir = gt->ObjectDirectory; - std::string result; - const char* sep = ""; - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - // Find the object file name corresponding to this source file. - std::map::const_iterator - map_it = mapping.find(*it); - // It must exist because we populated the mapping just above. - assert(!map_it->second.empty()); - result += sep; - std::string objFile = obj_dir + map_it->second; - cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true); - sf->SetObjectLibrary(tgtName); - sf->SetProperty("EXTERNAL_OBJECT", "1"); - result += objFile; - sep = ";"; - } - return result; - } -} targetObjectsNode; - -//---------------------------------------------------------------------------- -static const struct CompileFeaturesNode : public cmGeneratorExpressionNode -{ - CompileFeaturesNode() {} - - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - cmTarget const* target = context->HeadTarget; - if (!target) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - context->HadHeadSensitiveCondition = true; - - typedef std::map > LangMap; - static LangMap availableFeatures; - - LangMap testedFeatures; - - for (std::vector::const_iterator it = parameters.begin(); - it != parameters.end(); ++it) - { - std::string error; - std::string lang; - if (!context->Makefile->CompileFeatureKnown(context->HeadTarget, - *it, lang, &error)) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - testedFeatures[lang].push_back(*it); - - if (availableFeatures.find(lang) == availableFeatures.end()) - { - const char* featuresKnown - = context->Makefile->CompileFeaturesAvailable(lang, &error); - if (!featuresKnown) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - cmSystemTools::ExpandListArgument(featuresKnown, - availableFeatures[lang]); - } - } - - bool evalLL = dagChecker && dagChecker->EvaluatingLinkLibraries(); - - std::string result; - - for (LangMap::const_iterator lit = testedFeatures.begin(); - lit != testedFeatures.end(); ++lit) - { - std::vector const& langAvailable - = availableFeatures[lit->first]; - const char* standardDefault = context->Makefile - ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT"); - for (std::vector::const_iterator it = lit->second.begin(); - it != lit->second.end(); ++it) - { - if (std::find(langAvailable.begin(), langAvailable.end(), *it) - == langAvailable.end()) - { - return "0"; - } - if (standardDefault && !*standardDefault) - { - // This compiler has no notion of language standard levels. - // All features known for the language are always available. - continue; - } - if (!context->Makefile->HaveStandardAvailable(target, - lit->first, *it)) - { - if (evalLL) - { - const char* l = target->GetProperty(lit->first + "_STANDARD"); - if (!l) - { - l = standardDefault; - } - assert(l); - context->MaxLanguageStandard[target][lit->first] = l; - } - else - { - return "0"; - } - } - } - } - return "1"; - } -} compileFeaturesNode; - -//---------------------------------------------------------------------------- -static const char* targetPolicyWhitelist[] = { - 0 -#define TARGET_POLICY_STRING(POLICY) \ - , #POLICY - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING) - -#undef TARGET_POLICY_STRING -}; - -cmPolicies::PolicyStatus statusForTarget(cmTarget const* tgt, - const char *policy) -{ -#define RETURN_POLICY(POLICY) \ - if (strcmp(policy, #POLICY) == 0) \ - { \ - return tgt->GetPolicyStatus ## POLICY (); \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY) - -#undef RETURN_POLICY - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::WARN; -} - -cmPolicies::PolicyID policyForString(const char *policy_id) -{ -#define RETURN_POLICY_ID(POLICY_ID) \ - if (strcmp(policy_id, #POLICY_ID) == 0) \ - { \ - return cmPolicies:: POLICY_ID; \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID) - -#undef RETURN_POLICY_ID - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::CMP0002; -} - -//---------------------------------------------------------------------------- -static const struct TargetPolicyNode : public cmGeneratorExpressionNode -{ - TargetPolicyNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context , - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - - context->HadContextSensitiveCondition = true; - context->HadHeadSensitiveCondition = true; - - for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) - { - const char *policy = targetPolicyWhitelist[i]; - if (parameters.front() == policy) - { - cmMakefile *mf = context->HeadTarget->GetMakefile(); - switch(statusForTarget(context->HeadTarget, policy)) - { - case cmPolicies::WARN: - mf->IssueMessage(cmake::AUTHOR_WARNING, - mf->GetPolicies()-> - GetPolicyWarning(policyForString(policy))); - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::OLD: - return "0"; - case cmPolicies::NEW: - return "1"; - } - } - } - reportError(context, content->GetOriginalExpression(), - "$ may only be used with a limited number of " - "policies. Currently it may be used with the following policies:\n" - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -#define TARGET_POLICY_LIST_ITEM(POLICY) \ - " * " STRINGIFY(POLICY) "\n" - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM) - -#undef TARGET_POLICY_LIST_ITEM - ); - return std::string(); - } - -} targetPolicyNode; - -//---------------------------------------------------------------------------- -static const struct InstallPrefixNode : public cmGeneratorExpressionNode -{ - InstallPrefixNode() {} - - virtual bool GeneratesContent() const { return true; } - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - reportError(context, content->GetOriginalExpression(), - "INSTALL_PREFIX is a marker for install(EXPORT) only. It " - "should never be evaluated."); - return std::string(); - } - -} installPrefixNode; - -//---------------------------------------------------------------------------- -class ArtifactNameTag; -class ArtifactLinkerTag; -class ArtifactSonameTag; -class ArtifactPdbTag; - -class ArtifactPathTag; -class ArtifactDirTag; -class ArtifactNameTag; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The target soname file (.so.1). - if(target->IsDLLPlatform()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is not allowed " - "for DLL target platforms."); - return std::string(); - } - if(target->GetType() != cmTarget::SHARED_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is allowed only for " - "SHARED libraries."); - return std::string(); - } - std::string result = target->GetDirectory(context->Config); - result += "/"; - result += target->GetSOName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - std::string language = target->GetLinkerLanguage(context->Config); - - std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; - - if(!context->Makefile->IsOn(pdbSupportVar)) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is not supported by the target linker."); - return std::string(); - } - - cmTarget::TargetType targetType = target->GetType(); - - if(targetType != cmTarget::SHARED_LIBRARY && - targetType != cmTarget::MODULE_LIBRARY && - targetType != cmTarget::EXECUTABLE) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is allowed only for " - "targets with linker created artifacts."); - return std::string(); - } - - std::string result = target->GetPDBDirectory(context->Config); - result += "/"; - result += target->GetPDBName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The file used to link to the target (.so, .lib, .a). - if(!target->IsLinkable()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_LINKER_FILE is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); - return std::string(); - } - return target->GetFullPath(context->Config, - target->HasImportLibrary()); - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *) - { - return target->GetFullPath(context->Config, false, true); - } -}; - - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenameName(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenamePath(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return result; } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifact : public cmGeneratorExpressionNode -{ - TargetFilesystemArtifact() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - // Lookup the referenced target. - std::string name = *parameters.begin(); - - if (!cmGeneratorExpression::IsValidTargetName(name)) - { - ::reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - cmTarget* target = context->Makefile->FindTargetToUse(name); - if(!target) - { - ::reportError(context, content->GetOriginalExpression(), - "No target \"" + name + "\""); - return std::string(); - } - if(target->GetType() >= cmTarget::OBJECT_LIBRARY && - target->GetType() != cmTarget::UNKNOWN_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "Target \"" + name + "\" is not an executable or library."); - return std::string(); - } - if (dagChecker && (dagChecker->EvaluatingLinkLibraries(name.c_str()) - || (dagChecker->EvaluatingSources() - && name == dagChecker->TopTarget()))) - { - ::reportError(context, content->GetOriginalExpression(), - "Expressions which require the linker language may not " - "be used while evaluating link libraries"); - return std::string(); - } - context->DependTargets.insert(target); - context->AllTargets.insert(target); - - std::string result = - TargetFilesystemArtifactResultCreator::Create( - target, - context, - content); - if (context->HadError) - { - return std::string(); - } - return - TargetFilesystemArtifactResultGetter::Get(result); - } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactNodeGroup -{ - TargetFilesystemArtifactNodeGroup() - { - } - - TargetFilesystemArtifact File; - TargetFilesystemArtifact FileName; - TargetFilesystemArtifact FileDir; -}; - -//---------------------------------------------------------------------------- -static const -TargetFilesystemArtifactNodeGroup targetNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; - -//---------------------------------------------------------------------------- -static const -cmGeneratorExpressionNode* GetNode(const std::string &identifier) -{ - typedef std::map NodeMap; - static NodeMap nodeMap; - if (nodeMap.empty()) - { - nodeMap["0"] = &zeroNode; - nodeMap["1"] = &oneNode; - nodeMap["AND"] = &andNode; - nodeMap["OR"] = &orNode; - nodeMap["NOT"] = ¬Node; - nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; - nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; - nodeMap["VERSION_GREATER"] = &versionGreaterNode; - nodeMap["VERSION_LESS"] = &versionLessNode; - nodeMap["VERSION_EQUAL"] = &versionEqualNode; - nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; - nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; - nodeMap["PLATFORM_ID"] = &platformIdNode; - nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; - nodeMap["CONFIGURATION"] = &configurationNode; - nodeMap["CONFIG"] = &configurationTestNode; - nodeMap["TARGET_FILE"] = &targetNodeGroup.File; - nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; - nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; - nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; - nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; - nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; - nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; - nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; - nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; - nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; - nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; - nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; - nodeMap["STREQUAL"] = &strEqualNode; - nodeMap["EQUAL"] = &equalNode; - nodeMap["LOWER_CASE"] = &lowerCaseNode; - nodeMap["UPPER_CASE"] = &upperCaseNode; - nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; - nodeMap["BOOL"] = &boolNode; - nodeMap["ANGLE-R"] = &angle_rNode; - nodeMap["COMMA"] = &commaNode; - nodeMap["SEMICOLON"] = &semicolonNode; - nodeMap["TARGET_PROPERTY"] = &targetPropertyNode; - nodeMap["TARGET_NAME"] = &targetNameNode; - nodeMap["TARGET_OBJECTS"] = &targetObjectsNode; - nodeMap["TARGET_POLICY"] = &targetPolicyNode; - nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; - nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; - nodeMap["INSTALL_PREFIX"] = &installPrefixNode; - nodeMap["JOIN"] = &joinNode; - nodeMap["LINK_ONLY"] = &linkOnlyNode; - nodeMap["COMPILE_LANGUAGE"] = &languageNode; - } - NodeMap::const_iterator i = nodeMap.find(identifier); - if (i == nodeMap.end()) - { - return 0; - } - return i->second; - -} +#include "cmGeneratorExpressionNode.h" //---------------------------------------------------------------------------- GeneratorExpressionContent::GeneratorExpressionContent( @@ -1998,7 +113,8 @@ std::string GeneratorExpressionContent::Evaluate( } } - const cmGeneratorExpressionNode *node = GetNode(identifier); + const cmGeneratorExpressionNode *node = + cmGeneratorExpressionNode::GetNode(identifier); if (!node) { diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionNode.cxx similarity index 87% copy from Source/cmGeneratorExpressionEvaluator.cxx copy to Source/cmGeneratorExpressionNode.cxx index f289ead..2682f11 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -9,71 +9,9 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "cmMakefile.h" -#include "cmGeneratorExpressionEvaluator.h" -#include "cmGeneratorExpressionParser.h" -#include "cmGeneratorExpressionDAGChecker.h" -#include "cmGeneratorExpression.h" -#include "cmLocalGenerator.h" +#include "cmGeneratorExpressionNode.h" #include "cmGlobalGenerator.h" -#include "cmSourceFile.h" - -#include - -#include -#include - -//---------------------------------------------------------------------------- -static void reportError(cmGeneratorExpressionContext *context, - const std::string &expr, const std::string &result) -{ - context->HadError = true; - if (context->Quiet) - { - return; - } - - std::ostringstream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); -} - -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionNode -{ - enum { - DynamicParameters = 0, - OneOrMoreParameters = -1, - OneOrZeroParameters = -2 - }; - virtual ~cmGeneratorExpressionNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool RequiresLiteralInput() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const - { return false; } - - virtual int NumExpectedParameters() const { return 1; } - - virtual std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker - ) const = 0; - - static std::string EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker); -}; //---------------------------------------------------------------------------- std::string cmGeneratorExpressionNode::EvaluateDependentExpression( @@ -1847,8 +1785,8 @@ static const TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; //---------------------------------------------------------------------------- -static const -cmGeneratorExpressionNode* GetNode(const std::string &identifier) +const cmGeneratorExpressionNode* +cmGeneratorExpressionNode::GetNode(const std::string &identifier) { typedef std::map NodeMap; static NodeMap nodeMap; @@ -1908,229 +1846,23 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) return 0; } return i->second; - } //---------------------------------------------------------------------------- -GeneratorExpressionContent::GeneratorExpressionContent( - const char *startContent, - size_t length) - : StartContent(startContent), ContentLength(length) +void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result) { - -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::GetOriginalExpression() const -{ - return std::string(this->StartContent, this->ContentLength); -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::ProcessArbitraryContent( - const cmGeneratorExpressionNode *node, - const std::string &identifier, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - std::vector >::const_iterator - pit) const -{ - std::string result; - - const - std::vector >::const_iterator - pend = this->ParamChildren.end(); - for ( ; pit != pend; ++pit) - { - std::vector::const_iterator it - = pit->begin(); - const std::vector::const_iterator end - = pit->end(); - for ( ; it != end; ++it) - { - if (node->RequiresLiteralInput()) - { - if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires literal input."); - return std::string(); - } - } - result += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - if ((pit + 1) != pend) - { - result += ","; - } - } - if (node->RequiresLiteralInput()) - { - std::vector parameters; - parameters.push_back(result); - return node->Evaluate(parameters, context, this, dagChecker); - } - return result; -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::Evaluate( - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker) const -{ - std::string identifier; - { - std::vector::const_iterator it - = this->IdentifierChildren.begin(); - const std::vector::const_iterator end - = this->IdentifierChildren.end(); - for ( ; it != end; ++it) - { - identifier += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - } - - const cmGeneratorExpressionNode *node = GetNode(identifier); - - if (!node) - { - reportError(context, this->GetOriginalExpression(), - "Expression did not evaluate to a known generator expression"); - return std::string(); - } - - if (!node->GeneratesContent()) - { - if (node->NumExpectedParameters() == 1 - && node->AcceptsArbitraryContentParameter()) - { - if (this->ParamChildren.empty()) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires a parameter."); - } - } - else - { - std::vector parameters; - this->EvaluateParameters(node, identifier, context, dagChecker, - parameters); - } - return std::string(); - } - - std::vector parameters; - this->EvaluateParameters(node, identifier, context, dagChecker, parameters); - if (context->HadError) - { - return std::string(); - } - - return node->Evaluate(parameters, context, this, dagChecker); -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::EvaluateParameters( - const cmGeneratorExpressionNode *node, - const std::string &identifier, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - std::vector ¶meters) const -{ - const int numExpected = node->NumExpectedParameters(); - { - std::vector >::const_iterator - pit = this->ParamChildren.begin(); - const - std::vector >::const_iterator - pend = this->ParamChildren.end(); - const bool acceptsArbitraryContent - = node->AcceptsArbitraryContentParameter(); - int counter = 1; - for ( ; pit != pend; ++pit, ++counter) - { - if (acceptsArbitraryContent && counter == numExpected) - { - std::string lastParam = this->ProcessArbitraryContent(node, identifier, - context, - dagChecker, - pit); - parameters.push_back(lastParam); - return std::string(); - } - else - { - std::string parameter; - std::vector::const_iterator it = - pit->begin(); - const std::vector::const_iterator end = - pit->end(); - for ( ; it != end; ++it) - { - parameter += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - parameters.push_back(parameter); - } - } - } - - if ((numExpected > cmGeneratorExpressionNode::DynamicParameters - && (unsigned int)numExpected != parameters.size())) - { - if (numExpected == 0) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires no parameters."); - } - else if (numExpected == 1) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires " - "exactly one parameter."); - } - else - { - std::ostringstream e; - e << "$<" + identifier + "> expression requires " - << numExpected - << " comma separated parameters, but got " - << parameters.size() << " instead."; - reportError(context, this->GetOriginalExpression(), e.str()); - } - return std::string(); - } - - if (numExpected == cmGeneratorExpressionNode::OneOrMoreParameters - && parameters.empty()) - { - reportError(context, this->GetOriginalExpression(), "$<" + identifier - + "> expression requires at least one parameter."); - } - if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters - && parameters.size() > 1) + context->HadError = true; + if (context->Quiet) { - reportError(context, this->GetOriginalExpression(), "$<" + identifier - + "> expression requires one or zero parameters."); + return; } - return std::string(); -} -//---------------------------------------------------------------------------- -GeneratorExpressionContent::~GeneratorExpressionContent() -{ - cmDeleteAll(this->IdentifierChildren); - std::for_each(this->ParamChildren.begin(), this->ParamChildren.end(), - cmDeleteAll >); + std::ostringstream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << result; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str(), + context->Backtrace); } diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h new file mode 100644 index 0000000..847a00a --- /dev/null +++ b/Source/cmGeneratorExpressionNode.h @@ -0,0 +1,70 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionNode_h +#define cmGeneratorExpressionNode_h + +#include "cmMakefile.h" + +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionParser.h" +#include "cmGeneratorExpressionDAGChecker.h" +#include "cmGeneratorExpression.h" +#include "cmLocalGenerator.h" +#include "cmSourceFile.h" + +#include + +#include +#include + +#include "cmListFileCache.h" + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionNode +{ + enum { + DynamicParameters = 0, + OneOrMoreParameters = -1, + OneOrZeroParameters = -2 + }; + virtual ~cmGeneratorExpressionNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool RequiresLiteralInput() const { return false; } + + virtual bool AcceptsArbitraryContentParameter() const + { return false; } + + virtual int NumExpectedParameters() const { return 1; } + + virtual std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker + ) const = 0; + + static std::string EvaluateDependentExpression( + std::string const& prop, cmMakefile *makefile, + cmGeneratorExpressionContext *context, + cmTarget const* headTarget, cmTarget const* currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker); + + static const cmGeneratorExpressionNode* GetNode( + const std::string &identifier); +}; + +//---------------------------------------------------------------------------- +void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result); + +#endif diff --git a/bootstrap b/bootstrap index 320552a..6bc87ed 100755 --- a/bootstrap +++ b/bootstrap @@ -270,6 +270,7 @@ CMAKE_CXX_SOURCES="\ cmGeneratorExpressionDAGChecker \ cmGeneratorExpressionEvaluator \ cmGeneratorExpressionLexer \ + cmGeneratorExpressionNode \ cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc79c8aed0dd5a9fe3d757ff9ce6d62a9210820c commit cc79c8aed0dd5a9fe3d757ff9ce6d62a9210820c Author: Stephen Kelly AuthorDate: Sun Feb 22 21:30:44 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 23:25:34 2015 +0100 Genex: Extract an evaluateWithContext method. Make it easier to make modifications to the context before evaluating with it. diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 0a27016..a4990dc 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -72,18 +72,6 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmGeneratorExpressionDAGChecker *dagChecker, std::string const& language) const { - if (!this->NeedsEvaluation) - { - return this->Input.c_str(); - } - - this->Output = ""; - - std::vector::const_iterator it - = this->Evaluators.begin(); - const std::vector::const_iterator end - = this->Evaluators.end(); - cmGeneratorExpressionContext context; context.Makefile = mf; context.Config = config; @@ -98,6 +86,26 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.Backtrace = this->Backtrace; context.Language = language; + return this->EvaluateWithContext(context, dagChecker); +} + +//---------------------------------------------------------------------------- +const char* cmCompiledGeneratorExpression::EvaluateWithContext( + cmGeneratorExpressionContext& context, + cmGeneratorExpressionDAGChecker *dagChecker) const +{ + if (!this->NeedsEvaluation) + { + return this->Input.c_str(); + } + + this->Output = ""; + + std::vector::const_iterator it + = this->Evaluators.begin(); + const std::vector::const_iterator end + = this->Evaluators.end(); + for ( ; it != end; ++it) { this->Output += (*it)->Evaluate(&context, dagChecker); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 55d9691..11c27fd 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -24,6 +24,7 @@ class cmMakefile; class cmListFileBacktrace; struct cmGeneratorExpressionEvaluator; +struct cmGeneratorExpressionContext; struct cmGeneratorExpressionDAGChecker; class cmCompiledGeneratorExpression; @@ -131,6 +132,9 @@ public: std::map& mapping); private: + const char* EvaluateWithContext(cmGeneratorExpressionContext& context, + cmGeneratorExpressionDAGChecker *dagChecker) const; + cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, const std::string& input); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5af5028a17c37727a4fdacfa6e422d3bf53abfed commit 5af5028a17c37727a4fdacfa6e422d3bf53abfed Author: Stephen Kelly AuthorDate: Sun Feb 22 23:52:11 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 23:25:34 2015 +0100 Help: Move docs of $<0:...> and $<1:...> to output section. These are not 'logical' expressions. They create output and are often used together with the logical expressions. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index d38cf7e..477a132 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -40,10 +40,6 @@ otherwise expands to nothing. Available logical expressions are: -``$<0:...>`` - Empty string (ignores ``...``) -``$<1:...>`` - Content of ``...`` ``$`` ``1`` if the ``...`` is true, else ``0`` ``$`` @@ -241,6 +237,10 @@ where ``${prop}`` refers to a helper variable:: Available output expressions are: +``$<0:...>`` + Empty string (ignores ``...``) +``$<1:...>`` + Content of ``...`` ``$`` Joins the list with the content of ``...`` ``$`` ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 8 +- Source/CMakeLists.txt | 4 + Source/cmGeneratorExpression.cxx | 27 +- Source/cmGeneratorExpression.h | 4 + Source/cmGeneratorExpressionContext.cxx | 34 + Source/cmGeneratorExpressionContext.h | 54 + Source/cmGeneratorExpressionEvaluator.cxx | 1890 +------------------- Source/cmGeneratorExpressionEvaluator.h | 29 +- ...Evaluator.cxx => cmGeneratorExpressionNode.cxx} | 298 +-- Source/cmGeneratorExpressionNode.h | 70 + bootstrap | 2 + 11 files changed, 204 insertions(+), 2216 deletions(-) create mode 100644 Source/cmGeneratorExpressionContext.cxx create mode 100644 Source/cmGeneratorExpressionContext.h copy Source/{cmGeneratorExpressionEvaluator.cxx => cmGeneratorExpressionNode.cxx} (87%) create mode 100644 Source/cmGeneratorExpressionNode.h hooks/post-receive -- CMake From steveire at gmail.com Thu Mar 5 17:37:59 2015 From: steveire at gmail.com (Stephen Kelly) Date: Thu, 5 Mar 2015 17:37:59 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-861-g09e6248 Message-ID: <20150305223801.685ECAB800@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 09e6248ba23e6d89a98d03f4cb0831fb6ef55e3d (commit) via 860f73b3df7c5106b3757330b7f37ed44730dcbd (commit) from 67f87e683f8845b688cccf663ae7454d96e6dfe3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=09e6248ba23e6d89a98d03f4cb0831fb6ef55e3d commit 09e6248ba23e6d89a98d03f4cb0831fb6ef55e3d Merge: 67f87e6 860f73b Author: Stephen Kelly AuthorDate: Thu Mar 5 17:37:58 2015 -0500 Commit: CMake Topic Stage CommitDate: Thu Mar 5 17:37:58 2015 -0500 Merge topic 'refactor-GeneratorExpression' into next 860f73b3 Fix initializer order. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=860f73b3df7c5106b3757330b7f37ed44730dcbd commit 860f73b3df7c5106b3757330b7f37ed44730dcbd Author: Stephen Kelly AuthorDate: Thu Mar 5 23:37:36 2015 +0100 Commit: Stephen Kelly CommitDate: Thu Mar 5 23:37:36 2015 +0100 Fix initializer order. diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx index 9722d11..947015e 100644 --- a/Source/cmGeneratorExpressionContext.cxx +++ b/Source/cmGeneratorExpressionContext.cxx @@ -22,13 +22,13 @@ cmGeneratorExpressionContext::cmGeneratorExpressionContext( : Backtrace(backtrace), Makefile(mf), Config(config), + Language(language), HeadTarget(headTarget), CurrentTarget(currentTarget), Quiet(quiet), HadError(false), HadContextSensitiveCondition(false), HadHeadSensitiveCondition(false), - EvaluateForBuildsystem(evaluateForBuildsystem), - Language(language) + EvaluateForBuildsystem(evaluateForBuildsystem) { } ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionContext.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 6 00:01:13 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 6 Mar 2015 00:01:13 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-366-g8f38b8a Message-ID: <20150306050113.A4AF1AB633@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 8f38b8a4433b26da8f64b705fa82e520c40106d5 (commit) from 67a74c44541ed42b6898e98c87f4a9f625f9a458 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f38b8a4433b26da8f64b705fa82e520c40106d5 commit 8f38b8a4433b26da8f64b705fa82e520c40106d5 Author: Kitware Robot AuthorDate: Fri Mar 6 00:01:09 2015 -0500 Commit: Kitware Robot CommitDate: Fri Mar 6 00:01:09 2015 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1660cd8..3ca0984 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150305) +set(CMake_VERSION_PATCH 20150306) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Fri Mar 6 08:20:17 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Fri, 6 Mar 2015 08:20:17 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-865-g096abec Message-ID: <20150306132017.46CABAB270@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 096abecb3fc9fac10514c7cb48a2c04056273520 (commit) via e64f7e7fba6ab35343ef380f215e26d88ef0d01e (commit) via 8f38b8a4433b26da8f64b705fa82e520c40106d5 (commit) via 67a74c44541ed42b6898e98c87f4a9f625f9a458 (commit) from 09e6248ba23e6d89a98d03f4cb0831fb6ef55e3d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=096abecb3fc9fac10514c7cb48a2c04056273520 commit 096abecb3fc9fac10514c7cb48a2c04056273520 Merge: 09e6248 e64f7e7 Author: Nils Gladitz AuthorDate: Fri Mar 6 08:20:16 2015 -0500 Commit: CMake Topic Stage CommitDate: Fri Mar 6 08:20:16 2015 -0500 Merge topic 'fix-wixobj-filenames' into next e64f7e7f CPackWIX: Preserve all but the last extension when generating .wixobj names. 8f38b8a4 CMake Nightly Date Stamp 67a74c44 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e64f7e7fba6ab35343ef380f215e26d88ef0d01e commit e64f7e7fba6ab35343ef380f215e26d88ef0d01e Author: Nils Gladitz AuthorDate: Fri Mar 6 14:19:30 2015 +0100 Commit: Nils Gladitz CommitDate: Fri Mar 6 14:19:30 2015 +0100 CPackWIX: Preserve all but the last extension when generating .wixobj names. diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 4b8daf8..d1d1d58 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -271,7 +271,8 @@ bool cmCPackWIXGenerator::PackageFilesImpl() std::string const& sourceFilename = this->WixSources[i]; std::string objectFilename = - cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj"; + cmSystemTools::GetFilenameWithoutLastExtension(sourceFilename) + + ".wixobj"; if(!RunCandleCommand(sourceFilename, objectFilename)) { ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Fri Mar 6 09:08:00 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Fri, 6 Mar 2015 09:08:00 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-867-g26594e5 Message-ID: <20150306140800.97FD6ABB51@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 26594e5deb1e9c8e3332cd52da9f96c5ed196d9b (commit) via 099b0cab1d12b5b3734342ac516c8d42c78cdef7 (commit) from 096abecb3fc9fac10514c7cb48a2c04056273520 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26594e5deb1e9c8e3332cd52da9f96c5ed196d9b commit 26594e5deb1e9c8e3332cd52da9f96c5ed196d9b Merge: 096abec 099b0ca Author: Nils Gladitz AuthorDate: Fri Mar 6 09:07:59 2015 -0500 Commit: CMake Topic Stage CommitDate: Fri Mar 6 09:07:59 2015 -0500 Merge topic 'cbp-unit-targets' into next 099b0cab CodeBlocks: Declare which source file belongs to which targets. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=099b0cab1d12b5b3734342ac516c8d42c78cdef7 commit 099b0cab1d12b5b3734342ac516c8d42c78cdef7 Author: Nils Gladitz AuthorDate: Fri Mar 6 09:48:33 2015 +0100 Commit: Nils Gladitz CommitDate: Fri Mar 6 09:48:33 2015 +0100 CodeBlocks: Declare which source file belongs to which targets. This should allow the consuming IDE to determine which target specific preprocessor definitions and include directories are relevant for a given source file. diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 69857ef..d46d941 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -376,11 +376,13 @@ void cmExtraCodeBlocksGenerator fout<<" \n"; - // Collect all used source files in the project - // Sort them into two containers, one for C/C++ implementation files - // which may have an acompanying header, one for all other files - std::map cFiles; - std::set otherFiles; + // Collect all used source files in the project. + // Keep a list of C/C++ source files which might have an acompanying header + // that should be looked for. + typedef std::map all_files_map_t; + all_files_map_t allFiles; + std::vector cFiles; + for (std::vector::const_iterator lg=lgs.begin(); lg!=lgs.end(); lg++) { @@ -429,15 +431,15 @@ void cmExtraCodeBlocksGenerator } } - // then put it accordingly into one of the two containers - if (isCFile) - { - cFiles[(*si)->GetFullPath()] = *si ; - } - else + std::string fullPath = (*si)->GetFullPath(); + + if(isCFile) { - otherFiles.insert((*si)->GetFullPath()); + cFiles.push_back(fullPath); } + + CbpUnit &cbpUnit = allFiles[fullPath]; + cbpUnit.Targets.push_back(&(ti->second)); } } default: // intended fallthrough @@ -447,19 +449,21 @@ void cmExtraCodeBlocksGenerator } // The following loop tries to add header files matching to implementation - // files to the project. It does that by iterating over all source files, + // files to the project. It does that by iterating over all + // C/C++ source files, // replacing the file name extension with ".h" and checks whether such a // file exists. If it does, it is inserted into the map of files. // A very similar version of that code exists also in the kdevelop // project generator. - for (std::map::const_iterator + for (std::vector::const_iterator sit=cFiles.begin(); sit!=cFiles.end(); ++sit) { - std::string headerBasename=cmSystemTools::GetFilenamePath(sit->first); + std::string const& fileName = *sit; + std::string headerBasename=cmSystemTools::GetFilenamePath(fileName); headerBasename+="/"; - headerBasename+=cmSystemTools::GetFilenameWithoutExtension(sit->first); + headerBasename+=cmSystemTools::GetFilenameWithoutExtension(fileName); // check if there's a matching header around for(std::vector::const_iterator @@ -471,37 +475,38 @@ void cmExtraCodeBlocksGenerator hname += "."; hname += *ext; // if it's already in the set, don't check if it exists on disk - std::set::const_iterator headerIt=otherFiles.find(hname); - if (headerIt != otherFiles.end()) + if (allFiles.find(hname) != allFiles.end()) { break; } if(cmSystemTools::FileExists(hname.c_str())) { - otherFiles.insert(hname); + allFiles[hname].Targets = allFiles[fileName].Targets; break; } } } // insert all source files in the CodeBlocks project - // first the C/C++ implementation files, then all others - for (std::map::const_iterator - sit=cFiles.begin(); - sit!=cFiles.end(); + for (all_files_map_t::const_iterator + sit=allFiles.begin(); + sit!=allFiles.end(); ++sit) { - fout<<" first <<"\">\n" - " \n"; - } - for (std::set::const_iterator - sit=otherFiles.begin(); - sit!=otherFiles.end(); - ++sit) - { - fout<<" \n" - " \n"; + std::string const& unitFilename = sit->first; + CbpUnit const& unit = sit->second; + + fout<<" \n"; + + for(std::vector::const_iterator ti = unit.Targets.begin(); + ti != unit.Targets.end(); ++ti) + { + std::string const& targetName = (*ti)->GetName(); + fout<<" \n"; } // Add CMakeLists.txt diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index 0435ad8..97da1b8 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -39,6 +39,10 @@ public: virtual void Generate(); private: + struct CbpUnit + { + std::vector Targets; + }; void CreateProjectFile(const std::vector& lgs); ----------------------------------------------------------------------- Summary of changes: Source/cmExtraCodeBlocksGenerator.cxx | 71 ++++++++++++++++++--------------- Source/cmExtraCodeBlocksGenerator.h | 4 ++ 2 files changed, 42 insertions(+), 33 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Fri Mar 6 15:05:53 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Fri, 6 Mar 2015 15:05:53 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-870-g49a85a8 Message-ID: <20150306200553.9CB4EABB8A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 49a85a895ac60be51f27c581ebb1460ce61a5b47 (commit) via dae043fb7d436054801515025ebf5414aa1bc55a (commit) via 72adc8e8f8674770424148e70c32866d542e3a25 (commit) from 26594e5deb1e9c8e3332cd52da9f96c5ed196d9b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49a85a895ac60be51f27c581ebb1460ce61a5b47 commit 49a85a895ac60be51f27c581ebb1460ce61a5b47 Merge: 26594e5 dae043f Author: Nils Gladitz AuthorDate: Fri Mar 6 15:05:52 2015 -0500 Commit: CMake Topic Stage CommitDate: Fri Mar 6 15:05:52 2015 -0500 Merge topic 'fix-wixobj-filenames' into next dae043fb CPackWIX: Fix .wixobj file output locations and make sure they are unique. 72adc8e8 CPackWIX: Support patching of root elements. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dae043fb7d436054801515025ebf5414aa1bc55a commit dae043fb7d436054801515025ebf5414aa1bc55a Author: Nils Gladitz AuthorDate: Fri Mar 6 21:04:56 2015 +0100 Commit: Nils Gladitz CommitDate: Fri Mar 6 21:04:56 2015 +0100 CPackWIX: Fix .wixobj file output locations and make sure they are unique. diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 83b0948..257ce7a 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -265,14 +265,30 @@ bool cmCPackWIXGenerator::PackageFilesImpl() AppendUserSuppliedExtraSources(); + std::set usedBaseNames; + std::stringstream objectFiles; for(size_t i = 0; i < this->WixSources.size(); ++i) { std::string const& sourceFilename = this->WixSources[i]; + std::string baseName = + cmSystemTools::GetFilenameWithoutLastExtension(sourceFilename); + + unsigned int counter = 0; + std::string uniqueBaseName = baseName; + + while(usedBaseNames.find(uniqueBaseName) != usedBaseNames.end()) + { + std::stringstream tmp; + tmp << baseName << ++counter; + uniqueBaseName = tmp.str(); + } + + usedBaseNames.insert(uniqueBaseName); + std::string objectFilename = - cmSystemTools::GetFilenameWithoutLastExtension(sourceFilename) + - ".wixobj"; + this->CPackTopLevel + "/" + uniqueBaseName + ".wixobj"; if(!RunCandleCommand(sourceFilename, objectFilename)) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=72adc8e8f8674770424148e70c32866d542e3a25 commit 72adc8e8f8674770424148e70c32866d542e3a25 Author: Nils Gladitz AuthorDate: Fri Mar 6 20:40:53 2015 +0100 Commit: Nils Gladitz CommitDate: Fri Mar 6 20:40:53 2015 +0100 CPackWIX: Support patching of root elements. diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 105df96..5fe51a6 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -148,8 +148,10 @@ # Currently fragments can be injected into most # Component, File and Directory elements. # -# The special Id ``#PRODUCT`` can be used to inject content -# into the ```` element. +# The following additional special Ids can be used: +# +# * ``#PRODUCT`` for the ```` element. +# * ``#PRODUCTFEATURE`` for the root ```` element. # # The following example illustrates how this works. # diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index d1d1d58..83b0948 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -475,6 +475,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() featureDefinitions.AddAttribute("Title", cpackPackageName); featureDefinitions.AddAttribute("Level", "1"); + this->Patch->ApplyFragment("#PRODUCTFEATURE", featureDefinitions); const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY"); if(package) ----------------------------------------------------------------------- Summary of changes: Modules/CPackWIX.cmake | 6 ++++-- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Fri Mar 6 15:10:10 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Fri, 6 Mar 2015 15:10:10 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-873-g87f2a8a Message-ID: <20150306201010.B7AE9AA060@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 87f2a8a78ae564a0b964f5e2bb8b19778066811f (commit) via 2e16aff1e2218f042f403971403fe583fc5bec97 (commit) via b0852ebc09eec44041e8aa624ec4bb17bda14dac (commit) from 49a85a895ac60be51f27c581ebb1460ce61a5b47 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87f2a8a78ae564a0b964f5e2bb8b19778066811f commit 87f2a8a78ae564a0b964f5e2bb8b19778066811f Merge: 49a85a8 2e16aff Author: Nils Gladitz AuthorDate: Fri Mar 6 15:10:10 2015 -0500 Commit: CMake Topic Stage CommitDate: Fri Mar 6 15:10:10 2015 -0500 Merge topic 'fix-wixobj-filenames' into next 2e16aff1 CPackWIX: Fix .wixobj output locations and filenames. b0852ebc CPackWIX: Support patching of root elements. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e16aff1e2218f042f403971403fe583fc5bec97 commit 2e16aff1e2218f042f403971403fe583fc5bec97 Author: Nils Gladitz AuthorDate: Fri Mar 6 14:19:30 2015 +0100 Commit: Nils Gladitz CommitDate: Fri Mar 6 21:09:19 2015 +0100 CPackWIX: Fix .wixobj output locations and filenames. Preserve all but the last extension when generating .wixobj output filenames from source files and make sure they are unique. Output .wixobj files in cpack staging area instead of the current working directory. diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 13edde3..257ce7a 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -265,13 +265,30 @@ bool cmCPackWIXGenerator::PackageFilesImpl() AppendUserSuppliedExtraSources(); + std::set usedBaseNames; + std::stringstream objectFiles; for(size_t i = 0; i < this->WixSources.size(); ++i) { std::string const& sourceFilename = this->WixSources[i]; + std::string baseName = + cmSystemTools::GetFilenameWithoutLastExtension(sourceFilename); + + unsigned int counter = 0; + std::string uniqueBaseName = baseName; + + while(usedBaseNames.find(uniqueBaseName) != usedBaseNames.end()) + { + std::stringstream tmp; + tmp << baseName << ++counter; + uniqueBaseName = tmp.str(); + } + + usedBaseNames.insert(uniqueBaseName); + std::string objectFilename = - cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj"; + this->CPackTopLevel + "/" + uniqueBaseName + ".wixobj"; if(!RunCandleCommand(sourceFilename, objectFilename)) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b0852ebc09eec44041e8aa624ec4bb17bda14dac commit b0852ebc09eec44041e8aa624ec4bb17bda14dac Author: Nils Gladitz AuthorDate: Fri Mar 6 20:40:53 2015 +0100 Commit: Nils Gladitz CommitDate: Fri Mar 6 21:06:42 2015 +0100 CPackWIX: Support patching of root elements. diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 105df96..5fe51a6 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -148,8 +148,10 @@ # Currently fragments can be injected into most # Component, File and Directory elements. # -# The special Id ``#PRODUCT`` can be used to inject content -# into the ```` element. +# The following additional special Ids can be used: +# +# * ``#PRODUCT`` for the ```` element. +# * ``#PRODUCTFEATURE`` for the root ```` element. # # The following example illustrates how this works. # diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 4b8daf8..13edde3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -474,6 +474,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() featureDefinitions.AddAttribute("Title", cpackPackageName); featureDefinitions.AddAttribute("Level", "1"); + this->Patch->ApplyFragment("#PRODUCTFEATURE", featureDefinitions); const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY"); if(package) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 6 15:26:51 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 6 Mar 2015 15:26:51 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-875-gf377a02 Message-ID: <20150306202651.9F944AB136@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f377a0273265f61a1fd056e63ab106020262827e (commit) via d678084c293c0d82aeb426647aa97f1f6bd80f3e (commit) from 87f2a8a78ae564a0b964f5e2bb8b19778066811f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f377a0273265f61a1fd056e63ab106020262827e commit f377a0273265f61a1fd056e63ab106020262827e Merge: 87f2a8a d678084 Author: Brad King AuthorDate: Fri Mar 6 15:26:50 2015 -0500 Commit: CMake Topic Stage CommitDate: Fri Mar 6 15:26:50 2015 -0500 Merge topic 'custom-command-multiple-outputs' into next d678084c Makefile: Use witness for multiple custom command outputs (#15116) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d678084c293c0d82aeb426647aa97f1f6bd80f3e commit d678084c293c0d82aeb426647aa97f1f6bd80f3e Author: Brad King AuthorDate: Fri Mar 6 14:35:28 2015 -0500 Commit: Brad King CommitDate: Fri Mar 6 15:19:25 2015 -0500 Makefile: Use witness for multiple custom command outputs (#15116) In commit v3.2.0-rc1~272^2~2 (Makefile: Fix rebuild with multiple custom command outputs, 2014-12-05) we changed the generated makefile pattern for multiple outputs from out1: depends... commands... out2: out1 to out1 out2: depends... commands... This was based on the incorrect assumption that make tools would treat this as a combined output rule and run the command(s) exactly once for them. It turns out that instead this new pattern is equivalent to out1: depends... commands... out2: depends... commands... so the commands may be run more than once. Some documents suggest using a "dedicated witness" stamp file: stamp: depends... rm -f stamp touch stamp.tmp commands... mv stamp.tmp stamp out1 out2: stamp However, if the commands fail the error message will refer to the stamp instead of any of the real outputs, which may be confusing to readers. Also, this approach seems to have the same behavior of the original approach that motiviated the above commit: multiple invocations are needed to bring consumers of the outputs up to date. Instead we can return to the original approach but add an explicit touch to each extra output rule: out1: depends... commands... out2: out1 touch -c out2 This causes make tools to recognize that all outputs have changed and therefore to execute any commands that consume them. diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 950d440..6c20952 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -49,7 +49,6 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator() lg->SetUnixCD(false); lg->SetMakeCommandEscapeTargetTwice(true); lg->SetBorlandMakeCurlyHack(true); - lg->SetNoMultiOutputMultiDepRules(true); return lg; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index dfa6cc9..9213ad6 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -92,7 +92,6 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() this->SkipAssemblySourceRules = false; this->MakeCommandEscapeTargetTwice = false; this->BorlandMakeCurlyHack = false; - this->NoMultiOutputMultiDepRules = false; } //---------------------------------------------------------------------------- @@ -600,7 +599,6 @@ const std::string &cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath() return this->HomeRelativeOutputPath; } - //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 @@ -619,30 +617,6 @@ cmLocalUnixMakefileGenerator3 comment); return; } - std::vector outputs(1, target); - this->WriteMakeRule(os, comment, - outputs, depends, commands, - symbolic, in_help); -} - -//---------------------------------------------------------------------------- -void -cmLocalUnixMakefileGenerator3 -::WriteMakeRule(std::ostream& os, - const char* comment, - const std::vector& outputs, - const std::vector& depends, - const std::vector& commands, - bool symbolic, - bool in_help) -{ - // Make sure there is an output. - if(outputs.empty()) - { - cmSystemTools::Error("No outputs for WriteMakeRule! called with comment: ", - comment); - return; - } std::string replace; @@ -661,17 +635,7 @@ cmLocalUnixMakefileGenerator3 } // Construct the left hand side of the rule. - std::string tgt; - { - const char* sep = ""; - for (std::vector::const_iterator i = outputs.begin(); - i != outputs.end(); ++i) - { - tgt += sep; - tgt += this->Convert(*i,HOME_OUTPUT,MAKERULE); - sep = " "; - } - } + std::string tgt = this->Convert(target, HOME_OUTPUT, MAKERULE); const char* space = ""; if(tgt.size() == 1) @@ -697,19 +661,6 @@ cmLocalUnixMakefileGenerator3 // No dependencies. The commands will always run. os << cmMakeSafe(tgt) << space << ":\n"; } - else if(this->NoMultiOutputMultiDepRules && outputs.size() >= 2) - { - // Borland make does not understand multiple dependency rules when - // there are multiple outputs, so write them all on one line. - os << cmMakeSafe(tgt) << space << ":"; - for(std::vector::const_iterator dep = depends.begin(); - dep != depends.end(); ++dep) - { - replace = this->Convert(*dep, HOME_OUTPUT, MAKERULE); - os << " " << cmMakeSafe(replace); - } - os << "\n"; - } else { // Split dependencies into multiple rule lines. This allows for @@ -738,8 +689,7 @@ cmLocalUnixMakefileGenerator3 // Add the output to the local help if requested. if(in_help) { - this->LocalHelp.insert(this->LocalHelp.end(), - outputs.begin(), outputs.end()); + this->LocalHelp.push_back(target); } } @@ -1758,8 +1708,6 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose) { - // Nothing populates multiple output pairs anymore, but we need to - // honor it when working in a build tree generated by an older CMake. cmMakefile* mf = this->Makefile; // Get the string listing the multiple output pairs. diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 7c8e27f..4f2e4a0 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -61,13 +61,6 @@ public: const std::vector& commands, bool symbolic, bool in_help = false); - void WriteMakeRule(std::ostream& os, - const char* comment, - const std::vector& outputs, - const std::vector& depends, - const std::vector& commands, - bool symbolic, - bool in_help = false); // write the main variables used by the makefiles void WriteMakeVariables(std::ostream& makefileStream); @@ -161,9 +154,6 @@ public: void SetBorlandMakeCurlyHack(bool b) { this->BorlandMakeCurlyHack = b; } - void SetNoMultiOutputMultiDepRules(bool b) - { this->NoMultiOutputMultiDepRules = b; } - // used in writing out Cmake files such as WriteDirectoryInformation static void WriteCMakeArgument(std::ostream& os, const char* s); @@ -348,7 +338,6 @@ private: bool PassMakeflags; bool MakeCommandEscapeTargetTwice; bool BorlandMakeCurlyHack; - bool NoMultiOutputMultiDepRules; //========================================================================== std::string HomeRelativeOutputPath; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index cdda36c..e55f651 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -765,9 +765,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } // Write the build rule. - this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - outputs, depends, commands, false); - + this->WriteMakeRule(*this->BuildFileStream, 0, outputs, + depends, commands, false); // Write the main driver rule to build everything in this target. this->WriteTargetDriverRule(targetFullPath, relink); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7ed0c10..973e0dc 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -766,8 +766,8 @@ cmMakefileTargetGenerator } // Write the rule. - this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - outputs, depends, commands, false); + this->WriteMakeRule(*this->BuildFileStream, 0, outputs, + depends, commands, false); bool do_preprocess_rules = lang_has_preprocessor && this->LocalGenerator->GetCreatePreprocessedSourceRules(); @@ -988,6 +988,51 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules() depends, commands, true); } +//---------------------------------------------------------------------------- +void cmMakefileTargetGenerator::WriteMakeRule( + std::ostream& os, + const char* comment, + const std::vector& outputs, + const std::vector& depends, + const std::vector& commands, + bool symbolic, + bool in_help) +{ + if (outputs.size() == 0) + { + return; + } + + // We always attach the actual commands to the first output. + this->LocalGenerator->WriteMakeRule(os, comment, outputs[0], depends, + commands, symbolic, in_help); + + // For single outputs, we are done. + if (outputs.size() == 1) + { + return; + } + + // For multiple outputs, make the extra ones depend on the first one. + std::vector const output_depends(1, outputs[0]); + for (std::vector::const_iterator o = outputs.begin()+1; + o != outputs.end(); ++o) + { + // Touch the extra output so "make" knows that it was updated, + // but only if the output was acually created. + std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT, + cmLocalGenerator::SHELL); + std::vector output_commands( + 1,"@$(CMAKE_COMMAND) -E touch_nocreate " + out); + this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends, + output_commands, symbolic, in_help); + + // At build time, remove the first output if this one does not exist + // so that make will rerun the real commands that create this one. + MultipleOutputPairsType::value_type p(*o, outputs[0]); + this->MultipleOutputPairs.insert(p); + } +} //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::WriteTargetDependRules() @@ -1008,6 +1053,25 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() this->LocalGenerator-> WriteDependLanguageInfo(*this->InfoFileStream,*this->Target); + // Store multiple output pairs in the depend info file. + if(!this->MultipleOutputPairs.empty()) + { + *this->InfoFileStream + << "\n" + << "# Pairs of files generated by the same build rule.\n" + << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; + for(MultipleOutputPairsType::const_iterator pi = + this->MultipleOutputPairs.begin(); + pi != this->MultipleOutputPairs.end(); ++pi) + { + *this->InfoFileStream + << " " << this->LocalGenerator->EscapeForCMake(pi->first) + << " " << this->LocalGenerator->EscapeForCMake(pi->second) + << "\n"; + } + *this->InfoFileStream << " )\n\n"; + } + // Store list of targets linked directly or transitively. { *this->InfoFileStream @@ -1234,9 +1298,8 @@ void cmMakefileTargetGenerator symbolic = sf->GetPropertyAsBool("SYMBOLIC"); } } - this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - outputs, depends, commands, - symbolic); + this->WriteMakeRule(*this->BuildFileStream, 0, outputs, + depends, commands, symbolic); // If the rule has changed make sure the output is rebuilt. if(!symbolic) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index e31e086..f62c51d 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -222,6 +222,16 @@ protected: // Set of extra output files to be driven by the build. std::set ExtraFiles; + typedef std::map MultipleOutputPairsType; + MultipleOutputPairsType MultipleOutputPairs; + void WriteMakeRule(std::ostream& os, + const char* comment, + const std::vector& outputs, + const std::vector& depends, + const std::vector& commands, + bool symbolic, + bool in_help = false); + // Target name info. std::string TargetNameOut; std::string TargetNameSO; ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalBorlandMakefileGenerator.cxx | 1 - Source/cmLocalUnixMakefileGenerator3.cxx | 56 +------------------- Source/cmLocalUnixMakefileGenerator3.h | 11 ---- Source/cmMakefileLibraryTargetGenerator.cxx | 5 +- Source/cmMakefileTargetGenerator.cxx | 73 +++++++++++++++++++++++++-- Source/cmMakefileTargetGenerator.h | 10 ++++ 6 files changed, 82 insertions(+), 74 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 6 18:11:40 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 6 Mar 2015 18:11:40 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-877-g68c97b4 Message-ID: <20150306231140.64200AA1FD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 68c97b483a678ae46abc7b26f10ea3e0908d4411 (commit) via 28a9569214df943df4b93ac6003292c735fba4ed (commit) from f377a0273265f61a1fd056e63ab106020262827e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68c97b483a678ae46abc7b26f10ea3e0908d4411 commit 68c97b483a678ae46abc7b26f10ea3e0908d4411 Merge: f377a02 28a9569 Author: Brad King AuthorDate: Fri Mar 6 18:11:39 2015 -0500 Commit: CMake Topic Stage CommitDate: Fri Mar 6 18:11:39 2015 -0500 Merge topic 'custom-command-multiple-outputs' into next 28a95692 fixup! Makefile: Use witness for multiple custom command outputs (#15116) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=28a9569214df943df4b93ac6003292c735fba4ed commit 28a9569214df943df4b93ac6003292c735fba4ed Author: Brad King AuthorDate: Fri Mar 6 18:04:18 2015 -0500 Commit: Brad King CommitDate: Fri Mar 6 18:08:15 2015 -0500 fixup! Makefile: Use witness for multiple custom command outputs (#15116) Do not consider touching a symbolic output. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 973e0dc..4ece016 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1022,15 +1022,21 @@ void cmMakefileTargetGenerator::WriteMakeRule( // but only if the output was acually created. std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL); - std::vector output_commands( - 1,"@$(CMAKE_COMMAND) -E touch_nocreate " + out); + std::vector output_commands; + if (!symbolic) + { + output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out); + } this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends, output_commands, symbolic, in_help); - // At build time, remove the first output if this one does not exist - // so that make will rerun the real commands that create this one. - MultipleOutputPairsType::value_type p(*o, outputs[0]); - this->MultipleOutputPairs.insert(p); + if (!symbolic) + { + // At build time, remove the first output if this one does not exist + // so that "make" will rerun the real commands that create this one. + MultipleOutputPairsType::value_type p(*o, outputs[0]); + this->MultipleOutputPairs.insert(p); + } } } ----------------------------------------------------------------------- Summary of changes: Source/cmMakefileTargetGenerator.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 6 18:13:10 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 6 Mar 2015 18:13:10 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-879-g3291bc8 Message-ID: <20150306231310.7BBA5AADC4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3291bc8fdb63b145b084253b34a8016ac71a28de (commit) via 4589ab67e00de9b5907bf06fbbf0fb6f9ddcec7a (commit) from 68c97b483a678ae46abc7b26f10ea3e0908d4411 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3291bc8fdb63b145b084253b34a8016ac71a28de commit 3291bc8fdb63b145b084253b34a8016ac71a28de Merge: 68c97b4 4589ab6 Author: Brad King AuthorDate: Fri Mar 6 18:13:09 2015 -0500 Commit: CMake Topic Stage CommitDate: Fri Mar 6 18:13:09 2015 -0500 Merge topic 'custom-command-multiple-outputs' into next 4589ab67 Makefile: Use witness for multiple custom command outputs (#15116) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4589ab67e00de9b5907bf06fbbf0fb6f9ddcec7a commit 4589ab67e00de9b5907bf06fbbf0fb6f9ddcec7a Author: Brad King AuthorDate: Fri Mar 6 14:35:28 2015 -0500 Commit: Brad King CommitDate: Fri Mar 6 18:11:45 2015 -0500 Makefile: Use witness for multiple custom command outputs (#15116) In commit v3.2.0-rc1~272^2~2 (Makefile: Fix rebuild with multiple custom command outputs, 2014-12-05) we changed the generated makefile pattern for multiple outputs from out1: depends... commands... out2: out1 to out1 out2: depends... commands... This was based on the incorrect assumption that make tools would treat this as a combined output rule and run the command(s) exactly once for them. It turns out that instead this new pattern is equivalent to out1: depends... commands... out2: depends... commands... so the commands may be run more than once. Some documents suggest using a "dedicated witness" stamp file: stamp: depends... rm -f stamp touch stamp.tmp commands... mv stamp.tmp stamp out1 out2: stamp However, if the commands fail the error message will refer to the stamp instead of any of the real outputs, which may be confusing to readers. Also, this approach seems to have the same behavior of the original approach that motiviated the above commit: multiple invocations are needed to bring consumers of the outputs up to date. Instead we can return to the original approach but add an explicit touch to each extra output rule: out1: depends... commands... out2: out1 touch -c out2 This causes make tools to recognize that all outputs have changed and therefore to execute any commands that consume them. diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 950d440..6c20952 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -49,7 +49,6 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator() lg->SetUnixCD(false); lg->SetMakeCommandEscapeTargetTwice(true); lg->SetBorlandMakeCurlyHack(true); - lg->SetNoMultiOutputMultiDepRules(true); return lg; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index dfa6cc9..9213ad6 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -92,7 +92,6 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() this->SkipAssemblySourceRules = false; this->MakeCommandEscapeTargetTwice = false; this->BorlandMakeCurlyHack = false; - this->NoMultiOutputMultiDepRules = false; } //---------------------------------------------------------------------------- @@ -600,7 +599,6 @@ const std::string &cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath() return this->HomeRelativeOutputPath; } - //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 @@ -619,30 +617,6 @@ cmLocalUnixMakefileGenerator3 comment); return; } - std::vector outputs(1, target); - this->WriteMakeRule(os, comment, - outputs, depends, commands, - symbolic, in_help); -} - -//---------------------------------------------------------------------------- -void -cmLocalUnixMakefileGenerator3 -::WriteMakeRule(std::ostream& os, - const char* comment, - const std::vector& outputs, - const std::vector& depends, - const std::vector& commands, - bool symbolic, - bool in_help) -{ - // Make sure there is an output. - if(outputs.empty()) - { - cmSystemTools::Error("No outputs for WriteMakeRule! called with comment: ", - comment); - return; - } std::string replace; @@ -661,17 +635,7 @@ cmLocalUnixMakefileGenerator3 } // Construct the left hand side of the rule. - std::string tgt; - { - const char* sep = ""; - for (std::vector::const_iterator i = outputs.begin(); - i != outputs.end(); ++i) - { - tgt += sep; - tgt += this->Convert(*i,HOME_OUTPUT,MAKERULE); - sep = " "; - } - } + std::string tgt = this->Convert(target, HOME_OUTPUT, MAKERULE); const char* space = ""; if(tgt.size() == 1) @@ -697,19 +661,6 @@ cmLocalUnixMakefileGenerator3 // No dependencies. The commands will always run. os << cmMakeSafe(tgt) << space << ":\n"; } - else if(this->NoMultiOutputMultiDepRules && outputs.size() >= 2) - { - // Borland make does not understand multiple dependency rules when - // there are multiple outputs, so write them all on one line. - os << cmMakeSafe(tgt) << space << ":"; - for(std::vector::const_iterator dep = depends.begin(); - dep != depends.end(); ++dep) - { - replace = this->Convert(*dep, HOME_OUTPUT, MAKERULE); - os << " " << cmMakeSafe(replace); - } - os << "\n"; - } else { // Split dependencies into multiple rule lines. This allows for @@ -738,8 +689,7 @@ cmLocalUnixMakefileGenerator3 // Add the output to the local help if requested. if(in_help) { - this->LocalHelp.insert(this->LocalHelp.end(), - outputs.begin(), outputs.end()); + this->LocalHelp.push_back(target); } } @@ -1758,8 +1708,6 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose) { - // Nothing populates multiple output pairs anymore, but we need to - // honor it when working in a build tree generated by an older CMake. cmMakefile* mf = this->Makefile; // Get the string listing the multiple output pairs. diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 7c8e27f..4f2e4a0 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -61,13 +61,6 @@ public: const std::vector& commands, bool symbolic, bool in_help = false); - void WriteMakeRule(std::ostream& os, - const char* comment, - const std::vector& outputs, - const std::vector& depends, - const std::vector& commands, - bool symbolic, - bool in_help = false); // write the main variables used by the makefiles void WriteMakeVariables(std::ostream& makefileStream); @@ -161,9 +154,6 @@ public: void SetBorlandMakeCurlyHack(bool b) { this->BorlandMakeCurlyHack = b; } - void SetNoMultiOutputMultiDepRules(bool b) - { this->NoMultiOutputMultiDepRules = b; } - // used in writing out Cmake files such as WriteDirectoryInformation static void WriteCMakeArgument(std::ostream& os, const char* s); @@ -348,7 +338,6 @@ private: bool PassMakeflags; bool MakeCommandEscapeTargetTwice; bool BorlandMakeCurlyHack; - bool NoMultiOutputMultiDepRules; //========================================================================== std::string HomeRelativeOutputPath; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index cdda36c..e55f651 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -765,9 +765,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } // Write the build rule. - this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - outputs, depends, commands, false); - + this->WriteMakeRule(*this->BuildFileStream, 0, outputs, + depends, commands, false); // Write the main driver rule to build everything in this target. this->WriteTargetDriverRule(targetFullPath, relink); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7ed0c10..4ece016 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -766,8 +766,8 @@ cmMakefileTargetGenerator } // Write the rule. - this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - outputs, depends, commands, false); + this->WriteMakeRule(*this->BuildFileStream, 0, outputs, + depends, commands, false); bool do_preprocess_rules = lang_has_preprocessor && this->LocalGenerator->GetCreatePreprocessedSourceRules(); @@ -988,6 +988,57 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules() depends, commands, true); } +//---------------------------------------------------------------------------- +void cmMakefileTargetGenerator::WriteMakeRule( + std::ostream& os, + const char* comment, + const std::vector& outputs, + const std::vector& depends, + const std::vector& commands, + bool symbolic, + bool in_help) +{ + if (outputs.size() == 0) + { + return; + } + + // We always attach the actual commands to the first output. + this->LocalGenerator->WriteMakeRule(os, comment, outputs[0], depends, + commands, symbolic, in_help); + + // For single outputs, we are done. + if (outputs.size() == 1) + { + return; + } + + // For multiple outputs, make the extra ones depend on the first one. + std::vector const output_depends(1, outputs[0]); + for (std::vector::const_iterator o = outputs.begin()+1; + o != outputs.end(); ++o) + { + // Touch the extra output so "make" knows that it was updated, + // but only if the output was acually created. + std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT, + cmLocalGenerator::SHELL); + std::vector output_commands; + if (!symbolic) + { + output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out); + } + this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends, + output_commands, symbolic, in_help); + + if (!symbolic) + { + // At build time, remove the first output if this one does not exist + // so that "make" will rerun the real commands that create this one. + MultipleOutputPairsType::value_type p(*o, outputs[0]); + this->MultipleOutputPairs.insert(p); + } + } +} //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::WriteTargetDependRules() @@ -1008,6 +1059,25 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() this->LocalGenerator-> WriteDependLanguageInfo(*this->InfoFileStream,*this->Target); + // Store multiple output pairs in the depend info file. + if(!this->MultipleOutputPairs.empty()) + { + *this->InfoFileStream + << "\n" + << "# Pairs of files generated by the same build rule.\n" + << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; + for(MultipleOutputPairsType::const_iterator pi = + this->MultipleOutputPairs.begin(); + pi != this->MultipleOutputPairs.end(); ++pi) + { + *this->InfoFileStream + << " " << this->LocalGenerator->EscapeForCMake(pi->first) + << " " << this->LocalGenerator->EscapeForCMake(pi->second) + << "\n"; + } + *this->InfoFileStream << " )\n\n"; + } + // Store list of targets linked directly or transitively. { *this->InfoFileStream @@ -1234,9 +1304,8 @@ void cmMakefileTargetGenerator symbolic = sf->GetPropertyAsBool("SYMBOLIC"); } } - this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - outputs, depends, commands, - symbolic); + this->WriteMakeRule(*this->BuildFileStream, 0, outputs, + depends, commands, symbolic); // If the rule has changed make sure the output is rebuilt. if(!symbolic) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index e31e086..f62c51d 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -222,6 +222,16 @@ protected: // Set of extra output files to be driven by the build. std::set ExtraFiles; + typedef std::map MultipleOutputPairsType; + MultipleOutputPairsType MultipleOutputPairs; + void WriteMakeRule(std::ostream& os, + const char* comment, + const std::vector& outputs, + const std::vector& depends, + const std::vector& commands, + bool symbolic, + bool in_help = false); + // Target name info. std::string TargetNameOut; std::string TargetNameSO; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 6 19:59:36 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 6 Mar 2015 19:59:36 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-881-g5935b45 Message-ID: <20150307005936.AB152ABB53@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5935b45f7b2be4bc6fbb28d3393e5feab16bbbf5 (commit) via 66a9c90c4bb5bf93bd570a423f99486b24b9337d (commit) from 3291bc8fdb63b145b084253b34a8016ac71a28de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5935b45f7b2be4bc6fbb28d3393e5feab16bbbf5 commit 5935b45f7b2be4bc6fbb28d3393e5feab16bbbf5 Merge: 3291bc8 66a9c90 Author: Brad King AuthorDate: Fri Mar 6 19:59:34 2015 -0500 Commit: CMake Topic Stage CommitDate: Fri Mar 6 19:59:34 2015 -0500 Merge topic 'custom-command-multiple-outputs' into next 66a9c90c Makefile: Fix multiple custom command outputs regression (#15116) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=66a9c90c4bb5bf93bd570a423f99486b24b9337d commit 66a9c90c4bb5bf93bd570a423f99486b24b9337d Author: Brad King AuthorDate: Fri Mar 6 14:35:28 2015 -0500 Commit: Brad King CommitDate: Fri Mar 6 19:58:30 2015 -0500 Makefile: Fix multiple custom command outputs regression (#15116) In commit v3.2.0-rc1~272^2~2 (Makefile: Fix rebuild with multiple custom command outputs, 2014-12-05) we changed the generated makefile pattern for multiple outputs from out1: depends... commands... out2: out1 to out1 out2: depends... commands... This was based on the incorrect assumption that make tools would treat this as a combined output rule and run the command(s) exactly once for them. It turns out that instead this new pattern is equivalent to out1: depends... commands... out2: depends... commands... so the commands may be run more than once. Some documents suggest using a "dedicated witness" stamp file: stamp: depends... rm -f stamp touch stamp.tmp commands... mv stamp.tmp stamp out1 out2: stamp However, if the commands fail the error message will refer to the stamp instead of any of the real outputs, which may be confusing to readers. Also, this approach seems to have the same behavior of the original approach that motiviated the above commit: multiple invocations are needed to bring consumers of the outputs up to date. Instead we can return to the original approach but add an explicit touch to each extra output rule: out1: depends... commands... out2: out1 touch -c out2 This causes make tools to recognize that all outputs have changed and therefore to execute any commands that consume them. diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 950d440..6c20952 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -49,7 +49,6 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator() lg->SetUnixCD(false); lg->SetMakeCommandEscapeTargetTwice(true); lg->SetBorlandMakeCurlyHack(true); - lg->SetNoMultiOutputMultiDepRules(true); return lg; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index dfa6cc9..9213ad6 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -92,7 +92,6 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() this->SkipAssemblySourceRules = false; this->MakeCommandEscapeTargetTwice = false; this->BorlandMakeCurlyHack = false; - this->NoMultiOutputMultiDepRules = false; } //---------------------------------------------------------------------------- @@ -600,7 +599,6 @@ const std::string &cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath() return this->HomeRelativeOutputPath; } - //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 @@ -619,30 +617,6 @@ cmLocalUnixMakefileGenerator3 comment); return; } - std::vector outputs(1, target); - this->WriteMakeRule(os, comment, - outputs, depends, commands, - symbolic, in_help); -} - -//---------------------------------------------------------------------------- -void -cmLocalUnixMakefileGenerator3 -::WriteMakeRule(std::ostream& os, - const char* comment, - const std::vector& outputs, - const std::vector& depends, - const std::vector& commands, - bool symbolic, - bool in_help) -{ - // Make sure there is an output. - if(outputs.empty()) - { - cmSystemTools::Error("No outputs for WriteMakeRule! called with comment: ", - comment); - return; - } std::string replace; @@ -661,17 +635,7 @@ cmLocalUnixMakefileGenerator3 } // Construct the left hand side of the rule. - std::string tgt; - { - const char* sep = ""; - for (std::vector::const_iterator i = outputs.begin(); - i != outputs.end(); ++i) - { - tgt += sep; - tgt += this->Convert(*i,HOME_OUTPUT,MAKERULE); - sep = " "; - } - } + std::string tgt = this->Convert(target, HOME_OUTPUT, MAKERULE); const char* space = ""; if(tgt.size() == 1) @@ -697,19 +661,6 @@ cmLocalUnixMakefileGenerator3 // No dependencies. The commands will always run. os << cmMakeSafe(tgt) << space << ":\n"; } - else if(this->NoMultiOutputMultiDepRules && outputs.size() >= 2) - { - // Borland make does not understand multiple dependency rules when - // there are multiple outputs, so write them all on one line. - os << cmMakeSafe(tgt) << space << ":"; - for(std::vector::const_iterator dep = depends.begin(); - dep != depends.end(); ++dep) - { - replace = this->Convert(*dep, HOME_OUTPUT, MAKERULE); - os << " " << cmMakeSafe(replace); - } - os << "\n"; - } else { // Split dependencies into multiple rule lines. This allows for @@ -738,8 +689,7 @@ cmLocalUnixMakefileGenerator3 // Add the output to the local help if requested. if(in_help) { - this->LocalHelp.insert(this->LocalHelp.end(), - outputs.begin(), outputs.end()); + this->LocalHelp.push_back(target); } } @@ -1758,8 +1708,6 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose) { - // Nothing populates multiple output pairs anymore, but we need to - // honor it when working in a build tree generated by an older CMake. cmMakefile* mf = this->Makefile; // Get the string listing the multiple output pairs. diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 7c8e27f..4f2e4a0 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -61,13 +61,6 @@ public: const std::vector& commands, bool symbolic, bool in_help = false); - void WriteMakeRule(std::ostream& os, - const char* comment, - const std::vector& outputs, - const std::vector& depends, - const std::vector& commands, - bool symbolic, - bool in_help = false); // write the main variables used by the makefiles void WriteMakeVariables(std::ostream& makefileStream); @@ -161,9 +154,6 @@ public: void SetBorlandMakeCurlyHack(bool b) { this->BorlandMakeCurlyHack = b; } - void SetNoMultiOutputMultiDepRules(bool b) - { this->NoMultiOutputMultiDepRules = b; } - // used in writing out Cmake files such as WriteDirectoryInformation static void WriteCMakeArgument(std::ostream& os, const char* s); @@ -348,7 +338,6 @@ private: bool PassMakeflags; bool MakeCommandEscapeTargetTwice; bool BorlandMakeCurlyHack; - bool NoMultiOutputMultiDepRules; //========================================================================== std::string HomeRelativeOutputPath; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index cdda36c..e55f651 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -765,9 +765,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } // Write the build rule. - this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - outputs, depends, commands, false); - + this->WriteMakeRule(*this->BuildFileStream, 0, outputs, + depends, commands, false); // Write the main driver rule to build everything in this target. this->WriteTargetDriverRule(targetFullPath, relink); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 7ed0c10..4ece016 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -766,8 +766,8 @@ cmMakefileTargetGenerator } // Write the rule. - this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - outputs, depends, commands, false); + this->WriteMakeRule(*this->BuildFileStream, 0, outputs, + depends, commands, false); bool do_preprocess_rules = lang_has_preprocessor && this->LocalGenerator->GetCreatePreprocessedSourceRules(); @@ -988,6 +988,57 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules() depends, commands, true); } +//---------------------------------------------------------------------------- +void cmMakefileTargetGenerator::WriteMakeRule( + std::ostream& os, + const char* comment, + const std::vector& outputs, + const std::vector& depends, + const std::vector& commands, + bool symbolic, + bool in_help) +{ + if (outputs.size() == 0) + { + return; + } + + // We always attach the actual commands to the first output. + this->LocalGenerator->WriteMakeRule(os, comment, outputs[0], depends, + commands, symbolic, in_help); + + // For single outputs, we are done. + if (outputs.size() == 1) + { + return; + } + + // For multiple outputs, make the extra ones depend on the first one. + std::vector const output_depends(1, outputs[0]); + for (std::vector::const_iterator o = outputs.begin()+1; + o != outputs.end(); ++o) + { + // Touch the extra output so "make" knows that it was updated, + // but only if the output was acually created. + std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT, + cmLocalGenerator::SHELL); + std::vector output_commands; + if (!symbolic) + { + output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out); + } + this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends, + output_commands, symbolic, in_help); + + if (!symbolic) + { + // At build time, remove the first output if this one does not exist + // so that "make" will rerun the real commands that create this one. + MultipleOutputPairsType::value_type p(*o, outputs[0]); + this->MultipleOutputPairs.insert(p); + } + } +} //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::WriteTargetDependRules() @@ -1008,6 +1059,25 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() this->LocalGenerator-> WriteDependLanguageInfo(*this->InfoFileStream,*this->Target); + // Store multiple output pairs in the depend info file. + if(!this->MultipleOutputPairs.empty()) + { + *this->InfoFileStream + << "\n" + << "# Pairs of files generated by the same build rule.\n" + << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; + for(MultipleOutputPairsType::const_iterator pi = + this->MultipleOutputPairs.begin(); + pi != this->MultipleOutputPairs.end(); ++pi) + { + *this->InfoFileStream + << " " << this->LocalGenerator->EscapeForCMake(pi->first) + << " " << this->LocalGenerator->EscapeForCMake(pi->second) + << "\n"; + } + *this->InfoFileStream << " )\n\n"; + } + // Store list of targets linked directly or transitively. { *this->InfoFileStream @@ -1234,9 +1304,8 @@ void cmMakefileTargetGenerator symbolic = sf->GetPropertyAsBool("SYMBOLIC"); } } - this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - outputs, depends, commands, - symbolic); + this->WriteMakeRule(*this->BuildFileStream, 0, outputs, + depends, commands, symbolic); // If the rule has changed make sure the output is rebuilt. if(!symbolic) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index e31e086..f62c51d 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -222,6 +222,16 @@ protected: // Set of extra output files to be driven by the build. std::set ExtraFiles; + typedef std::map MultipleOutputPairsType; + MultipleOutputPairsType MultipleOutputPairs; + void WriteMakeRule(std::ostream& os, + const char* comment, + const std::vector& outputs, + const std::vector& depends, + const std::vector& commands, + bool symbolic, + bool in_help = false); + // Target name info. std::string TargetNameOut; std::string TargetNameSO; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 7 00:01:12 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 7 Mar 2015 00:01:12 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-367-g90a051f Message-ID: <20150307050112.9AFF8AB840@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 90a051f443c4cb400696b28651877c53e3c56607 (commit) from 8f38b8a4433b26da8f64b705fa82e520c40106d5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90a051f443c4cb400696b28651877c53e3c56607 commit 90a051f443c4cb400696b28651877c53e3c56607 Author: Kitware Robot AuthorDate: Sat Mar 7 00:01:10 2015 -0500 Commit: Kitware Robot CommitDate: Sat Mar 7 00:01:10 2015 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3ca0984..6f17e27 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150306) +set(CMake_VERSION_PATCH 20150307) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Sat Mar 7 06:49:10 2015 From: brad.king at kitware.com (Brad King) Date: Sat, 7 Mar 2015 06:49:10 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-883-g9881928 Message-ID: <20150307114911.91B7BAB03E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9881928d4feb9dadee3c882387dbf64889b18ccd (commit) via c5affc51053911dfa24b5ce9b832494b67db3f63 (commit) from 5935b45f7b2be4bc6fbb28d3393e5feab16bbbf5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9881928d4feb9dadee3c882387dbf64889b18ccd commit 9881928d4feb9dadee3c882387dbf64889b18ccd Merge: 5935b45 c5affc5 Author: Brad King AuthorDate: Sat Mar 7 06:49:07 2015 -0500 Commit: CMake Topic Stage CommitDate: Sat Mar 7 06:49:07 2015 -0500 Merge topic 'refactor-GeneratorExpression' into next c5affc51 cmGeneratorExpressionContext: Fix include order http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c5affc51053911dfa24b5ce9b832494b67db3f63 commit c5affc51053911dfa24b5ce9b832494b67db3f63 Author: Brad King AuthorDate: Sat Mar 7 06:48:15 2015 -0500 Commit: Brad King CommitDate: Sat Mar 7 06:48:18 2015 -0500 cmGeneratorExpressionContext: Fix include order We need to include a CMake header before a standard header to get LFS mangling right on AIX. diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h index c02994f..ed83509 100644 --- a/Source/cmGeneratorExpressionContext.h +++ b/Source/cmGeneratorExpressionContext.h @@ -12,12 +12,12 @@ #ifndef cmGeneratorExpressionContext_h #define cmGeneratorExpressionContext_h +#include "cmListFileCache.h" + #include #include #include -#include "cmListFileCache.h" - class cmTarget; //---------------------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionContext.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Sat Mar 7 07:18:03 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sat, 7 Mar 2015 07:18:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-885-gb002801 Message-ID: <20150307121803.94807AB268@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b0028012cb44d1b95f0a26b6f8fb711197a07b5b (commit) via 5f02a789f332fd4addfcfed1b7aab32a53be60f9 (commit) from 9881928d4feb9dadee3c882387dbf64889b18ccd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b0028012cb44d1b95f0a26b6f8fb711197a07b5b commit b0028012cb44d1b95f0a26b6f8fb711197a07b5b Merge: 9881928 5f02a78 Author: Stephen Kelly AuthorDate: Sat Mar 7 07:18:02 2015 -0500 Commit: CMake Topic Stage CommitDate: Sat Mar 7 07:18:02 2015 -0500 Merge topic 'refactor-GeneratorExpression' into next 5f02a789 Revert topic. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f02a789f332fd4addfcfed1b7aab32a53be60f9 commit 5f02a789f332fd4addfcfed1b7aab32a53be60f9 Author: Stephen Kelly AuthorDate: Sat Mar 7 13:17:24 2015 +0100 Commit: Stephen Kelly CommitDate: Sat Mar 7 13:17:31 2015 +0100 Revert topic. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 477a132..d38cf7e 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -40,6 +40,10 @@ otherwise expands to nothing. Available logical expressions are: +``$<0:...>`` + Empty string (ignores ``...``) +``$<1:...>`` + Content of ``...`` ``$`` ``1`` if the ``...`` is true, else ``0`` ``$`` @@ -237,10 +241,6 @@ where ``${prop}`` refers to a helper variable:: Available output expressions are: -``$<0:...>`` - Empty string (ignores ``...``) -``$<1:...>`` - Content of ``...`` ``$`` Joins the list with the content of ``...`` ``$`` diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 482bd39..5b518b8 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -238,16 +238,12 @@ set(SRCS cmFileTimeComparison.cxx cmFileTimeComparison.h cmGeneratedFileStream.cxx - cmGeneratorExpressionContext.cxx - cmGeneratorExpressionContext.h cmGeneratorExpressionDAGChecker.cxx cmGeneratorExpressionDAGChecker.h cmGeneratorExpressionEvaluator.cxx cmGeneratorExpressionEvaluator.h cmGeneratorExpressionLexer.cxx cmGeneratorExpressionLexer.h - cmGeneratorExpressionNode.cxx - cmGeneratorExpressionNode.h cmGeneratorExpressionParser.cxx cmGeneratorExpressionParser.h cmGeneratorExpression.cxx diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 2d795cb..0a27016 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -72,19 +72,6 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmGeneratorExpressionDAGChecker *dagChecker, std::string const& language) const { - cmGeneratorExpressionContext context(mf, config, quiet, headTarget, - currentTarget ? currentTarget : headTarget, - this->EvaluateForBuildsystem, - this->Backtrace, language); - - return this->EvaluateWithContext(context, dagChecker); -} - -//---------------------------------------------------------------------------- -const char* cmCompiledGeneratorExpression::EvaluateWithContext( - cmGeneratorExpressionContext& context, - cmGeneratorExpressionDAGChecker *dagChecker) const -{ if (!this->NeedsEvaluation) { return this->Input.c_str(); @@ -97,6 +84,20 @@ const char* cmCompiledGeneratorExpression::EvaluateWithContext( const std::vector::const_iterator end = this->Evaluators.end(); + cmGeneratorExpressionContext context; + context.Makefile = mf; + context.Config = config; + context.Quiet = quiet; + context.HadError = false; + context.HadContextSensitiveCondition = false; + context.HadHeadSensitiveCondition = false; + context.SourceSensitiveTargets.clear(); + context.HeadTarget = headTarget; + context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; + context.CurrentTarget = currentTarget ? currentTarget : headTarget; + context.Backtrace = this->Backtrace; + context.Language = language; + for ( ; it != end; ++it) { this->Output += (*it)->Evaluate(&context, dagChecker); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 11c27fd..55d9691 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -24,7 +24,6 @@ class cmMakefile; class cmListFileBacktrace; struct cmGeneratorExpressionEvaluator; -struct cmGeneratorExpressionContext; struct cmGeneratorExpressionDAGChecker; class cmCompiledGeneratorExpression; @@ -132,9 +131,6 @@ public: std::map& mapping); private: - const char* EvaluateWithContext(cmGeneratorExpressionContext& context, - cmGeneratorExpressionDAGChecker *dagChecker) const; - cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, const std::string& input); diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx deleted file mode 100644 index 947015e..0000000 --- a/Source/cmGeneratorExpressionContext.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2012 Stephen Kelly - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ - -#include "cmGeneratorExpressionContext.h" - -cmGeneratorExpressionContext::cmGeneratorExpressionContext( - cmMakefile* mf, std::string const& config, - bool quiet, cmTarget const* headTarget, - cmTarget const* currentTarget, - bool evaluateForBuildsystem, - cmListFileBacktrace const& backtrace, - std::string const& language) - : Backtrace(backtrace), - Makefile(mf), - Config(config), - Language(language), - HeadTarget(headTarget), - CurrentTarget(currentTarget), - Quiet(quiet), - HadError(false), - HadContextSensitiveCondition(false), - HadHeadSensitiveCondition(false), - EvaluateForBuildsystem(evaluateForBuildsystem) -{ -} diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h deleted file mode 100644 index ed83509..0000000 --- a/Source/cmGeneratorExpressionContext.h +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2012 Stephen Kelly - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGeneratorExpressionContext_h -#define cmGeneratorExpressionContext_h - -#include "cmListFileCache.h" - -#include -#include -#include - -class cmTarget; - -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionContext -{ - cmGeneratorExpressionContext(cmMakefile* mf, std::string const& config, - bool quiet, cmTarget const* headTarget, - cmTarget const* currentTarget, - bool evaluateForBuildsystem, - cmListFileBacktrace const& backtrace, - std::string const& language); - - - cmListFileBacktrace Backtrace; - std::set DependTargets; - std::set AllTargets; - std::set SeenTargetProperties; - std::set SourceSensitiveTargets; - std::map > - MaxLanguageStandard; - cmMakefile *Makefile; - std::string Config; - std::string Language; - cmTarget const* HeadTarget; // The target whose property is being evaluated. - cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears - // directly or indirectly in the property. - bool Quiet; - bool HadError; - bool HadContextSensitiveCondition; - bool HadHeadSensitiveCondition; - bool EvaluateForBuildsystem; -}; - -#endif diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index f2ffeef..f289ead 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -24,7 +24,1892 @@ #include #include -#include "cmGeneratorExpressionNode.h" +//---------------------------------------------------------------------------- +static void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result) +{ + context->HadError = true; + if (context->Quiet) + { + return; + } + + std::ostringstream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << result; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str(), + context->Backtrace); +} + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionNode +{ + enum { + DynamicParameters = 0, + OneOrMoreParameters = -1, + OneOrZeroParameters = -2 + }; + virtual ~cmGeneratorExpressionNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool RequiresLiteralInput() const { return false; } + + virtual bool AcceptsArbitraryContentParameter() const + { return false; } + + virtual int NumExpectedParameters() const { return 1; } + + virtual std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker + ) const = 0; + + static std::string EvaluateDependentExpression( + std::string const& prop, cmMakefile *makefile, + cmGeneratorExpressionContext *context, + cmTarget const* headTarget, cmTarget const* currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker); +}; + +//---------------------------------------------------------------------------- +std::string cmGeneratorExpressionNode::EvaluateDependentExpression( + std::string const& prop, cmMakefile *makefile, + cmGeneratorExpressionContext *context, + cmTarget const* headTarget, cmTarget const* currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker) +{ + cmGeneratorExpression ge(&context->Backtrace); + cmsys::auto_ptr cge = ge.Parse(prop); + cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); + std::string result = cge->Evaluate(makefile, + context->Config, + context->Quiet, + headTarget, + currentTarget, + dagChecker, + context->Language); + if (cge->GetHadContextSensitiveCondition()) + { + context->HadContextSensitiveCondition = true; + } + if (cge->GetHadHeadSensitiveCondition()) + { + context->HadHeadSensitiveCondition = true; + } + return result; +} + +//---------------------------------------------------------------------------- +static const struct ZeroNode : public cmGeneratorExpressionNode +{ + ZeroNode() {} + + virtual bool GeneratesContent() const { return false; } + + virtual bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return std::string(); + } +} zeroNode; + +//---------------------------------------------------------------------------- +static const struct OneNode : public cmGeneratorExpressionNode +{ + OneNode() {} + + virtual bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return parameters.front(); + } +} oneNode; + +//---------------------------------------------------------------------------- +static const struct OneNode buildInterfaceNode; + +//---------------------------------------------------------------------------- +static const struct ZeroNode installInterfaceNode; + +//---------------------------------------------------------------------------- +#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ +static const struct OP ## Node : public cmGeneratorExpressionNode \ +{ \ + OP ## Node () {} \ + virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \ + \ + std::string Evaluate(const std::vector ¶meters, \ + cmGeneratorExpressionContext *context, \ + const GeneratorExpressionContent *content, \ + cmGeneratorExpressionDAGChecker *) const \ + { \ + std::vector::const_iterator it = parameters.begin(); \ + const std::vector::const_iterator end = parameters.end(); \ + for ( ; it != end; ++it) \ + { \ + if (*it == #FAILURE_VALUE) \ + { \ + return #FAILURE_VALUE; \ + } \ + else if (*it != #SUCCESS_VALUE) \ + { \ + reportError(context, content->GetOriginalExpression(), \ + "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ + return std::string(); \ + } \ + } \ + return #SUCCESS_VALUE; \ + } \ +} OPNAME; + +BOOLEAN_OP_NODE(andNode, AND, 1, 0) +BOOLEAN_OP_NODE(orNode, OR, 0, 1) + +#undef BOOLEAN_OP_NODE + +//---------------------------------------------------------------------------- +static const struct NotNode : public cmGeneratorExpressionNode +{ + NotNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (*parameters.begin() != "0" && *parameters.begin() != "1") + { + reportError(context, content->GetOriginalExpression(), + "$ parameter must resolve to exactly one '0' or '1' value."); + return std::string(); + } + return *parameters.begin() == "0" ? "1" : "0"; + } +} notNode; + +//---------------------------------------------------------------------------- +static const struct BoolNode : public cmGeneratorExpressionNode +{ + BoolNode() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; + } +} boolNode; + +//---------------------------------------------------------------------------- +static const struct StrEqualNode : public cmGeneratorExpressionNode +{ + StrEqualNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return *parameters.begin() == parameters[1] ? "1" : "0"; + } +} strEqualNode; + +//---------------------------------------------------------------------------- +static const struct EqualNode : public cmGeneratorExpressionNode +{ + EqualNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + char *pEnd; + + int base = 0; + bool flipSign = false; + + const char *lhs = parameters[0].c_str(); + if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B")) + { + base = 2; + lhs += 2; + } + if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B")) + { + base = 2; + lhs += 3; + flipSign = true; + } + if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B")) + { + base = 2; + lhs += 3; + } + + long lnum = strtol(lhs, &pEnd, base); + if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) + { + reportError(context, content->GetOriginalExpression(), + "$ parameter " + parameters[0] + " is not a valid integer."); + return std::string(); + } + + if (flipSign) + { + lnum = -lnum; + } + + base = 0; + flipSign = false; + + const char *rhs = parameters[1].c_str(); + if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B")) + { + base = 2; + rhs += 2; + } + if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B")) + { + base = 2; + rhs += 3; + flipSign = true; + } + if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B")) + { + base = 2; + rhs += 3; + } + + long rnum = strtol(rhs, &pEnd, base); + if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE) + { + reportError(context, content->GetOriginalExpression(), + "$ parameter " + parameters[1] + " is not a valid integer."); + return std::string(); + } + + if (flipSign) + { + rnum = -rnum; + } + + return lnum == rnum ? "1" : "0"; + } +} equalNode; + +//---------------------------------------------------------------------------- +static const struct LowerCaseNode : public cmGeneratorExpressionNode +{ + LowerCaseNode() {} + + bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::LowerCase(parameters.front()); + } +} lowerCaseNode; + +//---------------------------------------------------------------------------- +static const struct UpperCaseNode : public cmGeneratorExpressionNode +{ + UpperCaseNode() {} + + bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::UpperCase(parameters.front()); + } +} upperCaseNode; + +//---------------------------------------------------------------------------- +static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode +{ + MakeCIdentifierNode() {} + + bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::MakeCidentifier(parameters.front()); + } +} makeCIdentifierNode; + +//---------------------------------------------------------------------------- +static const struct Angle_RNode : public cmGeneratorExpressionNode +{ + Angle_RNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ">"; + } +} angle_rNode; + +//---------------------------------------------------------------------------- +static const struct CommaNode : public cmGeneratorExpressionNode +{ + CommaNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ","; + } +} commaNode; + +//---------------------------------------------------------------------------- +static const struct SemicolonNode : public cmGeneratorExpressionNode +{ + SemicolonNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ";"; + } +} semicolonNode; + +//---------------------------------------------------------------------------- +struct CompilerIdNode : public cmGeneratorExpressionNode +{ + CompilerIdNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string EvaluateWithLanguage(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *, + const std::string &lang) const + { + const char *compilerId = + context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID"); + if (parameters.empty()) + { + return compilerId ? compilerId : ""; + } + static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); + if (!compilerIdValidator.find(*parameters.begin())) + { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + if (!compilerId) + { + return parameters.front().empty() ? "1" : "0"; + } + + if (strcmp(parameters.begin()->c_str(), compilerId) == 0) + { + return "1"; + } + + if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) + { + switch(context->Makefile->GetPolicyStatus(cmPolicies::CMP0044)) + { + case cmPolicies::WARN: + { + std::ostringstream e; + e << context->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0044); + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::AUTHOR_WARNING, + e.str(), context->Backtrace); + } + case cmPolicies::OLD: + return "1"; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; + } + } + return "0"; + } +}; + +//---------------------------------------------------------------------------- +static const struct CCompilerIdNode : public CompilerIdNode +{ + CCompilerIdNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It may " + "not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, + dagChecker, "C"); + } +} cCompilerIdNode; + +//---------------------------------------------------------------------------- +static const struct CXXCompilerIdNode : public CompilerIdNode +{ + CXXCompilerIdNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It may " + "not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, + dagChecker, "CXX"); + } +} cxxCompilerIdNode; + +//---------------------------------------------------------------------------- +struct CompilerVersionNode : public cmGeneratorExpressionNode +{ + CompilerVersionNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string EvaluateWithLanguage(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *, + const std::string &lang) const + { + const char *compilerVersion = context->Makefile->GetSafeDefinition( + "CMAKE_" + lang + "_COMPILER_VERSION"); + if (parameters.empty()) + { + return compilerVersion ? compilerVersion : ""; + } + + static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$"); + if (!compilerIdValidator.find(*parameters.begin())) + { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + if (!compilerVersion) + { + return parameters.front().empty() ? "1" : "0"; + } + + return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, + parameters.begin()->c_str(), + compilerVersion) ? "1" : "0"; + } +}; + +//---------------------------------------------------------------------------- +static const struct CCompilerVersionNode : public CompilerVersionNode +{ + CCompilerVersionNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It " + "may not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, + dagChecker, "C"); + } +} cCompilerVersionNode; + +//---------------------------------------------------------------------------- +static const struct CxxCompilerVersionNode : public CompilerVersionNode +{ + CxxCompilerVersionNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It " + "may not be used with add_custom_command or add_custom_target."); + return std::string(); + } + return this->EvaluateWithLanguage(parameters, context, content, + dagChecker, "CXX"); + } +} cxxCompilerVersionNode; + + +//---------------------------------------------------------------------------- +struct PlatformIdNode : public cmGeneratorExpressionNode +{ + PlatformIdNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + const char *platformId = + context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); + if (parameters.empty()) + { + return platformId ? platformId : ""; + } + + if (!platformId) + { + return parameters.front().empty() ? "1" : "0"; + } + + if (strcmp(parameters.begin()->c_str(), platformId) == 0) + { + return "1"; + } + return "0"; + } +} platformIdNode; + +//---------------------------------------------------------------------------- +static const struct VersionGreaterNode : public cmGeneratorExpressionNode +{ + VersionGreaterNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, + parameters.front().c_str(), + parameters[1].c_str()) ? "1" : "0"; + } +} versionGreaterNode; + +//---------------------------------------------------------------------------- +static const struct VersionLessNode : public cmGeneratorExpressionNode +{ + VersionLessNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, + parameters.front().c_str(), + parameters[1].c_str()) ? "1" : "0"; + } +} versionLessNode; + +//---------------------------------------------------------------------------- +static const struct VersionEqualNode : public cmGeneratorExpressionNode +{ + VersionEqualNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, + parameters.front().c_str(), + parameters[1].c_str()) ? "1" : "0"; + } +} versionEqualNode; + +//---------------------------------------------------------------------------- +static const struct LinkOnlyNode : public cmGeneratorExpressionNode +{ + LinkOnlyNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if(!dagChecker->GetTransitivePropertiesOnly()) + { + return parameters.front(); + } + return ""; + } +} linkOnlyNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationNode : public cmGeneratorExpressionNode +{ + ConfigurationNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + context->HadContextSensitiveCondition = true; + return context->Config; + } +} configurationNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationTestNode : public cmGeneratorExpressionNode +{ + ConfigurationTestNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (parameters.empty()) + { + return configurationNode.Evaluate(parameters, context, content, 0); + } + static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$"); + if (!configValidator.find(*parameters.begin())) + { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + context->HadContextSensitiveCondition = true; + if (context->Config.empty()) + { + return parameters.front().empty() ? "1" : "0"; + } + + if (cmsysString_strcasecmp(parameters.begin()->c_str(), + context->Config.c_str()) == 0) + { + return "1"; + } + + if (context->CurrentTarget + && context->CurrentTarget->IsImported()) + { + const char* loc = 0; + const char* imp = 0; + std::string suffix; + if (context->CurrentTarget->GetMappedConfig(context->Config, + &loc, + &imp, + suffix)) + { + // This imported target has an appropriate location + // for this (possibly mapped) config. + // Check if there is a proper config mapping for the tested config. + std::vector mappedConfigs; + std::string mapProp = "MAP_IMPORTED_CONFIG_"; + mapProp += cmSystemTools::UpperCase(context->Config); + if(const char* mapValue = + context->CurrentTarget->GetProperty(mapProp)) + { + cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), + mappedConfigs); + return std::find(mappedConfigs.begin(), mappedConfigs.end(), + cmSystemTools::UpperCase(parameters.front())) + != mappedConfigs.end() ? "1" : "0"; + } + } + } + return "0"; + } +} configurationTestNode; + +static const struct JoinNode : public cmGeneratorExpressionNode +{ + JoinNode() {} + + virtual int NumExpectedParameters() const { return 2; } + + virtual bool AcceptsArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + std::vector list; + cmSystemTools::ExpandListArgument(parameters.front(), list); + return cmJoin(list, parameters[1]); + } +} joinNode; + +static const struct CompileLanguageNode : public cmGeneratorExpressionNode +{ + CompileLanguageNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + if(context->Language.empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used to specify include " + "directories compile definitions, compile options and to evaluate " + "components of the file(GENERATE) command."); + return std::string(); + } + + std::vector enabledLanguages; + cmGlobalGenerator* gg + = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + if (!parameters.empty() && + std::find(enabledLanguages.begin(), enabledLanguages.end(), + parameters.front()) == enabledLanguages.end()) + { + reportError(context, content->GetOriginalExpression(), + "$ Unknown language."); + return std::string(); + } + + if (gg->GetName().find("Visual Studio") != std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ may not be used with Visual Studio " + "generators."); + return std::string(); + } + else if (gg->GetName().find("Xcode") != std::string::npos) + { + if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() + || dagChecker->EvaluatingIncludeDirectories())) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with COMPILE_OPTIONS " + "with the Xcode generator."); + return std::string(); + } + } + else + { + if(gg->GetName().find("Makefiles") == std::string::npos && + gg->GetName().find("Ninja") == std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ not supported for this generator."); + return std::string(); + } + } + if (parameters.empty()) + { + return context->Language; + } + return context->Language == parameters.front() ? "1" : "0"; + } +} languageNode; + +#define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ + , "INTERFACE_" #PROPERTY + +//---------------------------------------------------------------------------- +static const char* targetPropertyTransitiveWhitelist[] = { + 0 + CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME) +}; + +#undef TRANSITIVE_PROPERTY_NAME + +template +std::string +getLinkedTargetsContent( + std::vector const &libraries, + cmTarget const* target, + cmTarget const* headTarget, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + const std::string &interfacePropertyName) +{ + std::string linkedTargetsContent; + std::string sep; + std::string depString; + for (typename std::vector::const_iterator it = libraries.begin(); + it != libraries.end(); ++it) + { + // Broken code can have a target in its own link interface. + // Don't follow such link interface entries so as not to create a + // self-referencing loop. + if (it->Target && it->Target != target) + { + depString += + sep + "$Target->GetName() + "," + interfacePropertyName + ">"; + sep = ";"; + } + } + if(!depString.empty()) + { + linkedTargetsContent = + cmGeneratorExpressionNode::EvaluateDependentExpression(depString, + target->GetMakefile(), context, + headTarget, target, dagChecker); + } + linkedTargetsContent = + cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); + return linkedTargetsContent; +} + +//---------------------------------------------------------------------------- +static const struct TargetPropertyNode : public cmGeneratorExpressionNode +{ + TargetPropertyNode() {} + + // This node handles errors on parameter count itself. + virtual int NumExpectedParameters() const { return OneOrMoreParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagCheckerParent + ) const + { + if (parameters.size() != 1 && parameters.size() != 2) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires one or two parameters"); + return std::string(); + } + static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); + + cmTarget const* target = context->HeadTarget; + std::string propertyName = *parameters.begin(); + + if (parameters.size() == 1) + { + context->HadHeadSensitiveCondition = true; + } + if (!target && parameters.size() == 1) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. " + "It may not be used with add_custom_command or add_custom_target. " + "Specify the target to read a property from using the " + "$ signature instead."); + return std::string(); + } + + if (parameters.size() == 2) + { + if (parameters.begin()->empty() && parameters[1].empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty " + "target name and property name."); + return std::string(); + } + if (parameters.begin()->empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty " + "target name."); + return std::string(); + } + + std::string targetName = parameters.front(); + propertyName = parameters[1]; + if (!cmGeneratorExpression::IsValidTargetName(targetName)) + { + if (!propertyNameValidator.find(propertyName.c_str())) + { + ::reportError(context, content->GetOriginalExpression(), + "Target name and property name not supported."); + return std::string(); + } + ::reportError(context, content->GetOriginalExpression(), + "Target name not supported."); + return std::string(); + } + if(propertyName == "ALIASED_TARGET") + { + if(context->Makefile->IsAlias(targetName)) + { + if(cmTarget* tgt = context->Makefile->FindTargetToUse(targetName)) + { + return tgt->GetName(); + } + } + return ""; + } + target = context->Makefile->FindTargetToUse(targetName); + + if (!target) + { + std::ostringstream e; + e << "Target \"" + << targetName + << "\" not found."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + context->AllTargets.insert(target); + } + + if (target == context->HeadTarget) + { + // Keep track of the properties seen while processing. + // The evaluation of the LINK_LIBRARIES generator expressions + // will check this to ensure that properties have one consistent + // value for all evaluations. + context->SeenTargetProperties.insert(propertyName); + } + if (propertyName == "SOURCES") + { + context->SourceSensitiveTargets.insert(target); + } + + if (propertyName.empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty property " + "name."); + return std::string(); + } + + if (!propertyNameValidator.find(propertyName)) + { + ::reportError(context, content->GetOriginalExpression(), + "Property name not supported."); + return std::string(); + } + + assert(target); + + if (propertyName == "LINKER_LANGUAGE") + { + if (target->LinkLanguagePropagatesToDependents() && + dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries() + || dagCheckerParent->EvaluatingSources())) + { + reportError(context, content->GetOriginalExpression(), + "LINKER_LANGUAGE target property can not be used while evaluating " + "link libraries for a static library"); + return std::string(); + } + return target->GetLinkerLanguage(context->Config); + } + + cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, + target->GetName(), + propertyName, + content, + dagCheckerParent); + + switch (dagChecker.Check()) + { + case cmGeneratorExpressionDAGChecker::SELF_REFERENCE: + dagChecker.ReportError(context, content->GetOriginalExpression()); + return std::string(); + case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: + // No error. We just skip cyclic references. + return std::string(); + case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: + for (size_t i = 1; + i < cmArraySize(targetPropertyTransitiveWhitelist); + ++i) + { + if (targetPropertyTransitiveWhitelist[i] == propertyName) + { + // No error. We're not going to find anything new here. + return std::string(); + } + } + case cmGeneratorExpressionDAGChecker::DAG: + break; + } + + const char *prop = target->GetProperty(propertyName); + + if (dagCheckerParent) + { + if (dagCheckerParent->EvaluatingLinkLibraries()) + { +#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ + (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || + if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE) + false) + { + reportError(context, content->GetOriginalExpression(), + "$ expression in link libraries " + "evaluation depends on target property which is transitive " + "over the link libraries, creating a recursion."); + return std::string(); + } +#undef TRANSITIVE_PROPERTY_COMPARE + + if(!prop) + { + return std::string(); + } + } + else + { +#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) \ + dagCheckerParent->METHOD () || + + assert( + CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( + ASSERT_TRANSITIVE_PROPERTY_METHOD) + false); +#undef ASSERT_TRANSITIVE_PROPERTY_METHOD + } + } + + std::string linkedTargetsContent; + + std::string interfacePropertyName; + bool isInterfaceProperty = false; + +#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \ + if (propertyName == #prop) \ + { \ + interfacePropertyName = "INTERFACE_" #prop; \ + } \ + else if (propertyName == "INTERFACE_" #prop) \ + { \ + interfacePropertyName = "INTERFACE_" #prop; \ + isInterfaceProperty = true; \ + } \ + else + + CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME) + // Note that the above macro terminates with an else + /* else */ if (cmHasLiteralPrefix(propertyName.c_str(), + "COMPILE_DEFINITIONS_")) + { + cmPolicies::PolicyStatus polSt = + context->Makefile->GetPolicyStatus(cmPolicies::CMP0043); + if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) + { + interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; + } + } +#undef POPULATE_INTERFACE_PROPERTY_NAME + cmTarget const* headTarget = context->HeadTarget && isInterfaceProperty + ? context->HeadTarget : target; + + if(isInterfaceProperty) + { + if(cmTarget::LinkInterfaceLibraries const* iface = + target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) + { + linkedTargetsContent = + getLinkedTargetsContent(iface->Libraries, target, + headTarget, + context, &dagChecker, + interfacePropertyName); + } + } + else if(!interfacePropertyName.empty()) + { + if(cmTarget::LinkImplementationLibraries const* impl = + target->GetLinkImplementationLibraries(context->Config)) + { + linkedTargetsContent = + getLinkedTargetsContent(impl->Libraries, target, + target, + context, &dagChecker, + interfacePropertyName); + } + } + + if (!prop) + { + if (target->IsImported() + || target->GetType() == cmTarget::INTERFACE_LIBRARY) + { + return linkedTargetsContent; + } + if (target->IsLinkInterfaceDependentBoolProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + return target->GetLinkInterfaceDependentBoolProperty( + propertyName, + context->Config) ? "1" : "0"; + } + if (target->IsLinkInterfaceDependentStringProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentStringProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentNumberMinProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentNumberMaxProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + + return linkedTargetsContent; + } + + if (!target->IsImported() + && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) + { + if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentNumberMinProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, + context->Config)) + { + context->HadContextSensitiveCondition = true; + const char *propContent = + target->GetLinkInterfaceDependentNumberMaxProperty( + propertyName, + context->Config); + return propContent ? propContent : ""; + } + } + if(!interfacePropertyName.empty()) + { + std::string result = this->EvaluateDependentExpression(prop, + context->Makefile, context, + headTarget, target, &dagChecker); + if (!linkedTargetsContent.empty()) + { + result += (result.empty() ? "" : ";") + linkedTargetsContent; + } + return result; + } + return prop; + } +} targetPropertyNode; + +//---------------------------------------------------------------------------- +static const struct TargetNameNode : public cmGeneratorExpressionNode +{ + TargetNameNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool AcceptsArbitraryContentParameter() const { return true; } + virtual bool RequiresLiteralInput() const { return true; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return parameters.front(); + } + + virtual int NumExpectedParameters() const { return 1; } + +} targetNameNode; + +//---------------------------------------------------------------------------- +static const struct TargetObjectsNode : public cmGeneratorExpressionNode +{ + TargetObjectsNode() {} + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (!context->EvaluateForBuildsystem) + { + std::ostringstream e; + e << "The evaluation of the TARGET_OBJECTS generator expression " + "is only suitable for consumption by CMake. It is not suitable " + "for writing out elsewhere."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + + std::string tgtName = parameters.front(); + cmGeneratorTarget* gt = + context->Makefile->FindGeneratorTargetToUse(tgtName); + if (!gt) + { + std::ostringstream e; + e << "Objects of target \"" << tgtName + << "\" referenced but no such target exists."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + if (gt->GetType() != cmTarget::OBJECT_LIBRARY) + { + std::ostringstream e; + e << "Objects of target \"" << tgtName + << "\" referenced but is not an OBJECT library."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + + std::vector objectSources; + gt->GetObjectSources(objectSources, context->Config); + std::map mapping; + + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) + { + mapping[*it]; + } + + gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); + + std::string obj_dir = gt->ObjectDirectory; + std::string result; + const char* sep = ""; + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) + { + // Find the object file name corresponding to this source file. + std::map::const_iterator + map_it = mapping.find(*it); + // It must exist because we populated the mapping just above. + assert(!map_it->second.empty()); + result += sep; + std::string objFile = obj_dir + map_it->second; + cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true); + sf->SetObjectLibrary(tgtName); + sf->SetProperty("EXTERNAL_OBJECT", "1"); + result += objFile; + sep = ";"; + } + return result; + } +} targetObjectsNode; + +//---------------------------------------------------------------------------- +static const struct CompileFeaturesNode : public cmGeneratorExpressionNode +{ + CompileFeaturesNode() {} + + virtual int NumExpectedParameters() const { return OneOrMoreParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + cmTarget const* target = context->HeadTarget; + if (!target) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It may " + "not be used with add_custom_command or add_custom_target."); + return std::string(); + } + context->HadHeadSensitiveCondition = true; + + typedef std::map > LangMap; + static LangMap availableFeatures; + + LangMap testedFeatures; + + for (std::vector::const_iterator it = parameters.begin(); + it != parameters.end(); ++it) + { + std::string error; + std::string lang; + if (!context->Makefile->CompileFeatureKnown(context->HeadTarget, + *it, lang, &error)) + { + reportError(context, content->GetOriginalExpression(), error); + return std::string(); + } + testedFeatures[lang].push_back(*it); + + if (availableFeatures.find(lang) == availableFeatures.end()) + { + const char* featuresKnown + = context->Makefile->CompileFeaturesAvailable(lang, &error); + if (!featuresKnown) + { + reportError(context, content->GetOriginalExpression(), error); + return std::string(); + } + cmSystemTools::ExpandListArgument(featuresKnown, + availableFeatures[lang]); + } + } + + bool evalLL = dagChecker && dagChecker->EvaluatingLinkLibraries(); + + std::string result; + + for (LangMap::const_iterator lit = testedFeatures.begin(); + lit != testedFeatures.end(); ++lit) + { + std::vector const& langAvailable + = availableFeatures[lit->first]; + const char* standardDefault = context->Makefile + ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT"); + for (std::vector::const_iterator it = lit->second.begin(); + it != lit->second.end(); ++it) + { + if (std::find(langAvailable.begin(), langAvailable.end(), *it) + == langAvailable.end()) + { + return "0"; + } + if (standardDefault && !*standardDefault) + { + // This compiler has no notion of language standard levels. + // All features known for the language are always available. + continue; + } + if (!context->Makefile->HaveStandardAvailable(target, + lit->first, *it)) + { + if (evalLL) + { + const char* l = target->GetProperty(lit->first + "_STANDARD"); + if (!l) + { + l = standardDefault; + } + assert(l); + context->MaxLanguageStandard[target][lit->first] = l; + } + else + { + return "0"; + } + } + } + } + return "1"; + } +} compileFeaturesNode; + +//---------------------------------------------------------------------------- +static const char* targetPolicyWhitelist[] = { + 0 +#define TARGET_POLICY_STRING(POLICY) \ + , #POLICY + + CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING) + +#undef TARGET_POLICY_STRING +}; + +cmPolicies::PolicyStatus statusForTarget(cmTarget const* tgt, + const char *policy) +{ +#define RETURN_POLICY(POLICY) \ + if (strcmp(policy, #POLICY) == 0) \ + { \ + return tgt->GetPolicyStatus ## POLICY (); \ + } \ + + CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY) + +#undef RETURN_POLICY + + assert(0 && "Unreachable code. Not a valid policy"); + return cmPolicies::WARN; +} + +cmPolicies::PolicyID policyForString(const char *policy_id) +{ +#define RETURN_POLICY_ID(POLICY_ID) \ + if (strcmp(policy_id, #POLICY_ID) == 0) \ + { \ + return cmPolicies:: POLICY_ID; \ + } \ + + CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID) + +#undef RETURN_POLICY_ID + + assert(0 && "Unreachable code. Not a valid policy"); + return cmPolicies::CMP0002; +} + +//---------------------------------------------------------------------------- +static const struct TargetPolicyNode : public cmGeneratorExpressionNode +{ + TargetPolicyNode() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context , + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if (!context->HeadTarget) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with binary targets. It " + "may not be used with add_custom_command or add_custom_target."); + return std::string(); + } + + context->HadContextSensitiveCondition = true; + context->HadHeadSensitiveCondition = true; + + for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) + { + const char *policy = targetPolicyWhitelist[i]; + if (parameters.front() == policy) + { + cmMakefile *mf = context->HeadTarget->GetMakefile(); + switch(statusForTarget(context->HeadTarget, policy)) + { + case cmPolicies::WARN: + mf->IssueMessage(cmake::AUTHOR_WARNING, + mf->GetPolicies()-> + GetPolicyWarning(policyForString(policy))); + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::OLD: + return "0"; + case cmPolicies::NEW: + return "1"; + } + } + } + reportError(context, content->GetOriginalExpression(), + "$ may only be used with a limited number of " + "policies. Currently it may be used with the following policies:\n" + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +#define TARGET_POLICY_LIST_ITEM(POLICY) \ + " * " STRINGIFY(POLICY) "\n" + + CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM) + +#undef TARGET_POLICY_LIST_ITEM + ); + return std::string(); + } + +} targetPolicyNode; + +//---------------------------------------------------------------------------- +static const struct InstallPrefixNode : public cmGeneratorExpressionNode +{ + InstallPrefixNode() {} + + virtual bool GeneratesContent() const { return true; } + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + reportError(context, content->GetOriginalExpression(), + "INSTALL_PREFIX is a marker for install(EXPORT) only. It " + "should never be evaluated."); + return std::string(); + } + +} installPrefixNode; + +//---------------------------------------------------------------------------- +class ArtifactNameTag; +class ArtifactLinkerTag; +class ArtifactSonameTag; +class ArtifactPdbTag; + +class ArtifactPathTag; +class ArtifactDirTag; +class ArtifactNameTag; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The target soname file (.so.1). + if(target->IsDLLPlatform()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is not allowed " + "for DLL target platforms."); + return std::string(); + } + if(target->GetType() != cmTarget::SHARED_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is allowed only for " + "SHARED libraries."); + return std::string(); + } + std::string result = target->GetDirectory(context->Config); + result += "/"; + result += target->GetSOName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + std::string language = target->GetLinkerLanguage(context->Config); + + std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; + + if(!context->Makefile->IsOn(pdbSupportVar)) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is not supported by the target linker."); + return std::string(); + } + + cmTarget::TargetType targetType = target->GetType(); + + if(targetType != cmTarget::SHARED_LIBRARY && + targetType != cmTarget::MODULE_LIBRARY && + targetType != cmTarget::EXECUTABLE) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is allowed only for " + "targets with linker created artifacts."); + return std::string(); + } + + std::string result = target->GetPDBDirectory(context->Config); + result += "/"; + result += target->GetPDBName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The file used to link to the target (.so, .lib, .a). + if(!target->IsLinkable()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_FILE is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + return target->GetFullPath(context->Config, + target->HasImportLibrary()); + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *) + { + return target->GetFullPath(context->Config, false, true); + } +}; + + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenameName(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenamePath(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result) + { return result; } +}; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifact : public cmGeneratorExpressionNode +{ + TargetFilesystemArtifact() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker) const + { + // Lookup the referenced target. + std::string name = *parameters.begin(); + + if (!cmGeneratorExpression::IsValidTargetName(name)) + { + ::reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + cmTarget* target = context->Makefile->FindTargetToUse(name); + if(!target) + { + ::reportError(context, content->GetOriginalExpression(), + "No target \"" + name + "\""); + return std::string(); + } + if(target->GetType() >= cmTarget::OBJECT_LIBRARY && + target->GetType() != cmTarget::UNKNOWN_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "Target \"" + name + "\" is not an executable or library."); + return std::string(); + } + if (dagChecker && (dagChecker->EvaluatingLinkLibraries(name.c_str()) + || (dagChecker->EvaluatingSources() + && name == dagChecker->TopTarget()))) + { + ::reportError(context, content->GetOriginalExpression(), + "Expressions which require the linker language may not " + "be used while evaluating link libraries"); + return std::string(); + } + context->DependTargets.insert(target); + context->AllTargets.insert(target); + + std::string result = + TargetFilesystemArtifactResultCreator::Create( + target, + context, + content); + if (context->HadError) + { + return std::string(); + } + return + TargetFilesystemArtifactResultGetter::Get(result); + } +}; + +//---------------------------------------------------------------------------- +template +struct TargetFilesystemArtifactNodeGroup +{ + TargetFilesystemArtifactNodeGroup() + { + } + + TargetFilesystemArtifact File; + TargetFilesystemArtifact FileName; + TargetFilesystemArtifact FileDir; +}; + +//---------------------------------------------------------------------------- +static const +TargetFilesystemArtifactNodeGroup targetNodeGroup; + +static const +TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; + +static const +TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; + +static const +TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; + +//---------------------------------------------------------------------------- +static const +cmGeneratorExpressionNode* GetNode(const std::string &identifier) +{ + typedef std::map NodeMap; + static NodeMap nodeMap; + if (nodeMap.empty()) + { + nodeMap["0"] = &zeroNode; + nodeMap["1"] = &oneNode; + nodeMap["AND"] = &andNode; + nodeMap["OR"] = &orNode; + nodeMap["NOT"] = ¬Node; + nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; + nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; + nodeMap["VERSION_GREATER"] = &versionGreaterNode; + nodeMap["VERSION_LESS"] = &versionLessNode; + nodeMap["VERSION_EQUAL"] = &versionEqualNode; + nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; + nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; + nodeMap["PLATFORM_ID"] = &platformIdNode; + nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; + nodeMap["CONFIGURATION"] = &configurationNode; + nodeMap["CONFIG"] = &configurationTestNode; + nodeMap["TARGET_FILE"] = &targetNodeGroup.File; + nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; + nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; + nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; + nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; + nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; + nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; + nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; + nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; + nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; + nodeMap["STREQUAL"] = &strEqualNode; + nodeMap["EQUAL"] = &equalNode; + nodeMap["LOWER_CASE"] = &lowerCaseNode; + nodeMap["UPPER_CASE"] = &upperCaseNode; + nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; + nodeMap["BOOL"] = &boolNode; + nodeMap["ANGLE-R"] = &angle_rNode; + nodeMap["COMMA"] = &commaNode; + nodeMap["SEMICOLON"] = &semicolonNode; + nodeMap["TARGET_PROPERTY"] = &targetPropertyNode; + nodeMap["TARGET_NAME"] = &targetNameNode; + nodeMap["TARGET_OBJECTS"] = &targetObjectsNode; + nodeMap["TARGET_POLICY"] = &targetPolicyNode; + nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; + nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; + nodeMap["INSTALL_PREFIX"] = &installPrefixNode; + nodeMap["JOIN"] = &joinNode; + nodeMap["LINK_ONLY"] = &linkOnlyNode; + nodeMap["COMPILE_LANGUAGE"] = &languageNode; + } + NodeMap::const_iterator i = nodeMap.find(identifier); + if (i == nodeMap.end()) + { + return 0; + } + return i->second; + +} //---------------------------------------------------------------------------- GeneratorExpressionContent::GeneratorExpressionContent( @@ -113,8 +1998,7 @@ std::string GeneratorExpressionContent::Evaluate( } } - const cmGeneratorExpressionNode *node = - cmGeneratorExpressionNode::GetNode(identifier); + const cmGeneratorExpressionNode *node = GetNode(identifier); if (!node) { diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 7c1bd8c..b1fec0b 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -16,10 +16,37 @@ #include #include "cmListFileCache.h" -#include "cmGeneratorExpressionContext.h" class cmTarget; +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionContext +{ + cmGeneratorExpressionContext() + : Backtrace(NULL) + { + } + + cmListFileBacktrace Backtrace; + std::set DependTargets; + std::set AllTargets; + std::set SeenTargetProperties; + std::set SourceSensitiveTargets; + std::map > + MaxLanguageStandard; + cmMakefile *Makefile; + std::string Config; + std::string Language; + cmTarget const* HeadTarget; // The target whose property is being evaluated. + cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears + // directly or indirectly in the property. + bool Quiet; + bool HadError; + bool HadContextSensitiveCondition; + bool HadHeadSensitiveCondition; + bool EvaluateForBuildsystem; +}; + struct cmGeneratorExpressionDAGChecker; struct cmGeneratorExpressionNode; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx deleted file mode 100644 index 2682f11..0000000 --- a/Source/cmGeneratorExpressionNode.cxx +++ /dev/null @@ -1,1868 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2012 Stephen Kelly - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ - -#include "cmGeneratorExpressionNode.h" -#include "cmGlobalGenerator.h" - -//---------------------------------------------------------------------------- -std::string cmGeneratorExpressionNode::EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker) -{ - cmGeneratorExpression ge(&context->Backtrace); - cmsys::auto_ptr cge = ge.Parse(prop); - cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); - std::string result = cge->Evaluate(makefile, - context->Config, - context->Quiet, - headTarget, - currentTarget, - dagChecker, - context->Language); - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } - if (cge->GetHadHeadSensitiveCondition()) - { - context->HadHeadSensitiveCondition = true; - } - return result; -} - -//---------------------------------------------------------------------------- -static const struct ZeroNode : public cmGeneratorExpressionNode -{ - ZeroNode() {} - - virtual bool GeneratesContent() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return std::string(); - } -} zeroNode; - -//---------------------------------------------------------------------------- -static const struct OneNode : public cmGeneratorExpressionNode -{ - OneNode() {} - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } -} oneNode; - -//---------------------------------------------------------------------------- -static const struct OneNode buildInterfaceNode; - -//---------------------------------------------------------------------------- -static const struct ZeroNode installInterfaceNode; - -//---------------------------------------------------------------------------- -#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ -static const struct OP ## Node : public cmGeneratorExpressionNode \ -{ \ - OP ## Node () {} \ - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \ - \ - std::string Evaluate(const std::vector ¶meters, \ - cmGeneratorExpressionContext *context, \ - const GeneratorExpressionContent *content, \ - cmGeneratorExpressionDAGChecker *) const \ - { \ - std::vector::const_iterator it = parameters.begin(); \ - const std::vector::const_iterator end = parameters.end(); \ - for ( ; it != end; ++it) \ - { \ - if (*it == #FAILURE_VALUE) \ - { \ - return #FAILURE_VALUE; \ - } \ - else if (*it != #SUCCESS_VALUE) \ - { \ - reportError(context, content->GetOriginalExpression(), \ - "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ - return std::string(); \ - } \ - } \ - return #SUCCESS_VALUE; \ - } \ -} OPNAME; - -BOOLEAN_OP_NODE(andNode, AND, 1, 0) -BOOLEAN_OP_NODE(orNode, OR, 0, 1) - -#undef BOOLEAN_OP_NODE - -//---------------------------------------------------------------------------- -static const struct NotNode : public cmGeneratorExpressionNode -{ - NotNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (*parameters.begin() != "0" && *parameters.begin() != "1") - { - reportError(context, content->GetOriginalExpression(), - "$ parameter must resolve to exactly one '0' or '1' value."); - return std::string(); - } - return *parameters.begin() == "0" ? "1" : "0"; - } -} notNode; - -//---------------------------------------------------------------------------- -static const struct BoolNode : public cmGeneratorExpressionNode -{ - BoolNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; - } -} boolNode; - -//---------------------------------------------------------------------------- -static const struct StrEqualNode : public cmGeneratorExpressionNode -{ - StrEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return *parameters.begin() == parameters[1] ? "1" : "0"; - } -} strEqualNode; - -//---------------------------------------------------------------------------- -static const struct EqualNode : public cmGeneratorExpressionNode -{ - EqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - char *pEnd; - - int base = 0; - bool flipSign = false; - - const char *lhs = parameters[0].c_str(); - if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B")) - { - base = 2; - lhs += 2; - } - if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B")) - { - base = 2; - lhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B")) - { - base = 2; - lhs += 3; - } - - long lnum = strtol(lhs, &pEnd, base); - if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[0] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - lnum = -lnum; - } - - base = 0; - flipSign = false; - - const char *rhs = parameters[1].c_str(); - if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B")) - { - base = 2; - rhs += 2; - } - if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B")) - { - base = 2; - rhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B")) - { - base = 2; - rhs += 3; - } - - long rnum = strtol(rhs, &pEnd, base); - if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[1] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - rnum = -rnum; - } - - return lnum == rnum ? "1" : "0"; - } -} equalNode; - -//---------------------------------------------------------------------------- -static const struct LowerCaseNode : public cmGeneratorExpressionNode -{ - LowerCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::LowerCase(parameters.front()); - } -} lowerCaseNode; - -//---------------------------------------------------------------------------- -static const struct UpperCaseNode : public cmGeneratorExpressionNode -{ - UpperCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::UpperCase(parameters.front()); - } -} upperCaseNode; - -//---------------------------------------------------------------------------- -static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode -{ - MakeCIdentifierNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::MakeCidentifier(parameters.front()); - } -} makeCIdentifierNode; - -//---------------------------------------------------------------------------- -static const struct Angle_RNode : public cmGeneratorExpressionNode -{ - Angle_RNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ">"; - } -} angle_rNode; - -//---------------------------------------------------------------------------- -static const struct CommaNode : public cmGeneratorExpressionNode -{ - CommaNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ","; - } -} commaNode; - -//---------------------------------------------------------------------------- -static const struct SemicolonNode : public cmGeneratorExpressionNode -{ - SemicolonNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ";"; - } -} semicolonNode; - -//---------------------------------------------------------------------------- -struct CompilerIdNode : public cmGeneratorExpressionNode -{ - CompilerIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerId = - context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID"); - if (parameters.empty()) - { - return compilerId ? compilerId : ""; - } - static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), compilerId) == 0) - { - return "1"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) - { - switch(context->Makefile->GetPolicyStatus(cmPolicies::CMP0044)) - { - case cmPolicies::WARN: - { - std::ostringstream e; - e << context->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0044); - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::AUTHOR_WARNING, - e.str(), context->Backtrace); - } - case cmPolicies::OLD: - return "1"; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; - } - } - return "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerIdNode : public CompilerIdNode -{ - CCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerIdNode; - -//---------------------------------------------------------------------------- -static const struct CXXCompilerIdNode : public CompilerIdNode -{ - CXXCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerIdNode; - -//---------------------------------------------------------------------------- -struct CompilerVersionNode : public cmGeneratorExpressionNode -{ - CompilerVersionNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerVersion = context->Makefile->GetSafeDefinition( - "CMAKE_" + lang + "_COMPILER_VERSION"); - if (parameters.empty()) - { - return compilerVersion ? compilerVersion : ""; - } - - static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerVersion) - { - return parameters.front().empty() ? "1" : "0"; - } - - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.begin()->c_str(), - compilerVersion) ? "1" : "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerVersionNode : public CompilerVersionNode -{ - CCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerVersionNode; - -//---------------------------------------------------------------------------- -static const struct CxxCompilerVersionNode : public CompilerVersionNode -{ - CxxCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerVersionNode; - - -//---------------------------------------------------------------------------- -struct PlatformIdNode : public cmGeneratorExpressionNode -{ - PlatformIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - const char *platformId = - context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); - if (parameters.empty()) - { - return platformId ? platformId : ""; - } - - if (!platformId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), platformId) == 0) - { - return "1"; - } - return "0"; - } -} platformIdNode; - -//---------------------------------------------------------------------------- -static const struct VersionGreaterNode : public cmGeneratorExpressionNode -{ - VersionGreaterNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionGreaterNode; - -//---------------------------------------------------------------------------- -static const struct VersionLessNode : public cmGeneratorExpressionNode -{ - VersionLessNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionLessNode; - -//---------------------------------------------------------------------------- -static const struct VersionEqualNode : public cmGeneratorExpressionNode -{ - VersionEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionEqualNode; - -//---------------------------------------------------------------------------- -static const struct LinkOnlyNode : public cmGeneratorExpressionNode -{ - LinkOnlyNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(!dagChecker->GetTransitivePropertiesOnly()) - { - return parameters.front(); - } - return ""; - } -} linkOnlyNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationNode : public cmGeneratorExpressionNode -{ - ConfigurationNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - context->HadContextSensitiveCondition = true; - return context->Config; - } -} configurationNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationTestNode : public cmGeneratorExpressionNode -{ - ConfigurationTestNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (parameters.empty()) - { - return configurationNode.Evaluate(parameters, context, content, 0); - } - static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$"); - if (!configValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - context->HadContextSensitiveCondition = true; - if (context->Config.empty()) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), - context->Config.c_str()) == 0) - { - return "1"; - } - - if (context->CurrentTarget - && context->CurrentTarget->IsImported()) - { - const char* loc = 0; - const char* imp = 0; - std::string suffix; - if (context->CurrentTarget->GetMappedConfig(context->Config, - &loc, - &imp, - suffix)) - { - // This imported target has an appropriate location - // for this (possibly mapped) config. - // Check if there is a proper config mapping for the tested config. - std::vector mappedConfigs; - std::string mapProp = "MAP_IMPORTED_CONFIG_"; - mapProp += cmSystemTools::UpperCase(context->Config); - if(const char* mapValue = - context->CurrentTarget->GetProperty(mapProp)) - { - cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), - mappedConfigs); - return std::find(mappedConfigs.begin(), mappedConfigs.end(), - cmSystemTools::UpperCase(parameters.front())) - != mappedConfigs.end() ? "1" : "0"; - } - } - } - return "0"; - } -} configurationTestNode; - -static const struct JoinNode : public cmGeneratorExpressionNode -{ - JoinNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - std::vector list; - cmSystemTools::ExpandListArgument(parameters.front(), list); - return cmJoin(list, parameters[1]); - } -} joinNode; - -static const struct CompileLanguageNode : public cmGeneratorExpressionNode -{ - CompileLanguageNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(context->Language.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used to specify include " - "directories compile definitions, compile options and to evaluate " - "components of the file(GENERATE) command."); - return std::string(); - } - - std::vector enabledLanguages; - cmGlobalGenerator* gg - = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->GetEnabledLanguages(enabledLanguages); - if (!parameters.empty() && - std::find(enabledLanguages.begin(), enabledLanguages.end(), - parameters.front()) == enabledLanguages.end()) - { - reportError(context, content->GetOriginalExpression(), - "$ Unknown language."); - return std::string(); - } - - if (gg->GetName().find("Visual Studio") != std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ may not be used with Visual Studio " - "generators."); - return std::string(); - } - else if (gg->GetName().find("Xcode") != std::string::npos) - { - if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() - || dagChecker->EvaluatingIncludeDirectories())) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with COMPILE_OPTIONS " - "with the Xcode generator."); - return std::string(); - } - } - else - { - if(gg->GetName().find("Makefiles") == std::string::npos && - gg->GetName().find("Ninja") == std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ not supported for this generator."); - return std::string(); - } - } - if (parameters.empty()) - { - return context->Language; - } - return context->Language == parameters.front() ? "1" : "0"; - } -} languageNode; - -#define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ - , "INTERFACE_" #PROPERTY - -//---------------------------------------------------------------------------- -static const char* targetPropertyTransitiveWhitelist[] = { - 0 - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME) -}; - -#undef TRANSITIVE_PROPERTY_NAME - -template -std::string -getLinkedTargetsContent( - std::vector const &libraries, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) -{ - std::string linkedTargetsContent; - std::string sep; - std::string depString; - for (typename std::vector::const_iterator it = libraries.begin(); - it != libraries.end(); ++it) - { - // Broken code can have a target in its own link interface. - // Don't follow such link interface entries so as not to create a - // self-referencing loop. - if (it->Target && it->Target != target) - { - depString += - sep + "$Target->GetName() + "," + interfacePropertyName + ">"; - sep = ";"; - } - } - if(!depString.empty()) - { - linkedTargetsContent = - cmGeneratorExpressionNode::EvaluateDependentExpression(depString, - target->GetMakefile(), context, - headTarget, target, dagChecker); - } - linkedTargetsContent = - cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); - return linkedTargetsContent; -} - -//---------------------------------------------------------------------------- -static const struct TargetPropertyNode : public cmGeneratorExpressionNode -{ - TargetPropertyNode() {} - - // This node handles errors on parameter count itself. - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagCheckerParent - ) const - { - if (parameters.size() != 1 && parameters.size() != 2) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires one or two parameters"); - return std::string(); - } - static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); - - cmTarget const* target = context->HeadTarget; - std::string propertyName = *parameters.begin(); - - if (parameters.size() == 1) - { - context->HadHeadSensitiveCondition = true; - } - if (!target && parameters.size() == 1) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. " - "It may not be used with add_custom_command or add_custom_target. " - "Specify the target to read a property from using the " - "$ signature instead."); - return std::string(); - } - - if (parameters.size() == 2) - { - if (parameters.begin()->empty() && parameters[1].empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name and property name."); - return std::string(); - } - if (parameters.begin()->empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name."); - return std::string(); - } - - std::string targetName = parameters.front(); - propertyName = parameters[1]; - if (!cmGeneratorExpression::IsValidTargetName(targetName)) - { - if (!propertyNameValidator.find(propertyName.c_str())) - { - ::reportError(context, content->GetOriginalExpression(), - "Target name and property name not supported."); - return std::string(); - } - ::reportError(context, content->GetOriginalExpression(), - "Target name not supported."); - return std::string(); - } - if(propertyName == "ALIASED_TARGET") - { - if(context->Makefile->IsAlias(targetName)) - { - if(cmTarget* tgt = context->Makefile->FindTargetToUse(targetName)) - { - return tgt->GetName(); - } - } - return ""; - } - target = context->Makefile->FindTargetToUse(targetName); - - if (!target) - { - std::ostringstream e; - e << "Target \"" - << targetName - << "\" not found."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - context->AllTargets.insert(target); - } - - if (target == context->HeadTarget) - { - // Keep track of the properties seen while processing. - // The evaluation of the LINK_LIBRARIES generator expressions - // will check this to ensure that properties have one consistent - // value for all evaluations. - context->SeenTargetProperties.insert(propertyName); - } - if (propertyName == "SOURCES") - { - context->SourceSensitiveTargets.insert(target); - } - - if (propertyName.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty property " - "name."); - return std::string(); - } - - if (!propertyNameValidator.find(propertyName)) - { - ::reportError(context, content->GetOriginalExpression(), - "Property name not supported."); - return std::string(); - } - - assert(target); - - if (propertyName == "LINKER_LANGUAGE") - { - if (target->LinkLanguagePropagatesToDependents() && - dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries() - || dagCheckerParent->EvaluatingSources())) - { - reportError(context, content->GetOriginalExpression(), - "LINKER_LANGUAGE target property can not be used while evaluating " - "link libraries for a static library"); - return std::string(); - } - return target->GetLinkerLanguage(context->Config); - } - - cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, - target->GetName(), - propertyName, - content, - dagCheckerParent); - - switch (dagChecker.Check()) - { - case cmGeneratorExpressionDAGChecker::SELF_REFERENCE: - dagChecker.ReportError(context, content->GetOriginalExpression()); - return std::string(); - case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: - // No error. We just skip cyclic references. - return std::string(); - case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: - for (size_t i = 1; - i < cmArraySize(targetPropertyTransitiveWhitelist); - ++i) - { - if (targetPropertyTransitiveWhitelist[i] == propertyName) - { - // No error. We're not going to find anything new here. - return std::string(); - } - } - case cmGeneratorExpressionDAGChecker::DAG: - break; - } - - const char *prop = target->GetProperty(propertyName); - - if (dagCheckerParent) - { - if (dagCheckerParent->EvaluatingLinkLibraries()) - { -#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ - (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || - if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE) - false) - { - reportError(context, content->GetOriginalExpression(), - "$ expression in link libraries " - "evaluation depends on target property which is transitive " - "over the link libraries, creating a recursion."); - return std::string(); - } -#undef TRANSITIVE_PROPERTY_COMPARE - - if(!prop) - { - return std::string(); - } - } - else - { -#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) \ - dagCheckerParent->METHOD () || - - assert( - CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( - ASSERT_TRANSITIVE_PROPERTY_METHOD) - false); -#undef ASSERT_TRANSITIVE_PROPERTY_METHOD - } - } - - std::string linkedTargetsContent; - - std::string interfacePropertyName; - bool isInterfaceProperty = false; - -#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \ - if (propertyName == #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - } \ - else if (propertyName == "INTERFACE_" #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - isInterfaceProperty = true; \ - } \ - else - - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME) - // Note that the above macro terminates with an else - /* else */ if (cmHasLiteralPrefix(propertyName.c_str(), - "COMPILE_DEFINITIONS_")) - { - cmPolicies::PolicyStatus polSt = - context->Makefile->GetPolicyStatus(cmPolicies::CMP0043); - if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) - { - interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; - } - } -#undef POPULATE_INTERFACE_PROPERTY_NAME - cmTarget const* headTarget = context->HeadTarget && isInterfaceProperty - ? context->HeadTarget : target; - - if(isInterfaceProperty) - { - if(cmTarget::LinkInterfaceLibraries const* iface = - target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) - { - linkedTargetsContent = - getLinkedTargetsContent(iface->Libraries, target, - headTarget, - context, &dagChecker, - interfacePropertyName); - } - } - else if(!interfacePropertyName.empty()) - { - if(cmTarget::LinkImplementationLibraries const* impl = - target->GetLinkImplementationLibraries(context->Config)) - { - linkedTargetsContent = - getLinkedTargetsContent(impl->Libraries, target, - target, - context, &dagChecker, - interfacePropertyName); - } - } - - if (!prop) - { - if (target->IsImported() - || target->GetType() == cmTarget::INTERFACE_LIBRARY) - { - return linkedTargetsContent; - } - if (target->IsLinkInterfaceDependentBoolProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - return target->GetLinkInterfaceDependentBoolProperty( - propertyName, - context->Config) ? "1" : "0"; - } - if (target->IsLinkInterfaceDependentStringProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentStringProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - - return linkedTargetsContent; - } - - if (!target->IsImported() - && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) - { - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - } - if(!interfacePropertyName.empty()) - { - std::string result = this->EvaluateDependentExpression(prop, - context->Makefile, context, - headTarget, target, &dagChecker); - if (!linkedTargetsContent.empty()) - { - result += (result.empty() ? "" : ";") + linkedTargetsContent; - } - return result; - } - return prop; - } -} targetPropertyNode; - -//---------------------------------------------------------------------------- -static const struct TargetNameNode : public cmGeneratorExpressionNode -{ - TargetNameNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - virtual bool RequiresLiteralInput() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } - - virtual int NumExpectedParameters() const { return 1; } - -} targetNameNode; - -//---------------------------------------------------------------------------- -static const struct TargetObjectsNode : public cmGeneratorExpressionNode -{ - TargetObjectsNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->EvaluateForBuildsystem) - { - std::ostringstream e; - e << "The evaluation of the TARGET_OBJECTS generator expression " - "is only suitable for consumption by CMake. It is not suitable " - "for writing out elsewhere."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::string tgtName = parameters.front(); - cmGeneratorTarget* gt = - context->Makefile->FindGeneratorTargetToUse(tgtName); - if (!gt) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but no such target exists."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - if (gt->GetType() != cmTarget::OBJECT_LIBRARY) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but is not an OBJECT library."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::vector objectSources; - gt->GetObjectSources(objectSources, context->Config); - std::map mapping; - - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - mapping[*it]; - } - - gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - - std::string obj_dir = gt->ObjectDirectory; - std::string result; - const char* sep = ""; - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - // Find the object file name corresponding to this source file. - std::map::const_iterator - map_it = mapping.find(*it); - // It must exist because we populated the mapping just above. - assert(!map_it->second.empty()); - result += sep; - std::string objFile = obj_dir + map_it->second; - cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true); - sf->SetObjectLibrary(tgtName); - sf->SetProperty("EXTERNAL_OBJECT", "1"); - result += objFile; - sep = ";"; - } - return result; - } -} targetObjectsNode; - -//---------------------------------------------------------------------------- -static const struct CompileFeaturesNode : public cmGeneratorExpressionNode -{ - CompileFeaturesNode() {} - - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - cmTarget const* target = context->HeadTarget; - if (!target) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - context->HadHeadSensitiveCondition = true; - - typedef std::map > LangMap; - static LangMap availableFeatures; - - LangMap testedFeatures; - - for (std::vector::const_iterator it = parameters.begin(); - it != parameters.end(); ++it) - { - std::string error; - std::string lang; - if (!context->Makefile->CompileFeatureKnown(context->HeadTarget, - *it, lang, &error)) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - testedFeatures[lang].push_back(*it); - - if (availableFeatures.find(lang) == availableFeatures.end()) - { - const char* featuresKnown - = context->Makefile->CompileFeaturesAvailable(lang, &error); - if (!featuresKnown) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - cmSystemTools::ExpandListArgument(featuresKnown, - availableFeatures[lang]); - } - } - - bool evalLL = dagChecker && dagChecker->EvaluatingLinkLibraries(); - - std::string result; - - for (LangMap::const_iterator lit = testedFeatures.begin(); - lit != testedFeatures.end(); ++lit) - { - std::vector const& langAvailable - = availableFeatures[lit->first]; - const char* standardDefault = context->Makefile - ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT"); - for (std::vector::const_iterator it = lit->second.begin(); - it != lit->second.end(); ++it) - { - if (std::find(langAvailable.begin(), langAvailable.end(), *it) - == langAvailable.end()) - { - return "0"; - } - if (standardDefault && !*standardDefault) - { - // This compiler has no notion of language standard levels. - // All features known for the language are always available. - continue; - } - if (!context->Makefile->HaveStandardAvailable(target, - lit->first, *it)) - { - if (evalLL) - { - const char* l = target->GetProperty(lit->first + "_STANDARD"); - if (!l) - { - l = standardDefault; - } - assert(l); - context->MaxLanguageStandard[target][lit->first] = l; - } - else - { - return "0"; - } - } - } - } - return "1"; - } -} compileFeaturesNode; - -//---------------------------------------------------------------------------- -static const char* targetPolicyWhitelist[] = { - 0 -#define TARGET_POLICY_STRING(POLICY) \ - , #POLICY - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING) - -#undef TARGET_POLICY_STRING -}; - -cmPolicies::PolicyStatus statusForTarget(cmTarget const* tgt, - const char *policy) -{ -#define RETURN_POLICY(POLICY) \ - if (strcmp(policy, #POLICY) == 0) \ - { \ - return tgt->GetPolicyStatus ## POLICY (); \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY) - -#undef RETURN_POLICY - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::WARN; -} - -cmPolicies::PolicyID policyForString(const char *policy_id) -{ -#define RETURN_POLICY_ID(POLICY_ID) \ - if (strcmp(policy_id, #POLICY_ID) == 0) \ - { \ - return cmPolicies:: POLICY_ID; \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID) - -#undef RETURN_POLICY_ID - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::CMP0002; -} - -//---------------------------------------------------------------------------- -static const struct TargetPolicyNode : public cmGeneratorExpressionNode -{ - TargetPolicyNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context , - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - - context->HadContextSensitiveCondition = true; - context->HadHeadSensitiveCondition = true; - - for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) - { - const char *policy = targetPolicyWhitelist[i]; - if (parameters.front() == policy) - { - cmMakefile *mf = context->HeadTarget->GetMakefile(); - switch(statusForTarget(context->HeadTarget, policy)) - { - case cmPolicies::WARN: - mf->IssueMessage(cmake::AUTHOR_WARNING, - mf->GetPolicies()-> - GetPolicyWarning(policyForString(policy))); - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::OLD: - return "0"; - case cmPolicies::NEW: - return "1"; - } - } - } - reportError(context, content->GetOriginalExpression(), - "$ may only be used with a limited number of " - "policies. Currently it may be used with the following policies:\n" - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -#define TARGET_POLICY_LIST_ITEM(POLICY) \ - " * " STRINGIFY(POLICY) "\n" - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM) - -#undef TARGET_POLICY_LIST_ITEM - ); - return std::string(); - } - -} targetPolicyNode; - -//---------------------------------------------------------------------------- -static const struct InstallPrefixNode : public cmGeneratorExpressionNode -{ - InstallPrefixNode() {} - - virtual bool GeneratesContent() const { return true; } - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - reportError(context, content->GetOriginalExpression(), - "INSTALL_PREFIX is a marker for install(EXPORT) only. It " - "should never be evaluated."); - return std::string(); - } - -} installPrefixNode; - -//---------------------------------------------------------------------------- -class ArtifactNameTag; -class ArtifactLinkerTag; -class ArtifactSonameTag; -class ArtifactPdbTag; - -class ArtifactPathTag; -class ArtifactDirTag; -class ArtifactNameTag; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The target soname file (.so.1). - if(target->IsDLLPlatform()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is not allowed " - "for DLL target platforms."); - return std::string(); - } - if(target->GetType() != cmTarget::SHARED_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is allowed only for " - "SHARED libraries."); - return std::string(); - } - std::string result = target->GetDirectory(context->Config); - result += "/"; - result += target->GetSOName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - std::string language = target->GetLinkerLanguage(context->Config); - - std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; - - if(!context->Makefile->IsOn(pdbSupportVar)) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is not supported by the target linker."); - return std::string(); - } - - cmTarget::TargetType targetType = target->GetType(); - - if(targetType != cmTarget::SHARED_LIBRARY && - targetType != cmTarget::MODULE_LIBRARY && - targetType != cmTarget::EXECUTABLE) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is allowed only for " - "targets with linker created artifacts."); - return std::string(); - } - - std::string result = target->GetPDBDirectory(context->Config); - result += "/"; - result += target->GetPDBName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The file used to link to the target (.so, .lib, .a). - if(!target->IsLinkable()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_LINKER_FILE is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); - return std::string(); - } - return target->GetFullPath(context->Config, - target->HasImportLibrary()); - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *) - { - return target->GetFullPath(context->Config, false, true); - } -}; - - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenameName(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenamePath(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return result; } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifact : public cmGeneratorExpressionNode -{ - TargetFilesystemArtifact() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - // Lookup the referenced target. - std::string name = *parameters.begin(); - - if (!cmGeneratorExpression::IsValidTargetName(name)) - { - ::reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - cmTarget* target = context->Makefile->FindTargetToUse(name); - if(!target) - { - ::reportError(context, content->GetOriginalExpression(), - "No target \"" + name + "\""); - return std::string(); - } - if(target->GetType() >= cmTarget::OBJECT_LIBRARY && - target->GetType() != cmTarget::UNKNOWN_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "Target \"" + name + "\" is not an executable or library."); - return std::string(); - } - if (dagChecker && (dagChecker->EvaluatingLinkLibraries(name.c_str()) - || (dagChecker->EvaluatingSources() - && name == dagChecker->TopTarget()))) - { - ::reportError(context, content->GetOriginalExpression(), - "Expressions which require the linker language may not " - "be used while evaluating link libraries"); - return std::string(); - } - context->DependTargets.insert(target); - context->AllTargets.insert(target); - - std::string result = - TargetFilesystemArtifactResultCreator::Create( - target, - context, - content); - if (context->HadError) - { - return std::string(); - } - return - TargetFilesystemArtifactResultGetter::Get(result); - } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactNodeGroup -{ - TargetFilesystemArtifactNodeGroup() - { - } - - TargetFilesystemArtifact File; - TargetFilesystemArtifact FileName; - TargetFilesystemArtifact FileDir; -}; - -//---------------------------------------------------------------------------- -static const -TargetFilesystemArtifactNodeGroup targetNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; - -//---------------------------------------------------------------------------- -const cmGeneratorExpressionNode* -cmGeneratorExpressionNode::GetNode(const std::string &identifier) -{ - typedef std::map NodeMap; - static NodeMap nodeMap; - if (nodeMap.empty()) - { - nodeMap["0"] = &zeroNode; - nodeMap["1"] = &oneNode; - nodeMap["AND"] = &andNode; - nodeMap["OR"] = &orNode; - nodeMap["NOT"] = ¬Node; - nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; - nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; - nodeMap["VERSION_GREATER"] = &versionGreaterNode; - nodeMap["VERSION_LESS"] = &versionLessNode; - nodeMap["VERSION_EQUAL"] = &versionEqualNode; - nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; - nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; - nodeMap["PLATFORM_ID"] = &platformIdNode; - nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; - nodeMap["CONFIGURATION"] = &configurationNode; - nodeMap["CONFIG"] = &configurationTestNode; - nodeMap["TARGET_FILE"] = &targetNodeGroup.File; - nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; - nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; - nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; - nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; - nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; - nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; - nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; - nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; - nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; - nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; - nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; - nodeMap["STREQUAL"] = &strEqualNode; - nodeMap["EQUAL"] = &equalNode; - nodeMap["LOWER_CASE"] = &lowerCaseNode; - nodeMap["UPPER_CASE"] = &upperCaseNode; - nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; - nodeMap["BOOL"] = &boolNode; - nodeMap["ANGLE-R"] = &angle_rNode; - nodeMap["COMMA"] = &commaNode; - nodeMap["SEMICOLON"] = &semicolonNode; - nodeMap["TARGET_PROPERTY"] = &targetPropertyNode; - nodeMap["TARGET_NAME"] = &targetNameNode; - nodeMap["TARGET_OBJECTS"] = &targetObjectsNode; - nodeMap["TARGET_POLICY"] = &targetPolicyNode; - nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; - nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; - nodeMap["INSTALL_PREFIX"] = &installPrefixNode; - nodeMap["JOIN"] = &joinNode; - nodeMap["LINK_ONLY"] = &linkOnlyNode; - nodeMap["COMPILE_LANGUAGE"] = &languageNode; - } - NodeMap::const_iterator i = nodeMap.find(identifier); - if (i == nodeMap.end()) - { - return 0; - } - return i->second; -} - -//---------------------------------------------------------------------------- -void reportError(cmGeneratorExpressionContext *context, - const std::string &expr, const std::string &result) -{ - context->HadError = true; - if (context->Quiet) - { - return; - } - - std::ostringstream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); -} diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h deleted file mode 100644 index 847a00a..0000000 --- a/Source/cmGeneratorExpressionNode.h +++ /dev/null @@ -1,70 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2012 Stephen Kelly - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef cmGeneratorExpressionNode_h -#define cmGeneratorExpressionNode_h - -#include "cmMakefile.h" - -#include "cmGeneratorExpressionEvaluator.h" -#include "cmGeneratorExpressionParser.h" -#include "cmGeneratorExpressionDAGChecker.h" -#include "cmGeneratorExpression.h" -#include "cmLocalGenerator.h" -#include "cmSourceFile.h" - -#include - -#include -#include - -#include "cmListFileCache.h" - -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionNode -{ - enum { - DynamicParameters = 0, - OneOrMoreParameters = -1, - OneOrZeroParameters = -2 - }; - virtual ~cmGeneratorExpressionNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool RequiresLiteralInput() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const - { return false; } - - virtual int NumExpectedParameters() const { return 1; } - - virtual std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker - ) const = 0; - - static std::string EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker); - - static const cmGeneratorExpressionNode* GetNode( - const std::string &identifier); -}; - -//---------------------------------------------------------------------------- -void reportError(cmGeneratorExpressionContext *context, - const std::string &expr, const std::string &result); - -#endif diff --git a/bootstrap b/bootstrap index 4239802..320552a 100755 --- a/bootstrap +++ b/bootstrap @@ -267,11 +267,9 @@ CMAKE_CXX_SOURCES="\ cmInstallDirectoryGenerator \ cmGeneratedFileStream \ cmGeneratorTarget \ - cmGeneratorExpressionContext \ cmGeneratorExpressionDAGChecker \ cmGeneratorExpressionEvaluator \ cmGeneratorExpressionLexer \ - cmGeneratorExpressionNode \ cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 8 +- Source/CMakeLists.txt | 4 - Source/cmGeneratorExpression.cxx | 27 +- Source/cmGeneratorExpression.h | 4 - Source/cmGeneratorExpressionContext.cxx | 34 - Source/cmGeneratorExpressionContext.h | 54 - Source/cmGeneratorExpressionEvaluator.cxx | 1890 ++++++++++++++++++++++++- Source/cmGeneratorExpressionEvaluator.h | 29 +- Source/cmGeneratorExpressionNode.cxx | 1868 ------------------------ Source/cmGeneratorExpressionNode.h | 70 - bootstrap | 2 - 11 files changed, 1933 insertions(+), 2057 deletions(-) delete mode 100644 Source/cmGeneratorExpressionContext.cxx delete mode 100644 Source/cmGeneratorExpressionContext.h delete mode 100644 Source/cmGeneratorExpressionNode.cxx delete mode 100644 Source/cmGeneratorExpressionNode.h hooks/post-receive -- CMake From steveire at gmail.com Sat Mar 7 07:24:39 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sat, 7 Mar 2015 07:24:39 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-892-g325b8b6 Message-ID: <20150307122439.B6446AB669@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 325b8b652927c23b95bbc5fe1d8bdd0a139e32fd (commit) via 9ea624b0096bab173c819bbd30332cabea2fd157 (commit) via 6cb58a0c8b5628476b4701f472fc32e5bfb10664 (commit) via 940c1f0ce5397c650f17ceb232ed348fbe3e3f53 (commit) via ce8075b73f0655b6acc4a2a33cc66eae51aa3d6c (commit) via e387ce7d681f9bd6c90c41f34b7500dfeb3b32ba (commit) via 4a0128f42feb7da9b6bebe0c2c3aa7a756b96822 (commit) from b0028012cb44d1b95f0a26b6f8fb711197a07b5b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=325b8b652927c23b95bbc5fe1d8bdd0a139e32fd commit 325b8b652927c23b95bbc5fe1d8bdd0a139e32fd Merge: b002801 9ea624b Author: Stephen Kelly AuthorDate: Sat Mar 7 07:24:37 2015 -0500 Commit: CMake Topic Stage CommitDate: Sat Mar 7 07:24:37 2015 -0500 Merge topic 'target-language-genex' into next 9ea624b0 File(GENERATE): Process genex evaluation files for each language. 6cb58a0c Genex: Allow COMPILE_LANGUAGE when processing include directories. 940c1f0c Genex: Allow COMPILE_LANGUAGE when processing compile definitions. ce8075b7 Genex: Enable use of COMPILE_LANGUAGE for compile options. e387ce7d Genex: Add a COMPILE_LANGUAGE generator expression. 4a0128f4 VS6: Compute CMAKE_*_FLAGS and COMPILE_DEFINITIONS* only when needed http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ea624b0096bab173c819bbd30332cabea2fd157 commit 9ea624b0096bab173c819bbd30332cabea2fd157 Author: Stephen Kelly AuthorDate: Sun Feb 22 17:44:59 2015 +0100 Commit: Stephen Kelly CommitDate: Sat Mar 7 13:23:21 2015 +0100 File(GENERATE): Process genex evaluation files for each language. diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 4e2a868..fa00283 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -38,13 +38,15 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( //---------------------------------------------------------------------------- void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, + const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm) { std::string rawCondition = this->Condition->GetInput(); if (!rawCondition.empty()) { - std::string condResult = this->Condition->Evaluate(this->Makefile, config); + std::string condResult = this->Condition->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); if (condResult == "0") { return; @@ -60,9 +62,11 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } const std::string outputFileName - = this->OutputFileExpr->Evaluate(this->Makefile, config); + = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); const std::string outputContent - = inputExpression->Evaluate(this->Makefile, config); + = inputExpression->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); std::map::iterator it = outputFiles.find(outputFileName); @@ -75,7 +79,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } std::ostringstream e; e << "Evaluation file to be written multiple times for different " - "configurations with different content:\n " << outputFileName; + "configurations or languages with different content:\n " + << outputFileName; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -97,14 +102,22 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, void cmGeneratorExpressionEvaluationFile::CreateOutputFile( std::string const& config) { - std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config); - cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); - sf->SetProperty("GENERATED", "1"); - + std::vector enabledLanguages; cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->SetFilenameTargetDepends(sf, + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) + { + std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, *le); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); + sf->SetProperty("GENERATED", "1"); + + gg->SetFilenameTargetDepends(sf, this->OutputFileExpr->GetSourceSensitiveTargets()); + } } //---------------------------------------------------------------------------- @@ -153,13 +166,23 @@ void cmGeneratorExpressionEvaluationFile::Generate() { allConfigs.push_back(""); } - for(std::vector::const_iterator li = allConfigs.begin(); - li != allConfigs.end(); ++li) + + std::vector enabledLanguages; + cmGlobalGenerator *gg + = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) { - this->Generate(*li, inputExpression.get(), outputFiles, perm); - if(cmSystemTools::GetFatalErrorOccured()) + for(std::vector::const_iterator li = allConfigs.begin(); + li != allConfigs.end(); ++li) { - return; + this->Generate(*li, *le, inputExpression.get(), outputFiles, perm); + if(cmSystemTools::GetFatalErrorOccured()) + { + return; + } } } } diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 3394ade..4424bec 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -34,7 +34,7 @@ public: void CreateOutputFile(std::string const& config); private: - void Generate(const std::string& config, + void Generate(const std::string& config, const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm); diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake new file mode 100644 index 0000000..e2b081d --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -0,0 +1,12 @@ + +enable_language(CXX C) + +add_library(empty empty.cpp empty.c) +target_compile_options(empty + PRIVATE LANG_IS_$ +) + +file(GENERATE + OUTPUT opts-$.txt + CONTENT "$\n" +) diff --git a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt index dbd39de..0abb7df 100644 --- a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt +++ b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt @@ -1,5 +1,5 @@ CMake Error in CMakeLists.txt: Evaluation file to be written multiple times for different configurations - with different content: + or languages with different content: .*output.txt diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 97f93d5..db344ef 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -17,6 +17,16 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() +if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") + run_cmake(COMPILE_LANGUAGE-genex) + foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() + endforeach() +endif() + set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") diff --git a/Tests/RunCMake/File_Generate/empty.c b/Tests/RunCMake/File_Generate/empty.c new file mode 100644 index 0000000..563eef0 --- /dev/null +++ b/Tests/RunCMake/File_Generate/empty.c @@ -0,0 +1,8 @@ + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty_c() +{ + return 0; +} http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6cb58a0c8b5628476b4701f472fc32e5bfb10664 commit 6cb58a0c8b5628476b4701f472fc32e5bfb10664 Author: Stephen Kelly AuthorDate: Wed Mar 4 21:53:15 2015 +0100 Commit: Stephen Kelly CommitDate: Sat Mar 7 13:23:21 2015 +0100 Genex: Allow COMPILE_LANGUAGE when processing include directories. Issue an error if this is encountered by an IDE generator. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b6d97d1..d38cf7e 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -121,7 +121,8 @@ Available logical expressions are: target_link_libraries(myapp myapp_c myapp_cxx) The ``Makefile`` and ``Ninja`` based generators can also use this - expression to specify compile-language specific compile definitions: + expression to specify compile-language specific compile definitions + and include directories: .. code-block:: cmake @@ -129,6 +130,9 @@ Available logical expressions are: target_compile_definitions(myapp PRIVATE $<$:COMPILING_CXX> ) + target_include_directories(myapp + PRIVATE $<$:/opt/foo/cxx_headers> + ) Informational Expressions ========================= diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 26ee7af..f289ead 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -850,7 +850,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } else if (gg->GetName().find("Xcode") != std::string::npos) { - if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() + || dagChecker->EvaluatingIncludeDirectories())) { reportError(context, content->GetOriginalExpression(), "$ may only be used with COMPILE_OPTIONS " diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 44c9e9a..b7b2eff 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -960,9 +960,10 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang, //---------------------------------------------------------------------------- std::vector -cmGeneratorTarget::GetIncludeDirectories(const std::string& config) const +cmGeneratorTarget::GetIncludeDirectories(const std::string& config, + const std::string& lang) const { - return this->Target->GetIncludeDirectories(config); + return this->Target->GetIncludeDirectories(config, lang); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2083b88..c329cf5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -85,7 +85,7 @@ public: /** Get the include directories for this target. */ std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, const std::string& lang) const; bool IsSystemIncludeDirectory(const std::string& dir, const std::string& config) const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 735dfa9..37cc2c6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1600,7 +1600,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // Get the target-specific include directories. std::vector includes; - includes = target->GetIncludeDirectories(config); + includes = target->GetIncludeDirectories(config, lang); // Support putting all the in-project include directories first if // it is requested by the project. diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9ecb029..50491af 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2114,6 +2114,32 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << " )\n"; } + + // Target-specific include directories: + cmakefileStream + << "\n" + << "# The include file search paths:\n"; + cmakefileStream + << "set(CMAKE_" << l->first << "_TARGET_INCLUDE_PATH\n"; + std::vector includes; + + cmGeneratorTarget* gt = this->GetGlobalGenerator() + ->GetGeneratorTarget(&target); + + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->GetIncludeDirectories(includes, gt, + l->first, config); + for(std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) + { + cmakefileStream + << " \"" + << this->Convert(*i, cmLocalGenerator::HOME_OUTPUT) + << "\"\n"; + } + cmakefileStream + << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 57c49f1..c7a7110 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1056,40 +1056,6 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; } - // Target-specific include directories: - *this->InfoFileStream - << "\n" - << "# The include file search paths:\n"; - *this->InfoFileStream - << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; - std::vector includes; - - const std::string& config = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->LocalGenerator->GetIncludeDirectories(includes, - this->GeneratorTarget, - "C", config); - for(std::vector::iterator i = includes.begin(); - i != includes.end(); ++i) - { - *this->InfoFileStream - << " \"" - << this->LocalGenerator->Convert(*i, - cmLocalGenerator::HOME_OUTPUT) - << "\"\n"; - } - *this->InfoFileStream - << " )\n"; - *this->InfoFileStream - << "set(CMAKE_CXX_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_ASM_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - // and now write the rule to use it std::vector depends; std::vector commands; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 87dcc99..7a6ad8b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1979,7 +1979,8 @@ static void processIncludeDirectories(cmTarget const* tgt, std::vector &includes, UNORDERED_SET &uniqueIncludes, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugIncludes) + const std::string& config, bool debugIncludes, + const std::string& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -1995,7 +1996,7 @@ static void processIncludeDirectories(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, language), entryIncludes); std::string usedIncludes; @@ -2106,7 +2107,8 @@ static void processIncludeDirectories(cmTarget const* tgt, //---------------------------------------------------------------------------- std::vector -cmTarget::GetIncludeDirectories(const std::string& config) const +cmTarget::GetIncludeDirectories(const std::string& config, + const std::string& language) const { std::vector includes; UNORDERED_SET uniqueIncludes; @@ -2139,7 +2141,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); std::vector linkInterfaceIncludeDirectoriesEntries; @@ -2179,7 +2182,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); deleteAndClear(linkInterfaceIncludeDirectoriesEntries); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0356c1e..5170b31 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -568,7 +568,8 @@ public: bool contentOnly) const; std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, + const std::string& language) const; void InsertInclude(const cmValueWithOrigin &entry, bool before = false); void InsertCompileOption(const cmValueWithOrigin &entry, diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 661bbaa..d57556a 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -42,6 +42,20 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_include_directories(consumer + PRIVATE + $<$:${CMAKE_CURRENT_SOURCE_DIR}/cxx_only> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/c_only> + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_include_directories(consumer PRIVATE $ diff --git a/Tests/CMakeCommands/target_include_directories/c_only/c_only.h b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h new file mode 100644 index 0000000..29f68ee --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h @@ -0,0 +1,2 @@ + +#define C_ONLY_DEFINE diff --git a/Tests/CMakeCommands/target_include_directories/consumer.c b/Tests/CMakeCommands/target_include_directories/consumer.c new file mode 100644 index 0000000..8821f5b --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/consumer.c @@ -0,0 +1,10 @@ + +#ifdef TEST_LANG_DEFINES + #include "c_only.h" + + #ifndef C_ONLY_DEFINE + #error Expected C_ONLY_DEFINE + #endif +#endif + +int consumer_c() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp index 7e3443e..649510c 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.cpp +++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp @@ -4,6 +4,9 @@ #include "interfaceinclude.h" #include "relative_dir.h" #include "consumer.h" +#ifdef TEST_LANG_DEFINES + #include "cxx_only.h" +#endif #ifdef PRIVATEINCLUDE_DEFINE #error Unexpected PRIVATEINCLUDE_DEFINE @@ -29,4 +32,10 @@ #error Expected CONSUMER_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CXX_ONLY_DEFINE + #error Expected CXX_ONLY_DEFINE + #endif +#endif + int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h new file mode 100644 index 0000000..67289a4 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h @@ -0,0 +1,2 @@ + +#define CXX_ONLY_DEFINE diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt new file mode 100644 index 0000000..ec15068 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt new file mode 100644 index 0000000..fdf92b2 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake new file mode 100644 index 0000000..31771f6 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_include_directories(main PRIVATE $<$:anydir>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 8a32aef..5e0a5f5 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -11,3 +11,10 @@ elseif (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) run_cmake(CompileDefinitions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file IncludeDirectories-stderr-Xcode.txt) + run_cmake(IncludeDirectories) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file IncludeDirectories-stderr-VS.txt) + run_cmake(IncludeDirectories) +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=940c1f0ce5397c650f17ceb232ed348fbe3e3f53 commit 940c1f0ce5397c650f17ceb232ed348fbe3e3f53 Author: Stephen Kelly AuthorDate: Wed Mar 4 21:46:42 2015 +0100 Commit: Stephen Kelly CommitDate: Sat Mar 7 13:23:19 2015 +0100 Genex: Allow COMPILE_LANGUAGE when processing compile definitions. Issue an error if this is encountered by an IDE generator. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b1b1102..b6d97d1 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -120,6 +120,16 @@ Available logical expressions are: add_executable(myapp main.cpp) target_link_libraries(myapp myapp_c myapp_cxx) + The ``Makefile`` and ``Ninja`` based generators can also use this + expression to specify compile-language specific compile definitions: + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_definitions(myapp + PRIVATE $<$:COMPILING_CXX> + ) + Informational Expressions ========================= diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 69857ef..614e7d9 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -599,7 +599,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, // the compilerdefines for this target std::vector cdefs; - target->GetCompileDefinitions(cdefs, buildType); + target->GetCompileDefinitions(cdefs, buildType, "C"); // Expand the list. for(std::vector::const_iterator di = cdefs.begin(); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 5fff0fb..25f9005 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -436,7 +436,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, } // Add preprocessor definitions for this target and configuration. - lg->AddCompileDefinitions(defines, target, config); + lg->AddCompileDefinitions(defines, target, config, language); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); { std::string defPropName = "COMPILE_DEFINITIONS_"; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 89bdb5b..26ee7af 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -817,7 +817,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector ¶meters, cmGeneratorExpressionContext *context, const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const + cmGeneratorExpressionDAGChecker *dagChecker) const { if(context->Language.empty()) { @@ -848,11 +848,20 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "generators."); return std::string(); } + else if (gg->GetName().find("Xcode") != std::string::npos) + { + if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with COMPILE_OPTIONS " + "with the Xcode generator."); + return std::string(); + } + } else { if(gg->GetName().find("Makefiles") == std::string::npos && - gg->GetName().find("Ninja") == std::string::npos && - gg->GetName().find("Xcode") == std::string::npos) + gg->GetName().find("Ninja") == std::string::npos) { reportError(context, content->GetOriginalExpression(), "$ not supported for this generator."); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e89161d..bd8a1f5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1803,7 +1803,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "C"); this->AppendDefines(ppDefs, targetDefines); buildSettings->AddAttribute ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index be82085..735dfa9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1428,11 +1428,11 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config) + const std::string& config, + const std::string& lang) { std::vector targetDefines; - target->GetCompileDefinitions(targetDefines, - config); + target->GetCompileDefinitions(targetDefines, config, lang); this->AppendDefines(defines, targetDefines); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3a9d5be..f1f0da1 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -239,7 +239,8 @@ public: const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config); + const std::string& config, + const std::string& lang); /** Compute the language used to compile the given source file. */ std::string GetSourceFileLanguage(const cmSourceFile& source); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 432cb3a..9ecb029 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2094,26 +2094,26 @@ void cmLocalUnixMakefileGenerator3 << "set(CMAKE_" << l->first << "_COMPILER_ID \"" << cid << "\")\n"; } - } - // Build a list of preprocessor definitions for the target. - std::set defines; - this->AddCompileDefinitions(defines, &target, - this->ConfigurationName); - if(!defines.empty()) - { - cmakefileStream - << "\n" - << "# Preprocessor definitions for this target.\n" - << "set(CMAKE_TARGET_DEFINITIONS\n"; - for(std::set::const_iterator di = defines.begin(); - di != defines.end(); ++di) + // Build a list of preprocessor definitions for the target. + std::set defines; + this->AddCompileDefinitions(defines, &target, + this->ConfigurationName, l->first); + if(!defines.empty()) { cmakefileStream - << " " << this->EscapeForCMake(*di) << "\n"; + << "\n" + << "# Preprocessor definitions for this target.\n" + << "set(CMAKE_TARGET_DEFINITIONS_" << l->first << "\n"; + for(std::set::const_iterator di = defines.begin(); + di != defines.end(); ++di) + { + cmakefileStream + << " " << this->EscapeForCMake(*di) << "\n"; + } + cmakefileStream + << " )\n"; } - cmakefileStream - << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 0848b03..2b999eb 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1778,15 +1778,15 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, ""); + this->AddCompileDefinitions(definesSet, &target, "", linkLanguage); this->AddCompileDefinitions(debugDefinesSet, &target, - "DEBUG"); + "DEBUG", linkLanguage); this->AddCompileDefinitions(releaseDefinesSet, &target, - "RELEASE"); + "RELEASE", linkLanguage); this->AddCompileDefinitions(minsizeDefinesSet, &target, - "MINSIZEREL"); + "MINSIZEREL", linkLanguage); this->AddCompileDefinitions(debugrelDefinesSet, &target, - "RELWITHDEBINFO"); + "RELWITHDEBINFO", linkLanguage); std::string defines = " "; std::string debugDefines = " "; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ed560aa..f53f825 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -775,7 +775,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "CXX"); targetOptions.AddDefines(targetDefines); targetOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 20207f5..57c49f1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -329,7 +329,7 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->ConfigurationName); + this->LocalGenerator->ConfigurationName, l); std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, lang); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index cfd8937..92fccd3 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -231,7 +231,7 @@ ComputeDefines(cmSourceFile const* source, const std::string& language) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->GetConfigName()); + this->GetConfigName(), language); this->LocalGenerator->AppendDefines (defines, source->GetProperty("COMPILE_DEFINITIONS")); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e18e757..844d708 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -507,7 +507,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, incs = cmJoin(includeDirs, ";"); std::set defines; - localGen->AddCompileDefinitions(defines, target, config); + localGen->AddCompileDefinitions(defines, target, config, "CXX"); defs += cmJoin(defines, ";"); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c54d694..87dcc99 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2336,16 +2336,18 @@ static void processCompileDefinitions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions", std::string()); + "definitions", language); } //---------------------------------------------------------------------------- void cmTarget::GetCompileDefinitions(std::vector &list, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2377,7 +2379,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); std::vector linkInterfaceCompileDefinitionsEntries; @@ -2424,7 +2427,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); deleteAndClear(linkInterfaceCompileDefinitionsEntries); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 56db22e..0356c1e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -496,7 +496,8 @@ public: const char* GetExportMacro() const; void GetCompileDefinitions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; // Compute the set of languages compiled by the target. This is // computed every time it is called because the languages can change diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 04d1487..19444ed 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1876,7 +1876,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); std::vector targetDefines; - this->Target->GetCompileDefinitions(targetDefines, configName.c_str()); + this->Target->GetCompileDefinitions(targetDefines, + configName.c_str(), "CXX"); clOptions.AddDefines(targetDefines); if(this->MSTools) { diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 14d40aa..f96283d 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -26,6 +26,21 @@ target_compile_definitions(consumer PRIVATE ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_compile_definitions(consumer + PRIVATE + CONSUMER_LANG_$ + LANG_IS_CXX=$ + LANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + add_definitions(-DSOME_DEF) add_library(imp UNKNOWN IMPORTED) get_target_property(_res imp COMPILE_DEFINITIONS) diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c new file mode 100644 index 0000000..5796d96 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp index a391114..778f57e 100644 --- a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp @@ -15,4 +15,22 @@ #error Expected DASH_D_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt new file mode 100644 index 0000000..73b66ac --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt new file mode 100644 index 0000000..a1ed633 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake new file mode 100644 index 0000000..7935d88 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_definitions(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 2c5d9ae..8a32aef 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -4,3 +4,10 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) run_cmake(CompileOptions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt) + run_cmake(CompileDefinitions) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) + run_cmake(CompileDefinitions) +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce8075b73f0655b6acc4a2a33cc66eae51aa3d6c commit ce8075b73f0655b6acc4a2a33cc66eae51aa3d6c Author: Stephen Kelly AuthorDate: Tue Nov 25 22:47:44 2014 +0100 Commit: Stephen Kelly CommitDate: Sat Mar 7 13:19:45 2015 +0100 Genex: Enable use of COMPILE_LANGUAGE for compile options. Follow-ups will allow the use of the generator expression for compile definitions and include directories for non-IDE generators. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index c47a7c4..b1b1102 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -93,6 +93,32 @@ Available logical expressions are: for the 'head' target, an error is reported. See the :manual:`cmake-compile-features(7)` manual for information on compile features. +``$`` + ``1`` when the language used for compilation unit matches ``lang``, + otherwise ``0``. This expression used to specify compile options for + source files of a particular language in a target. For example, to specify + the use of the ``-fno-exceptions`` compile option (compiler id checks + elided): + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_options(myapp + PRIVATE $<$:-fno-exceptions> + ) + + This generator expression has limited use because it is not possible to + use it with the Visual Studio generators. Portable buildsystems would + not use this expression, and would create separate libraries for each + source file language instead: + + .. code-block:: cmake + + add_library(myapp_c foo.c) + add_library(myapp_cxx foo.c) + target_compile_options(myapp_cxx PUBLIC -fno-exceptions) + add_executable(myapp main.cpp) + target_link_libraries(myapp myapp_c myapp_cxx) Informational Expressions ========================= @@ -174,6 +200,10 @@ Available informational expressions are: ``$`` Content of the install prefix when the target is exported via :command:`install(EXPORT)` and empty otherwise. +``$`` + The compile language of source files when evaluating compile options. See + the unary version for notes about portability of this generator + expression. Output Expressions ================== diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 63a46f2..89bdb5b 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -827,6 +827,38 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "components of the file(GENERATE) command."); return std::string(); } + + std::vector enabledLanguages; + cmGlobalGenerator* gg + = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + if (!parameters.empty() && + std::find(enabledLanguages.begin(), enabledLanguages.end(), + parameters.front()) == enabledLanguages.end()) + { + reportError(context, content->GetOriginalExpression(), + "$ Unknown language."); + return std::string(); + } + + if (gg->GetName().find("Visual Studio") != std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ may not be used with Visual Studio " + "generators."); + return std::string(); + } + else + { + if(gg->GetName().find("Makefiles") == std::string::npos && + gg->GetName().find("Ninja") == std::string::npos && + gg->GetName().find("Xcode") == std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ not supported for this generator."); + return std::string(); + } + } if (parameters.empty()) { return context->Language; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7c83f27..be82085 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1453,7 +1453,7 @@ void cmLocalGenerator::AddCompileOptions( { cmSystemTools::ParseWindowsCommandLine(targetFlags, opts); } - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { @@ -1474,7 +1474,7 @@ void cmLocalGenerator::AddCompileOptions( this->AppendFlags(flags, targetFlags); } std::vector opts; - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e046bef..c54d694 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2192,7 +2192,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions, const char *logName) + const std::string& config, bool debugOptions, const char *logName, + std::string const& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -2204,7 +2205,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, + language), entryOptions); std::string usedOptions; for(std::vector::iterator @@ -2238,10 +2240,12 @@ static void processCompileOptions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "options"); + dagChecker, config, debugOptions, "options", + language); } //---------------------------------------------------------------------------- @@ -2271,7 +2275,8 @@ void cmTarget::GetAutoUicOptions(std::vector &result, //---------------------------------------------------------------------------- void cmTarget::GetCompileOptions(std::vector &result, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2303,7 +2308,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); std::vector linkInterfaceCompileOptionsEntries; @@ -2318,7 +2324,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); deleteAndClear(linkInterfaceCompileOptionsEntries); } @@ -2333,7 +2340,7 @@ static void processCompileDefinitions(cmTarget const* tgt, { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions"); + "definitions", std::string()); } //---------------------------------------------------------------------------- @@ -2431,7 +2438,8 @@ static void processCompileFeatures(cmTarget const* tgt, const std::string& config, bool debugOptions) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "features"); + dagChecker, config, debugOptions, "features", + std::string()); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ddd9859..56db22e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -577,7 +577,8 @@ public: void AppendBuildInterfaceIncludes(); void GetCompileOptions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; void GetAutoUicOptions(std::vector &result, const std::string& config) const; void GetCompileFeatures(std::vector &features, diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 1d04639..35dd276 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -23,6 +23,21 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) +if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_compile_options(consumer + PRIVATE + -DCONSUMER_LANG_$ + -DLANG_IS_CXX=$ + -DLANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_compile_options(consumer PRIVATE $<$:$> ) diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c new file mode 100644 index 0000000..5796d96 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 1299606..c5882a5 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -15,4 +15,22 @@ #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057..9f1256e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -208,3 +208,5 @@ add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) if(RPMBUILD_EXECUTABLE) add_RunCMake_test(CPackRPM) endif() + +add_RunCMake_test(COMPILE_LANGUAGE-genex) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt new file mode 100644 index 0000000..e9e8e9f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileOptions.cmake:5 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake new file mode 100644 index 0000000..6c92abc --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_options(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake new file mode 100644 index 0000000..2c5d9ae --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +if (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) + run_cmake(CompileOptions) +endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp new file mode 100644 index 0000000..31a1337 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt new file mode 100644 index 0000000..444da45 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at COMPILE_LANGUAGE-unknown-lang.cmake:4 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ Unknown language. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake new file mode 100644 index 0000000..cec12a3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<$:-Wall>) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index f591c3d..542b7fc 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -23,6 +23,7 @@ run_cmake(COMPILE_LANGUAGE-target_sources) run_cmake(COMPILE_LANGUAGE-add_executable) run_cmake(COMPILE_LANGUAGE-add_library) run_cmake(COMPILE_LANGUAGE-add_test) +run_cmake(COMPILE_LANGUAGE-unknown-lang) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e387ce7d681f9bd6c90c41f34b7500dfeb3b32ba commit e387ce7d681f9bd6c90c41f34b7500dfeb3b32ba Author: Stephen Kelly AuthorDate: Sun Feb 22 17:43:13 2015 +0100 Commit: Stephen Kelly CommitDate: Sat Mar 7 13:19:45 2015 +0100 Genex: Add a COMPILE_LANGUAGE generator expression. diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index bf96951..0a27016 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -52,14 +52,16 @@ cmGeneratorExpression::~cmGeneratorExpression() const char *cmCompiledGeneratorExpression::Evaluate( cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, - cmGeneratorExpressionDAGChecker *dagChecker) const + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& language) const { return this->Evaluate(mf, config, quiet, headTarget, headTarget, - dagChecker); + dagChecker, + language); } //---------------------------------------------------------------------------- @@ -67,7 +69,8 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker) const + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& language) const { if (!this->NeedsEvaluation) { @@ -93,6 +96,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; context.CurrentTarget = currentTarget ? currentTarget : headTarget; context.Backtrace = this->Backtrace; + context.Language = language; for ( ; it != end; ++it) { diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 57f78c5..55d9691 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -80,11 +80,13 @@ public: bool quiet = false, cmTarget const* headTarget = 0, cmTarget const* currentTarget = 0, - cmGeneratorExpressionDAGChecker *dagChecker = 0) const; + cmGeneratorExpressionDAGChecker *dagChecker = 0, + std::string const& language = std::string()) const; const char* Evaluate(cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, - cmGeneratorExpressionDAGChecker *dagChecker) const; + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& language = std::string()) const; /** Get set of targets found during evaluations. */ std::set const& GetTargets() const diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index ba18faa..63a46f2 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -16,6 +16,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpression.h" #include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" #include "cmSourceFile.h" #include @@ -89,7 +90,8 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( context->Quiet, headTarget, currentTarget, - dagChecker); + dagChecker, + context->Language); if (cge->GetHadContextSensitiveCondition()) { context->HadContextSensitiveCondition = true; @@ -806,6 +808,33 @@ static const struct JoinNode : public cmGeneratorExpressionNode } } joinNode; +static const struct CompileLanguageNode : public cmGeneratorExpressionNode +{ + CompileLanguageNode() {} + + virtual int NumExpectedParameters() const { return OneOrZeroParameters; } + + std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *) const + { + if(context->Language.empty()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used to specify include " + "directories compile definitions, compile options and to evaluate " + "components of the file(GENERATE) command."); + return std::string(); + } + if (parameters.empty()) + { + return context->Language; + } + return context->Language == parameters.front() ? "1" : "0"; + } +} languageNode; + #define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ , "INTERFACE_" #PROPERTY @@ -1829,6 +1858,7 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["INSTALL_PREFIX"] = &installPrefixNode; nodeMap["JOIN"] = &joinNode; nodeMap["LINK_ONLY"] = &linkOnlyNode; + nodeMap["COMPILE_LANGUAGE"] = &languageNode; } NodeMap::const_iterator i = nodeMap.find(identifier); if (i == nodeMap.end()) diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0bf1797..b1fec0b 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -36,6 +36,7 @@ struct cmGeneratorExpressionContext MaxLanguageStandard; cmMakefile *Makefile; std::string Config; + std::string Language; cmTarget const* HeadTarget; // The target whose property is being evaluated. cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears // directly or indirectly in the property. diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt new file mode 100644 index 0000000..789b4d0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_custom_command.cmake:6 \(add_custom_command\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake new file mode 100644 index 0000000..f4ba261 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake @@ -0,0 +1,8 @@ + +enable_language(C) + +add_library(empty empty.c) + +add_custom_command(TARGET empty PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $ +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt new file mode 100644 index 0000000..400fbc0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_custom_target.cmake:4 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake new file mode 100644 index 0000000..4102623 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake @@ -0,0 +1,6 @@ + +enable_language(C) + +add_custom_target(empty + COMMAND ${CMAKE_COMMAND} -E echo $ +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt new file mode 100644 index 0000000..e45bb02 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_executable.cmake:4 \(add_executable\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake new file mode 100644 index 0000000..5c2ff35 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake @@ -0,0 +1,4 @@ + +enable_language(C) + +add_executable(empty empty.$) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt new file mode 100644 index 0000000..c9ee6fe --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_library.cmake:4 \(add_library\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake new file mode 100644 index 0000000..dd9f824 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake @@ -0,0 +1,4 @@ + +enable_language(C) + +add_library(empty empty.$) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt new file mode 100644 index 0000000..9955f5d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-add_test.cmake:5 \(add_test\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake new file mode 100644 index 0000000..deedf65 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt new file mode 100644 index 0000000..eca700f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake new file mode 100644 index 0000000..92c20e3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + empty.$ + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt new file mode 100644 index 0000000..2d324e2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at COMPILE_LANGUAGE-target_sources.cmake:5 \(target_sources\): + Error evaluating generator expression: + + \$ + + \$ may only be used to specify include directories + compile definitions, compile options and to evaluate components of the + file\(GENERATE\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake new file mode 100644 index 0000000..0c78acd --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake @@ -0,0 +1,5 @@ + +enable_language(C) + +add_library(empty empty.c) +target_sources(empty PRIVATE empty.$) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 6c32393..f591c3d 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -16,6 +16,13 @@ run_cmake(NonValidTarget-C_COMPILER_VERSION) run_cmake(NonValidTarget-CXX_COMPILER_VERSION) run_cmake(NonValidTarget-TARGET_PROPERTY) run_cmake(NonValidTarget-TARGET_POLICY) +run_cmake(COMPILE_LANGUAGE-add_custom_target) +run_cmake(COMPILE_LANGUAGE-add_custom_command) +run_cmake(COMPILE_LANGUAGE-install) +run_cmake(COMPILE_LANGUAGE-target_sources) +run_cmake(COMPILE_LANGUAGE-add_executable) +run_cmake(COMPILE_LANGUAGE-add_library) +run_cmake(COMPILE_LANGUAGE-add_test) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a0128f42feb7da9b6bebe0c2c3aa7a756b96822 commit 4a0128f42feb7da9b6bebe0c2c3aa7a756b96822 Author: Brad King AuthorDate: Thu Mar 5 16:50:07 2015 -0500 Commit: Stephen Kelly CommitDate: Sat Mar 7 13:19:40 2015 +0100 VS6: Compute CMAKE_*_FLAGS and COMPILE_DEFINITIONS* only when needed These placeholders are used only in the .dsp templates for targets that actually compile sources. diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1d62093..0848b03 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1701,15 +1701,15 @@ void cmLocalVisualStudio6Generator = this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX"); cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX", debugPostfix?debugPostfix:""); - // store flags for each configuration - std::string flags = " "; - std::string flagsRelease = " "; - std::string flagsMinSizeRel = " "; - std::string flagsDebug = " "; - std::string flagsRelWithDebInfo = " "; if(target.GetType() >= cmTarget::EXECUTABLE && target.GetType() <= cmTarget::OBJECT_LIBRARY) { + // store flags for each configuration + std::string flags = " "; + std::string flagsRelease = " "; + std::string flagsMinSizeRel = " "; + std::string flagsDebug = " "; + std::string flagsRelWithDebInfo = " "; std::vector configs; target.GetMakefile()->GetConfigurations(configs); std::vector::const_iterator it = configs.begin(); @@ -1760,72 +1760,77 @@ void cmLocalVisualStudio6Generator "MinSizeRel"); this->AddCompileOptions(flagsRelWithDebInfo, &target, linkLanguage, "RelWithDebInfo"); - } - // if _UNICODE and _SBCS are not found, then add -D_MBCS - std::string defs = this->Makefile->GetDefineFlags(); - if(flags.find("D_UNICODE") == flags.npos && - defs.find("D_UNICODE") == flags.npos && - flags.find("D_SBCS") == flags.npos && - defs.find("D_SBCS") == flags.npos) - { - flags += " /D \"_MBCS\""; - } + // if _UNICODE and _SBCS are not found, then add -D_MBCS + std::string defs = this->Makefile->GetDefineFlags(); + if(flags.find("D_UNICODE") == flags.npos && + defs.find("D_UNICODE") == flags.npos && + flags.find("D_SBCS") == flags.npos && + defs.find("D_SBCS") == flags.npos) + { + flags += " /D \"_MBCS\""; + } - // Add per-target and per-configuration preprocessor definitions. - std::set definesSet; - std::set debugDefinesSet; - std::set releaseDefinesSet; - std::set minsizeDefinesSet; - std::set debugrelDefinesSet; - - this->AddCompileDefinitions(definesSet, &target, ""); - this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG"); - this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE"); - this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL"); - this->AddCompileDefinitions(debugrelDefinesSet, &target, "RELWITHDEBINFO"); - - std::string defines = " "; - std::string debugDefines = " "; - std::string releaseDefines = " "; - std::string minsizeDefines = " "; - std::string debugrelDefines = " "; - - this->JoinDefines(definesSet, defines, ""); - this->JoinDefines(debugDefinesSet, debugDefines, ""); - this->JoinDefines(releaseDefinesSet, releaseDefines, ""); - this->JoinDefines(minsizeDefinesSet, minsizeDefines, ""); - this->JoinDefines(debugrelDefinesSet, debugrelDefines, ""); - - flags += defines; - flagsDebug += debugDefines; - flagsRelease += releaseDefines; - flagsMinSizeRel += minsizeDefines; - flagsRelWithDebInfo += debugrelDefines; - - // The template files have CXX FLAGS in them, that need to be replaced. - // There are not separate CXX and C template files, so we use the same - // variable names. The previous code sets up flags* variables to contain - // the correct C or CXX flags - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", - flagsMinSizeRel.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", - flagsDebug.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", - flagsRelWithDebInfo.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", - flagsRelease.c_str()); - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); - - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL", - minsizeDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", - debugDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO", - debugrelDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE", - releaseDefines.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", defines.c_str()); + // Add per-target and per-configuration preprocessor definitions. + std::set definesSet; + std::set debugDefinesSet; + std::set releaseDefinesSet; + std::set minsizeDefinesSet; + std::set debugrelDefinesSet; + + this->AddCompileDefinitions(definesSet, &target, ""); + this->AddCompileDefinitions(debugDefinesSet, &target, + "DEBUG"); + this->AddCompileDefinitions(releaseDefinesSet, &target, + "RELEASE"); + this->AddCompileDefinitions(minsizeDefinesSet, &target, + "MINSIZEREL"); + this->AddCompileDefinitions(debugrelDefinesSet, &target, + "RELWITHDEBINFO"); + + std::string defines = " "; + std::string debugDefines = " "; + std::string releaseDefines = " "; + std::string minsizeDefines = " "; + std::string debugrelDefines = " "; + + this->JoinDefines(definesSet, defines, ""); + this->JoinDefines(debugDefinesSet, debugDefines, ""); + this->JoinDefines(releaseDefinesSet, releaseDefines, ""); + this->JoinDefines(minsizeDefinesSet, minsizeDefines, ""); + this->JoinDefines(debugrelDefinesSet, debugrelDefines, ""); + + flags += defines; + flagsDebug += debugDefines; + flagsRelease += releaseDefines; + flagsMinSizeRel += minsizeDefines; + flagsRelWithDebInfo += debugrelDefines; + + // The template files have CXX FLAGS in them, that need to be replaced. + // There are not separate CXX and C template files, so we use the same + // variable names. The previous code sets up flags* variables to + // contain the correct C or CXX flags + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", + flagsMinSizeRel.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", + flagsDebug.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO", + flagsRelWithDebInfo.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", + flagsRelease.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); + + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL", + minsizeDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", + debugDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO", + debugrelDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE", + releaseDefines.c_str()); + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", + defines.c_str()); + } fout << line.c_str() << std::endl; } ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Sat Mar 7 07:29:12 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sat, 7 Mar 2015 07:29:12 -0500 (EST) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-895-g0a15455 Message-ID: <20150307122912.6DE8FAB633@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0a15455b6d15150652cc57895ca0e927ff16b765 (commit) via fa25e0d8506311e626efe062ab4d0978600a50c9 (commit) via 860c2761ded6d8133a028cdd1bbc567bbb74e486 (commit) from 325b8b652927c23b95bbc5fe1d8bdd0a139e32fd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a15455b6d15150652cc57895ca0e927ff16b765 commit 0a15455b6d15150652cc57895ca0e927ff16b765 Merge: 325b8b6 fa25e0d Author: Stephen Kelly AuthorDate: Sat Mar 7 07:29:11 2015 -0500 Commit: CMake Topic Stage CommitDate: Sat Mar 7 07:29:11 2015 -0500 Merge topic 'target-language-genex' into next fa25e0d8 Allow COMPILE_LANGUAGE with Watcom WMake. 860c2761 Extract a variable. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa25e0d8506311e626efe062ab4d0978600a50c9 commit fa25e0d8506311e626efe062ab4d0978600a50c9 Author: Stephen Kelly AuthorDate: Sat Mar 7 13:28:24 2015 +0100 Commit: Stephen Kelly CommitDate: Sat Mar 7 13:28:24 2015 +0100 Allow COMPILE_LANGUAGE with Watcom WMake. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 9bfcbaa..756d932 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -863,7 +863,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode else { if(genName.find("Makefiles") == std::string::npos && - genName.find("Ninja") == std::string::npos) + genName.find("Ninja") == std::string::npos && + genName.find("Watcom WMake") == std::string::npos) { reportError(context, content->GetOriginalExpression(), "$ not supported for this generator."); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=860c2761ded6d8133a028cdd1bbc567bbb74e486 commit 860c2761ded6d8133a028cdd1bbc567bbb74e486 Author: Stephen Kelly AuthorDate: Sat Mar 7 13:27:49 2015 +0100 Commit: Stephen Kelly CommitDate: Sat Mar 7 13:27:49 2015 +0100 Extract a variable. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index f289ead..9bfcbaa 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -841,14 +841,15 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode return std::string(); } - if (gg->GetName().find("Visual Studio") != std::string::npos) + std::string genName = gg->GetName(); + if (genName.find("Visual Studio") != std::string::npos) { reportError(context, content->GetOriginalExpression(), "$ may not be used with Visual Studio " "generators."); return std::string(); } - else if (gg->GetName().find("Xcode") != std::string::npos) + else if (genName.find("Xcode") != std::string::npos) { if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() || dagChecker->EvaluatingIncludeDirectories())) @@ -861,8 +862,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } else { - if(gg->GetName().find("Makefiles") == std::string::npos && - gg->GetName().find("Ninja") == std::string::npos) + if(genName.find("Makefiles") == std::string::npos && + genName.find("Ninja") == std::string::npos) { reportError(context, content->GetOriginalExpression(), "$ not supported for this generator."); ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionEvaluator.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Mar 8 00:01:12 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 8 Mar 2015 00:01:12 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-368-g42f0cb0 Message-ID: <20150308050112.2C275AB211@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 42f0cb0c103ba83eadff09485bab2287655ffbea (commit) from 90a051f443c4cb400696b28651877c53e3c56607 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42f0cb0c103ba83eadff09485bab2287655ffbea commit 42f0cb0c103ba83eadff09485bab2287655ffbea Author: Kitware Robot AuthorDate: Sun Mar 8 00:01:09 2015 -0500 Commit: Kitware Robot CommitDate: Sun Mar 8 00:01:09 2015 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6f17e27..332d802 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150307) +set(CMake_VERSION_PATCH 20150308) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Sun Mar 8 09:06:45 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sun, 8 Mar 2015 09:06:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-903-ge410257 Message-ID: <20150308130645.105F8AB9CD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e410257de9ec20cac70a365a94f6d4ddf48ccc57 (commit) via d623d67864ccc5b6158bd215bd3a164ae2b912dd (commit) via d5b9039b870a8a05e146cafbea49a216e15f2d9e (commit) via d8915b7531f6a5d6f9cd6c59d2b22b0d6089ddb0 (commit) via 90f36278dedaf61119fc5376f578a0fd3227a106 (commit) via a619074d7091adfac7b75acc2f5f9791b7e706cb (commit) via a35831232d00cd39156b487539726d780df7abd5 (commit) via 90a051f443c4cb400696b28651877c53e3c56607 (commit) from 0a15455b6d15150652cc57895ca0e927ff16b765 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e410257de9ec20cac70a365a94f6d4ddf48ccc57 commit e410257de9ec20cac70a365a94f6d4ddf48ccc57 Merge: 0a15455 d623d67 Author: Stephen Kelly AuthorDate: Sun Mar 8 09:06:42 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun Mar 8 09:06:42 2015 -0400 Merge topic 'cmRemoveDuplicates-improvement' into next d623d678 cmRemoveDuplicates: Partially specialize the API for pointer types. d5b9039b cmRemoveDuplicates: Type-parameterize all uniq-operations d8915b75 cmRemoveDuplicates: Store unique iterators instead of values. 90f36278 cmRemoveDuplicates: Fix iterator -> const_iterator. a619074d cmInstalledFile: Move Property implementation out of line. a3583123 Include cmAlgorithms where it is used. 90a051f4 CMake Nightly Date Stamp diff --cc Source/cmGeneratorExpressionEvaluator.cxx index 756d932,a62374b..cd0e982 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@@ -16,8 -16,8 +16,9 @@@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorExpression.h" #include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" #include "cmSourceFile.h" + #include "cmAlgorithms.h" #include http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d623d67864ccc5b6158bd215bd3a164ae2b912dd commit d623d67864ccc5b6158bd215bd3a164ae2b912dd Author: Stephen Kelly AuthorDate: Sun Mar 8 09:43:11 2015 +0100 Commit: Stephen Kelly CommitDate: Sun Mar 8 14:05:43 2015 +0100 cmRemoveDuplicates: Partially specialize the API for pointer types. If de-duplicating a container of pointers, there is no need to store iterators to them, as that is just more 'pointer chasing'. Store the pointers themselves and use API which compares the pointers in the specialization. diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 5504fee..0cf7701 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -263,7 +263,7 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) namespace ContainerAlgorithms { -template +template struct RemoveDuplicatesAPI { typedef typename Range::const_iterator const_iterator; @@ -275,6 +275,18 @@ struct RemoveDuplicatesAPI static bool valueCompare(It it, const_iterator it2) { return **it != *it2; } }; +template +struct RemoveDuplicatesAPI +{ + typedef typename Range::const_iterator const_iterator; + typedef T* value_type; + + static bool lessThan(value_type a, value_type b) { return a < b; } + static value_type uniqueValue(const_iterator a) { return *a; } + template + static bool valueCompare(It it, const_iterator it2) { return *it != *it2; } +}; + } template http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d5b9039b870a8a05e146cafbea49a216e15f2d9e commit d5b9039b870a8a05e146cafbea49a216e15f2d9e Author: Stephen Kelly AuthorDate: Sun Mar 1 21:57:16 2015 +0100 Commit: Stephen Kelly CommitDate: Sun Mar 8 14:05:43 2015 +0100 cmRemoveDuplicates: Type-parameterize all uniq-operations diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 1b7029b..5504fee 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -176,12 +176,6 @@ private: Range const& m_range; }; -struct IterLess -{ - template - bool operator()(It const& a, It const& b) const { return *a < *b; } -}; - } template @@ -267,10 +261,27 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) ContainerAlgorithms::BinarySearcher(m)); } +namespace ContainerAlgorithms { + +template +struct RemoveDuplicatesAPI +{ + typedef typename Range::const_iterator const_iterator; + typedef typename Range::const_iterator value_type; + + static bool lessThan(value_type a, value_type b) { return *a < *b; } + static value_type uniqueValue(const_iterator a) { return a; } + template + static bool valueCompare(It it, const_iterator it2) { return **it != *it2; } +}; + +} + template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - typedef typename Range::const_iterator T; + typedef typename ContainerAlgorithms::RemoveDuplicatesAPI API; + typedef typename API::value_type T; std::vector unique; unique.reserve(r.size()); std::vector indices; @@ -280,11 +291,11 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) it != end; ++it, ++count) { const typename std::vector::iterator low = - std::lower_bound(unique.begin(), unique.end(), it, - ContainerAlgorithms::IterLess()); - if (low == unique.end() || **low != *it) + std::lower_bound(unique.begin(), unique.end(), + API::uniqueValue(it), API::lessThan); + if (low == unique.end() || API::valueCompare(low, it)) { - unique.insert(low, it); + unique.insert(low, API::uniqueValue(it)); } else { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d8915b7531f6a5d6f9cd6c59d2b22b0d6089ddb0 commit d8915b7531f6a5d6f9cd6c59d2b22b0d6089ddb0 Author: Stephen Kelly AuthorDate: Sun Mar 1 21:53:04 2015 +0100 Commit: Stephen Kelly CommitDate: Sun Mar 8 14:05:43 2015 +0100 cmRemoveDuplicates: Store unique iterators instead of values. There is no need to copy all of the values in the container in order to determine uniqueness. Iterators can be stored instead and can be used with standard algorithms with custom comparison methods. This also means that we use less space in case the value_type size is greater than sizeof(iterator). That is common for std::string which may require up to 32 bytes (libstdc++ 5.0 and MSVC at least). With libstdc++ 4.9 and older, std::string is 8 bytes, so we likely don't gain anything here. Inspired-by: Daniel Pfeifer diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index f032de7..1b7029b 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -176,6 +176,12 @@ private: Range const& m_range; }; +struct IterLess +{ + template + bool operator()(It const& a, It const& b) const { return *a < *b; } +}; + } template @@ -264,8 +270,8 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - typedef std::vector UniqueVector; - UniqueVector unique; + typedef typename Range::const_iterator T; + std::vector unique; unique.reserve(r.size()); std::vector indices; size_t count = 0; @@ -273,11 +279,12 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) for(typename Range::const_iterator it = r.begin(); it != end; ++it, ++count) { - const typename UniqueVector::iterator low = - std::lower_bound(unique.begin(), unique.end(), *it); - if (low == unique.end() || *low != *it) + const typename std::vector::iterator low = + std::lower_bound(unique.begin(), unique.end(), it, + ContainerAlgorithms::IterLess()); + if (low == unique.end() || **low != *it) { - unique.insert(low, *it); + unique.insert(low, it); } else { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90f36278dedaf61119fc5376f578a0fd3227a106 commit 90f36278dedaf61119fc5376f578a0fd3227a106 Author: Stephen Kelly AuthorDate: Sun Mar 8 14:04:54 2015 +0100 Commit: Stephen Kelly CommitDate: Sun Mar 8 14:05:43 2015 +0100 cmRemoveDuplicates: Fix iterator -> const_iterator. diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index b9d7e78..f032de7 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -269,7 +269,7 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) unique.reserve(r.size()); std::vector indices; size_t count = 0; - const typename Range::iterator end = r.end(); + const typename Range::const_iterator end = r.end(); for(typename Range::const_iterator it = r.begin(); it != end; ++it, ++count) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a619074d7091adfac7b75acc2f5f9791b7e706cb commit a619074d7091adfac7b75acc2f5f9791b7e706cb Author: Stephen Kelly AuthorDate: Sun Mar 8 13:37:44 2015 +0100 Commit: Stephen Kelly CommitDate: Sun Mar 8 13:52:32 2015 +0100 cmInstalledFile: Move Property implementation out of line. Don't require re-building the world when changing cmAlgorithms.h. diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index 4b53752..8c52b48 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -12,6 +12,7 @@ #include "cmInstalledFile.h" #include "cmSystemTools.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmInstalledFile::cmInstalledFile(): @@ -29,6 +30,16 @@ cmInstalledFile::~cmInstalledFile() } } +cmInstalledFile::Property::Property() +{ + +} + +cmInstalledFile::Property::~Property() +{ + cmDeleteAll(this->ValueExpressions); +} + //---------------------------------------------------------------------------- void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) { diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index cdb0866..3af90a7 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -13,7 +13,6 @@ #define cmInstalledFile_h #include "cmGeneratorExpression.h" -#include "cmAlgorithms.h" /** \class cmInstalledFile * \brief Represents a file intended for installation. @@ -32,15 +31,8 @@ public: struct Property { - Property() - { - - } - - ~Property() - { - cmDeleteAll(this->ValueExpressions); - } + Property(); + ~Property(); ExpressionVectorType ValueExpressions; }; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a35831232d00cd39156b487539726d780df7abd5 commit a35831232d00cd39156b487539726d780df7abd5 Author: Stephen Kelly AuthorDate: Sun Mar 8 13:51:20 2015 +0100 Commit: Stephen Kelly CommitDate: Sun Mar 8 13:52:15 2015 +0100 Include cmAlgorithms where it is used. diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index fe27e2b..29e07ef 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -20,6 +20,7 @@ #include "cmGeneratedFileStream.h" #include "cmXMLSafe.h" #include "cmFileTimeComparison.h" +#include "cmAlgorithms.h" //#include #include diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index dcd0b6c..d60062e 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -22,6 +22,7 @@ #include "cmCursesDummyWidget.h" #include "cmCursesCacheEntryComposite.h" #include "cmCursesLongMessageForm.h" +#include "cmAlgorithms.h" inline int ctrl(int z) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e6d3960..1d0df69 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -26,6 +26,7 @@ #include "cmVersionMacros.h" #include "cmCTestCommand.h" #include "cmCTestStartCommand.h" +#include "cmAlgorithms.h" #include "cmCTestBuildHandler.h" #include "cmCTestBuildAndTestHandler.h" diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index be28b2f..6005d5f 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -17,6 +17,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 479da75..b0e0f36 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -19,6 +19,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index e9390e4..59efa52 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -14,6 +14,7 @@ #include "cmCacheManager.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" +#include "cmAlgorithms.h" #include "cmExportTryCompileFileGenerator.h" #include diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 6dde349..63d8fa6 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -15,6 +15,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include #include // isspace diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index f4e3a75..8c17536 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -14,6 +14,7 @@ #include "cmSystemTools.h" #include "cmVersion.h" #include "cmRST.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 71728be..b4fad98 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -22,6 +22,7 @@ #include "cmTargetExport.h" #include "cmVersion.h" #include "cmComputeLinkInformation.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ba1dde2..6d639c9 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -19,6 +19,7 @@ #include "cmInstallExportGenerator.h" #include "cmInstallTargetGenerator.h" #include "cmTargetExport.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmExportInstallFileGenerator diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 0290c92..ec22ea0 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -16,6 +16,7 @@ #include "cmInstallType.h" #include "cmFileTimeComparison.h" #include "cmCryptoHash.h" +#include "cmAlgorithms.h" #include "cmTimestamp.h" diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index ffc641c..f63df61 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmFindBase.h" +#include "cmAlgorithms.h" + cmFindBase::cmFindBase() { this->AlreadyInCache = false; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 26bd4b9..87f9037 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -14,6 +14,7 @@ #include #include #include +#include "cmAlgorithms.h" #ifdef CMAKE_BUILD_WITH_CMAKE #include "cmVariableWatch.h" diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index bf96951..a1bb97b 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -14,6 +14,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "assert.h" +#include "cmAlgorithms.h" #include "cmGeneratorExpressionEvaluator.h" #include "cmGeneratorExpressionLexer.h" diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index c8b9949..ff8790c 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -13,6 +13,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index ba18faa..a62374b 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -17,6 +17,7 @@ #include "cmGeneratorExpression.h" #include "cmLocalGenerator.h" #include "cmSourceFile.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 44c9e9a..20ffbd0 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -20,6 +20,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index fd18596..85aa31f 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmake.h" +#include "cmAlgorithms.h" // cmGetCMakePropertyCommand bool cmGetCMakePropertyCommand diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 36395aa..0b247c2 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -32,6 +32,7 @@ #include "cmGeneratorExpressionEvaluationFile.h" #include "cmExportBuildFileGenerator.h" #include "cmCPackPropertiesGenerator.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 5701564..7648813 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -18,6 +18,7 @@ #include "cmSourceFile.h" #include "cmTarget.h" #include "cmGeneratorTarget.h" +#include "cmAlgorithms.h" cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() { diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 17617aa..d18269d 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -12,6 +12,7 @@ #include "cmListCommand.h" #include #include +#include "cmAlgorithms.h" #include // required for atoi #include diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7c83f27..8858149 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -25,6 +25,7 @@ #include "cmCustomCommandGenerator.h" #include "cmVersion.h" #include "cmake.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # define CM_LG_ENCODE_OBJECT_NAMES diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 432cb3a..a22bde9 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -20,6 +20,7 @@ #include "cmVersion.h" #include "cmFileTimeComparison.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" // Include dependency scanners for supported languages. Only the // C/C++ scanner is needed for bootstrapping CMake. diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 12c8576..b7cbae6 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -12,6 +12,7 @@ #include "cmMacroCommand.h" #include "cmake.h" +#include "cmAlgorithms.h" // define the class for macro commands class cmMacroHelperCommand : public cmCommand diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 31bbb73..a6d4e58 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -12,6 +12,7 @@ #include "cmMakeDepend.h" #include "cmSystemTools.h" #include "cmGeneratorExpression.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ccfe2b1..0fd06d7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -30,6 +30,7 @@ #include "cmInstallGenerator.h" #include "cmTestGenerator.h" #include "cmDefinitions.h" +#include "cmAlgorithms.h" #include "cmake.h" #include // required for atoi diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index c352c1a..155a30e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -19,6 +19,7 @@ #include "cmOSXBundleGenerator.h" #include "cmGeneratorTarget.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 23f8526..a612437 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmSystemTools.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 5016493..df531e7 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmOutputRequiredFilesCommand.h" #include "cmMakeDepend.h" +#include "cmAlgorithms.h" #include class cmLBDepend : public cmMakeDepend diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3a48101..c680523 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -4,6 +4,7 @@ #include "cmSourceFile.h" #include "cmVersion.h" #include "cmVersionMacros.h" +#include "cmAlgorithms.h" #include #include #include diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e18e757..a80f606 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -16,6 +16,7 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #if defined(_WIN32) && !defined(__CYGWIN__) # include "cmLocalVisualStudioGenerator.h" diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 1e777ab..045c82e 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -12,6 +12,7 @@ #include "cmSearchPath.h" #include "cmFindCommon.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmSearchPath::cmSearchPath(cmFindCommon* findCmd) diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index b81951d..9d67c1e 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -15,6 +15,7 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include "assert.h" diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e046bef..c2a190a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -19,6 +19,7 @@ #include "cmListFileCache.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" +#include "cmAlgorithms.h" #include #include #include diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx index dc19720..394a166 100644 --- a/Source/cmTargetCompileDefinitionsCommand.cxx +++ b/Source/cmTargetCompileDefinitionsCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileDefinitionsCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileDefinitionsCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx index 6ebc31e..823afa1 100644 --- a/Source/cmTargetCompileFeaturesCommand.cxx +++ b/Source/cmTargetCompileFeaturesCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileFeaturesCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileFeaturesCommand::InitialPass( std::vector const& args, cmExecutionStatus &) diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index 8c6fc06..a85153d 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileOptionsCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileOptionsCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 80e90a8..11196e4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -20,6 +20,7 @@ #include "cmSourceFile.h" #include "cmTest.h" #include "cmDocumentationFormatter.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmGraphVizWriter.h" diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index e0bd55b..ac73ad0 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -24,6 +24,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" #include #ifdef CMAKE_BUILD_WITH_CMAKE diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 7d67bd8..9f2ea46 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -15,6 +15,7 @@ #include "cmGlobalGenerator.h" #include "cmQtAutoGenerators.h" #include "cmVersion.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/CTest/cmCTestBuildHandler.cxx | 1 + Source/CursesDialog/cmCursesMainForm.cxx | 1 + Source/cmAlgorithms.h | 44 ++++++++++++++++++++++---- Source/cmCTest.cxx | 1 + Source/cmComputeLinkDepends.cxx | 1 + Source/cmComputeLinkInformation.cxx | 1 + Source/cmCoreTryCompile.cxx | 1 + Source/cmDependsC.cxx | 1 + Source/cmDocumentation.cxx | 1 + Source/cmExportFileGenerator.cxx | 1 + Source/cmExportInstallFileGenerator.cxx | 1 + Source/cmFileCommand.cxx | 1 + Source/cmFindBase.cxx | 2 ++ Source/cmFindPackageCommand.cxx | 1 + Source/cmGeneratorExpression.cxx | 1 + Source/cmGeneratorExpressionDAGChecker.cxx | 1 + Source/cmGeneratorExpressionEvaluator.cxx | 1 + Source/cmGeneratorTarget.cxx | 1 + Source/cmGetCMakePropertyCommand.cxx | 1 + Source/cmGlobalGenerator.cxx | 1 + Source/cmGlobalUnixMakefileGenerator3.cxx | 1 + Source/cmInstalledFile.cxx | 11 +++++++ Source/cmInstalledFile.h | 12 ++----- Source/cmListCommand.cxx | 1 + Source/cmLocalGenerator.cxx | 1 + Source/cmLocalUnixMakefileGenerator3.cxx | 1 + Source/cmMacroCommand.cxx | 1 + Source/cmMakeDepend.cxx | 1 + Source/cmMakefile.cxx | 1 + Source/cmNinjaNormalTargetGenerator.cxx | 1 + Source/cmOrderDirectories.cxx | 1 + Source/cmOutputRequiredFilesCommand.cxx | 1 + Source/cmPolicies.cxx | 1 + Source/cmQtAutoGenerators.cxx | 1 + Source/cmSearchPath.cxx | 1 + Source/cmSourceFileLocation.cxx | 1 + Source/cmTarget.cxx | 1 + Source/cmTargetCompileDefinitionsCommand.cxx | 2 ++ Source/cmTargetCompileFeaturesCommand.cxx | 2 ++ Source/cmTargetCompileOptionsCommand.cxx | 2 ++ Source/cmake.cxx | 1 + Source/cmakemain.cxx | 1 + Source/cmcmd.cxx | 1 + 44 files changed, 95 insertions(+), 18 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Sun Mar 8 11:16:32 2015 From: steveire at gmail.com (Stephen Kelly) Date: Sun, 8 Mar 2015 11:16:32 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-905-g735edbd Message-ID: <20150308151632.4AEDCAB551@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 735edbd3335791929fa2e9ab4cd25b001dada607 (commit) via 40895db516323e2cffab7162420d8db0db396c68 (commit) from e410257de9ec20cac70a365a94f6d4ddf48ccc57 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=735edbd3335791929fa2e9ab4cd25b001dada607 commit 735edbd3335791929fa2e9ab4cd25b001dada607 Merge: e410257 40895db Author: Stephen Kelly AuthorDate: Sun Mar 8 11:16:31 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun Mar 8 11:16:31 2015 -0400 Merge topic 'cmRemoveDuplicates-improvement' into next 40895db5 includes http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=40895db516323e2cffab7162420d8db0db396c68 commit 40895db516323e2cffab7162420d8db0db396c68 Author: Stephen Kelly AuthorDate: Sun Mar 8 16:15:56 2015 +0100 Commit: Stephen Kelly CommitDate: Sun Mar 8 16:15:59 2015 +0100 includes diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7df2073..18d40e1 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -17,6 +17,7 @@ #include "cmVisualStudioSlnData.h" #include "cmVisualStudioSlnParser.h" #include "cmake.h" +#include "cmAlgorithms.h" static const char vs10generatorName[] = "Visual Studio 10 2010"; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 3013200..ed828b6 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio11Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs11generatorName[] = "Visual Studio 11 2012"; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 2bc9379..c2e6f47 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio12Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs12generatorName[] = "Visual Studio 12 2013"; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index fe702c0..b551c65 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio14Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs14generatorName[] = "Visual Studio 14 2015"; ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalVisualStudio10Generator.cxx | 1 + Source/cmGlobalVisualStudio11Generator.cxx | 1 + Source/cmGlobalVisualStudio12Generator.cxx | 1 + Source/cmGlobalVisualStudio14Generator.cxx | 1 + 4 files changed, 4 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 9 00:01:12 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 9 Mar 2015 00:01:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-369-gbdb00b3 Message-ID: <20150309040112.378D7ABC93@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via bdb00b36133c64a36fbba7fd6c648725062b6732 (commit) from 42f0cb0c103ba83eadff09485bab2287655ffbea (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bdb00b36133c64a36fbba7fd6c648725062b6732 commit bdb00b36133c64a36fbba7fd6c648725062b6732 Author: Kitware Robot AuthorDate: Mon Mar 9 00:01:09 2015 -0400 Commit: Kitware Robot CommitDate: Mon Mar 9 00:01:09 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 332d802..038a09f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150308) +set(CMake_VERSION_PATCH 20150309) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Mar 9 07:13:12 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 9 Mar 2015 07:13:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-909-gfa7fb61 Message-ID: <20150309111312.6E4DFAAAD8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via fa7fb614ecd53a88893e5d9c9ed6377531d101e9 (commit) via f5f8982bae9a2458fd49dc0dd0b820b0694b3723 (commit) via bdb00b36133c64a36fbba7fd6c648725062b6732 (commit) via 42f0cb0c103ba83eadff09485bab2287655ffbea (commit) from 735edbd3335791929fa2e9ab4cd25b001dada607 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa7fb614ecd53a88893e5d9c9ed6377531d101e9 commit fa7fb614ecd53a88893e5d9c9ed6377531d101e9 Merge: 735edbd f5f8982 Author: Nils Gladitz AuthorDate: Mon Mar 9 07:13:09 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 07:13:09 2015 -0400 Merge topic 'main_dependency_diagnostic' into next f5f8982b add_custom_command: Diagnose MAIN_DEPENDENCY limitation. bdb00b36 CMake Nightly Date Stamp 42f0cb0c CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f5f8982bae9a2458fd49dc0dd0b820b0694b3723 commit f5f8982bae9a2458fd49dc0dd0b820b0694b3723 Author: Nils Gladitz AuthorDate: Mon Mar 9 12:12:13 2015 +0100 Commit: Nils Gladitz CommitDate: Mon Mar 9 12:12:13 2015 +0100 add_custom_command: Diagnose MAIN_DEPENDENCY limitation. The new policy CMP0057 diagnoses reuse of the same MAIN_DEPENDENCY across multiple custom commands. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 96f39e6..76ca5d4 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -114,3 +114,4 @@ All Policies /policy/CMP0054 /policy/CMP0055 /policy/CMP0056 + /policy/CMP0057 diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst new file mode 100644 index 0000000..5cf0784 --- /dev/null +++ b/Help/policy/CMP0057.rst @@ -0,0 +1,21 @@ +CMP0057 +------- + +Disallow multiple ``MAIN_DEPENDENCY`` specifications for the same file. + +CMake 3.3 and above no longer allow the same input file to be used +as a ``MAIN_DEPENDENCY`` in more than one custom command. + +Listing the same input file more than once in this context has not been +supported by earlier versions either and would lead to build time issues +but was not diagnosed. + +The ``OLD`` behavior for this policy is to allow using the same input file +in a ``MAIN_DEPENDENCY`` specfication more than once. +The ``NEW`` behavior is to disallow using the same input file in a +``MAIN_DEPENDENCY`` specification more than once. + +This policy was introduced in CMake version 3.3. +CMake version |release| warns when the policy is not set and uses +``OLD`` behavior. Use the :command:`cmake_policy` command to set +it to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/release/dev/main_dependency_diagnostic.rst b/Help/release/dev/main_dependency_diagnostic.rst new file mode 100644 index 0000000..13486ef --- /dev/null +++ b/Help/release/dev/main_dependency_diagnostic.rst @@ -0,0 +1,6 @@ +main_dependency_diagnostic +-------------------------- + +* Listing the same input file as a MAIN_DEPENDENCY of a custom command + can lead to broken build time behavior. This is now diagnosed. + See policy :policy:`CMP0057`. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ccfe2b1..6de1c61 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -985,6 +985,33 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, } else { + std::ostringstream e; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + bool issueMessage = false; + + switch(this->GetPolicyStatus(cmPolicies::CMP0057)) + { + case cmPolicies::WARN: + e << (this->GetPolicies()-> + GetPolicyWarning(cmPolicies::CMP0057)) << "\n"; + issueMessage = true; + case cmPolicies::OLD: + break; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + issueMessage = true; + messageType = cmake::FATAL_ERROR; + break; + } + + if(issueMessage) + { + e << "\"" << main_dependency << "\" can only be specified as a " + "custom command MAIN_DEPENDENCY once."; + IssueMessage(messageType, e.str()); + } + // The existing custom command is different. We need to // generate a rule file for this new command. file = 0; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3a48101..07e210e 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -374,6 +374,11 @@ cmPolicies::cmPolicies() CMP0056, "CMP0056", "Honor link flags in try_compile() source-file signature.", 3,2,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0057, "CMP0057", + "Disallow multiple MAIN_DEPENDENCY specifications for the same file.", + 3,3,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index c393c2f..854b132 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -113,6 +113,8 @@ public: /// or keywords when unquoted. CMP0055, ///< Strict checking for break() command. CMP0056, ///< Honor link flags in try_compile() source-file signature. + CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications + /// for the same file. /** \brief Always the last entry. * diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt new file mode 100644 index 0000000..9607d54 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0057-NEW.cmake:8 \(add_custom_command\): + "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake new file mode 100644 index 0000000..22dbfb3 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0057 NEW) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake new file mode 100644 index 0000000..ccf4fcb --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0057 OLD) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt new file mode 100644 index 0000000..0791bcc --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at CMP0057-WARN.cmake:6 \(add_custom_command\): + Policy CMP0057 is not set: Disallow multiple MAIN_DEPENDENCY specifications + for the same input file. Run "cmake --help-policy CMP0057" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake new file mode 100644 index 0000000..1837968 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake @@ -0,0 +1,11 @@ +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake new file mode 100644 index 0000000..8ce02f9 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0057 NEW) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1) diff --git a/Tests/RunCMake/CMP0057/CMakeLists.txt b/Tests/RunCMake/CMP0057/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0057/RunCMakeTest.cmake b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake new file mode 100644 index 0000000..f79235f --- /dev/null +++ b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(CMP0057-OLD) +run_cmake(CMP0057-NEW) +run_cmake(CMP0057-WARN) + +run_cmake(CMP0057-once_is_ok) diff --git a/Tests/RunCMake/CMP0057/input.txt b/Tests/RunCMake/CMP0057/input.txt new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057..3bc96c9 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -63,6 +63,7 @@ add_RunCMake_test(CMP0051) add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) +add_RunCMake_test(CMP0057) add_RunCMake_test(CTest) if(NOT CMake_TEST_EXTERNAL_CMAKE) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0057.rst | 21 +++++++++++++++ Help/release/dev/main_dependency_diagnostic.rst | 6 +++++ Source/CMakeVersion.cmake | 2 +- Source/cmMakefile.cxx | 27 ++++++++++++++++++++ Source/cmPolicies.cxx | 5 ++++ Source/cmPolicies.h | 2 ++ .../CMP0057-NEW-result.txt} | 0 Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt | 4 +++ Tests/RunCMake/CMP0057/CMP0057-NEW.cmake | 13 ++++++++++ Tests/RunCMake/CMP0057/CMP0057-OLD.cmake | 13 ++++++++++ Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt | 10 ++++++++ Tests/RunCMake/CMP0057/CMP0057-WARN.cmake | 11 ++++++++ Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake | 8 ++++++ Tests/RunCMake/{CMP0055 => CMP0057}/CMakeLists.txt | 0 Tests/RunCMake/CMP0057/RunCMakeTest.cmake | 7 +++++ .../hello.f => Tests/RunCMake/CMP0057/input.txt | 0 Tests/RunCMake/CMakeLists.txt | 1 + 18 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 Help/policy/CMP0057.rst create mode 100644 Help/release/dev/main_dependency_diagnostic.rst copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CMP0057/CMP0057-NEW-result.txt} (100%) create mode 100644 Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0057/CMP0057-NEW.cmake create mode 100644 Tests/RunCMake/CMP0057/CMP0057-OLD.cmake create mode 100644 Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0057/CMP0057-WARN.cmake create mode 100644 Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake copy Tests/RunCMake/{CMP0055 => CMP0057}/CMakeLists.txt (100%) create mode 100644 Tests/RunCMake/CMP0057/RunCMakeTest.cmake copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/CMP0057/input.txt (100%) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Mar 9 07:45:27 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 9 Mar 2015 07:45:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-911-g248c2a8 Message-ID: <20150309114527.6E410AADE7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 248c2a8d0bd7eb82ea9bb924fd3e930eb4113ef0 (commit) via 1f615523e9bc05b1f791da47fc81cd585be3c595 (commit) from fa7fb614ecd53a88893e5d9c9ed6377531d101e9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=248c2a8d0bd7eb82ea9bb924fd3e930eb4113ef0 commit 248c2a8d0bd7eb82ea9bb924fd3e930eb4113ef0 Merge: fa7fb61 1f61552 Author: Nils Gladitz AuthorDate: Mon Mar 9 07:45:26 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 07:45:26 2015 -0400 Merge topic 'main_dependency_diagnostic' into next 1f615523 add_custom_command: Fix CMP0057 test. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f615523e9bc05b1f791da47fc81cd585be3c595 commit 1f615523e9bc05b1f791da47fc81cd585be3c595 Author: Nils Gladitz AuthorDate: Mon Mar 9 12:45:04 2015 +0100 Commit: Nils Gladitz CommitDate: Mon Mar 9 12:45:04 2015 +0100 add_custom_command: Fix CMP0057 test. diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt index 0791bcc..da3a1cb 100644 --- a/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt @@ -1,8 +1,7 @@ CMake Warning \(dev\) at CMP0057-WARN.cmake:6 \(add_custom_command\): Policy CMP0057 is not set: Disallow multiple MAIN_DEPENDENCY specifications - for the same input file. Run "cmake --help-policy CMP0057" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. + for the same file. Run "cmake --help-policy CMP0057" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once. Call Stack \(most recent call first\): ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Mon Mar 9 07:45:49 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Mon, 9 Mar 2015 07:45:49 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-913-g06a1320 Message-ID: <20150309114549.99379AAEE0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 06a1320496736adaf831328f9d7321dae6a296b6 (commit) via 242c396656783b1b3d542b14bc62710a46a87518 (commit) from 248c2a8d0bd7eb82ea9bb924fd3e930eb4113ef0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=06a1320496736adaf831328f9d7321dae6a296b6 commit 06a1320496736adaf831328f9d7321dae6a296b6 Merge: 248c2a8 242c396 Author: Nils Gladitz AuthorDate: Mon Mar 9 07:45:48 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 07:45:48 2015 -0400 Merge topic 'main_dependency_diagnostic' into next 242c3966 add_custom_command: Diagnose MAIN_DEPENDENCY limitation. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=242c396656783b1b3d542b14bc62710a46a87518 commit 242c396656783b1b3d542b14bc62710a46a87518 Author: Nils Gladitz AuthorDate: Mon Mar 9 12:12:13 2015 +0100 Commit: Nils Gladitz CommitDate: Mon Mar 9 12:45:38 2015 +0100 add_custom_command: Diagnose MAIN_DEPENDENCY limitation. The new policy CMP0057 diagnoses reuse of the same MAIN_DEPENDENCY across multiple custom commands. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 96f39e6..76ca5d4 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -114,3 +114,4 @@ All Policies /policy/CMP0054 /policy/CMP0055 /policy/CMP0056 + /policy/CMP0057 diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst new file mode 100644 index 0000000..5cf0784 --- /dev/null +++ b/Help/policy/CMP0057.rst @@ -0,0 +1,21 @@ +CMP0057 +------- + +Disallow multiple ``MAIN_DEPENDENCY`` specifications for the same file. + +CMake 3.3 and above no longer allow the same input file to be used +as a ``MAIN_DEPENDENCY`` in more than one custom command. + +Listing the same input file more than once in this context has not been +supported by earlier versions either and would lead to build time issues +but was not diagnosed. + +The ``OLD`` behavior for this policy is to allow using the same input file +in a ``MAIN_DEPENDENCY`` specfication more than once. +The ``NEW`` behavior is to disallow using the same input file in a +``MAIN_DEPENDENCY`` specification more than once. + +This policy was introduced in CMake version 3.3. +CMake version |release| warns when the policy is not set and uses +``OLD`` behavior. Use the :command:`cmake_policy` command to set +it to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/release/dev/main_dependency_diagnostic.rst b/Help/release/dev/main_dependency_diagnostic.rst new file mode 100644 index 0000000..13486ef --- /dev/null +++ b/Help/release/dev/main_dependency_diagnostic.rst @@ -0,0 +1,6 @@ +main_dependency_diagnostic +-------------------------- + +* Listing the same input file as a MAIN_DEPENDENCY of a custom command + can lead to broken build time behavior. This is now diagnosed. + See policy :policy:`CMP0057`. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ccfe2b1..6de1c61 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -985,6 +985,33 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, } else { + std::ostringstream e; + cmake::MessageType messageType = cmake::AUTHOR_WARNING; + bool issueMessage = false; + + switch(this->GetPolicyStatus(cmPolicies::CMP0057)) + { + case cmPolicies::WARN: + e << (this->GetPolicies()-> + GetPolicyWarning(cmPolicies::CMP0057)) << "\n"; + issueMessage = true; + case cmPolicies::OLD: + break; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + issueMessage = true; + messageType = cmake::FATAL_ERROR; + break; + } + + if(issueMessage) + { + e << "\"" << main_dependency << "\" can only be specified as a " + "custom command MAIN_DEPENDENCY once."; + IssueMessage(messageType, e.str()); + } + // The existing custom command is different. We need to // generate a rule file for this new command. file = 0; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3a48101..07e210e 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -374,6 +374,11 @@ cmPolicies::cmPolicies() CMP0056, "CMP0056", "Honor link flags in try_compile() source-file signature.", 3,2,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0057, "CMP0057", + "Disallow multiple MAIN_DEPENDENCY specifications for the same file.", + 3,3,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index c393c2f..854b132 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -113,6 +113,8 @@ public: /// or keywords when unquoted. CMP0055, ///< Strict checking for break() command. CMP0056, ///< Honor link flags in try_compile() source-file signature. + CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications + /// for the same file. /** \brief Always the last entry. * diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt new file mode 100644 index 0000000..9607d54 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0057-NEW.cmake:8 \(add_custom_command\): + "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake new file mode 100644 index 0000000..22dbfb3 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0057 NEW) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake new file mode 100644 index 0000000..ccf4fcb --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0057 OLD) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt new file mode 100644 index 0000000..da3a1cb --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMP0057-WARN.cmake:6 \(add_custom_command\): + Policy CMP0057 is not set: Disallow multiple MAIN_DEPENDENCY specifications + for the same file. Run "cmake --help-policy CMP0057" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake new file mode 100644 index 0000000..1837968 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake @@ -0,0 +1,11 @@ +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_command(OUTPUT out2 + COMMAND ${CMAKE_COMMAND} -E echo out2 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1 out2) diff --git a/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake new file mode 100644 index 0000000..8ce02f9 --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0057 NEW) + +add_custom_command(OUTPUT out1 + COMMAND ${CMAKE_COMMAND} -E echo out1 + MAIN_DEPENDENCY input.txt +) + +add_custom_target(mytarget1 ALL DEPENDS out1) diff --git a/Tests/RunCMake/CMP0057/CMakeLists.txt b/Tests/RunCMake/CMP0057/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/CMP0057/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0057/RunCMakeTest.cmake b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake new file mode 100644 index 0000000..f79235f --- /dev/null +++ b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(CMP0057-OLD) +run_cmake(CMP0057-NEW) +run_cmake(CMP0057-WARN) + +run_cmake(CMP0057-once_is_ok) diff --git a/Tests/RunCMake/CMP0057/input.txt b/Tests/RunCMake/CMP0057/input.txt new file mode 100644 index 0000000..e69de29 diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057..3bc96c9 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -63,6 +63,7 @@ add_RunCMake_test(CMP0051) add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) +add_RunCMake_test(CMP0057) add_RunCMake_test(CTest) if(NOT CMake_TEST_EXTERNAL_CMAKE) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 09:18:09 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 09:18:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-916-g2f7769a Message-ID: <20150309131809.7F82BAB150@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2f7769aa7c25b9d051c29fdd854ac010b1db740b (commit) via 024e25e485f8d1dbca40521fbc0bcd61e383f413 (commit) via 3ef776fc38fecff332e568f307dcf4e6f82fbe14 (commit) from 06a1320496736adaf831328f9d7321dae6a296b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2f7769aa7c25b9d051c29fdd854ac010b1db740b commit 2f7769aa7c25b9d051c29fdd854ac010b1db740b Merge: 06a1320 024e25e Author: Brad King AuthorDate: Mon Mar 9 09:18:07 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 09:18:07 2015 -0400 Merge topic 'configure_file-NEWLINE_STYLE-no-warn' into next 024e25e4 Tests: Add more signature tests to RunCMake.configure_file test 3ef776fc configure_file: Do not warn about newline style arguments http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=024e25e485f8d1dbca40521fbc0bcd61e383f413 commit 024e25e485f8d1dbca40521fbc0bcd61e383f413 Author: Brad King AuthorDate: Mon Mar 9 08:42:02 2015 -0400 Commit: Brad King CommitDate: Mon Mar 9 09:17:59 2015 -0400 Tests: Add more signature tests to RunCMake.configure_file test Move the test cases from Tests/CMakeTests/ConfigureFileTest.cmake.in over to use the RunCMake.configure_file infrastructure. This does much more robust verification of CMake output for each test case, and would have caught the regression fixed in our parent commit. diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index ce36830..d5524c3 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -19,7 +19,6 @@ AddCMakeTest(GetFilenameComponentRealpath "") AddCMakeTest(Version "") AddCMakeTest(Message "") AddCMakeTest(File "") -AddCMakeTest(ConfigureFile "") AddCMakeTest(SeparateArguments "") AddCMakeTest(ImplicitLinkInfo "") AddCMakeTest(ModuleNotices "") diff --git a/Tests/CMakeTests/ConfigureFile-DirOutput.cmake b/Tests/CMakeTests/ConfigureFile-DirOutput.cmake deleted file mode 100644 index d682a2d..0000000 --- a/Tests/CMakeTests/ConfigureFile-DirOutput.cmake +++ /dev/null @@ -1,5 +0,0 @@ -file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-DirOutput.txt "DirOutput test file\n") -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-DirOutput) -configure_file(ConfigureFile-DirOutput.txt ConfigureFile-DirOutput) -file(READ ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-DirOutput/ConfigureFile-DirOutput.txt out) -message("${out}") diff --git a/Tests/CMakeTests/ConfigureFile-Relative.cmake b/Tests/CMakeTests/ConfigureFile-Relative.cmake deleted file mode 100644 index 532580a..0000000 --- a/Tests/CMakeTests/ConfigureFile-Relative.cmake +++ /dev/null @@ -1,4 +0,0 @@ -file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-Relative-In.txt "Relative test file\n") -configure_file(ConfigureFile-Relative-In.txt ConfigureFile-Relative-Out.txt) -file(READ ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-Relative-Out.txt out) -message("${out}") diff --git a/Tests/CMakeTests/ConfigureFileTest.cmake.in b/Tests/CMakeTests/ConfigureFileTest.cmake.in deleted file mode 100644 index 6cc61d9..0000000 --- a/Tests/CMakeTests/ConfigureFileTest.cmake.in +++ /dev/null @@ -1,28 +0,0 @@ -set(DirInput-RESULT 1) -set(DirInput-STDERR "is a directory") -set(DirOutput-RESULT 0) -set(DirOutput-STDERR "DirOutput test file") -set(Relative-RESULT 0) -set(Relative-STDERR "Relative test file") -set(BadArg-RESULT 1) -set(BadArg-STDERR "called with incorrect number of arguments") -set(NewLineStyle-NoArg-RESULT 1) -set(NewLineStyle-NoArg-STDERR "NEWLINE_STYLE must set a style:") -set(NewLineStyle-WrongArg-RESULT 1) -set(NewLineStyle-WrongArg-STDERR "NEWLINE_STYLE sets an unknown style") -set(NewLineStyle-ValidArg-RESULT 0) -set(NewLineStyle-ValidArg-STDERR ) -set(NewLineStyle-COPYONLY-RESULT 1) -set(NewLineStyle-COPYONLY-STDERR "COPYONLY could not be used in combination") - -include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") -check_cmake_test(ConfigureFile - DirInput - DirOutput - Relative - BadArg - NewLineStyle-NoArg - NewLineStyle-WrongArg - NewLineStyle-ValidArg - NewLineStyle-COPYONLY - ) diff --git a/Tests/RunCMake/configure_file/BadArg-result.txt b/Tests/RunCMake/configure_file/BadArg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/BadArg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/BadArg-stderr.txt b/Tests/RunCMake/configure_file/BadArg-stderr.txt new file mode 100644 index 0000000..4567d3f --- /dev/null +++ b/Tests/RunCMake/configure_file/BadArg-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BadArg.cmake:[0-9]+ \(configure_file\): + configure_file called with incorrect number of arguments, expected 2 +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-BadArg.cmake b/Tests/RunCMake/configure_file/BadArg.cmake similarity index 100% rename from Tests/CMakeTests/ConfigureFile-BadArg.cmake rename to Tests/RunCMake/configure_file/BadArg.cmake diff --git a/Tests/RunCMake/configure_file/DirInput-result.txt b/Tests/RunCMake/configure_file/DirInput-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/DirInput-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/DirInput-stderr.txt b/Tests/RunCMake/configure_file/DirInput-stderr.txt new file mode 100644 index 0000000..2e0cd14 --- /dev/null +++ b/Tests/RunCMake/configure_file/DirInput-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at DirInput.cmake:[0-9]+ \(configure_file\): + configure_file input location + + .*/Tests/RunCMake/configure_file/. + + is a directory but a file was expected. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-DirInput.cmake b/Tests/RunCMake/configure_file/DirInput.cmake similarity index 100% rename from Tests/CMakeTests/ConfigureFile-DirInput.cmake rename to Tests/RunCMake/configure_file/DirInput.cmake diff --git a/Tests/RunCMake/configure_file/DirOutput-stderr.txt b/Tests/RunCMake/configure_file/DirOutput-stderr.txt new file mode 100644 index 0000000..d051f7c --- /dev/null +++ b/Tests/RunCMake/configure_file/DirOutput-stderr.txt @@ -0,0 +1 @@ +^DirOutput test file$ diff --git a/Tests/RunCMake/configure_file/DirOutput.cmake b/Tests/RunCMake/configure_file/DirOutput.cmake new file mode 100644 index 0000000..aa0fadf --- /dev/null +++ b/Tests/RunCMake/configure_file/DirOutput.cmake @@ -0,0 +1,4 @@ +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DirOutput) +configure_file(DirOutput.txt DirOutput) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/DirOutput/DirOutput.txt out) +message("${out}") diff --git a/Tests/RunCMake/configure_file/DirOutput.txt b/Tests/RunCMake/configure_file/DirOutput.txt new file mode 100644 index 0000000..16388a6 --- /dev/null +++ b/Tests/RunCMake/configure_file/DirOutput.txt @@ -0,0 +1 @@ +DirOutput test file diff --git a/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-result.txt b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt new file mode 100644 index 0000000..3f66909 --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NewLineStyle-COPYONLY.cmake:[0-9]+ \(configure_file\): + configure_file COPYONLY could not be used in combination with NEWLINE_STYLE +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake similarity index 58% rename from Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake rename to Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake index 3b09eb0..c07b8f5 100644 --- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake +++ b/Tests/RunCMake/configure_file/NewLineStyle-COPYONLY.cmake @@ -1,3 +1,3 @@ -set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt) file(WRITE ${file_name} "Data\n") configure_file(${file_name} ${file_name}.out COPYONLY NEWLINE_STYLE DOS) diff --git a/Tests/RunCMake/configure_file/NewLineStyle-NoArg-result.txt b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt new file mode 100644 index 0000000..3652657 --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at NewLineStyle-NoArg.cmake:[0-9]+ \(configure_file\): + configure_file NEWLINE_STYLE must set a style: LF, CRLF, UNIX, DOS, or + WIN32 +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake similarity index 55% rename from Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake rename to Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake index 133a67a..b35bde1 100644 --- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake +++ b/Tests/RunCMake/configure_file/NewLineStyle-NoArg.cmake @@ -1,3 +1,3 @@ -set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt) file(WRITE ${file_name} "Data\n") configure_file(${file_name} ${file_name}.out NEWLINE_STYLE) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake similarity index 85% rename from Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake rename to Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake index b7e619c..8d9f474 100644 --- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake +++ b/Tests/RunCMake/configure_file/NewLineStyle-ValidArg.cmake @@ -1,4 +1,4 @@ -set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt) function(test_eol style in out) file(WRITE ${file_name} "${in}") diff --git a/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-result.txt b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt new file mode 100644 index 0000000..0d6855f --- /dev/null +++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at NewLineStyle-WrongArg.cmake:[0-9]+ \(configure_file\): + configure_file NEWLINE_STYLE sets an unknown style, only LF, CRLF, UNIX, + DOS, and WIN32 are supported +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake similarity index 56% rename from Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake rename to Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake index e8887c1..3ae906d 100644 --- a/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake +++ b/Tests/RunCMake/configure_file/NewLineStyle-WrongArg.cmake @@ -1,3 +1,3 @@ -set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt) +set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt) file(WRITE ${file_name} "Data\n") configure_file(${file_name} ${file_name}.out NEWLINE_STYLE FOO) diff --git a/Tests/RunCMake/configure_file/Relative-In.txt b/Tests/RunCMake/configure_file/Relative-In.txt new file mode 100644 index 0000000..572fe53 --- /dev/null +++ b/Tests/RunCMake/configure_file/Relative-In.txt @@ -0,0 +1 @@ +Relative test file diff --git a/Tests/RunCMake/configure_file/Relative-stderr.txt b/Tests/RunCMake/configure_file/Relative-stderr.txt new file mode 100644 index 0000000..b94de0d --- /dev/null +++ b/Tests/RunCMake/configure_file/Relative-stderr.txt @@ -0,0 +1 @@ +^Relative test file$ diff --git a/Tests/RunCMake/configure_file/Relative.cmake b/Tests/RunCMake/configure_file/Relative.cmake new file mode 100644 index 0000000..085991c --- /dev/null +++ b/Tests/RunCMake/configure_file/Relative.cmake @@ -0,0 +1,3 @@ +configure_file(Relative-In.txt Relative-Out.txt) +file(READ ${CMAKE_CURRENT_BINARY_DIR}/Relative-Out.txt out) +message("${out}") diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake index 489652b..de14468 100644 --- a/Tests/RunCMake/configure_file/RunCMakeTest.cmake +++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake @@ -7,6 +7,14 @@ run_cmake(UTF16BE-BOM) run_cmake(UTF32LE-BOM) run_cmake(UTF32BE-BOM) run_cmake(UnknownArg) +run_cmake(DirInput) +run_cmake(DirOutput) +run_cmake(Relative) +run_cmake(BadArg) +run_cmake(NewLineStyle-NoArg) +run_cmake(NewLineStyle-WrongArg) +run_cmake(NewLineStyle-ValidArg) +run_cmake(NewLineStyle-COPYONLY) if(RunCMake_GENERATOR MATCHES "Make") # Use a single build tree for a few tests without cleaning. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3ef776fc38fecff332e568f307dcf4e6f82fbe14 commit 3ef776fc38fecff332e568f307dcf4e6f82fbe14 Author: Brad King AuthorDate: Mon Mar 9 08:38:21 2015 -0400 Commit: Brad King CommitDate: Mon Mar 9 09:17:59 2015 -0400 configure_file: Do not warn about newline style arguments The unknown argument warning added by commit v3.2.0-rc1~452^2 (configure_file: Warn about unknown arguments, 2014-10-31) failed to account for options handled by the NewLineStyle member instead of directly in the main loop. Simply whitelist them for now. diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index fa7f486..6876388 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -100,6 +100,13 @@ bool cmConfigureFileCommand { /* Ignore legacy option. */ } + else if(args[i] == "NEWLINE_STYLE" || + args[i] == "LF" || args[i] == "UNIX" || + args[i] == "CRLF" || args[i] == "WIN32" || + args[i] == "DOS") + { + /* Options handled by NewLineStyle member above. */ + } else { unknown_args += " "; ----------------------------------------------------------------------- Summary of changes: Source/cmConfigureFileCommand.cxx | 7 +++++ Tests/CMakeTests/CMakeLists.txt | 1 - Tests/CMakeTests/ConfigureFile-DirOutput.cmake | 5 ---- Tests/CMakeTests/ConfigureFile-Relative.cmake | 4 --- Tests/CMakeTests/ConfigureFileTest.cmake.in | 28 -------------------- .../BadArg-result.txt} | 0 Tests/RunCMake/configure_file/BadArg-stderr.txt | 4 +++ .../configure_file/BadArg.cmake} | 0 .../DirInput-result.txt} | 0 Tests/RunCMake/configure_file/DirInput-stderr.txt | 8 ++++++ .../configure_file/DirInput.cmake} | 0 Tests/RunCMake/configure_file/DirOutput-stderr.txt | 1 + Tests/RunCMake/configure_file/DirOutput.cmake | 4 +++ Tests/RunCMake/configure_file/DirOutput.txt | 1 + .../NewLineStyle-COPYONLY-result.txt} | 0 .../NewLineStyle-COPYONLY-stderr.txt | 4 +++ .../configure_file/NewLineStyle-COPYONLY.cmake} | 2 +- .../NewLineStyle-NoArg-result.txt} | 0 .../configure_file/NewLineStyle-NoArg-stderr.txt | 5 ++++ .../configure_file/NewLineStyle-NoArg.cmake} | 2 +- .../configure_file/NewLineStyle-ValidArg.cmake} | 2 +- .../NewLineStyle-WrongArg-result.txt} | 0 .../NewLineStyle-WrongArg-stderr.txt | 5 ++++ .../configure_file/NewLineStyle-WrongArg.cmake} | 2 +- Tests/RunCMake/configure_file/Relative-In.txt | 1 + Tests/RunCMake/configure_file/Relative-stderr.txt | 1 + Tests/RunCMake/configure_file/Relative.cmake | 3 +++ Tests/RunCMake/configure_file/RunCMakeTest.cmake | 8 ++++++ 28 files changed, 56 insertions(+), 42 deletions(-) delete mode 100644 Tests/CMakeTests/ConfigureFile-DirOutput.cmake delete mode 100644 Tests/CMakeTests/ConfigureFile-Relative.cmake delete mode 100644 Tests/CMakeTests/ConfigureFileTest.cmake.in copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/BadArg-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/BadArg-stderr.txt rename Tests/{CMakeTests/ConfigureFile-BadArg.cmake => RunCMake/configure_file/BadArg.cmake} (100%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/DirInput-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/DirInput-stderr.txt rename Tests/{CMakeTests/ConfigureFile-DirInput.cmake => RunCMake/configure_file/DirInput.cmake} (100%) create mode 100644 Tests/RunCMake/configure_file/DirOutput-stderr.txt create mode 100644 Tests/RunCMake/configure_file/DirOutput.cmake create mode 100644 Tests/RunCMake/configure_file/DirOutput.txt copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/NewLineStyle-COPYONLY-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake => RunCMake/configure_file/NewLineStyle-COPYONLY.cmake} (58%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/NewLineStyle-NoArg-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake => RunCMake/configure_file/NewLineStyle-NoArg.cmake} (55%) rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake => RunCMake/configure_file/NewLineStyle-ValidArg.cmake} (85%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/NewLineStyle-WrongArg-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake => RunCMake/configure_file/NewLineStyle-WrongArg.cmake} (56%) create mode 100644 Tests/RunCMake/configure_file/Relative-In.txt create mode 100644 Tests/RunCMake/configure_file/Relative-stderr.txt create mode 100644 Tests/RunCMake/configure_file/Relative.cmake hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 09:45:52 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 09:45:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-371-g387466d Message-ID: <20150309134552.EFE9CAAFF0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 387466dd9508ae57a864cdd8f2c8d8d28140b74c (commit) via 66a9c90c4bb5bf93bd570a423f99486b24b9337d (commit) from bdb00b36133c64a36fbba7fd6c648725062b6732 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=387466dd9508ae57a864cdd8f2c8d8d28140b74c commit 387466dd9508ae57a864cdd8f2c8d8d28140b74c Merge: bdb00b3 66a9c90 Author: Brad King AuthorDate: Mon Mar 9 09:45:51 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 09:45:51 2015 -0400 Merge topic 'custom-command-multiple-outputs' 66a9c90c Makefile: Fix multiple custom command outputs regression (#15116) ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalBorlandMakefileGenerator.cxx | 1 - Source/cmLocalUnixMakefileGenerator3.cxx | 56 +------------------ Source/cmLocalUnixMakefileGenerator3.h | 11 ---- Source/cmMakefileLibraryTargetGenerator.cxx | 5 +- Source/cmMakefileTargetGenerator.cxx | 79 +++++++++++++++++++++++++-- Source/cmMakefileTargetGenerator.h | 10 ++++ 6 files changed, 88 insertions(+), 74 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 09:45:56 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 09:45:56 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-374-g3f66bde Message-ID: <20150309134556.D4BCCAAFF6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 3f66bde4f70566166437dc4d7c9beaeba1ee33ee (commit) via 44ef47000eb4f4ac7b4fc041afd3579ebe355469 (commit) via aa84d26e631e11d73328c24ac0301c43f661869b (commit) from 387466dd9508ae57a864cdd8f2c8d8d28140b74c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f66bde4f70566166437dc4d7c9beaeba1ee33ee commit 3f66bde4f70566166437dc4d7c9beaeba1ee33ee Merge: 387466d 44ef470 Author: Brad King AuthorDate: Mon Mar 9 09:45:54 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 09:45:54 2015 -0400 Merge topic 'update-kwsys' 44ef4700 Merge branch 'upstream-kwsys' into update-kwsys aa84d26e KWSys 2015-03-03 (4890f30c) ----------------------------------------------------------------------- Summary of changes: Source/kwsys/Glob.cxx | 93 ++++++++++++++++++++++++++++++++++++++++------ Source/kwsys/Glob.hxx.in | 47 +++++++++++++++++++++-- 2 files changed, 124 insertions(+), 16 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 09:45:58 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 09:45:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-377-g6f28bc6 Message-ID: <20150309134558.97942AB054@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6f28bc6b511ff8052968c2a7d40a3dc5bcfcb2aa (commit) via 2e16aff1e2218f042f403971403fe583fc5bec97 (commit) via b0852ebc09eec44041e8aa624ec4bb17bda14dac (commit) from 3f66bde4f70566166437dc4d7c9beaeba1ee33ee (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f28bc6b511ff8052968c2a7d40a3dc5bcfcb2aa commit 6f28bc6b511ff8052968c2a7d40a3dc5bcfcb2aa Merge: 3f66bde 2e16aff Author: Brad King AuthorDate: Mon Mar 9 09:45:57 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 09:45:57 2015 -0400 Merge topic 'fix-wixobj-filenames' 2e16aff1 CPackWIX: Fix .wixobj output locations and filenames. b0852ebc CPackWIX: Support patching of root elements. ----------------------------------------------------------------------- Summary of changes: Modules/CPackWIX.cmake | 6 ++++-- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 09:46:00 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 09:46:00 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-379-ga6d488f Message-ID: <20150309134600.629D0AB055@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a6d488f2ceb62b968c6f0a8971a3556195af80ca (commit) via 099b0cab1d12b5b3734342ac516c8d42c78cdef7 (commit) from 6f28bc6b511ff8052968c2a7d40a3dc5bcfcb2aa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6d488f2ceb62b968c6f0a8971a3556195af80ca commit a6d488f2ceb62b968c6f0a8971a3556195af80ca Merge: 6f28bc6 099b0ca Author: Brad King AuthorDate: Mon Mar 9 09:45:59 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 09:45:59 2015 -0400 Merge topic 'cbp-unit-targets' 099b0cab CodeBlocks: Declare which source file belongs to which targets. ----------------------------------------------------------------------- Summary of changes: Source/cmExtraCodeBlocksGenerator.cxx | 71 ++++++++++++++++++--------------- Source/cmExtraCodeBlocksGenerator.h | 4 ++ 2 files changed, 42 insertions(+), 33 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 09:48:14 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 09:48:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-921-g9eb5112 Message-ID: <20150309134814.F0F20AB395@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9eb5112f845b9634a40cbf541174a531f96e43da (commit) via a6d488f2ceb62b968c6f0a8971a3556195af80ca (commit) via 6f28bc6b511ff8052968c2a7d40a3dc5bcfcb2aa (commit) via 3f66bde4f70566166437dc4d7c9beaeba1ee33ee (commit) via 387466dd9508ae57a864cdd8f2c8d8d28140b74c (commit) from 2f7769aa7c25b9d051c29fdd854ac010b1db740b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9eb5112f845b9634a40cbf541174a531f96e43da commit 9eb5112f845b9634a40cbf541174a531f96e43da Merge: 2f7769a a6d488f Author: Brad King AuthorDate: Mon Mar 9 09:48:07 2015 -0400 Commit: Brad King CommitDate: Mon Mar 9 09:48:07 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 10:07:11 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 10:07:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-923-ga4f71ff Message-ID: <20150309140711.CCB28ABEB2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a4f71ff435624bbccb41f912a2d7470e3c35456d (commit) via 86032ae0ebb7e86f3ff5617e080dd827dbbe98b0 (commit) from 9eb5112f845b9634a40cbf541174a531f96e43da (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4f71ff435624bbccb41f912a2d7470e3c35456d commit a4f71ff435624bbccb41f912a2d7470e3c35456d Merge: 9eb5112 86032ae Author: Brad King AuthorDate: Mon Mar 9 10:07:10 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 10:07:10 2015 -0400 Merge topic 'ExternalProject-byproducts-tokens' into next 86032ae0 ExternalProject: Replace placeholder tokens in BYPRODUCTS http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=86032ae0ebb7e86f3ff5617e080dd827dbbe98b0 commit 86032ae0ebb7e86f3ff5617e080dd827dbbe98b0 Author: Gae?tan Lehmann AuthorDate: Fri Mar 6 11:43:16 2015 +0100 Commit: Brad King CommitDate: Mon Mar 9 10:04:44 2015 -0400 ExternalProject: Replace placeholder tokens in BYPRODUCTS This allows the developer to specify the byproducts relative to the binary directory without the need to set the binary directory location explicitly. diff --git a/Help/release/dev/ExternalProject-byproducts-tokens.rst b/Help/release/dev/ExternalProject-byproducts-tokens.rst new file mode 100644 index 0000000..20b4dd4 --- /dev/null +++ b/Help/release/dev/ExternalProject-byproducts-tokens.rst @@ -0,0 +1,5 @@ +ExternalProject-byproducts-tokens +--------------------------------- + +* The :module:`ExternalProject` module learned to replace tokens + like ```` in the ``BYPRODUCTS`` of each step. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 1f9f4d3..d7b985d 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -251,8 +251,8 @@ Create custom targets to build projects in external trees ``LOG 1`` Wrap step in script to log output - The command line, comment, and working directory of every standard and - custom step is processed to replace tokens ````, + The command line, comment, working directory, and byproducts of every + standard and custom step are processed to replace tokens ````, ````, ````, and ```` with corresponding property values. @@ -1443,7 +1443,7 @@ function(ExternalProject_Add_Step name step) endif() # Replace location tags. - _ep_replace_location_tags(${name} comment command work_dir) + _ep_replace_location_tags(${name} comment command work_dir byproducts) # Custom comment? get_property(comment_set TARGET ${name} PROPERTY _EP_${step}_COMMENT SET) diff --git a/Tests/CustomCommandByproducts/CMakeLists.txt b/Tests/CustomCommandByproducts/CMakeLists.txt index 884f8c2..3289e8f 100644 --- a/Tests/CustomCommandByproducts/CMakeLists.txt +++ b/Tests/CustomCommandByproducts/CMakeLists.txt @@ -102,6 +102,27 @@ add_library(ExternalLibrary STATIC IMPORTED) set_property(TARGET ExternalLibrary PROPERTY IMPORTED_LOCATION ${ExternalLibrary_LIBRARY}) add_dependencies(ExternalLibrary ExternalTarget) +# Generate the library file of an imported target as a byproduct +# of an external project. The byproduct uses that is substituted +# by the real binary path +if(CMAKE_CONFIGURATION_TYPES) + set(cfg /${CMAKE_CFG_INTDIR}) +else() + set(cfg) +endif() +include(ExternalProject) +ExternalProject_Add(ExtTargetSubst + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" + BUILD_BYPRODUCTS "${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) +ExternalProject_Get_Property(ExtTargetSubst binary_dir) +add_library(ExternalLibraryWithSubstitution STATIC IMPORTED) +set_property(TARGET ExternalLibraryWithSubstitution PROPERTY IMPORTED_LOCATION + ${binary_dir}${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}) +add_dependencies(ExternalLibraryWithSubstitution ExtTargetSubst) + # Add an executable consuming all the byproducts. add_executable(CustomCommandByproducts CustomCommandByproducts.c ----------------------------------------------------------------------- Summary of changes: .../dev/ExternalProject-byproducts-tokens.rst | 5 +++++ Modules/ExternalProject.cmake | 6 +++--- Tests/CustomCommandByproducts/CMakeLists.txt | 21 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 Help/release/dev/ExternalProject-byproducts-tokens.rst hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 10:39:28 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 10:39:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-925-g814dafa Message-ID: <20150309143928.CBEAB2C9D0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 814dafa67b9505e7d8816a2443277c9de95c5460 (commit) via 7fde97947770258cd175756c315cbd07295bdb97 (commit) from a4f71ff435624bbccb41f912a2d7470e3c35456d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=814dafa67b9505e7d8816a2443277c9de95c5460 commit 814dafa67b9505e7d8816a2443277c9de95c5460 Merge: a4f71ff 7fde979 Author: Brad King AuthorDate: Mon Mar 9 10:39:28 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 10:39:28 2015 -0400 Merge topic 'vs-Intel-Fortran-map-more-flags' into next 7fde9794 VS: Add more Fortran compiler flags to flag table (#15381) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7fde97947770258cd175756c315cbd07295bdb97 commit 7fde97947770258cd175756c315cbd07295bdb97 Author: Oyvind Jensen AuthorDate: Thu Mar 5 14:49:14 2015 +0100 Commit: Brad King CommitDate: Mon Mar 9 10:17:37 2015 -0400 VS: Add more Fortran compiler flags to flag table (#15381) Due to a difference in how AdditionalOptions are implemented in the Fortran component of VS and the C/C++ component, flags that are not listed in the flag table are at risk of being overwritten. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ed560aa..3efe7ba 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -391,6 +391,13 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] = {"OptimizeForProcessor", "QxT", "", "codeExclusivelyCore2Duo", 0}, {"OptimizeForProcessor", "QxO", "", "codeExclusivelyCore2StreamingSIMD", 0}, {"OptimizeForProcessor", "QxS", "", "codeExclusivelyCore2StreamingSIMD4", 0}, + {"OpenMP", "Qopenmp", "", "OpenMPParallelCode", 0}, + {"OpenMP", "Qopenmp-stubs", "", "OpenMPSequentialCode", 0}, + {"Traceback", "traceback", "", "true", 0}, + {"Traceback", "notraceback", "", "false", 0}, + {"FloatingPointExceptionHandling", "fpe:0", "", "fpe0"}, + {"FloatingPointExceptionHandling", "fpe:1", "", "fpe1"}, + {"FloatingPointExceptionHandling", "fpe:3", "", "fpe3"}, {"ModulePath", "module:", "", "", cmVS7FlagTable::UserValueRequired}, ----------------------------------------------------------------------- Summary of changes: Source/cmLocalVisualStudio7Generator.cxx | 7 +++++++ 1 file changed, 7 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 13:37:09 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 13:37:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-927-g60fd5e0 Message-ID: <20150309173709.A6B8AABE48@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 60fd5e0a216879aca4f18e840a73e26ad95239d0 (commit) via a6b09085715d0d7f299e9ca76a4835ce5f5acfaf (commit) from 814dafa67b9505e7d8816a2443277c9de95c5460 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60fd5e0a216879aca4f18e840a73e26ad95239d0 commit 60fd5e0a216879aca4f18e840a73e26ad95239d0 Merge: 814dafa a6b0908 Author: Brad King AuthorDate: Mon Mar 9 13:37:08 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 13:37:08 2015 -0400 Merge topic 'ninja-check-root-robustly' into next a6b09085 Ninja: Improve internal check for generating at the top-level (#15436) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6b09085715d0d7f299e9ca76a4835ce5f5acfaf commit a6b09085715d0d7f299e9ca76a4835ce5f5acfaf Author: Brad King AuthorDate: Mon Mar 9 09:25:16 2015 -0400 Commit: Brad King CommitDate: Mon Mar 9 13:36:46 2015 -0400 Ninja: Improve internal check for generating at the top-level (#15436) Simply check for whether the local generator has a parent instead of depending on a string comparison of directory names. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3a9d5be..d64ae0f 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -130,7 +130,7 @@ public: std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote); ///! set/get the parent generator - cmLocalGenerator* GetParent(){return this->Parent;} + cmLocalGenerator* GetParent() const {return this->Parent;} void SetParent(cmLocalGenerator* g) { this->Parent = g; g->AddChild(this); } ///! set/get the children diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 413dc0f..640c1b3 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -182,8 +182,7 @@ cmake* cmLocalNinjaGenerator::GetCMakeInstance() bool cmLocalNinjaGenerator::isRootMakefile() const { - return (strcmp(this->Makefile->GetCurrentDirectory(), - this->GetCMakeInstance()->GetHomeDirectory()) == 0); + return !this->GetParent(); } void cmLocalNinjaGenerator::WriteBuildFileTop() ----------------------------------------------------------------------- Summary of changes: Source/cmLocalGenerator.h | 2 +- Source/cmLocalNinjaGenerator.cxx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Mon Mar 9 16:08:13 2015 From: steveire at gmail.com (Stephen Kelly) Date: Mon, 9 Mar 2015 16:08:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-932-gbd86df6 Message-ID: <20150309200813.4F740AC03C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via bd86df676c8b19c0f5a4e5d87c0074caf3ebcbe3 (commit) via 9e1689413fd1e54e8056b7d369cd508636987072 (commit) via b734fa44719a780683e2eb0dfaabd38d64daa3f6 (commit) via 0b945ea9a6a38d1b3ee27cc32afb4268bd571600 (commit) via 5c559f11137dcb14113a3c5df99ff896c65c7596 (commit) from 60fd5e0a216879aca4f18e840a73e26ad95239d0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd86df676c8b19c0f5a4e5d87c0074caf3ebcbe3 commit bd86df676c8b19c0f5a4e5d87c0074caf3ebcbe3 Merge: 60fd5e0 9e16894 Author: Stephen Kelly AuthorDate: Mon Mar 9 16:08:11 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 16:08:11 2015 -0400 Merge topic 'target-language-genex' into next 9e168941 File(GENERATE): Process genex evaluation files for each language. b734fa44 Genex: Allow COMPILE_LANGUAGE when processing include directories. 0b945ea9 Genex: Allow COMPILE_LANGUAGE when processing compile definitions. 5c559f11 Genex: Enable use of COMPILE_LANGUAGE for compile options. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e1689413fd1e54e8056b7d369cd508636987072 commit 9e1689413fd1e54e8056b7d369cd508636987072 Author: Stephen Kelly AuthorDate: Sun Feb 22 17:44:59 2015 +0100 Commit: Stephen Kelly CommitDate: Mon Mar 9 20:49:17 2015 +0100 File(GENERATE): Process genex evaluation files for each language. diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 4e2a868..fa00283 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -38,13 +38,15 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( //---------------------------------------------------------------------------- void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, + const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm) { std::string rawCondition = this->Condition->GetInput(); if (!rawCondition.empty()) { - std::string condResult = this->Condition->Evaluate(this->Makefile, config); + std::string condResult = this->Condition->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); if (condResult == "0") { return; @@ -60,9 +62,11 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } const std::string outputFileName - = this->OutputFileExpr->Evaluate(this->Makefile, config); + = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); const std::string outputContent - = inputExpression->Evaluate(this->Makefile, config); + = inputExpression->Evaluate(this->Makefile, config, + false, 0, 0, 0, lang); std::map::iterator it = outputFiles.find(outputFileName); @@ -75,7 +79,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, } std::ostringstream e; e << "Evaluation file to be written multiple times for different " - "configurations with different content:\n " << outputFileName; + "configurations or languages with different content:\n " + << outputFileName; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -97,14 +102,22 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, void cmGeneratorExpressionEvaluationFile::CreateOutputFile( std::string const& config) { - std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config); - cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); - sf->SetProperty("GENERATED", "1"); - + std::vector enabledLanguages; cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->SetFilenameTargetDepends(sf, + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) + { + std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config, + false, 0, 0, 0, *le); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(name); + sf->SetProperty("GENERATED", "1"); + + gg->SetFilenameTargetDepends(sf, this->OutputFileExpr->GetSourceSensitiveTargets()); + } } //---------------------------------------------------------------------------- @@ -153,13 +166,23 @@ void cmGeneratorExpressionEvaluationFile::Generate() { allConfigs.push_back(""); } - for(std::vector::const_iterator li = allConfigs.begin(); - li != allConfigs.end(); ++li) + + std::vector enabledLanguages; + cmGlobalGenerator *gg + = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + + for(std::vector::const_iterator le = enabledLanguages.begin(); + le != enabledLanguages.end(); ++le) { - this->Generate(*li, inputExpression.get(), outputFiles, perm); - if(cmSystemTools::GetFatalErrorOccured()) + for(std::vector::const_iterator li = allConfigs.begin(); + li != allConfigs.end(); ++li) { - return; + this->Generate(*li, *le, inputExpression.get(), outputFiles, perm); + if(cmSystemTools::GetFatalErrorOccured()) + { + return; + } } } } diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 3394ade..4424bec 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -34,7 +34,7 @@ public: void CreateOutputFile(std::string const& config); private: - void Generate(const std::string& config, + void Generate(const std::string& config, const std::string& lang, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles, mode_t perm); diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake new file mode 100644 index 0000000..e2b081d --- /dev/null +++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake @@ -0,0 +1,12 @@ + +enable_language(CXX C) + +add_library(empty empty.cpp empty.c) +target_compile_options(empty + PRIVATE LANG_IS_$ +) + +file(GENERATE + OUTPUT opts-$.txt + CONTENT "$\n" +) diff --git a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt index dbd39de..0abb7df 100644 --- a/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt +++ b/Tests/RunCMake/File_Generate/OutputConflict-stderr.txt @@ -1,5 +1,5 @@ CMake Error in CMakeLists.txt: Evaluation file to be written multiple times for different configurations - with different content: + or languages with different content: .*output.txt diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 97f93d5..db344ef 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -17,6 +17,16 @@ if (NOT file_contents MATCHES "generated.cpp.rule") message(SEND_ERROR "Rule file not in target sources! ${file_contents}") endif() +if (NOT RunCMake_GENERATOR MATCHES "Visual Studio") + run_cmake(COMPILE_LANGUAGE-genex) + foreach(l CXX C) + file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs) + if (NOT l_defs STREQUAL "LANG_IS_${l}\n") + message(FATAL_ERROR "File content does not match: ${l_defs}") + endif() + endforeach() +endif() + set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") diff --git a/Tests/RunCMake/File_Generate/empty.c b/Tests/RunCMake/File_Generate/empty.c new file mode 100644 index 0000000..563eef0 --- /dev/null +++ b/Tests/RunCMake/File_Generate/empty.c @@ -0,0 +1,8 @@ + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty_c() +{ + return 0; +} http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b734fa44719a780683e2eb0dfaabd38d64daa3f6 commit b734fa44719a780683e2eb0dfaabd38d64daa3f6 Author: Stephen Kelly AuthorDate: Wed Mar 4 21:53:15 2015 +0100 Commit: Stephen Kelly CommitDate: Mon Mar 9 20:49:17 2015 +0100 Genex: Allow COMPILE_LANGUAGE when processing include directories. Issue an error if this is encountered by an IDE generator. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b6d97d1..d38cf7e 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -121,7 +121,8 @@ Available logical expressions are: target_link_libraries(myapp myapp_c myapp_cxx) The ``Makefile`` and ``Ninja`` based generators can also use this - expression to specify compile-language specific compile definitions: + expression to specify compile-language specific compile definitions + and include directories: .. code-block:: cmake @@ -129,6 +130,9 @@ Available logical expressions are: target_compile_definitions(myapp PRIVATE $<$:COMPILING_CXX> ) + target_include_directories(myapp + PRIVATE $<$:/opt/foo/cxx_headers> + ) Informational Expressions ========================= diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 3ec8595..756d932 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -851,7 +851,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode } else if (genName.find("Xcode") != std::string::npos) { - if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() + || dagChecker->EvaluatingIncludeDirectories())) { reportError(context, content->GetOriginalExpression(), "$ may only be used with COMPILE_OPTIONS " diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 44c9e9a..b7b2eff 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -960,9 +960,10 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang, //---------------------------------------------------------------------------- std::vector -cmGeneratorTarget::GetIncludeDirectories(const std::string& config) const +cmGeneratorTarget::GetIncludeDirectories(const std::string& config, + const std::string& lang) const { - return this->Target->GetIncludeDirectories(config); + return this->Target->GetIncludeDirectories(config, lang); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2083b88..c329cf5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -85,7 +85,7 @@ public: /** Get the include directories for this target. */ std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, const std::string& lang) const; bool IsSystemIncludeDirectory(const std::string& dir, const std::string& config) const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 735dfa9..37cc2c6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1600,7 +1600,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, // Get the target-specific include directories. std::vector includes; - includes = target->GetIncludeDirectories(config); + includes = target->GetIncludeDirectories(config, lang); // Support putting all the in-project include directories first if // it is requested by the project. diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9ecb029..50491af 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2114,6 +2114,32 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << " )\n"; } + + // Target-specific include directories: + cmakefileStream + << "\n" + << "# The include file search paths:\n"; + cmakefileStream + << "set(CMAKE_" << l->first << "_TARGET_INCLUDE_PATH\n"; + std::vector includes; + + cmGeneratorTarget* gt = this->GetGlobalGenerator() + ->GetGeneratorTarget(&target); + + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->GetIncludeDirectories(includes, gt, + l->first, config); + for(std::vector::iterator i = includes.begin(); + i != includes.end(); ++i) + { + cmakefileStream + << " \"" + << this->Convert(*i, cmLocalGenerator::HOME_OUTPUT) + << "\"\n"; + } + cmakefileStream + << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 57c49f1..c7a7110 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1056,40 +1056,6 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; } - // Target-specific include directories: - *this->InfoFileStream - << "\n" - << "# The include file search paths:\n"; - *this->InfoFileStream - << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; - std::vector includes; - - const std::string& config = - this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->LocalGenerator->GetIncludeDirectories(includes, - this->GeneratorTarget, - "C", config); - for(std::vector::iterator i = includes.begin(); - i != includes.end(); ++i) - { - *this->InfoFileStream - << " \"" - << this->LocalGenerator->Convert(*i, - cmLocalGenerator::HOME_OUTPUT) - << "\"\n"; - } - *this->InfoFileStream - << " )\n"; - *this->InfoFileStream - << "set(CMAKE_CXX_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - *this->InfoFileStream - << "set(CMAKE_ASM_TARGET_INCLUDE_PATH " - << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; - // and now write the rule to use it std::vector depends; std::vector commands; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 87dcc99..7a6ad8b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1979,7 +1979,8 @@ static void processIncludeDirectories(cmTarget const* tgt, std::vector &includes, UNORDERED_SET &uniqueIncludes, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugIncludes) + const std::string& config, bool debugIncludes, + const std::string& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -1995,7 +1996,7 @@ static void processIncludeDirectories(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, language), entryIncludes); std::string usedIncludes; @@ -2106,7 +2107,8 @@ static void processIncludeDirectories(cmTarget const* tgt, //---------------------------------------------------------------------------- std::vector -cmTarget::GetIncludeDirectories(const std::string& config) const +cmTarget::GetIncludeDirectories(const std::string& config, + const std::string& language) const { std::vector includes; UNORDERED_SET uniqueIncludes; @@ -2139,7 +2141,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); std::vector linkInterfaceIncludeDirectoriesEntries; @@ -2179,7 +2182,8 @@ cmTarget::GetIncludeDirectories(const std::string& config) const uniqueIncludes, &dagChecker, config, - debugIncludes); + debugIncludes, + language); deleteAndClear(linkInterfaceIncludeDirectoriesEntries); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0356c1e..5170b31 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -568,7 +568,8 @@ public: bool contentOnly) const; std::vector GetIncludeDirectories( - const std::string& config) const; + const std::string& config, + const std::string& language) const; void InsertInclude(const cmValueWithOrigin &entry, bool before = false); void InsertCompileOption(const cmValueWithOrigin &entry, diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 661bbaa..d57556a 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -42,6 +42,20 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_include_directories(consumer + PRIVATE + $<$:${CMAKE_CURRENT_SOURCE_DIR}/cxx_only> + $<$:${CMAKE_CURRENT_SOURCE_DIR}/c_only> + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_include_directories(consumer PRIVATE $ diff --git a/Tests/CMakeCommands/target_include_directories/c_only/c_only.h b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h new file mode 100644 index 0000000..29f68ee --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/c_only/c_only.h @@ -0,0 +1,2 @@ + +#define C_ONLY_DEFINE diff --git a/Tests/CMakeCommands/target_include_directories/consumer.c b/Tests/CMakeCommands/target_include_directories/consumer.c new file mode 100644 index 0000000..8821f5b --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/consumer.c @@ -0,0 +1,10 @@ + +#ifdef TEST_LANG_DEFINES + #include "c_only.h" + + #ifndef C_ONLY_DEFINE + #error Expected C_ONLY_DEFINE + #endif +#endif + +int consumer_c() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp index 7e3443e..649510c 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.cpp +++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp @@ -4,6 +4,9 @@ #include "interfaceinclude.h" #include "relative_dir.h" #include "consumer.h" +#ifdef TEST_LANG_DEFINES + #include "cxx_only.h" +#endif #ifdef PRIVATEINCLUDE_DEFINE #error Unexpected PRIVATEINCLUDE_DEFINE @@ -29,4 +32,10 @@ #error Expected CONSUMER_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CXX_ONLY_DEFINE + #error Expected CXX_ONLY_DEFINE + #endif +#endif + int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h new file mode 100644 index 0000000..67289a4 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h @@ -0,0 +1,2 @@ + +#define CXX_ONLY_DEFINE diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt new file mode 100644 index 0000000..ec15068 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt new file mode 100644 index 0000000..fdf92b2 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake new file mode 100644 index 0000000..31771f6 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_include_directories(main PRIVATE $<$:anydir>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 8a32aef..5e0a5f5 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -11,3 +11,10 @@ elseif (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) run_cmake(CompileDefinitions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file IncludeDirectories-stderr-Xcode.txt) + run_cmake(IncludeDirectories) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file IncludeDirectories-stderr-VS.txt) + run_cmake(IncludeDirectories) +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0b945ea9a6a38d1b3ee27cc32afb4268bd571600 commit 0b945ea9a6a38d1b3ee27cc32afb4268bd571600 Author: Stephen Kelly AuthorDate: Wed Mar 4 21:46:42 2015 +0100 Commit: Stephen Kelly CommitDate: Mon Mar 9 20:49:16 2015 +0100 Genex: Allow COMPILE_LANGUAGE when processing compile definitions. Issue an error if this is encountered by an IDE generator. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index b1b1102..b6d97d1 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -120,6 +120,16 @@ Available logical expressions are: add_executable(myapp main.cpp) target_link_libraries(myapp myapp_c myapp_cxx) + The ``Makefile`` and ``Ninja`` based generators can also use this + expression to specify compile-language specific compile definitions: + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_definitions(myapp + PRIVATE $<$:COMPILING_CXX> + ) + Informational Expressions ========================= diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 69857ef..614e7d9 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -599,7 +599,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, // the compilerdefines for this target std::vector cdefs; - target->GetCompileDefinitions(cdefs, buildType); + target->GetCompileDefinitions(cdefs, buildType, "C"); // Expand the list. for(std::vector::const_iterator di = cdefs.begin(); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 5fff0fb..25f9005 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -436,7 +436,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, } // Add preprocessor definitions for this target and configuration. - lg->AddCompileDefinitions(defines, target, config); + lg->AddCompileDefinitions(defines, target, config, language); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); { std::string defPropName = "COMPILE_DEFINITIONS_"; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6a9f251..3ec8595 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -817,7 +817,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode std::string Evaluate(const std::vector ¶meters, cmGeneratorExpressionContext *context, const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const + cmGeneratorExpressionDAGChecker *dagChecker) const { if(context->Language.empty()) { @@ -849,12 +849,21 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "generators."); return std::string(); } + else if (genName.find("Xcode") != std::string::npos) + { + if (dagChecker && dagChecker->EvaluatingCompileDefinitions()) + { + reportError(context, content->GetOriginalExpression(), + "$ may only be used with COMPILE_OPTIONS " + "with the Xcode generator."); + return std::string(); + } + } else { if(genName.find("Makefiles") == std::string::npos && genName.find("Ninja") == std::string::npos && - genName.find("Watcom WMake") == std::string::npos && - genName.find("Xcode") == std::string::npos) + genName.find("Watcom WMake") == std::string::npos) { reportError(context, content->GetOriginalExpression(), "$ not supported for this generator."); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e89161d..bd8a1f5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1803,7 +1803,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "C"); this->AppendDefines(ppDefs, targetDefines); buildSettings->AddAttribute ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index be82085..735dfa9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1428,11 +1428,11 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config) + const std::string& config, + const std::string& lang) { std::vector targetDefines; - target->GetCompileDefinitions(targetDefines, - config); + target->GetCompileDefinitions(targetDefines, config, lang); this->AppendDefines(defines, targetDefines); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3a9d5be..f1f0da1 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -239,7 +239,8 @@ public: const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, cmTarget const* target, - const std::string& config); + const std::string& config, + const std::string& lang); /** Compute the language used to compile the given source file. */ std::string GetSourceFileLanguage(const cmSourceFile& source); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 432cb3a..9ecb029 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2094,26 +2094,26 @@ void cmLocalUnixMakefileGenerator3 << "set(CMAKE_" << l->first << "_COMPILER_ID \"" << cid << "\")\n"; } - } - // Build a list of preprocessor definitions for the target. - std::set defines; - this->AddCompileDefinitions(defines, &target, - this->ConfigurationName); - if(!defines.empty()) - { - cmakefileStream - << "\n" - << "# Preprocessor definitions for this target.\n" - << "set(CMAKE_TARGET_DEFINITIONS\n"; - for(std::set::const_iterator di = defines.begin(); - di != defines.end(); ++di) + // Build a list of preprocessor definitions for the target. + std::set defines; + this->AddCompileDefinitions(defines, &target, + this->ConfigurationName, l->first); + if(!defines.empty()) { cmakefileStream - << " " << this->EscapeForCMake(*di) << "\n"; + << "\n" + << "# Preprocessor definitions for this target.\n" + << "set(CMAKE_TARGET_DEFINITIONS_" << l->first << "\n"; + for(std::set::const_iterator di = defines.begin(); + di != defines.end(); ++di) + { + cmakefileStream + << " " << this->EscapeForCMake(*di) << "\n"; + } + cmakefileStream + << " )\n"; } - cmakefileStream - << " )\n"; } // Store include transform rule properties. Write the directory diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 0848b03..2b999eb 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1778,15 +1778,15 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, ""); + this->AddCompileDefinitions(definesSet, &target, "", linkLanguage); this->AddCompileDefinitions(debugDefinesSet, &target, - "DEBUG"); + "DEBUG", linkLanguage); this->AddCompileDefinitions(releaseDefinesSet, &target, - "RELEASE"); + "RELEASE", linkLanguage); this->AddCompileDefinitions(minsizeDefinesSet, &target, - "MINSIZEREL"); + "MINSIZEREL", linkLanguage); this->AddCompileDefinitions(debugrelDefinesSet, &target, - "RELWITHDEBINFO"); + "RELWITHDEBINFO", linkLanguage); std::string defines = " "; std::string debugDefines = " "; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ed560aa..f53f825 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -775,7 +775,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); std::vector targetDefines; - target.GetCompileDefinitions(targetDefines, configName); + target.GetCompileDefinitions(targetDefines, configName, "CXX"); targetOptions.AddDefines(targetDefines); targetOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 20207f5..57c49f1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -329,7 +329,7 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->ConfigurationName); + this->LocalGenerator->ConfigurationName, l); std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, lang); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index cfd8937..92fccd3 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -231,7 +231,7 @@ ComputeDefines(cmSourceFile const* source, const std::string& language) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->GetConfigName()); + this->GetConfigName(), language); this->LocalGenerator->AppendDefines (defines, source->GetProperty("COMPILE_DEFINITIONS")); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e18e757..844d708 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -507,7 +507,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, incs = cmJoin(includeDirs, ";"); std::set defines; - localGen->AddCompileDefinitions(defines, target, config); + localGen->AddCompileDefinitions(defines, target, config, "CXX"); defs += cmJoin(defines, ";"); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c54d694..87dcc99 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2336,16 +2336,18 @@ static void processCompileDefinitions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions", std::string()); + "definitions", language); } //---------------------------------------------------------------------------- void cmTarget::GetCompileDefinitions(std::vector &list, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2377,7 +2379,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); std::vector linkInterfaceCompileDefinitionsEntries; @@ -2424,7 +2427,8 @@ void cmTarget::GetCompileDefinitions(std::vector &list, uniqueOptions, &dagChecker, config, - debugDefines); + debugDefines, + language); deleteAndClear(linkInterfaceCompileDefinitionsEntries); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 56db22e..0356c1e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -496,7 +496,8 @@ public: const char* GetExportMacro() const; void GetCompileDefinitions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; // Compute the set of languages compiled by the target. This is // computed every time it is called because the languages can change diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 04d1487..19444ed 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1876,7 +1876,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); std::vector targetDefines; - this->Target->GetCompileDefinitions(targetDefines, configName.c_str()); + this->Target->GetCompileDefinitions(targetDefines, + configName.c_str(), "CXX"); clOptions.AddDefines(targetDefines); if(this->MSTools) { diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 14d40aa..f96283d 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -26,6 +26,21 @@ target_compile_definitions(consumer PRIVATE ) +if (CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_compile_definitions(consumer + PRIVATE + CONSUMER_LANG_$ + LANG_IS_CXX=$ + LANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + add_definitions(-DSOME_DEF) add_library(imp UNKNOWN IMPORTED) get_target_property(_res imp COMPILE_DEFINITIONS) diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c new file mode 100644 index 0000000..5796d96 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp index a391114..778f57e 100644 --- a/Tests/CMakeCommands/target_compile_definitions/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.cpp @@ -15,4 +15,22 @@ #error Expected DASH_D_DEFINE #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt new file mode 100644 index 0000000..73b66ac --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt new file mode 100644 index 0000000..a1ed633 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt @@ -0,0 +1,9 @@ +CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\): + Error evaluating generator expression: + + \$ + + \$ may only be used with COMPILE_OPTIONS with the + Xcode generator. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake new file mode 100644 index 0000000..7935d88 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_definitions(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake index 2c5d9ae..8a32aef 100644 --- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -4,3 +4,10 @@ if (RunCMake_GENERATOR MATCHES "Visual Studio") set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) run_cmake(CompileOptions) endif() +if (RunCMake_GENERATOR STREQUAL "Xcode") + set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt) + run_cmake(CompileDefinitions) +elseif (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileDefinitions-stderr-VS.txt) + run_cmake(CompileDefinitions) +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c559f11137dcb14113a3c5df99ff896c65c7596 commit 5c559f11137dcb14113a3c5df99ff896c65c7596 Author: Stephen Kelly AuthorDate: Tue Nov 25 22:47:44 2014 +0100 Commit: Stephen Kelly CommitDate: Mon Mar 9 20:48:57 2015 +0100 Genex: Enable use of COMPILE_LANGUAGE for compile options. Follow-ups will allow the use of the generator expression for compile definitions and include directories for non-IDE generators. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index c47a7c4..b1b1102 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -93,6 +93,32 @@ Available logical expressions are: for the 'head' target, an error is reported. See the :manual:`cmake-compile-features(7)` manual for information on compile features. +``$`` + ``1`` when the language used for compilation unit matches ``lang``, + otherwise ``0``. This expression used to specify compile options for + source files of a particular language in a target. For example, to specify + the use of the ``-fno-exceptions`` compile option (compiler id checks + elided): + + .. code-block:: cmake + + add_executable(myapp main.cpp foo.c bar.cpp) + target_compile_options(myapp + PRIVATE $<$:-fno-exceptions> + ) + + This generator expression has limited use because it is not possible to + use it with the Visual Studio generators. Portable buildsystems would + not use this expression, and would create separate libraries for each + source file language instead: + + .. code-block:: cmake + + add_library(myapp_c foo.c) + add_library(myapp_cxx foo.c) + target_compile_options(myapp_cxx PUBLIC -fno-exceptions) + add_executable(myapp main.cpp) + target_link_libraries(myapp myapp_c myapp_cxx) Informational Expressions ========================= @@ -174,6 +200,10 @@ Available informational expressions are: ``$`` Content of the install prefix when the target is exported via :command:`install(EXPORT)` and empty otherwise. +``$`` + The compile language of source files when evaluating compile options. See + the unary version for notes about portability of this generator + expression. Output Expressions ================== diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 63a46f2..6a9f251 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -827,6 +827,40 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "components of the file(GENERATE) command."); return std::string(); } + + std::vector enabledLanguages; + cmGlobalGenerator* gg + = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); + gg->GetEnabledLanguages(enabledLanguages); + if (!parameters.empty() && + std::find(enabledLanguages.begin(), enabledLanguages.end(), + parameters.front()) == enabledLanguages.end()) + { + reportError(context, content->GetOriginalExpression(), + "$ Unknown language."); + return std::string(); + } + + std::string genName = gg->GetName(); + if (genName.find("Visual Studio") != std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ may not be used with Visual Studio " + "generators."); + return std::string(); + } + else + { + if(genName.find("Makefiles") == std::string::npos && + genName.find("Ninja") == std::string::npos && + genName.find("Watcom WMake") == std::string::npos && + genName.find("Xcode") == std::string::npos) + { + reportError(context, content->GetOriginalExpression(), + "$ not supported for this generator."); + return std::string(); + } + } if (parameters.empty()) { return context->Language; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7c83f27..be82085 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1453,7 +1453,7 @@ void cmLocalGenerator::AddCompileOptions( { cmSystemTools::ParseWindowsCommandLine(targetFlags, opts); } - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { @@ -1474,7 +1474,7 @@ void cmLocalGenerator::AddCompileOptions( this->AppendFlags(flags, targetFlags); } std::vector opts; - target->GetCompileOptions(opts, config); + target->GetCompileOptions(opts, config, lang); for(std::vector::const_iterator i = opts.begin(); i != opts.end(); ++i) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e046bef..c54d694 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2192,7 +2192,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions, const char *logName) + const std::string& config, bool debugOptions, const char *logName, + std::string const& language) { cmMakefile *mf = tgt->GetMakefile(); @@ -2204,7 +2205,8 @@ static void processCompileOptionsInternal(cmTarget const* tgt, config, false, tgt, - dagChecker), + dagChecker, + language), entryOptions); std::string usedOptions; for(std::vector::iterator @@ -2238,10 +2240,12 @@ static void processCompileOptions(cmTarget const* tgt, std::vector &options, UNORDERED_SET &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) + const std::string& config, bool debugOptions, + std::string const& language) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "options"); + dagChecker, config, debugOptions, "options", + language); } //---------------------------------------------------------------------------- @@ -2271,7 +2275,8 @@ void cmTarget::GetAutoUicOptions(std::vector &result, //---------------------------------------------------------------------------- void cmTarget::GetCompileOptions(std::vector &result, - const std::string& config) const + const std::string& config, + const std::string& language) const { UNORDERED_SET uniqueOptions; @@ -2303,7 +2308,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); std::vector linkInterfaceCompileOptionsEntries; @@ -2318,7 +2324,8 @@ void cmTarget::GetCompileOptions(std::vector &result, uniqueOptions, &dagChecker, config, - debugOptions); + debugOptions, + language); deleteAndClear(linkInterfaceCompileOptionsEntries); } @@ -2333,7 +2340,7 @@ static void processCompileDefinitions(cmTarget const* tgt, { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions"); + "definitions", std::string()); } //---------------------------------------------------------------------------- @@ -2431,7 +2438,8 @@ static void processCompileFeatures(cmTarget const* tgt, const std::string& config, bool debugOptions) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "features"); + dagChecker, config, debugOptions, "features", + std::string()); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ddd9859..56db22e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -577,7 +577,8 @@ public: void AppendBuildInterfaceIncludes(); void GetCompileOptions(std::vector &result, - const std::string& config) const; + const std::string& config, + const std::string& language) const; void GetAutoUicOptions(std::vector &result, const std::string& config) const; void GetCompileFeatures(std::vector &features, diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index 1d04639..35dd276 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -23,6 +23,21 @@ add_executable(consumer "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp" ) +if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") + target_sources(consumer PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c" + ) + target_compile_options(consumer + PRIVATE + -DCONSUMER_LANG_$ + -DLANG_IS_CXX=$ + -DLANG_IS_C=$ + ) + target_compile_definitions(consumer + PRIVATE -DTEST_LANG_DEFINES + ) +endif() + target_compile_options(consumer PRIVATE $<$:$> ) diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c new file mode 100644 index 0000000..5796d96 --- /dev/null +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -0,0 +1,23 @@ + +#ifdef TEST_LANG_DEFINES + #ifdef CONSUMER_LANG_CXX + #error Unexpected CONSUMER_LANG_CXX + #endif + + #ifndef CONSUMER_LANG_C + #error Expected CONSUMER_LANG_C + #endif + + #if !LANG_IS_C + #error Expected LANG_IS_C + #endif + + #if LANG_IS_CXX + #error Unexpected LANG_IS_CXX + #endif +#endif + +void consumer_c() +{ + +} diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 1299606..c5882a5 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -15,4 +15,22 @@ #endif +#ifdef TEST_LANG_DEFINES + #ifndef CONSUMER_LANG_CXX + #error Expected CONSUMER_LANG_CXX + #endif + + #ifdef CONSUMER_LANG_C + #error Unexpected CONSUMER_LANG_C + #endif + + #if !LANG_IS_CXX + #error Expected LANG_IS_CXX + #endif + + #if LANG_IS_C + #error Unexpected LANG_IS_C + #endif +#endif + int main() { return 0; } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057..9f1256e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -208,3 +208,5 @@ add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) if(RPMBUILD_EXECUTABLE) add_RunCMake_test(CPackRPM) endif() + +add_RunCMake_test(COMPILE_LANGUAGE-genex) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt new file mode 100644 index 0000000..ef2163c --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt new file mode 100644 index 0000000..e9e8e9f --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt @@ -0,0 +1,8 @@ +CMake Error at CompileOptions.cmake:5 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ may not be used with Visual Studio generators. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake new file mode 100644 index 0000000..6c92abc --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake @@ -0,0 +1,5 @@ + +enable_language(CXX) + +add_executable(main main.cpp) +target_compile_options(main PRIVATE $<$:-DANYTHING>) diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake new file mode 100644 index 0000000..2c5d9ae --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +if (RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake-stderr-file CompileOptions-stderr-VS.txt) + run_cmake(CompileOptions) +endif() diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp new file mode 100644 index 0000000..31a1337 --- /dev/null +++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt new file mode 100644 index 0000000..444da45 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at COMPILE_LANGUAGE-unknown-lang.cmake:4 \(target_compile_options\): + Error evaluating generator expression: + + \$ + + \$ Unknown language. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake new file mode 100644 index 0000000..cec12a3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<$:-Wall>) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index f591c3d..542b7fc 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -23,6 +23,7 @@ run_cmake(COMPILE_LANGUAGE-target_sources) run_cmake(COMPILE_LANGUAGE-add_executable) run_cmake(COMPILE_LANGUAGE-add_library) run_cmake(COMPILE_LANGUAGE-add_test) +run_cmake(COMPILE_LANGUAGE-unknown-lang) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 9 16:35:23 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 9 Mar 2015 16:35:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-934-g9aec617 Message-ID: <20150309203523.B56CCABB12@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9aec617f083d5b27041ba36d727763c5ae6efe37 (commit) via 458c9e95dee1f6c5a6e5b537a544a8a7c8c56d10 (commit) from bd86df676c8b19c0f5a4e5d87c0074caf3ebcbe3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9aec617f083d5b27041ba36d727763c5ae6efe37 commit 9aec617f083d5b27041ba36d727763c5ae6efe37 Merge: bd86df6 458c9e9 Author: Brad King AuthorDate: Mon Mar 9 16:35:22 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 16:35:22 2015 -0400 Merge topic 'UseSWIG-fix-CMP0054-warnings' into next 458c9e95 UseSWIG: Avoid if() auto-dereferene in quoted arguments http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=458c9e95dee1f6c5a6e5b537a544a8a7c8c56d10 commit 458c9e95dee1f6c5a6e5b537a544a8a7c8c56d10 Author: Brad King AuthorDate: Mon Mar 9 16:32:43 2015 -0400 Commit: Brad King CommitDate: Mon Mar 9 16:35:08 2015 -0400 UseSWIG: Avoid if() auto-dereferene in quoted arguments Protect against variables named "CSHARP", "PERL", "PYTHON", or "UNKNOWN" when CMP0054 is not set to NEW. Reported-by: Tuukka Pasanen diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index bab1b21..7939b1f 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -76,16 +76,16 @@ macro(SWIG_MODULE_INITIALIZE name language) if (";${CMAKE_SWIG_FLAGS};" MATCHES ";-noproxy;") set (SWIG_MODULE_${name}_NOPROXY TRUE) endif () - if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN") + if("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xUNKNOWN") message(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") - elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY) + elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xPYTHON" AND NOT SWIG_MODULE_${name}_NOPROXY) # swig will produce a module.py containing an 'import _modulename' statement, # which implies having a corresponding _modulename.so (*NIX), _modulename.pyd (Win32), # unless the -noproxy flag is used set(SWIG_MODULE_${name}_REAL_NAME "_${name}") - elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL") + elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xPERL") set(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") - elseif("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "CSHARP") + elseif("x${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "xCSHARP") # This makes sure that the name used in the generated DllImport # matches the library name created by CMake set(SWIG_MODULE_${name}_EXTRA_FLAGS "-dllimport;${name}") ----------------------------------------------------------------------- Summary of changes: Modules/UseSWIG.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Mon Mar 9 16:55:12 2015 From: steveire at gmail.com (Stephen Kelly) Date: Mon, 9 Mar 2015 16:55:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-936-g95105b9 Message-ID: <20150309205512.A21DEABB55@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 95105b9e140a74048d0bcd015e92c8ddc6593a61 (commit) via 5f09436b9fa31160e3d08ee502486ea0472551ba (commit) from 9aec617f083d5b27041ba36d727763c5ae6efe37 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95105b9e140a74048d0bcd015e92c8ddc6593a61 commit 95105b9e140a74048d0bcd015e92c8ddc6593a61 Merge: 9aec617 5f09436 Author: Stephen Kelly AuthorDate: Mon Mar 9 16:55:11 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 9 16:55:11 2015 -0400 Merge topic 'target-language-genex' into next 5f09436b Help: Add release notes for target-language-genex. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f09436b9fa31160e3d08ee502486ea0472551ba commit 5f09436b9fa31160e3d08ee502486ea0472551ba Author: Stephen Kelly AuthorDate: Mon Mar 9 21:54:28 2015 +0100 Commit: Stephen Kelly CommitDate: Mon Mar 9 21:54:51 2015 +0100 Help: Add release notes for target-language-genex. diff --git a/Help/release/dev/target-language-genex.rst b/Help/release/dev/target-language-genex.rst new file mode 100644 index 0000000..d197900 --- /dev/null +++ b/Help/release/dev/target-language-genex.rst @@ -0,0 +1,8 @@ +target-language-genex +--------------------- + +* A new ``COMPILE_LANGUAGE`` + :manual:`Generator expression ` allows + specifying compile options for target files based on :prop_sf:`LANGUAGE`. + This feature has varying support for various generators. See the + :manual:`cmake-generator-expressions(7)` manual for details. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/target-language-genex.rst | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Help/release/dev/target-language-genex.rst hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 10 00:01:22 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 10 Mar 2015 00:01:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-380-ga5505c4 Message-ID: <20150310040122.A822FAB8DF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a5505c4c53672a55f5e9e577ffb0ac3bd78c7847 (commit) from a6d488f2ceb62b968c6f0a8971a3556195af80ca (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5505c4c53672a55f5e9e577ffb0ac3bd78c7847 commit a5505c4c53672a55f5e9e577ffb0ac3bd78c7847 Author: Kitware Robot AuthorDate: Tue Mar 10 00:01:19 2015 -0400 Commit: Kitware Robot CommitDate: Tue Mar 10 00:01:19 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 038a09f..8fcdac9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150309) +set(CMake_VERSION_PATCH 20150310) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 08:39:58 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 08:39:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-938-ga173921 Message-ID: <20150310123958.86A3FAA771@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a173921342439ec3e2073b0752265c22078134fb (commit) via 30319c4ef8f1de651b1ceee5dc6ae2bec0b3dfb2 (commit) from 95105b9e140a74048d0bcd015e92c8ddc6593a61 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a173921342439ec3e2073b0752265c22078134fb commit a173921342439ec3e2073b0752265c22078134fb Merge: 95105b9 30319c4 Author: Brad King AuthorDate: Tue Mar 10 08:39:57 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 08:39:57 2015 -0400 Merge topic 'vs-Intel-Fortran-map-more-flags' into next 30319c4e fixup! VS: Add more Fortran compiler flags to flag table (#15381) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30319c4ef8f1de651b1ceee5dc6ae2bec0b3dfb2 commit 30319c4ef8f1de651b1ceee5dc6ae2bec0b3dfb2 Author: Brad King AuthorDate: Tue Mar 10 08:39:34 2015 -0400 Commit: Brad King CommitDate: Tue Mar 10 08:39:34 2015 -0400 fixup! VS: Add more Fortran compiler flags to flag table (#15381) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 3efe7ba..25d80f2 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -395,9 +395,9 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] = {"OpenMP", "Qopenmp-stubs", "", "OpenMPSequentialCode", 0}, {"Traceback", "traceback", "", "true", 0}, {"Traceback", "notraceback", "", "false", 0}, - {"FloatingPointExceptionHandling", "fpe:0", "", "fpe0"}, - {"FloatingPointExceptionHandling", "fpe:1", "", "fpe1"}, - {"FloatingPointExceptionHandling", "fpe:3", "", "fpe3"}, + {"FloatingPointExceptionHandling", "fpe:0", "", "fpe0", 0}, + {"FloatingPointExceptionHandling", "fpe:1", "", "fpe1", 0}, + {"FloatingPointExceptionHandling", "fpe:3", "", "fpe3", 0}, {"ModulePath", "module:", "", "", cmVS7FlagTable::UserValueRequired}, ----------------------------------------------------------------------- Summary of changes: Source/cmLocalVisualStudio7Generator.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 08:40:54 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 08:40:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-940-g8a48986 Message-ID: <20150310124054.67873AAA33@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8a48986c38539150ac5eeafa11fb584de68e1d85 (commit) via 18d5a4bcfd688687d334d645dfdaa7fd5a207bd9 (commit) from a173921342439ec3e2073b0752265c22078134fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a48986c38539150ac5eeafa11fb584de68e1d85 commit 8a48986c38539150ac5eeafa11fb584de68e1d85 Merge: a173921 18d5a4b Author: Brad King AuthorDate: Tue Mar 10 08:40:53 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 08:40:53 2015 -0400 Merge topic 'vs-Intel-Fortran-map-more-flags' into next 18d5a4bc VS: Add more Fortran compiler flags to flag table (#15381) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18d5a4bcfd688687d334d645dfdaa7fd5a207bd9 commit 18d5a4bcfd688687d334d645dfdaa7fd5a207bd9 Author: Oyvind Jensen AuthorDate: Thu Mar 5 14:49:14 2015 +0100 Commit: Brad King CommitDate: Tue Mar 10 08:40:37 2015 -0400 VS: Add more Fortran compiler flags to flag table (#15381) Due to a difference in how AdditionalOptions are implemented in the Fortran component of VS and the C/C++ component, flags that are not listed in the flag table are at risk of being overwritten. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ed560aa..25d80f2 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -391,6 +391,13 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] = {"OptimizeForProcessor", "QxT", "", "codeExclusivelyCore2Duo", 0}, {"OptimizeForProcessor", "QxO", "", "codeExclusivelyCore2StreamingSIMD", 0}, {"OptimizeForProcessor", "QxS", "", "codeExclusivelyCore2StreamingSIMD4", 0}, + {"OpenMP", "Qopenmp", "", "OpenMPParallelCode", 0}, + {"OpenMP", "Qopenmp-stubs", "", "OpenMPSequentialCode", 0}, + {"Traceback", "traceback", "", "true", 0}, + {"Traceback", "notraceback", "", "false", 0}, + {"FloatingPointExceptionHandling", "fpe:0", "", "fpe0", 0}, + {"FloatingPointExceptionHandling", "fpe:1", "", "fpe1", 0}, + {"FloatingPointExceptionHandling", "fpe:3", "", "fpe3", 0}, {"ModulePath", "module:", "", "", cmVS7FlagTable::UserValueRequired}, ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 08:47:03 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 08:47:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-942-g1191533 Message-ID: <20150310124703.DC7F0AB76A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 11915337b3e9e3964e5a98155d5399e76fe30803 (commit) via 94887cb6f1200c505d86e3e52f7abf88cb5e2a72 (commit) from 8a48986c38539150ac5eeafa11fb584de68e1d85 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11915337b3e9e3964e5a98155d5399e76fe30803 commit 11915337b3e9e3964e5a98155d5399e76fe30803 Merge: 8a48986 94887cb Author: Brad King AuthorDate: Tue Mar 10 08:47:03 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 08:47:03 2015 -0400 Merge topic 'vs-express-build-output' into next 94887cb6 cmake: Teach --build to get VCExpress output (#15437) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94887cb6f1200c505d86e3e52f7abf88cb5e2a72 commit 94887cb6f1200c505d86e3e52f7abf88cb5e2a72 Author: Brad King AuthorDate: Tue Mar 10 08:42:18 2015 -0400 Commit: Brad King CommitDate: Tue Mar 10 08:42:18 2015 -0400 cmake: Teach --build to get VCExpress output (#15437) VCExpress does not produce output if its pipes are connected to an interactive terminal. Add a special case to 'cmake --build' to capture the output through a pipe and re-print it instead of sharing output pipes with VCExpress. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 36395aa..e95cf50 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1717,6 +1717,19 @@ int cmGlobalGenerator::Build( std::string outputBuffer; std::string* outputPtr = &outputBuffer; + std::vector makeCommand; + this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName, + bindir, target, config, fast, verbose, + nativeOptions); + + // Workaround to convince VCExpress.exe to produce output. + if (outputflag == cmSystemTools::OUTPUT_PASSTHROUGH && + !makeCommand.empty() && cmSystemTools::LowerCase( + cmSystemTools::GetFilenameName(makeCommand[0])) == "vcexpress.exe") + { + outputflag = cmSystemTools::OUTPUT_NORMAL; + } + // should we do a clean first? if (clean) { @@ -1743,10 +1756,6 @@ int cmGlobalGenerator::Build( } // now build - std::vector makeCommand; - this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName, - bindir, target, config, fast, verbose, - nativeOptions); std::string makeCommandStr = cmSystemTools::PrintSingleCommand(makeCommand); output += "\nRun Build Command:"; output += makeCommandStr; ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:10:39 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:10:39 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-944-gc1c2465 Message-ID: <20150310131039.C5CF3AA176@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c1c24657fc549f6f332a91b875d1cd2126f32b91 (commit) via f0879ca64db54ac909c4e10787918b50126f9ffb (commit) from 11915337b3e9e3964e5a98155d5399e76fe30803 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1c24657fc549f6f332a91b875d1cd2126f32b91 commit c1c24657fc549f6f332a91b875d1cd2126f32b91 Merge: 1191533 f0879ca Author: Brad King AuthorDate: Tue Mar 10 09:10:38 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 09:10:38 2015 -0400 Merge topic 'target-language-genex' into next f0879ca6 fixup! Help: Add release notes for target-language-genex. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f0879ca64db54ac909c4e10787918b50126f9ffb commit f0879ca64db54ac909c4e10787918b50126f9ffb Author: Brad King AuthorDate: Tue Mar 10 09:10:28 2015 -0400 Commit: Brad King CommitDate: Tue Mar 10 09:10:28 2015 -0400 fixup! Help: Add release notes for target-language-genex. diff --git a/Help/release/dev/target-language-genex.rst b/Help/release/dev/target-language-genex.rst index d197900..ed4cb5e 100644 --- a/Help/release/dev/target-language-genex.rst +++ b/Help/release/dev/target-language-genex.rst @@ -1,8 +1,9 @@ target-language-genex --------------------- -* A new ``COMPILE_LANGUAGE`` - :manual:`Generator expression ` allows - specifying compile options for target files based on :prop_sf:`LANGUAGE`. - This feature has varying support for various generators. See the - :manual:`cmake-generator-expressions(7)` manual for details. +* A new ``COMPILE_LANGUAGE`` generator expression was introduced to + allow specification of compile options for target files based on the + :prop_sf:`LANGUAGE` of each source file. Due to limitations of the + underlying native build tools, this feature has varying support across + generators. See the :manual:`cmake-generator-expressions(7)` manual + for details. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/target-language-genex.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:10:54 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:10:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-946-g973f819 Message-ID: <20150310131054.36A83AA344@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 973f819ee872c16a596d1dd1bb6cbf85e9065b81 (commit) via 232a6883a1fe480def1743af6d711097b98b026e (commit) from c1c24657fc549f6f332a91b875d1cd2126f32b91 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=973f819ee872c16a596d1dd1bb6cbf85e9065b81 commit 973f819ee872c16a596d1dd1bb6cbf85e9065b81 Merge: c1c2465 232a688 Author: Brad King AuthorDate: Tue Mar 10 09:10:53 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 09:10:53 2015 -0400 Merge topic 'target-language-genex' into next 232a6883 Help: Add release notes for target-language-genex. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=232a6883a1fe480def1743af6d711097b98b026e commit 232a6883a1fe480def1743af6d711097b98b026e Author: Stephen Kelly AuthorDate: Mon Mar 9 21:54:28 2015 +0100 Commit: Brad King CommitDate: Tue Mar 10 09:10:47 2015 -0400 Help: Add release notes for target-language-genex. diff --git a/Help/release/dev/target-language-genex.rst b/Help/release/dev/target-language-genex.rst new file mode 100644 index 0000000..ed4cb5e --- /dev/null +++ b/Help/release/dev/target-language-genex.rst @@ -0,0 +1,9 @@ +target-language-genex +--------------------- + +* A new ``COMPILE_LANGUAGE`` generator expression was introduced to + allow specification of compile options for target files based on the + :prop_sf:`LANGUAGE` of each source file. Due to limitations of the + underlying native build tools, this feature has varying support across + generators. See the :manual:`cmake-generator-expressions(7)` manual + for details. ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:12:27 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:12:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-383-gfa4617b Message-ID: <20150310131227.07760AABEF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via fa4617b7ea00474053b3d0278f316db226322626 (commit) via 024e25e485f8d1dbca40521fbc0bcd61e383f413 (commit) via 3ef776fc38fecff332e568f307dcf4e6f82fbe14 (commit) from a5505c4c53672a55f5e9e577ffb0ac3bd78c7847 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa4617b7ea00474053b3d0278f316db226322626 commit fa4617b7ea00474053b3d0278f316db226322626 Merge: a5505c4 024e25e Author: Brad King AuthorDate: Tue Mar 10 09:12:24 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 09:12:24 2015 -0400 Merge topic 'configure_file-NEWLINE_STYLE-no-warn' 024e25e4 Tests: Add more signature tests to RunCMake.configure_file test 3ef776fc configure_file: Do not warn about newline style arguments ----------------------------------------------------------------------- Summary of changes: Source/cmConfigureFileCommand.cxx | 7 +++++ Tests/CMakeTests/CMakeLists.txt | 1 - Tests/CMakeTests/ConfigureFile-DirOutput.cmake | 5 ---- Tests/CMakeTests/ConfigureFile-Relative.cmake | 4 --- Tests/CMakeTests/ConfigureFileTest.cmake.in | 28 -------------------- .../BadArg-result.txt} | 0 Tests/RunCMake/configure_file/BadArg-stderr.txt | 4 +++ .../configure_file/BadArg.cmake} | 0 .../DirInput-result.txt} | 0 Tests/RunCMake/configure_file/DirInput-stderr.txt | 8 ++++++ .../configure_file/DirInput.cmake} | 0 Tests/RunCMake/configure_file/DirOutput-stderr.txt | 1 + Tests/RunCMake/configure_file/DirOutput.cmake | 4 +++ Tests/RunCMake/configure_file/DirOutput.txt | 1 + .../NewLineStyle-COPYONLY-result.txt} | 0 .../NewLineStyle-COPYONLY-stderr.txt | 4 +++ .../configure_file/NewLineStyle-COPYONLY.cmake} | 2 +- .../NewLineStyle-NoArg-result.txt} | 0 .../configure_file/NewLineStyle-NoArg-stderr.txt | 5 ++++ .../configure_file/NewLineStyle-NoArg.cmake} | 2 +- .../configure_file/NewLineStyle-ValidArg.cmake} | 2 +- .../NewLineStyle-WrongArg-result.txt} | 0 .../NewLineStyle-WrongArg-stderr.txt | 5 ++++ .../configure_file/NewLineStyle-WrongArg.cmake} | 2 +- Tests/RunCMake/configure_file/Relative-In.txt | 1 + Tests/RunCMake/configure_file/Relative-stderr.txt | 1 + Tests/RunCMake/configure_file/Relative.cmake | 3 +++ Tests/RunCMake/configure_file/RunCMakeTest.cmake | 8 ++++++ 28 files changed, 56 insertions(+), 42 deletions(-) delete mode 100644 Tests/CMakeTests/ConfigureFile-DirOutput.cmake delete mode 100644 Tests/CMakeTests/ConfigureFile-Relative.cmake delete mode 100644 Tests/CMakeTests/ConfigureFileTest.cmake.in copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/BadArg-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/BadArg-stderr.txt rename Tests/{CMakeTests/ConfigureFile-BadArg.cmake => RunCMake/configure_file/BadArg.cmake} (100%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/DirInput-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/DirInput-stderr.txt rename Tests/{CMakeTests/ConfigureFile-DirInput.cmake => RunCMake/configure_file/DirInput.cmake} (100%) create mode 100644 Tests/RunCMake/configure_file/DirOutput-stderr.txt create mode 100644 Tests/RunCMake/configure_file/DirOutput.cmake create mode 100644 Tests/RunCMake/configure_file/DirOutput.txt copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/NewLineStyle-COPYONLY-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake => RunCMake/configure_file/NewLineStyle-COPYONLY.cmake} (58%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/NewLineStyle-NoArg-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake => RunCMake/configure_file/NewLineStyle-NoArg.cmake} (55%) rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake => RunCMake/configure_file/NewLineStyle-ValidArg.cmake} (85%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/NewLineStyle-WrongArg-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake => RunCMake/configure_file/NewLineStyle-WrongArg.cmake} (56%) create mode 100644 Tests/RunCMake/configure_file/Relative-In.txt create mode 100644 Tests/RunCMake/configure_file/Relative-stderr.txt create mode 100644 Tests/RunCMake/configure_file/Relative.cmake hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:12:29 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:12:29 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-385-g01fadeb Message-ID: <20150310131229.21FD7AAC86@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 01fadeb205317f7bd22b4762a03fcb7b32b2bc95 (commit) via a6b09085715d0d7f299e9ca76a4835ce5f5acfaf (commit) from fa4617b7ea00474053b3d0278f316db226322626 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=01fadeb205317f7bd22b4762a03fcb7b32b2bc95 commit 01fadeb205317f7bd22b4762a03fcb7b32b2bc95 Merge: fa4617b a6b0908 Author: Brad King AuthorDate: Tue Mar 10 09:12:27 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 09:12:27 2015 -0400 Merge topic 'ninja-check-root-robustly' a6b09085 Ninja: Improve internal check for generating at the top-level (#15436) ----------------------------------------------------------------------- Summary of changes: Source/cmLocalGenerator.h | 2 +- Source/cmLocalNinjaGenerator.cxx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:12:31 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:12:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-387-g976c3cc Message-ID: <20150310131231.30901AACBE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 976c3ccc6aa62d58a613fe3106c73fce134123e2 (commit) via 458c9e95dee1f6c5a6e5b537a544a8a7c8c56d10 (commit) from 01fadeb205317f7bd22b4762a03fcb7b32b2bc95 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=976c3ccc6aa62d58a613fe3106c73fce134123e2 commit 976c3ccc6aa62d58a613fe3106c73fce134123e2 Merge: 01fadeb 458c9e9 Author: Brad King AuthorDate: Tue Mar 10 09:12:30 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 09:12:30 2015 -0400 Merge topic 'UseSWIG-fix-CMP0054-warnings' 458c9e95 UseSWIG: Avoid if() auto-dereferene in quoted arguments ----------------------------------------------------------------------- Summary of changes: Modules/UseSWIG.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:12:33 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:12:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-389-gcce9671 Message-ID: <20150310131233.6178AAAC86@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via cce9671b4fea099c5109569108bca2dafe92a97e (commit) via 86032ae0ebb7e86f3ff5617e080dd827dbbe98b0 (commit) from 976c3ccc6aa62d58a613fe3106c73fce134123e2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cce9671b4fea099c5109569108bca2dafe92a97e commit cce9671b4fea099c5109569108bca2dafe92a97e Merge: 976c3cc 86032ae Author: Brad King AuthorDate: Tue Mar 10 09:12:32 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 09:12:32 2015 -0400 Merge topic 'ExternalProject-byproducts-tokens' 86032ae0 ExternalProject: Replace placeholder tokens in BYPRODUCTS ----------------------------------------------------------------------- Summary of changes: .../dev/ExternalProject-byproducts-tokens.rst | 5 +++++ Modules/ExternalProject.cmake | 6 +++--- Tests/CustomCommandByproducts/CMakeLists.txt | 21 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 Help/release/dev/ExternalProject-byproducts-tokens.rst hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:12:35 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:12:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-397-gad6fbb8 Message-ID: <20150310131235.ACFF1AAD94@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ad6fbb88bbeb4db17f0f060525c638f0b7b01a33 (commit) via 232a6883a1fe480def1743af6d711097b98b026e (commit) via 9e1689413fd1e54e8056b7d369cd508636987072 (commit) via b734fa44719a780683e2eb0dfaabd38d64daa3f6 (commit) via 0b945ea9a6a38d1b3ee27cc32afb4268bd571600 (commit) via 5c559f11137dcb14113a3c5df99ff896c65c7596 (commit) via e387ce7d681f9bd6c90c41f34b7500dfeb3b32ba (commit) via 4a0128f42feb7da9b6bebe0c2c3aa7a756b96822 (commit) from cce9671b4fea099c5109569108bca2dafe92a97e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad6fbb88bbeb4db17f0f060525c638f0b7b01a33 commit ad6fbb88bbeb4db17f0f060525c638f0b7b01a33 Merge: cce9671 232a688 Author: Brad King AuthorDate: Tue Mar 10 09:12:34 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 09:12:34 2015 -0400 Merge topic 'target-language-genex' 232a6883 Help: Add release notes for target-language-genex. 9e168941 File(GENERATE): Process genex evaluation files for each language. b734fa44 Genex: Allow COMPILE_LANGUAGE when processing include directories. 0b945ea9 Genex: Allow COMPILE_LANGUAGE when processing compile definitions. 5c559f11 Genex: Enable use of COMPILE_LANGUAGE for compile options. e387ce7d Genex: Add a COMPILE_LANGUAGE generator expression. 4a0128f4 VS6: Compute CMAKE_*_FLAGS and COMPILE_DEFINITIONS* only when needed ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 44 ++++++ Help/release/dev/target-language-genex.rst | 9 ++ Source/cmExtraCodeBlocksGenerator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 2 +- Source/cmGeneratorExpression.cxx | 10 +- Source/cmGeneratorExpression.h | 6 +- Source/cmGeneratorExpressionEvaluationFile.cxx | 51 +++++-- Source/cmGeneratorExpressionEvaluationFile.h | 2 +- Source/cmGeneratorExpressionEvaluator.cxx | 76 +++++++++- Source/cmGeneratorExpressionEvaluator.h | 1 + Source/cmGeneratorTarget.cxx | 5 +- Source/cmGeneratorTarget.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 12 +- Source/cmLocalGenerator.h | 3 +- Source/cmLocalUnixMakefileGenerator3.cxx | 50 +++++-- Source/cmLocalVisualStudio6Generator.cxx | 145 ++++++++++---------- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 36 +---- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmTarget.cxx | 52 ++++--- Source/cmTarget.h | 9 +- Source/cmVisualStudio10TargetGenerator.cxx | 3 +- .../target_compile_definitions/CMakeLists.txt | 15 ++ .../target_compile_definitions/consumer.c | 23 ++++ .../target_compile_definitions/consumer.cpp | 18 +++ .../target_compile_options/CMakeLists.txt | 15 ++ .../target_compile_options/consumer.c | 23 ++++ .../target_compile_options/consumer.cpp | 18 +++ .../target_include_directories/CMakeLists.txt | 14 ++ .../target_include_directories/c_only/c_only.h | 2 + .../target_include_directories/consumer.c | 10 ++ .../target_include_directories/consumer.cpp | 9 ++ .../target_include_directories/cxx_only/cxx_only.h | 2 + Tests/RunCMake/CMakeLists.txt | 2 + .../CMakeLists.txt | 0 .../CompileDefinitions-result.txt} | 0 .../CompileDefinitions-stderr-VS.txt | 8 ++ .../CompileDefinitions-stderr-Xcode.txt | 9 ++ .../CompileDefinitions.cmake | 5 + .../CompileOptions-result.txt} | 0 .../CompileOptions-stderr-VS.txt | 8 ++ .../COMPILE_LANGUAGE-genex/CompileOptions.cmake | 5 + .../IncludeDirectories-result.txt} | 0 .../IncludeDirectories-stderr-VS.txt | 8 ++ .../IncludeDirectories-stderr-Xcode.txt | 9 ++ .../IncludeDirectories.cmake | 5 + .../COMPILE_LANGUAGE-genex/RunCMakeTest.cmake | 20 +++ Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp | 5 + .../COMPILE_LANGUAGE-genex-result.txt} | 0 .../File_Generate/COMPILE_LANGUAGE-genex.cmake | 12 ++ .../File_Generate/OutputConflict-stderr.txt | 2 +- Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 10 ++ Tests/RunCMake/File_Generate/empty.c | 8 ++ ...COMPILE_LANGUAGE-add_custom_command-result.txt} | 0 .../COMPILE_LANGUAGE-add_custom_command-stderr.txt | 10 ++ .../COMPILE_LANGUAGE-add_custom_command.cmake | 8 ++ .../COMPILE_LANGUAGE-add_custom_target-result.txt} | 0 .../COMPILE_LANGUAGE-add_custom_target-stderr.txt | 10 ++ .../COMPILE_LANGUAGE-add_custom_target.cmake | 6 + .../COMPILE_LANGUAGE-add_executable-result.txt} | 0 .../COMPILE_LANGUAGE-add_executable-stderr.txt | 10 ++ .../COMPILE_LANGUAGE-add_executable.cmake | 4 + .../COMPILE_LANGUAGE-add_library-result.txt} | 0 .../COMPILE_LANGUAGE-add_library-stderr.txt | 10 ++ .../COMPILE_LANGUAGE-add_library.cmake | 4 + .../COMPILE_LANGUAGE-add_test-result.txt} | 0 .../COMPILE_LANGUAGE-add_test-stderr.txt | 10 ++ .../COMPILE_LANGUAGE-add_test.cmake | 5 + .../COMPILE_LANGUAGE-install-result.txt} | 0 .../COMPILE_LANGUAGE-install-stderr.txt | 8 ++ .../COMPILE_LANGUAGE-install.cmake | 5 + .../COMPILE_LANGUAGE-target_sources-result.txt} | 0 .../COMPILE_LANGUAGE-target_sources-stderr.txt | 10 ++ .../COMPILE_LANGUAGE-target_sources.cmake | 5 + .../COMPILE_LANGUAGE-unknown-lang-result.txt} | 0 .../COMPILE_LANGUAGE-unknown-lang-stderr.txt | 8 ++ .../COMPILE_LANGUAGE-unknown-lang.cmake | 4 + .../GeneratorExpression/RunCMakeTest.cmake | 8 ++ 80 files changed, 741 insertions(+), 177 deletions(-) create mode 100644 Help/release/dev/target-language-genex.rst create mode 100644 Tests/CMakeCommands/target_compile_definitions/consumer.c create mode 100644 Tests/CMakeCommands/target_compile_options/consumer.c create mode 100644 Tests/CMakeCommands/target_include_directories/c_only/c_only.h create mode 100644 Tests/CMakeCommands/target_include_directories/consumer.c create mode 100644 Tests/CMakeCommands/target_include_directories/cxx_only/cxx_only.h copy Tests/RunCMake/{CMP0055 => COMPILE_LANGUAGE-genex}/CMakeLists.txt (100%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => COMPILE_LANGUAGE-genex/CompileDefinitions-result.txt} (100%) create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => COMPILE_LANGUAGE-genex/CompileOptions-result.txt} (100%) create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt} (100%) create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => File_Generate/COMPILE_LANGUAGE-genex-result.txt} (100%) create mode 100644 Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake create mode 100644 Tests/RunCMake/File_Generate/empty.c copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_command.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_custom_target.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_executable-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_executable.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_library-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_library.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-add_test-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-add_test.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-install-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-install.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-target_sources-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-target_sources.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/COMPILE_LANGUAGE-unknown-lang.cmake hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:13:03 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:13:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-953-ge0481ff Message-ID: <20150310131303.26F28AADD0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e0481ff2308cef250fdc14448e7e75b86520e151 (commit) via ad6fbb88bbeb4db17f0f060525c638f0b7b01a33 (commit) via cce9671b4fea099c5109569108bca2dafe92a97e (commit) via 976c3ccc6aa62d58a613fe3106c73fce134123e2 (commit) via 01fadeb205317f7bd22b4762a03fcb7b32b2bc95 (commit) via fa4617b7ea00474053b3d0278f316db226322626 (commit) via a5505c4c53672a55f5e9e577ffb0ac3bd78c7847 (commit) from 973f819ee872c16a596d1dd1bb6cbf85e9065b81 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e0481ff2308cef250fdc14448e7e75b86520e151 commit e0481ff2308cef250fdc14448e7e75b86520e151 Merge: 973f819 ad6fbb8 Author: Brad King AuthorDate: Tue Mar 10 09:12:53 2015 -0400 Commit: Brad King CommitDate: Tue Mar 10 09:12:53 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:14:18 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:14:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-402-gc4ffc1b Message-ID: <20150310131418.EA531AAEA0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c4ffc1b8c78b3733518442c462beb8453bb2085c (commit) via 0fe4cce22f440f0e666c9691bc6e03d34380ae4f (commit) via 244e3d0fc97433a9e75a82a64f98ea25ab11d3bb (commit) via 77f3804ab2c10228b55ce8f5d255ba5bef1537c1 (commit) via cc1ee21383c0eb18620a2bcb028c1ebc56e8fd12 (commit) from ad6fbb88bbeb4db17f0f060525c638f0b7b01a33 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:14:19 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:14:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-959-gd18646f Message-ID: <20150310131419.134D3AAEA1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d18646ff86b3983e7b98713a6f703e4755c01cb6 (commit) via c4ffc1b8c78b3733518442c462beb8453bb2085c (commit) via 0fe4cce22f440f0e666c9691bc6e03d34380ae4f (commit) via 244e3d0fc97433a9e75a82a64f98ea25ab11d3bb (commit) via 77f3804ab2c10228b55ce8f5d255ba5bef1537c1 (commit) via cc1ee21383c0eb18620a2bcb028c1ebc56e8fd12 (commit) from e0481ff2308cef250fdc14448e7e75b86520e151 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d18646ff86b3983e7b98713a6f703e4755c01cb6 commit d18646ff86b3983e7b98713a6f703e4755c01cb6 Merge: e0481ff c4ffc1b Author: Brad King AuthorDate: Tue Mar 10 09:13:56 2015 -0400 Commit: Brad King CommitDate: Tue Mar 10 09:13:56 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:14:19 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:14:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.2.0-9-g0fe4cce Message-ID: <20150310131419.77E3FAAEBF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 0fe4cce22f440f0e666c9691bc6e03d34380ae4f (commit) via 458c9e95dee1f6c5a6e5b537a544a8a7c8c56d10 (commit) via 244e3d0fc97433a9e75a82a64f98ea25ab11d3bb (commit) via a6b09085715d0d7f299e9ca76a4835ce5f5acfaf (commit) via 77f3804ab2c10228b55ce8f5d255ba5bef1537c1 (commit) via 024e25e485f8d1dbca40521fbc0bcd61e383f413 (commit) via 3ef776fc38fecff332e568f307dcf4e6f82fbe14 (commit) via cc1ee21383c0eb18620a2bcb028c1ebc56e8fd12 (commit) via 66a9c90c4bb5bf93bd570a423f99486b24b9337d (commit) from a49a467fd02dded8e8976008082659054484b8fe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/UseSWIG.cmake | 8 +- Source/cmConfigureFileCommand.cxx | 7 ++ Source/cmGlobalBorlandMakefileGenerator.cxx | 1 - Source/cmLocalGenerator.h | 2 +- Source/cmLocalNinjaGenerator.cxx | 3 +- Source/cmLocalUnixMakefileGenerator3.cxx | 56 +------------- Source/cmLocalUnixMakefileGenerator3.h | 11 --- Source/cmMakefileLibraryTargetGenerator.cxx | 5 +- Source/cmMakefileTargetGenerator.cxx | 79 ++++++++++++++++++-- Source/cmMakefileTargetGenerator.h | 10 +++ Tests/CMakeTests/CMakeLists.txt | 1 - Tests/CMakeTests/ConfigureFile-DirOutput.cmake | 5 -- Tests/CMakeTests/ConfigureFile-Relative.cmake | 4 - Tests/CMakeTests/ConfigureFileTest.cmake.in | 28 ------- .../BadArg-result.txt} | 0 Tests/RunCMake/configure_file/BadArg-stderr.txt | 4 + .../configure_file/BadArg.cmake} | 0 .../DirInput-result.txt} | 0 Tests/RunCMake/configure_file/DirInput-stderr.txt | 8 ++ .../configure_file/DirInput.cmake} | 0 Tests/RunCMake/configure_file/DirOutput-stderr.txt | 1 + Tests/RunCMake/configure_file/DirOutput.cmake | 4 + Tests/RunCMake/configure_file/DirOutput.txt | 1 + .../NewLineStyle-COPYONLY-result.txt} | 0 .../NewLineStyle-COPYONLY-stderr.txt | 4 + .../configure_file/NewLineStyle-COPYONLY.cmake} | 2 +- .../NewLineStyle-NoArg-result.txt} | 0 .../configure_file/NewLineStyle-NoArg-stderr.txt | 5 ++ .../configure_file/NewLineStyle-NoArg.cmake} | 2 +- .../configure_file/NewLineStyle-ValidArg.cmake} | 2 +- .../NewLineStyle-WrongArg-result.txt} | 0 .../NewLineStyle-WrongArg-stderr.txt | 5 ++ .../configure_file/NewLineStyle-WrongArg.cmake} | 2 +- Tests/RunCMake/configure_file/Relative-In.txt | 1 + Tests/RunCMake/configure_file/Relative-stderr.txt | 1 + Tests/RunCMake/configure_file/Relative.cmake | 3 + Tests/RunCMake/configure_file/RunCMakeTest.cmake | 8 ++ 37 files changed, 150 insertions(+), 123 deletions(-) delete mode 100644 Tests/CMakeTests/ConfigureFile-DirOutput.cmake delete mode 100644 Tests/CMakeTests/ConfigureFile-Relative.cmake delete mode 100644 Tests/CMakeTests/ConfigureFileTest.cmake.in copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/BadArg-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/BadArg-stderr.txt rename Tests/{CMakeTests/ConfigureFile-BadArg.cmake => RunCMake/configure_file/BadArg.cmake} (100%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/DirInput-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/DirInput-stderr.txt rename Tests/{CMakeTests/ConfigureFile-DirInput.cmake => RunCMake/configure_file/DirInput.cmake} (100%) create mode 100644 Tests/RunCMake/configure_file/DirOutput-stderr.txt create mode 100644 Tests/RunCMake/configure_file/DirOutput.cmake create mode 100644 Tests/RunCMake/configure_file/DirOutput.txt copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/NewLineStyle-COPYONLY-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/NewLineStyle-COPYONLY-stderr.txt rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake => RunCMake/configure_file/NewLineStyle-COPYONLY.cmake} (58%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/NewLineStyle-NoArg-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/NewLineStyle-NoArg-stderr.txt rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake => RunCMake/configure_file/NewLineStyle-NoArg.cmake} (55%) rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake => RunCMake/configure_file/NewLineStyle-ValidArg.cmake} (85%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => configure_file/NewLineStyle-WrongArg-result.txt} (100%) create mode 100644 Tests/RunCMake/configure_file/NewLineStyle-WrongArg-stderr.txt rename Tests/{CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake => RunCMake/configure_file/NewLineStyle-WrongArg.cmake} (56%) create mode 100644 Tests/RunCMake/configure_file/Relative-In.txt create mode 100644 Tests/RunCMake/configure_file/Relative-stderr.txt create mode 100644 Tests/RunCMake/configure_file/Relative.cmake hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 09:20:09 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 09:20:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-962-g210bb6b Message-ID: <20150310132009.A00AEAB18D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 210bb6b7a999c1ab0d898e4af64fbd217dbfbdb8 (commit) via 4c5f8244fb2563381f5abf9d7513639dbdaaa73f (commit) via 732d8a467ab8a295b1bbf580f865980f8a1a9b29 (commit) from d18646ff86b3983e7b98713a6f703e4755c01cb6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=210bb6b7a999c1ab0d898e4af64fbd217dbfbdb8 commit 210bb6b7a999c1ab0d898e4af64fbd217dbfbdb8 Merge: d18646f 4c5f824 Author: Brad King AuthorDate: Tue Mar 10 09:20:08 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 09:20:08 2015 -0400 Merge topic 'test-release' into next 4c5f8244 Merge branch 'release' into test-release 732d8a46 CMake 3.2.1 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c5f8244fb2563381f5abf9d7513639dbdaaa73f commit 4c5f8244fb2563381f5abf9d7513639dbdaaa73f Merge: c4ffc1b 732d8a4 Author: Brad King AuthorDate: Tue Mar 10 09:19:50 2015 -0400 Commit: Brad King CommitDate: Tue Mar 10 09:19:50 2015 -0400 Merge branch 'release' into test-release http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=732d8a467ab8a295b1bbf580f865980f8a1a9b29 commit 732d8a467ab8a295b1bbf580f865980f8a1a9b29 Author: Brad King AuthorDate: Tue Mar 10 09:15:35 2015 -0400 Commit: Brad King CommitDate: Tue Mar 10 09:15:35 2015 -0400 CMake 3.2.1 diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 006e65a..8e7ccd1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 0) +set(CMake_VERSION_PATCH 1) #set(CMake_VERSION_RC 0) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 14:27:25 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 14:27:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-404-g1a8e4c8 Message-ID: <20150310182725.CC207AB56F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 1a8e4c86921e8b018be950924dc54c532134feb5 (commit) via 732d8a467ab8a295b1bbf580f865980f8a1a9b29 (commit) from c4ffc1b8c78b3733518442c462beb8453bb2085c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 14:27:25 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 14:27:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-964-g5efa12d Message-ID: <20150310182725.E80D1AB570@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5efa12d728240c156b4ee9463a6dc18690cafb1b (commit) via 1a8e4c86921e8b018be950924dc54c532134feb5 (commit) from 210bb6b7a999c1ab0d898e4af64fbd217dbfbdb8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5efa12d728240c156b4ee9463a6dc18690cafb1b commit 5efa12d728240c156b4ee9463a6dc18690cafb1b Merge: 210bb6b 1a8e4c8 Author: Brad King AuthorDate: Tue Mar 10 14:27:00 2015 -0400 Commit: Brad King CommitDate: Tue Mar 10 14:27:00 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 14:27:26 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 14:27:26 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.2.0-10-g732d8a4 Message-ID: <20150310182726.0762BAB572@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, release has been updated via 732d8a467ab8a295b1bbf580f865980f8a1a9b29 (commit) from 0fe4cce22f440f0e666c9691bc6e03d34380ae4f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 10 14:50:43 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 10 Mar 2015 14:50:43 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-966-g737eb5c Message-ID: <20150310185043.7B60DAB5DB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 737eb5caab017e16ae73d9ce53ab566bda04e891 (commit) via 77534e84b27701e371ccee780be5acffe7cced59 (commit) from 5efa12d728240c156b4ee9463a6dc18690cafb1b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=737eb5caab017e16ae73d9ce53ab566bda04e891 commit 737eb5caab017e16ae73d9ce53ab566bda04e891 Merge: 5efa12d 77534e8 Author: Brad King AuthorDate: Tue Mar 10 14:50:42 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 14:50:42 2015 -0400 Merge topic 'allow-no-language-standard' into next 77534e84 Add options to build CMake without any language dialects http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77534e84b27701e371ccee780be5acffe7cced59 commit 77534e84b27701e371ccee780be5acffe7cced59 Author: Brad King AuthorDate: Tue Mar 10 14:49:40 2015 -0400 Commit: Brad King CommitDate: Tue Mar 10 14:49:40 2015 -0400 Add options to build CMake without any language dialects If CMake_NO__STANDARD is set, do not set CMAKE__STANDARD. This will allow users to build with their own -std= flags without CMake adding any itself. diff --git a/CMakeLists.txt b/CMakeLists.txt index 1250a94..d86ae96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,10 +37,10 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") endif() # Use most-recent available language dialects with GNU and Clang -if(NOT DEFINED CMAKE_C_STANDARD) +if(NOT DEFINED CMAKE_C_STANDARD AND NOT CMake_NO_C_STANDARD) set(CMAKE_C_STANDARD 11) endif() -if(NOT DEFINED CMAKE_CXX_STANDARD) +if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From steveire at gmail.com Tue Mar 10 16:25:33 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 10 Mar 2015 16:25:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-968-g1d054bf Message-ID: <20150310202533.AF5CEAB5BE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1d054bf65c67edf290109335872943ebcf30cade (commit) via 3ff95f3b0b1eed95aa6e4d6baa59c68a047072ea (commit) from 737eb5caab017e16ae73d9ce53ab566bda04e891 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d054bf65c67edf290109335872943ebcf30cade commit 1d054bf65c67edf290109335872943ebcf30cade Merge: 737eb5c 3ff95f3 Author: Stephen Kelly AuthorDate: Tue Mar 10 16:25:33 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 16:25:33 2015 -0400 Merge topic 'cmAlgorithms-early-return' into next 3ff95f3b cmAlgorithms: Add early return in cmRemoveIndices. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3ff95f3b0b1eed95aa6e4d6baa59c68a047072ea commit 3ff95f3b0b1eed95aa6e4d6baa59c68a047072ea Author: Stephen Kelly AuthorDate: Thu Mar 5 23:14:27 2015 +0100 Commit: Stephen Kelly CommitDate: Tue Mar 10 21:20:58 2015 +0100 cmAlgorithms: Add early return in cmRemoveIndices. Avoid derefencing the iterator and segfaulting if the range is empty. diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index b9d7e78..be57da3 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -237,6 +237,11 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) { typename InputRange::const_iterator remIt = rem.begin(); typename InputRange::const_iterator remEnd = rem.end(); + const typename Range::iterator rangeEnd = r.end(); + if (remIt == remEnd) + { + return rangeEnd; + } typename Range::iterator writer = r.begin(); std::advance(writer, *remIt); @@ -244,7 +249,6 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) typename InputRange::value_type prevRem = *remIt; ++remIt; size_t count = 1; - const typename Range::iterator rangeEnd = r.end(); for ( ; writer != rangeEnd && remIt != remEnd; ++count, ++remIt) { std::advance(pivot, *remIt - prevRem); ----------------------------------------------------------------------- Summary of changes: Source/cmAlgorithms.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From steveire at gmail.com Tue Mar 10 16:28:39 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 10 Mar 2015 16:28:39 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-974-gd88859d Message-ID: <20150310202839.452B1AB998@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d88859dfcdc4e4dd1e00a854bb4115d7b230a72a (commit) via 661750987f93018056665223f347141ae8dc5555 (commit) via 74500a2cf0368e3075762cbaee97e8186d46786c (commit) via 40c80f35e93101996d20fc10d3ebc14eaf6b660f (commit) via 80b9f0cbe263c64613acd18e4e94505924fce40e (commit) via 642048ce356304155bf67b85deeacb9d030c3300 (commit) from 1d054bf65c67edf290109335872943ebcf30cade (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d88859dfcdc4e4dd1e00a854bb4115d7b230a72a commit d88859dfcdc4e4dd1e00a854bb4115d7b230a72a Merge: 1d054bf 6617509 Author: Stephen Kelly AuthorDate: Tue Mar 10 16:28:37 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 16:28:37 2015 -0400 Merge topic 'refactor-cmGeneratorExpression' into next 66175098 Genex: Extend cmGeneratorExpressionContext constructor. 74500a2c Genex: Split cmGeneratorExpressionContext into own file. 40c80f35 Genex: Split cmGeneratorExpressionNode into own file. 80b9f0cb Genex: Extract an evaluateWithContext method. 642048ce Help: Move docs of $<0:...> and $<1:...> to output section. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=661750987f93018056665223f347141ae8dc5555 commit 661750987f93018056665223f347141ae8dc5555 Author: Stephen Kelly AuthorDate: Sun Feb 22 21:41:06 2015 +0100 Commit: Stephen Kelly CommitDate: Tue Mar 10 21:19:38 2015 +0100 Genex: Extend cmGeneratorExpressionContext constructor. Initialize the members in the appropriate place. diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index a4990dc..2d795cb 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -72,19 +72,10 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmGeneratorExpressionDAGChecker *dagChecker, std::string const& language) const { - cmGeneratorExpressionContext context; - context.Makefile = mf; - context.Config = config; - context.Quiet = quiet; - context.HadError = false; - context.HadContextSensitiveCondition = false; - context.HadHeadSensitiveCondition = false; - context.SourceSensitiveTargets.clear(); - context.HeadTarget = headTarget; - context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; - context.CurrentTarget = currentTarget ? currentTarget : headTarget; - context.Backtrace = this->Backtrace; - context.Language = language; + cmGeneratorExpressionContext context(mf, config, quiet, headTarget, + currentTarget ? currentTarget : headTarget, + this->EvaluateForBuildsystem, + this->Backtrace, language); return this->EvaluateWithContext(context, dagChecker); } diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx index 4ed8ff2..947015e 100644 --- a/Source/cmGeneratorExpressionContext.cxx +++ b/Source/cmGeneratorExpressionContext.cxx @@ -12,7 +12,23 @@ #include "cmGeneratorExpressionContext.h" -cmGeneratorExpressionContext::cmGeneratorExpressionContext(); - : Backtrace(NULL) +cmGeneratorExpressionContext::cmGeneratorExpressionContext( + cmMakefile* mf, std::string const& config, + bool quiet, cmTarget const* headTarget, + cmTarget const* currentTarget, + bool evaluateForBuildsystem, + cmListFileBacktrace const& backtrace, + std::string const& language) + : Backtrace(backtrace), + Makefile(mf), + Config(config), + Language(language), + HeadTarget(headTarget), + CurrentTarget(currentTarget), + Quiet(quiet), + HadError(false), + HadContextSensitiveCondition(false), + HadHeadSensitiveCondition(false), + EvaluateForBuildsystem(evaluateForBuildsystem) { } diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h index ce6f376..ed83509 100644 --- a/Source/cmGeneratorExpressionContext.h +++ b/Source/cmGeneratorExpressionContext.h @@ -23,7 +23,13 @@ class cmTarget; //---------------------------------------------------------------------------- struct cmGeneratorExpressionContext { - cmGeneratorExpressionContext(); + cmGeneratorExpressionContext(cmMakefile* mf, std::string const& config, + bool quiet, cmTarget const* headTarget, + cmTarget const* currentTarget, + bool evaluateForBuildsystem, + cmListFileBacktrace const& backtrace, + std::string const& language); + cmListFileBacktrace Backtrace; std::set DependTargets; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=74500a2cf0368e3075762cbaee97e8186d46786c commit 74500a2cf0368e3075762cbaee97e8186d46786c Author: Stephen Kelly AuthorDate: Wed Mar 4 23:53:22 2015 +0100 Commit: Stephen Kelly CommitDate: Tue Mar 10 21:19:38 2015 +0100 Genex: Split cmGeneratorExpressionContext into own file. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8d0d484..482bd39 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -238,6 +238,8 @@ set(SRCS cmFileTimeComparison.cxx cmFileTimeComparison.h cmGeneratedFileStream.cxx + cmGeneratorExpressionContext.cxx + cmGeneratorExpressionContext.h cmGeneratorExpressionDAGChecker.cxx cmGeneratorExpressionDAGChecker.h cmGeneratorExpressionEvaluator.cxx diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx new file mode 100644 index 0000000..4ed8ff2 --- /dev/null +++ b/Source/cmGeneratorExpressionContext.cxx @@ -0,0 +1,18 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmGeneratorExpressionContext.h" + +cmGeneratorExpressionContext::cmGeneratorExpressionContext(); + : Backtrace(NULL) +{ +} diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h new file mode 100644 index 0000000..ce6f376 --- /dev/null +++ b/Source/cmGeneratorExpressionContext.h @@ -0,0 +1,48 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionContext_h +#define cmGeneratorExpressionContext_h + +#include "cmListFileCache.h" + +#include +#include +#include + +class cmTarget; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionContext +{ + cmGeneratorExpressionContext(); + + cmListFileBacktrace Backtrace; + std::set DependTargets; + std::set AllTargets; + std::set SeenTargetProperties; + std::set SourceSensitiveTargets; + std::map > + MaxLanguageStandard; + cmMakefile *Makefile; + std::string Config; + std::string Language; + cmTarget const* HeadTarget; // The target whose property is being evaluated. + cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears + // directly or indirectly in the property. + bool Quiet; + bool HadError; + bool HadContextSensitiveCondition; + bool HadHeadSensitiveCondition; + bool EvaluateForBuildsystem; +}; + +#endif diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index b1fec0b..7c1bd8c 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -16,37 +16,10 @@ #include #include "cmListFileCache.h" +#include "cmGeneratorExpressionContext.h" class cmTarget; -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionContext -{ - cmGeneratorExpressionContext() - : Backtrace(NULL) - { - } - - cmListFileBacktrace Backtrace; - std::set DependTargets; - std::set AllTargets; - std::set SeenTargetProperties; - std::set SourceSensitiveTargets; - std::map > - MaxLanguageStandard; - cmMakefile *Makefile; - std::string Config; - std::string Language; - cmTarget const* HeadTarget; // The target whose property is being evaluated. - cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears - // directly or indirectly in the property. - bool Quiet; - bool HadError; - bool HadContextSensitiveCondition; - bool HadHeadSensitiveCondition; - bool EvaluateForBuildsystem; -}; - struct cmGeneratorExpressionDAGChecker; struct cmGeneratorExpressionNode; diff --git a/bootstrap b/bootstrap index 6bc87ed..4239802 100755 --- a/bootstrap +++ b/bootstrap @@ -267,6 +267,7 @@ CMAKE_CXX_SOURCES="\ cmInstallDirectoryGenerator \ cmGeneratedFileStream \ cmGeneratorTarget \ + cmGeneratorExpressionContext \ cmGeneratorExpressionDAGChecker \ cmGeneratorExpressionEvaluator \ cmGeneratorExpressionLexer \ http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=40c80f35e93101996d20fc10d3ebc14eaf6b660f commit 40c80f35e93101996d20fc10d3ebc14eaf6b660f Author: Stephen Kelly AuthorDate: Sun Feb 22 23:32:11 2015 +0100 Commit: Stephen Kelly CommitDate: Tue Mar 10 21:19:38 2015 +0100 Genex: Split cmGeneratorExpressionNode into own file. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 5b518b8..8d0d484 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -244,6 +244,8 @@ set(SRCS cmGeneratorExpressionEvaluator.h cmGeneratorExpressionLexer.cxx cmGeneratorExpressionLexer.h + cmGeneratorExpressionNode.cxx + cmGeneratorExpressionNode.h cmGeneratorExpressionParser.cxx cmGeneratorExpressionParser.h cmGeneratorExpression.cxx diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 756d932..f2ffeef 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -24,1894 +24,7 @@ #include #include -//---------------------------------------------------------------------------- -static void reportError(cmGeneratorExpressionContext *context, - const std::string &expr, const std::string &result) -{ - context->HadError = true; - if (context->Quiet) - { - return; - } - - std::ostringstream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); -} - -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionNode -{ - enum { - DynamicParameters = 0, - OneOrMoreParameters = -1, - OneOrZeroParameters = -2 - }; - virtual ~cmGeneratorExpressionNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool RequiresLiteralInput() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const - { return false; } - - virtual int NumExpectedParameters() const { return 1; } - - virtual std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker - ) const = 0; - - static std::string EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker); -}; - -//---------------------------------------------------------------------------- -std::string cmGeneratorExpressionNode::EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker) -{ - cmGeneratorExpression ge(&context->Backtrace); - cmsys::auto_ptr cge = ge.Parse(prop); - cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); - std::string result = cge->Evaluate(makefile, - context->Config, - context->Quiet, - headTarget, - currentTarget, - dagChecker, - context->Language); - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } - if (cge->GetHadHeadSensitiveCondition()) - { - context->HadHeadSensitiveCondition = true; - } - return result; -} - -//---------------------------------------------------------------------------- -static const struct ZeroNode : public cmGeneratorExpressionNode -{ - ZeroNode() {} - - virtual bool GeneratesContent() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return std::string(); - } -} zeroNode; - -//---------------------------------------------------------------------------- -static const struct OneNode : public cmGeneratorExpressionNode -{ - OneNode() {} - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } -} oneNode; - -//---------------------------------------------------------------------------- -static const struct OneNode buildInterfaceNode; - -//---------------------------------------------------------------------------- -static const struct ZeroNode installInterfaceNode; - -//---------------------------------------------------------------------------- -#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ -static const struct OP ## Node : public cmGeneratorExpressionNode \ -{ \ - OP ## Node () {} \ - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \ - \ - std::string Evaluate(const std::vector ¶meters, \ - cmGeneratorExpressionContext *context, \ - const GeneratorExpressionContent *content, \ - cmGeneratorExpressionDAGChecker *) const \ - { \ - std::vector::const_iterator it = parameters.begin(); \ - const std::vector::const_iterator end = parameters.end(); \ - for ( ; it != end; ++it) \ - { \ - if (*it == #FAILURE_VALUE) \ - { \ - return #FAILURE_VALUE; \ - } \ - else if (*it != #SUCCESS_VALUE) \ - { \ - reportError(context, content->GetOriginalExpression(), \ - "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ - return std::string(); \ - } \ - } \ - return #SUCCESS_VALUE; \ - } \ -} OPNAME; - -BOOLEAN_OP_NODE(andNode, AND, 1, 0) -BOOLEAN_OP_NODE(orNode, OR, 0, 1) - -#undef BOOLEAN_OP_NODE - -//---------------------------------------------------------------------------- -static const struct NotNode : public cmGeneratorExpressionNode -{ - NotNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (*parameters.begin() != "0" && *parameters.begin() != "1") - { - reportError(context, content->GetOriginalExpression(), - "$ parameter must resolve to exactly one '0' or '1' value."); - return std::string(); - } - return *parameters.begin() == "0" ? "1" : "0"; - } -} notNode; - -//---------------------------------------------------------------------------- -static const struct BoolNode : public cmGeneratorExpressionNode -{ - BoolNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; - } -} boolNode; - -//---------------------------------------------------------------------------- -static const struct StrEqualNode : public cmGeneratorExpressionNode -{ - StrEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return *parameters.begin() == parameters[1] ? "1" : "0"; - } -} strEqualNode; - -//---------------------------------------------------------------------------- -static const struct EqualNode : public cmGeneratorExpressionNode -{ - EqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - char *pEnd; - - int base = 0; - bool flipSign = false; - - const char *lhs = parameters[0].c_str(); - if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B")) - { - base = 2; - lhs += 2; - } - if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B")) - { - base = 2; - lhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B")) - { - base = 2; - lhs += 3; - } - - long lnum = strtol(lhs, &pEnd, base); - if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[0] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - lnum = -lnum; - } - - base = 0; - flipSign = false; - - const char *rhs = parameters[1].c_str(); - if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B")) - { - base = 2; - rhs += 2; - } - if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B")) - { - base = 2; - rhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B")) - { - base = 2; - rhs += 3; - } - - long rnum = strtol(rhs, &pEnd, base); - if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[1] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - rnum = -rnum; - } - - return lnum == rnum ? "1" : "0"; - } -} equalNode; - -//---------------------------------------------------------------------------- -static const struct LowerCaseNode : public cmGeneratorExpressionNode -{ - LowerCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::LowerCase(parameters.front()); - } -} lowerCaseNode; - -//---------------------------------------------------------------------------- -static const struct UpperCaseNode : public cmGeneratorExpressionNode -{ - UpperCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::UpperCase(parameters.front()); - } -} upperCaseNode; - -//---------------------------------------------------------------------------- -static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode -{ - MakeCIdentifierNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::MakeCidentifier(parameters.front()); - } -} makeCIdentifierNode; - -//---------------------------------------------------------------------------- -static const struct Angle_RNode : public cmGeneratorExpressionNode -{ - Angle_RNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ">"; - } -} angle_rNode; - -//---------------------------------------------------------------------------- -static const struct CommaNode : public cmGeneratorExpressionNode -{ - CommaNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ","; - } -} commaNode; - -//---------------------------------------------------------------------------- -static const struct SemicolonNode : public cmGeneratorExpressionNode -{ - SemicolonNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ";"; - } -} semicolonNode; - -//---------------------------------------------------------------------------- -struct CompilerIdNode : public cmGeneratorExpressionNode -{ - CompilerIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerId = - context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID"); - if (parameters.empty()) - { - return compilerId ? compilerId : ""; - } - static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), compilerId) == 0) - { - return "1"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) - { - switch(context->Makefile->GetPolicyStatus(cmPolicies::CMP0044)) - { - case cmPolicies::WARN: - { - std::ostringstream e; - e << context->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0044); - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::AUTHOR_WARNING, - e.str(), context->Backtrace); - } - case cmPolicies::OLD: - return "1"; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; - } - } - return "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerIdNode : public CompilerIdNode -{ - CCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerIdNode; - -//---------------------------------------------------------------------------- -static const struct CXXCompilerIdNode : public CompilerIdNode -{ - CXXCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerIdNode; - -//---------------------------------------------------------------------------- -struct CompilerVersionNode : public cmGeneratorExpressionNode -{ - CompilerVersionNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerVersion = context->Makefile->GetSafeDefinition( - "CMAKE_" + lang + "_COMPILER_VERSION"); - if (parameters.empty()) - { - return compilerVersion ? compilerVersion : ""; - } - - static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerVersion) - { - return parameters.front().empty() ? "1" : "0"; - } - - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.begin()->c_str(), - compilerVersion) ? "1" : "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerVersionNode : public CompilerVersionNode -{ - CCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerVersionNode; - -//---------------------------------------------------------------------------- -static const struct CxxCompilerVersionNode : public CompilerVersionNode -{ - CxxCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerVersionNode; - - -//---------------------------------------------------------------------------- -struct PlatformIdNode : public cmGeneratorExpressionNode -{ - PlatformIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - const char *platformId = - context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); - if (parameters.empty()) - { - return platformId ? platformId : ""; - } - - if (!platformId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), platformId) == 0) - { - return "1"; - } - return "0"; - } -} platformIdNode; - -//---------------------------------------------------------------------------- -static const struct VersionGreaterNode : public cmGeneratorExpressionNode -{ - VersionGreaterNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionGreaterNode; - -//---------------------------------------------------------------------------- -static const struct VersionLessNode : public cmGeneratorExpressionNode -{ - VersionLessNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionLessNode; - -//---------------------------------------------------------------------------- -static const struct VersionEqualNode : public cmGeneratorExpressionNode -{ - VersionEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionEqualNode; - -//---------------------------------------------------------------------------- -static const struct LinkOnlyNode : public cmGeneratorExpressionNode -{ - LinkOnlyNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(!dagChecker->GetTransitivePropertiesOnly()) - { - return parameters.front(); - } - return ""; - } -} linkOnlyNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationNode : public cmGeneratorExpressionNode -{ - ConfigurationNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - context->HadContextSensitiveCondition = true; - return context->Config; - } -} configurationNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationTestNode : public cmGeneratorExpressionNode -{ - ConfigurationTestNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (parameters.empty()) - { - return configurationNode.Evaluate(parameters, context, content, 0); - } - static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$"); - if (!configValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - context->HadContextSensitiveCondition = true; - if (context->Config.empty()) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), - context->Config.c_str()) == 0) - { - return "1"; - } - - if (context->CurrentTarget - && context->CurrentTarget->IsImported()) - { - const char* loc = 0; - const char* imp = 0; - std::string suffix; - if (context->CurrentTarget->GetMappedConfig(context->Config, - &loc, - &imp, - suffix)) - { - // This imported target has an appropriate location - // for this (possibly mapped) config. - // Check if there is a proper config mapping for the tested config. - std::vector mappedConfigs; - std::string mapProp = "MAP_IMPORTED_CONFIG_"; - mapProp += cmSystemTools::UpperCase(context->Config); - if(const char* mapValue = - context->CurrentTarget->GetProperty(mapProp)) - { - cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), - mappedConfigs); - return std::find(mappedConfigs.begin(), mappedConfigs.end(), - cmSystemTools::UpperCase(parameters.front())) - != mappedConfigs.end() ? "1" : "0"; - } - } - } - return "0"; - } -} configurationTestNode; - -static const struct JoinNode : public cmGeneratorExpressionNode -{ - JoinNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - std::vector list; - cmSystemTools::ExpandListArgument(parameters.front(), list); - return cmJoin(list, parameters[1]); - } -} joinNode; - -static const struct CompileLanguageNode : public cmGeneratorExpressionNode -{ - CompileLanguageNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(context->Language.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used to specify include " - "directories compile definitions, compile options and to evaluate " - "components of the file(GENERATE) command."); - return std::string(); - } - - std::vector enabledLanguages; - cmGlobalGenerator* gg - = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->GetEnabledLanguages(enabledLanguages); - if (!parameters.empty() && - std::find(enabledLanguages.begin(), enabledLanguages.end(), - parameters.front()) == enabledLanguages.end()) - { - reportError(context, content->GetOriginalExpression(), - "$ Unknown language."); - return std::string(); - } - - std::string genName = gg->GetName(); - if (genName.find("Visual Studio") != std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ may not be used with Visual Studio " - "generators."); - return std::string(); - } - else if (genName.find("Xcode") != std::string::npos) - { - if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() - || dagChecker->EvaluatingIncludeDirectories())) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with COMPILE_OPTIONS " - "with the Xcode generator."); - return std::string(); - } - } - else - { - if(genName.find("Makefiles") == std::string::npos && - genName.find("Ninja") == std::string::npos && - genName.find("Watcom WMake") == std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ not supported for this generator."); - return std::string(); - } - } - if (parameters.empty()) - { - return context->Language; - } - return context->Language == parameters.front() ? "1" : "0"; - } -} languageNode; - -#define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ - , "INTERFACE_" #PROPERTY - -//---------------------------------------------------------------------------- -static const char* targetPropertyTransitiveWhitelist[] = { - 0 - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME) -}; - -#undef TRANSITIVE_PROPERTY_NAME - -template -std::string -getLinkedTargetsContent( - std::vector const &libraries, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) -{ - std::string linkedTargetsContent; - std::string sep; - std::string depString; - for (typename std::vector::const_iterator it = libraries.begin(); - it != libraries.end(); ++it) - { - // Broken code can have a target in its own link interface. - // Don't follow such link interface entries so as not to create a - // self-referencing loop. - if (it->Target && it->Target != target) - { - depString += - sep + "$Target->GetName() + "," + interfacePropertyName + ">"; - sep = ";"; - } - } - if(!depString.empty()) - { - linkedTargetsContent = - cmGeneratorExpressionNode::EvaluateDependentExpression(depString, - target->GetMakefile(), context, - headTarget, target, dagChecker); - } - linkedTargetsContent = - cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); - return linkedTargetsContent; -} - -//---------------------------------------------------------------------------- -static const struct TargetPropertyNode : public cmGeneratorExpressionNode -{ - TargetPropertyNode() {} - - // This node handles errors on parameter count itself. - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagCheckerParent - ) const - { - if (parameters.size() != 1 && parameters.size() != 2) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires one or two parameters"); - return std::string(); - } - static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); - - cmTarget const* target = context->HeadTarget; - std::string propertyName = *parameters.begin(); - - if (parameters.size() == 1) - { - context->HadHeadSensitiveCondition = true; - } - if (!target && parameters.size() == 1) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. " - "It may not be used with add_custom_command or add_custom_target. " - "Specify the target to read a property from using the " - "$ signature instead."); - return std::string(); - } - - if (parameters.size() == 2) - { - if (parameters.begin()->empty() && parameters[1].empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name and property name."); - return std::string(); - } - if (parameters.begin()->empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name."); - return std::string(); - } - - std::string targetName = parameters.front(); - propertyName = parameters[1]; - if (!cmGeneratorExpression::IsValidTargetName(targetName)) - { - if (!propertyNameValidator.find(propertyName.c_str())) - { - ::reportError(context, content->GetOriginalExpression(), - "Target name and property name not supported."); - return std::string(); - } - ::reportError(context, content->GetOriginalExpression(), - "Target name not supported."); - return std::string(); - } - if(propertyName == "ALIASED_TARGET") - { - if(context->Makefile->IsAlias(targetName)) - { - if(cmTarget* tgt = context->Makefile->FindTargetToUse(targetName)) - { - return tgt->GetName(); - } - } - return ""; - } - target = context->Makefile->FindTargetToUse(targetName); - - if (!target) - { - std::ostringstream e; - e << "Target \"" - << targetName - << "\" not found."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - context->AllTargets.insert(target); - } - - if (target == context->HeadTarget) - { - // Keep track of the properties seen while processing. - // The evaluation of the LINK_LIBRARIES generator expressions - // will check this to ensure that properties have one consistent - // value for all evaluations. - context->SeenTargetProperties.insert(propertyName); - } - if (propertyName == "SOURCES") - { - context->SourceSensitiveTargets.insert(target); - } - - if (propertyName.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty property " - "name."); - return std::string(); - } - - if (!propertyNameValidator.find(propertyName)) - { - ::reportError(context, content->GetOriginalExpression(), - "Property name not supported."); - return std::string(); - } - - assert(target); - - if (propertyName == "LINKER_LANGUAGE") - { - if (target->LinkLanguagePropagatesToDependents() && - dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries() - || dagCheckerParent->EvaluatingSources())) - { - reportError(context, content->GetOriginalExpression(), - "LINKER_LANGUAGE target property can not be used while evaluating " - "link libraries for a static library"); - return std::string(); - } - return target->GetLinkerLanguage(context->Config); - } - - cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, - target->GetName(), - propertyName, - content, - dagCheckerParent); - - switch (dagChecker.Check()) - { - case cmGeneratorExpressionDAGChecker::SELF_REFERENCE: - dagChecker.ReportError(context, content->GetOriginalExpression()); - return std::string(); - case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: - // No error. We just skip cyclic references. - return std::string(); - case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: - for (size_t i = 1; - i < cmArraySize(targetPropertyTransitiveWhitelist); - ++i) - { - if (targetPropertyTransitiveWhitelist[i] == propertyName) - { - // No error. We're not going to find anything new here. - return std::string(); - } - } - case cmGeneratorExpressionDAGChecker::DAG: - break; - } - - const char *prop = target->GetProperty(propertyName); - - if (dagCheckerParent) - { - if (dagCheckerParent->EvaluatingLinkLibraries()) - { -#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ - (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || - if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE) - false) - { - reportError(context, content->GetOriginalExpression(), - "$ expression in link libraries " - "evaluation depends on target property which is transitive " - "over the link libraries, creating a recursion."); - return std::string(); - } -#undef TRANSITIVE_PROPERTY_COMPARE - - if(!prop) - { - return std::string(); - } - } - else - { -#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) \ - dagCheckerParent->METHOD () || - - assert( - CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( - ASSERT_TRANSITIVE_PROPERTY_METHOD) - false); -#undef ASSERT_TRANSITIVE_PROPERTY_METHOD - } - } - - std::string linkedTargetsContent; - - std::string interfacePropertyName; - bool isInterfaceProperty = false; - -#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \ - if (propertyName == #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - } \ - else if (propertyName == "INTERFACE_" #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - isInterfaceProperty = true; \ - } \ - else - - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME) - // Note that the above macro terminates with an else - /* else */ if (cmHasLiteralPrefix(propertyName.c_str(), - "COMPILE_DEFINITIONS_")) - { - cmPolicies::PolicyStatus polSt = - context->Makefile->GetPolicyStatus(cmPolicies::CMP0043); - if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) - { - interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; - } - } -#undef POPULATE_INTERFACE_PROPERTY_NAME - cmTarget const* headTarget = context->HeadTarget && isInterfaceProperty - ? context->HeadTarget : target; - - if(isInterfaceProperty) - { - if(cmTarget::LinkInterfaceLibraries const* iface = - target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) - { - linkedTargetsContent = - getLinkedTargetsContent(iface->Libraries, target, - headTarget, - context, &dagChecker, - interfacePropertyName); - } - } - else if(!interfacePropertyName.empty()) - { - if(cmTarget::LinkImplementationLibraries const* impl = - target->GetLinkImplementationLibraries(context->Config)) - { - linkedTargetsContent = - getLinkedTargetsContent(impl->Libraries, target, - target, - context, &dagChecker, - interfacePropertyName); - } - } - - if (!prop) - { - if (target->IsImported() - || target->GetType() == cmTarget::INTERFACE_LIBRARY) - { - return linkedTargetsContent; - } - if (target->IsLinkInterfaceDependentBoolProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - return target->GetLinkInterfaceDependentBoolProperty( - propertyName, - context->Config) ? "1" : "0"; - } - if (target->IsLinkInterfaceDependentStringProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentStringProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - - return linkedTargetsContent; - } - - if (!target->IsImported() - && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) - { - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - } - if(!interfacePropertyName.empty()) - { - std::string result = this->EvaluateDependentExpression(prop, - context->Makefile, context, - headTarget, target, &dagChecker); - if (!linkedTargetsContent.empty()) - { - result += (result.empty() ? "" : ";") + linkedTargetsContent; - } - return result; - } - return prop; - } -} targetPropertyNode; - -//---------------------------------------------------------------------------- -static const struct TargetNameNode : public cmGeneratorExpressionNode -{ - TargetNameNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - virtual bool RequiresLiteralInput() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } - - virtual int NumExpectedParameters() const { return 1; } - -} targetNameNode; - -//---------------------------------------------------------------------------- -static const struct TargetObjectsNode : public cmGeneratorExpressionNode -{ - TargetObjectsNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->EvaluateForBuildsystem) - { - std::ostringstream e; - e << "The evaluation of the TARGET_OBJECTS generator expression " - "is only suitable for consumption by CMake. It is not suitable " - "for writing out elsewhere."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::string tgtName = parameters.front(); - cmGeneratorTarget* gt = - context->Makefile->FindGeneratorTargetToUse(tgtName); - if (!gt) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but no such target exists."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - if (gt->GetType() != cmTarget::OBJECT_LIBRARY) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but is not an OBJECT library."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::vector objectSources; - gt->GetObjectSources(objectSources, context->Config); - std::map mapping; - - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - mapping[*it]; - } - - gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - - std::string obj_dir = gt->ObjectDirectory; - std::string result; - const char* sep = ""; - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - // Find the object file name corresponding to this source file. - std::map::const_iterator - map_it = mapping.find(*it); - // It must exist because we populated the mapping just above. - assert(!map_it->second.empty()); - result += sep; - std::string objFile = obj_dir + map_it->second; - cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true); - sf->SetObjectLibrary(tgtName); - sf->SetProperty("EXTERNAL_OBJECT", "1"); - result += objFile; - sep = ";"; - } - return result; - } -} targetObjectsNode; - -//---------------------------------------------------------------------------- -static const struct CompileFeaturesNode : public cmGeneratorExpressionNode -{ - CompileFeaturesNode() {} - - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - cmTarget const* target = context->HeadTarget; - if (!target) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - context->HadHeadSensitiveCondition = true; - - typedef std::map > LangMap; - static LangMap availableFeatures; - - LangMap testedFeatures; - - for (std::vector::const_iterator it = parameters.begin(); - it != parameters.end(); ++it) - { - std::string error; - std::string lang; - if (!context->Makefile->CompileFeatureKnown(context->HeadTarget, - *it, lang, &error)) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - testedFeatures[lang].push_back(*it); - - if (availableFeatures.find(lang) == availableFeatures.end()) - { - const char* featuresKnown - = context->Makefile->CompileFeaturesAvailable(lang, &error); - if (!featuresKnown) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - cmSystemTools::ExpandListArgument(featuresKnown, - availableFeatures[lang]); - } - } - - bool evalLL = dagChecker && dagChecker->EvaluatingLinkLibraries(); - - std::string result; - - for (LangMap::const_iterator lit = testedFeatures.begin(); - lit != testedFeatures.end(); ++lit) - { - std::vector const& langAvailable - = availableFeatures[lit->first]; - const char* standardDefault = context->Makefile - ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT"); - for (std::vector::const_iterator it = lit->second.begin(); - it != lit->second.end(); ++it) - { - if (std::find(langAvailable.begin(), langAvailable.end(), *it) - == langAvailable.end()) - { - return "0"; - } - if (standardDefault && !*standardDefault) - { - // This compiler has no notion of language standard levels. - // All features known for the language are always available. - continue; - } - if (!context->Makefile->HaveStandardAvailable(target, - lit->first, *it)) - { - if (evalLL) - { - const char* l = target->GetProperty(lit->first + "_STANDARD"); - if (!l) - { - l = standardDefault; - } - assert(l); - context->MaxLanguageStandard[target][lit->first] = l; - } - else - { - return "0"; - } - } - } - } - return "1"; - } -} compileFeaturesNode; - -//---------------------------------------------------------------------------- -static const char* targetPolicyWhitelist[] = { - 0 -#define TARGET_POLICY_STRING(POLICY) \ - , #POLICY - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING) - -#undef TARGET_POLICY_STRING -}; - -cmPolicies::PolicyStatus statusForTarget(cmTarget const* tgt, - const char *policy) -{ -#define RETURN_POLICY(POLICY) \ - if (strcmp(policy, #POLICY) == 0) \ - { \ - return tgt->GetPolicyStatus ## POLICY (); \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY) - -#undef RETURN_POLICY - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::WARN; -} - -cmPolicies::PolicyID policyForString(const char *policy_id) -{ -#define RETURN_POLICY_ID(POLICY_ID) \ - if (strcmp(policy_id, #POLICY_ID) == 0) \ - { \ - return cmPolicies:: POLICY_ID; \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID) - -#undef RETURN_POLICY_ID - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::CMP0002; -} - -//---------------------------------------------------------------------------- -static const struct TargetPolicyNode : public cmGeneratorExpressionNode -{ - TargetPolicyNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context , - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - - context->HadContextSensitiveCondition = true; - context->HadHeadSensitiveCondition = true; - - for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) - { - const char *policy = targetPolicyWhitelist[i]; - if (parameters.front() == policy) - { - cmMakefile *mf = context->HeadTarget->GetMakefile(); - switch(statusForTarget(context->HeadTarget, policy)) - { - case cmPolicies::WARN: - mf->IssueMessage(cmake::AUTHOR_WARNING, - mf->GetPolicies()-> - GetPolicyWarning(policyForString(policy))); - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::OLD: - return "0"; - case cmPolicies::NEW: - return "1"; - } - } - } - reportError(context, content->GetOriginalExpression(), - "$ may only be used with a limited number of " - "policies. Currently it may be used with the following policies:\n" - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -#define TARGET_POLICY_LIST_ITEM(POLICY) \ - " * " STRINGIFY(POLICY) "\n" - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM) - -#undef TARGET_POLICY_LIST_ITEM - ); - return std::string(); - } - -} targetPolicyNode; - -//---------------------------------------------------------------------------- -static const struct InstallPrefixNode : public cmGeneratorExpressionNode -{ - InstallPrefixNode() {} - - virtual bool GeneratesContent() const { return true; } - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - reportError(context, content->GetOriginalExpression(), - "INSTALL_PREFIX is a marker for install(EXPORT) only. It " - "should never be evaluated."); - return std::string(); - } - -} installPrefixNode; - -//---------------------------------------------------------------------------- -class ArtifactNameTag; -class ArtifactLinkerTag; -class ArtifactSonameTag; -class ArtifactPdbTag; - -class ArtifactPathTag; -class ArtifactDirTag; -class ArtifactNameTag; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The target soname file (.so.1). - if(target->IsDLLPlatform()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is not allowed " - "for DLL target platforms."); - return std::string(); - } - if(target->GetType() != cmTarget::SHARED_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is allowed only for " - "SHARED libraries."); - return std::string(); - } - std::string result = target->GetDirectory(context->Config); - result += "/"; - result += target->GetSOName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - std::string language = target->GetLinkerLanguage(context->Config); - - std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; - - if(!context->Makefile->IsOn(pdbSupportVar)) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is not supported by the target linker."); - return std::string(); - } - - cmTarget::TargetType targetType = target->GetType(); - - if(targetType != cmTarget::SHARED_LIBRARY && - targetType != cmTarget::MODULE_LIBRARY && - targetType != cmTarget::EXECUTABLE) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is allowed only for " - "targets with linker created artifacts."); - return std::string(); - } - - std::string result = target->GetPDBDirectory(context->Config); - result += "/"; - result += target->GetPDBName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The file used to link to the target (.so, .lib, .a). - if(!target->IsLinkable()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_LINKER_FILE is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); - return std::string(); - } - return target->GetFullPath(context->Config, - target->HasImportLibrary()); - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *) - { - return target->GetFullPath(context->Config, false, true); - } -}; - - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenameName(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenamePath(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return result; } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifact : public cmGeneratorExpressionNode -{ - TargetFilesystemArtifact() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - // Lookup the referenced target. - std::string name = *parameters.begin(); - - if (!cmGeneratorExpression::IsValidTargetName(name)) - { - ::reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - cmTarget* target = context->Makefile->FindTargetToUse(name); - if(!target) - { - ::reportError(context, content->GetOriginalExpression(), - "No target \"" + name + "\""); - return std::string(); - } - if(target->GetType() >= cmTarget::OBJECT_LIBRARY && - target->GetType() != cmTarget::UNKNOWN_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "Target \"" + name + "\" is not an executable or library."); - return std::string(); - } - if (dagChecker && (dagChecker->EvaluatingLinkLibraries(name.c_str()) - || (dagChecker->EvaluatingSources() - && name == dagChecker->TopTarget()))) - { - ::reportError(context, content->GetOriginalExpression(), - "Expressions which require the linker language may not " - "be used while evaluating link libraries"); - return std::string(); - } - context->DependTargets.insert(target); - context->AllTargets.insert(target); - - std::string result = - TargetFilesystemArtifactResultCreator::Create( - target, - context, - content); - if (context->HadError) - { - return std::string(); - } - return - TargetFilesystemArtifactResultGetter::Get(result); - } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactNodeGroup -{ - TargetFilesystemArtifactNodeGroup() - { - } - - TargetFilesystemArtifact File; - TargetFilesystemArtifact FileName; - TargetFilesystemArtifact FileDir; -}; - -//---------------------------------------------------------------------------- -static const -TargetFilesystemArtifactNodeGroup targetNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; - -//---------------------------------------------------------------------------- -static const -cmGeneratorExpressionNode* GetNode(const std::string &identifier) -{ - typedef std::map NodeMap; - static NodeMap nodeMap; - if (nodeMap.empty()) - { - nodeMap["0"] = &zeroNode; - nodeMap["1"] = &oneNode; - nodeMap["AND"] = &andNode; - nodeMap["OR"] = &orNode; - nodeMap["NOT"] = ¬Node; - nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; - nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; - nodeMap["VERSION_GREATER"] = &versionGreaterNode; - nodeMap["VERSION_LESS"] = &versionLessNode; - nodeMap["VERSION_EQUAL"] = &versionEqualNode; - nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; - nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; - nodeMap["PLATFORM_ID"] = &platformIdNode; - nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; - nodeMap["CONFIGURATION"] = &configurationNode; - nodeMap["CONFIG"] = &configurationTestNode; - nodeMap["TARGET_FILE"] = &targetNodeGroup.File; - nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; - nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; - nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; - nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; - nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; - nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; - nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; - nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; - nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; - nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; - nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; - nodeMap["STREQUAL"] = &strEqualNode; - nodeMap["EQUAL"] = &equalNode; - nodeMap["LOWER_CASE"] = &lowerCaseNode; - nodeMap["UPPER_CASE"] = &upperCaseNode; - nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; - nodeMap["BOOL"] = &boolNode; - nodeMap["ANGLE-R"] = &angle_rNode; - nodeMap["COMMA"] = &commaNode; - nodeMap["SEMICOLON"] = &semicolonNode; - nodeMap["TARGET_PROPERTY"] = &targetPropertyNode; - nodeMap["TARGET_NAME"] = &targetNameNode; - nodeMap["TARGET_OBJECTS"] = &targetObjectsNode; - nodeMap["TARGET_POLICY"] = &targetPolicyNode; - nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; - nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; - nodeMap["INSTALL_PREFIX"] = &installPrefixNode; - nodeMap["JOIN"] = &joinNode; - nodeMap["LINK_ONLY"] = &linkOnlyNode; - nodeMap["COMPILE_LANGUAGE"] = &languageNode; - } - NodeMap::const_iterator i = nodeMap.find(identifier); - if (i == nodeMap.end()) - { - return 0; - } - return i->second; - -} +#include "cmGeneratorExpressionNode.h" //---------------------------------------------------------------------------- GeneratorExpressionContent::GeneratorExpressionContent( @@ -2000,7 +113,8 @@ std::string GeneratorExpressionContent::Evaluate( } } - const cmGeneratorExpressionNode *node = GetNode(identifier); + const cmGeneratorExpressionNode *node = + cmGeneratorExpressionNode::GetNode(identifier); if (!node) { diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionNode.cxx similarity index 87% copy from Source/cmGeneratorExpressionEvaluator.cxx copy to Source/cmGeneratorExpressionNode.cxx index 756d932..17254d2 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -9,71 +9,9 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "cmMakefile.h" -#include "cmGeneratorExpressionEvaluator.h" -#include "cmGeneratorExpressionParser.h" -#include "cmGeneratorExpressionDAGChecker.h" -#include "cmGeneratorExpression.h" -#include "cmLocalGenerator.h" +#include "cmGeneratorExpressionNode.h" #include "cmGlobalGenerator.h" -#include "cmSourceFile.h" - -#include - -#include -#include - -//---------------------------------------------------------------------------- -static void reportError(cmGeneratorExpressionContext *context, - const std::string &expr, const std::string &result) -{ - context->HadError = true; - if (context->Quiet) - { - return; - } - - std::ostringstream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); -} - -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionNode -{ - enum { - DynamicParameters = 0, - OneOrMoreParameters = -1, - OneOrZeroParameters = -2 - }; - virtual ~cmGeneratorExpressionNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool RequiresLiteralInput() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const - { return false; } - - virtual int NumExpectedParameters() const { return 1; } - - virtual std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker - ) const = 0; - - static std::string EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker); -}; //---------------------------------------------------------------------------- std::string cmGeneratorExpressionNode::EvaluateDependentExpression( @@ -840,7 +778,6 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "$ Unknown language."); return std::string(); } - std::string genName = gg->GetName(); if (genName.find("Visual Studio") != std::string::npos) { @@ -1849,8 +1786,8 @@ static const TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; //---------------------------------------------------------------------------- -static const -cmGeneratorExpressionNode* GetNode(const std::string &identifier) +const cmGeneratorExpressionNode* +cmGeneratorExpressionNode::GetNode(const std::string &identifier) { typedef std::map NodeMap; static NodeMap nodeMap; @@ -1910,229 +1847,23 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) return 0; } return i->second; - -} - -//---------------------------------------------------------------------------- -GeneratorExpressionContent::GeneratorExpressionContent( - const char *startContent, - size_t length) - : StartContent(startContent), ContentLength(length) -{ - -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::GetOriginalExpression() const -{ - return std::string(this->StartContent, this->ContentLength); -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::ProcessArbitraryContent( - const cmGeneratorExpressionNode *node, - const std::string &identifier, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - std::vector >::const_iterator - pit) const -{ - std::string result; - - const - std::vector >::const_iterator - pend = this->ParamChildren.end(); - for ( ; pit != pend; ++pit) - { - std::vector::const_iterator it - = pit->begin(); - const std::vector::const_iterator end - = pit->end(); - for ( ; it != end; ++it) - { - if (node->RequiresLiteralInput()) - { - if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires literal input."); - return std::string(); - } - } - result += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - if ((pit + 1) != pend) - { - result += ","; - } - } - if (node->RequiresLiteralInput()) - { - std::vector parameters; - parameters.push_back(result); - return node->Evaluate(parameters, context, this, dagChecker); - } - return result; -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::Evaluate( - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker) const -{ - std::string identifier; - { - std::vector::const_iterator it - = this->IdentifierChildren.begin(); - const std::vector::const_iterator end - = this->IdentifierChildren.end(); - for ( ; it != end; ++it) - { - identifier += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - } - - const cmGeneratorExpressionNode *node = GetNode(identifier); - - if (!node) - { - reportError(context, this->GetOriginalExpression(), - "Expression did not evaluate to a known generator expression"); - return std::string(); - } - - if (!node->GeneratesContent()) - { - if (node->NumExpectedParameters() == 1 - && node->AcceptsArbitraryContentParameter()) - { - if (this->ParamChildren.empty()) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires a parameter."); - } - } - else - { - std::vector parameters; - this->EvaluateParameters(node, identifier, context, dagChecker, - parameters); - } - return std::string(); - } - - std::vector parameters; - this->EvaluateParameters(node, identifier, context, dagChecker, parameters); - if (context->HadError) - { - return std::string(); - } - - return node->Evaluate(parameters, context, this, dagChecker); } //---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::EvaluateParameters( - const cmGeneratorExpressionNode *node, - const std::string &identifier, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - std::vector ¶meters) const +void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result) { - const int numExpected = node->NumExpectedParameters(); - { - std::vector >::const_iterator - pit = this->ParamChildren.begin(); - const - std::vector >::const_iterator - pend = this->ParamChildren.end(); - const bool acceptsArbitraryContent - = node->AcceptsArbitraryContentParameter(); - int counter = 1; - for ( ; pit != pend; ++pit, ++counter) - { - if (acceptsArbitraryContent && counter == numExpected) - { - std::string lastParam = this->ProcessArbitraryContent(node, identifier, - context, - dagChecker, - pit); - parameters.push_back(lastParam); - return std::string(); - } - else - { - std::string parameter; - std::vector::const_iterator it = - pit->begin(); - const std::vector::const_iterator end = - pit->end(); - for ( ; it != end; ++it) - { - parameter += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - parameters.push_back(parameter); - } - } - } - - if ((numExpected > cmGeneratorExpressionNode::DynamicParameters - && (unsigned int)numExpected != parameters.size())) - { - if (numExpected == 0) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires no parameters."); - } - else if (numExpected == 1) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires " - "exactly one parameter."); - } - else - { - std::ostringstream e; - e << "$<" + identifier + "> expression requires " - << numExpected - << " comma separated parameters, but got " - << parameters.size() << " instead."; - reportError(context, this->GetOriginalExpression(), e.str()); - } - return std::string(); - } - - if (numExpected == cmGeneratorExpressionNode::OneOrMoreParameters - && parameters.empty()) - { - reportError(context, this->GetOriginalExpression(), "$<" + identifier - + "> expression requires at least one parameter."); - } - if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters - && parameters.size() > 1) + context->HadError = true; + if (context->Quiet) { - reportError(context, this->GetOriginalExpression(), "$<" + identifier - + "> expression requires one or zero parameters."); + return; } - return std::string(); -} -//---------------------------------------------------------------------------- -GeneratorExpressionContent::~GeneratorExpressionContent() -{ - cmDeleteAll(this->IdentifierChildren); - std::for_each(this->ParamChildren.begin(), this->ParamChildren.end(), - cmDeleteAll >); + std::ostringstream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << result; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str(), + context->Backtrace); } diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h new file mode 100644 index 0000000..847a00a --- /dev/null +++ b/Source/cmGeneratorExpressionNode.h @@ -0,0 +1,70 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionNode_h +#define cmGeneratorExpressionNode_h + +#include "cmMakefile.h" + +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionParser.h" +#include "cmGeneratorExpressionDAGChecker.h" +#include "cmGeneratorExpression.h" +#include "cmLocalGenerator.h" +#include "cmSourceFile.h" + +#include + +#include +#include + +#include "cmListFileCache.h" + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionNode +{ + enum { + DynamicParameters = 0, + OneOrMoreParameters = -1, + OneOrZeroParameters = -2 + }; + virtual ~cmGeneratorExpressionNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool RequiresLiteralInput() const { return false; } + + virtual bool AcceptsArbitraryContentParameter() const + { return false; } + + virtual int NumExpectedParameters() const { return 1; } + + virtual std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker + ) const = 0; + + static std::string EvaluateDependentExpression( + std::string const& prop, cmMakefile *makefile, + cmGeneratorExpressionContext *context, + cmTarget const* headTarget, cmTarget const* currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker); + + static const cmGeneratorExpressionNode* GetNode( + const std::string &identifier); +}; + +//---------------------------------------------------------------------------- +void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result); + +#endif diff --git a/bootstrap b/bootstrap index 320552a..6bc87ed 100755 --- a/bootstrap +++ b/bootstrap @@ -270,6 +270,7 @@ CMAKE_CXX_SOURCES="\ cmGeneratorExpressionDAGChecker \ cmGeneratorExpressionEvaluator \ cmGeneratorExpressionLexer \ + cmGeneratorExpressionNode \ cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80b9f0cbe263c64613acd18e4e94505924fce40e commit 80b9f0cbe263c64613acd18e4e94505924fce40e Author: Stephen Kelly AuthorDate: Sun Feb 22 21:30:44 2015 +0100 Commit: Stephen Kelly CommitDate: Tue Mar 10 21:19:38 2015 +0100 Genex: Extract an evaluateWithContext method. Make it easier to make modifications to the context before evaluating with it. diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 0a27016..a4990dc 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -72,18 +72,6 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmGeneratorExpressionDAGChecker *dagChecker, std::string const& language) const { - if (!this->NeedsEvaluation) - { - return this->Input.c_str(); - } - - this->Output = ""; - - std::vector::const_iterator it - = this->Evaluators.begin(); - const std::vector::const_iterator end - = this->Evaluators.end(); - cmGeneratorExpressionContext context; context.Makefile = mf; context.Config = config; @@ -98,6 +86,26 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.Backtrace = this->Backtrace; context.Language = language; + return this->EvaluateWithContext(context, dagChecker); +} + +//---------------------------------------------------------------------------- +const char* cmCompiledGeneratorExpression::EvaluateWithContext( + cmGeneratorExpressionContext& context, + cmGeneratorExpressionDAGChecker *dagChecker) const +{ + if (!this->NeedsEvaluation) + { + return this->Input.c_str(); + } + + this->Output = ""; + + std::vector::const_iterator it + = this->Evaluators.begin(); + const std::vector::const_iterator end + = this->Evaluators.end(); + for ( ; it != end; ++it) { this->Output += (*it)->Evaluate(&context, dagChecker); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 55d9691..11c27fd 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -24,6 +24,7 @@ class cmMakefile; class cmListFileBacktrace; struct cmGeneratorExpressionEvaluator; +struct cmGeneratorExpressionContext; struct cmGeneratorExpressionDAGChecker; class cmCompiledGeneratorExpression; @@ -131,6 +132,9 @@ public: std::map& mapping); private: + const char* EvaluateWithContext(cmGeneratorExpressionContext& context, + cmGeneratorExpressionDAGChecker *dagChecker) const; + cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, const std::string& input); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=642048ce356304155bf67b85deeacb9d030c3300 commit 642048ce356304155bf67b85deeacb9d030c3300 Author: Stephen Kelly AuthorDate: Sun Feb 22 23:52:11 2015 +0100 Commit: Stephen Kelly CommitDate: Tue Mar 10 21:19:38 2015 +0100 Help: Move docs of $<0:...> and $<1:...> to output section. These are not 'logical' expressions. They create output and are often used together with the logical expressions. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index d38cf7e..477a132 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -40,10 +40,6 @@ otherwise expands to nothing. Available logical expressions are: -``$<0:...>`` - Empty string (ignores ``...``) -``$<1:...>`` - Content of ``...`` ``$`` ``1`` if the ``...`` is true, else ``0`` ``$`` @@ -241,6 +237,10 @@ where ``${prop}`` refers to a helper variable:: Available output expressions are: +``$<0:...>`` + Empty string (ignores ``...``) +``$<1:...>`` + Content of ``...`` ``$`` Joins the list with the content of ``...`` ``$`` ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 8 +- Source/CMakeLists.txt | 4 + Source/cmGeneratorExpression.cxx | 27 +- Source/cmGeneratorExpression.h | 4 + Source/cmGeneratorExpressionContext.cxx | 34 + Source/cmGeneratorExpressionContext.h | 54 + Source/cmGeneratorExpressionEvaluator.cxx | 1892 +------------------- Source/cmGeneratorExpressionEvaluator.h | 29 +- ...Evaluator.cxx => cmGeneratorExpressionNode.cxx} | 300 +--- Source/cmGeneratorExpressionNode.h | 70 + bootstrap | 2 + 11 files changed, 204 insertions(+), 2220 deletions(-) create mode 100644 Source/cmGeneratorExpressionContext.cxx create mode 100644 Source/cmGeneratorExpressionContext.h copy Source/{cmGeneratorExpressionEvaluator.cxx => cmGeneratorExpressionNode.cxx} (87%) create mode 100644 Source/cmGeneratorExpressionNode.h hooks/post-receive -- CMake From bill.hoffman at kitware.com Tue Mar 10 18:20:27 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Tue, 10 Mar 2015 18:20:27 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-978-gecce429 Message-ID: <20150310222028.9BA77AB140@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ecce4291e6ccf51902d16cff862d3a0c729f4802 (commit) via 8c68af5e7628d7d18bd3e34e300044c459b9acfe (commit) via 169c867f5671fa6cca2fde53b9d7732c348c7499 (commit) via 5c3c29ffd3a36e710792d7b9954bf3ec95cee58a (commit) from d88859dfcdc4e4dd1e00a854bb4115d7b230a72a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ecce4291e6ccf51902d16cff862d3a0c729f4802 commit ecce4291e6ccf51902d16cff862d3a0c729f4802 Merge: d88859d 8c68af5 Author: Bill Hoffman AuthorDate: Tue Mar 10 18:20:24 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 18:20:24 2015 -0400 Merge topic 'add_repeat_testing' into next 8c68af5e Add a test for the run until fail ctest option. 169c867f Fix some unitialized class variables. 5c3c29ff Add a new --repeat-until-fail option to ctest. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c68af5e7628d7d18bd3e34e300044c459b9acfe commit 8c68af5e7628d7d18bd3e34e300044c459b9acfe Author: Bill Hoffman AuthorDate: Tue Mar 10 18:08:01 2015 -0400 Commit: Bill Hoffman CommitDate: Tue Mar 10 18:08:01 2015 -0400 Add a test for the run until fail ctest option. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 08765de..4300c7e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2583,6 +2583,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ADD_TEST_MACRO(CTestTestSerialOrder ${CMAKE_CTEST_COMMAND} --output-on-failure -C "\${CTestTest_CONFIG}") + add_test_macro(CTestTestRunUntilFail ${CMAKE_CTEST_COMMAND} + --repeat-until-fail 4 -C "\${CTestTest_CONFIG}") + set_tests_properties(CTestTestRunUntilFail PROPERTIES + PASS_REGULAR_EXPRESSION + "1/2.*Test #1:.* initialization.*Passed.*Test #2.*test1.*Failed" + ) + if(NOT BORLAND) set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process) add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4 diff --git a/Tests/CTestTestRunUntilFail/CMakeLists.txt b/Tests/CTestTestRunUntilFail/CMakeLists.txt new file mode 100644 index 0000000..7788d73 --- /dev/null +++ b/Tests/CTestTestRunUntilFail/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 2.8.12) +project(CTestTestSerialOrder) +enable_testing() +set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") +add_test(NAME initialization + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/init.cmake") +add_test(NAME test1 + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/test1.cmake") +set_tests_properties(test1 PROPERTIES DEPENDS "initialization") diff --git a/Tests/CTestTestRunUntilFail/init.cmake b/Tests/CTestTestRunUntilFail/init.cmake new file mode 100644 index 0000000..560fb5e --- /dev/null +++ b/Tests/CTestTestRunUntilFail/init.cmake @@ -0,0 +1 @@ +file(WRITE "${TEST_OUTPUT_FILE}" "0") diff --git a/Tests/CTestTestRunUntilFail/test1.cmake b/Tests/CTestTestRunUntilFail/test1.cmake new file mode 100644 index 0000000..d7fafb8 --- /dev/null +++ b/Tests/CTestTestRunUntilFail/test1.cmake @@ -0,0 +1,8 @@ +message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}") +file(READ "${TEST_OUTPUT_FILE}" COUNT) +message("COUNT= ${COUNT}") +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}") +if(${COUNT} EQUAL 2) + message(FATAL_ERROR "this test fails on the 2nd run") +endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=169c867f5671fa6cca2fde53b9d7732c348c7499 commit 169c867f5671fa6cca2fde53b9d7732c348c7499 Author: Bill Hoffman AuthorDate: Mon Mar 9 16:07:22 2015 -0400 Commit: Bill Hoffman CommitDate: Mon Mar 9 16:07:22 2015 -0400 Fix some unitialized class variables. diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 2f89963..55e2a44 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -328,6 +328,8 @@ cmCTest::cmCTest() this->OutputTestOutputOnTestFailure = false; this->ComputedCompressTestOutput = false; this->ComputedCompressMemCheckOutput = false; + this->RepeatTests = 1; // default to run each test once + this->RepeatUntilFail = false; if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE")) { this->OutputTestOutputOnTestFailure = true; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c3c29ffd3a36e710792d7b9954bf3ec95cee58a commit 5c3c29ffd3a36e710792d7b9954bf3ec95cee58a Author: Bill Hoffman AuthorDate: Thu Mar 5 16:51:10 2015 -0500 Commit: Bill Hoffman CommitDate: Thu Mar 5 16:51:10 2015 -0500 Add a new --repeat-until-fail option to ctest. This option tells ctest to run each test N times until the test fails or the N times have run. This is useful for finding random failing tests. diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index eb33d8e..bd090db 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -121,6 +121,11 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) this->RunningCount += GetProcessorsUsed(test); cmCTestRunTest* testRun = new cmCTestRunTest(this->TestHandler); + if(this->CTest->GetRepeatUntilFail()) + { + testRun->SetRunUntilFailOn(); + testRun->SetNumberOfRuns(this->CTest->GetTestRepeat()); + } testRun->SetIndex(test); testRun->SetTestProperties(this->Properties[test]); @@ -289,7 +294,13 @@ bool cmCTestMultiProcessHandler::CheckOutput() cmCTestRunTest* p = *i; int test = p->GetIndex(); - if(p->EndTest(this->Completed, this->Total, true)) + bool testResult = p->EndTest(this->Completed, this->Total, true); + if(p->StartAgain()) + { + this->Completed--; // remove the completed test because run again + continue; + } + if(testResult) { this->Passed->push_back(p->GetTestProperties()->Name); } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 03131fd..6f72684 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -33,6 +33,9 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) this->CompressedOutput = ""; this->CompressionRatio = 2; this->StopTimePassed = false; + this->NumberOfRunsLeft = 1; // default to 1 run of the test + this->RunUntilFail = false; // default to run the test once + this->RunAgain = false; // default to not having to run again } cmCTestRunTest::~cmCTestRunTest() @@ -357,13 +360,50 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) this->MemCheckPostProcess(); this->ComputeWeightedCost(); } - // Always push the current TestResult onto the + // If the test does not need to rerun push the current TestResult onto the // TestHandler vector - this->TestHandler->TestResults.push_back(this->TestResult); + if(!this->NeedsToRerun()) + { + this->TestHandler->TestResults.push_back(this->TestResult); + } delete this->TestProcess; return passed; } +bool cmCTestRunTest::StartAgain() +{ + if(!this->RunAgain) + { + return false; + } + this->RunAgain = false; // reset + // change to tests directory + std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); + cmSystemTools::ChangeDirectory(this->TestProperties->Directory); + this->StartTest(this->TotalNumberOfTests); + // change back + cmSystemTools::ChangeDirectory(current_dir); + return true; +} + +bool cmCTestRunTest::NeedsToRerun() +{ + this->NumberOfRunsLeft--; + if(this->NumberOfRunsLeft == 0) + { + return false; + } + // if number of runs left is not 0, and we are running until + // we find a failed test, then return true so the test can be + // restarted + if(this->RunUntilFail + && this->TestResult.Status == cmCTestTestHandler::COMPLETED) + { + this->RunAgain = true; + return true; + } + return false; +} //---------------------------------------------------------------------- void cmCTestRunTest::ComputeWeightedCost() { @@ -400,6 +440,7 @@ void cmCTestRunTest::MemCheckPostProcess() // Starts the execution of a test. Returns once it has started bool cmCTestRunTest::StartTest(size_t total) { + this->TotalNumberOfTests = total; // save for rerun case cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8) << "Start " << std::setw(getNumWidth(this->TestHandler->GetMaxIndex())) @@ -494,10 +535,10 @@ bool cmCTestRunTest::StartTest(size_t total) //---------------------------------------------------------------------- void cmCTestRunTest::ComputeArguments() { + this->Arguments.clear(); // reset becaue this might be a rerun std::vector::const_iterator j = this->TestProperties->Args.begin(); ++j; // skip test name - // find the test executable if(this->TestHandler->MemCheck) { @@ -682,10 +723,28 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) - << completed << "/"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) - << total << " "); + // if this is the last or only run of this test + // then print out completed / total + // Only issue is if a test fails and we are running until fail + // then it will never print out the completed / total, same would + // got for run until pass. Trick is when this is called we don't + // yet know if we are passing or failing. + if(this->NumberOfRunsLeft == 1) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << completed << "/"); + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << total << " "); + } + // if this is one of several runs of a test just print blank space + // to keep things neat + else + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << " " << " "); + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << " " << " "); + } if ( this->TestHandler->MemCheck ) { diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 476f3e1..3b5c831 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -27,6 +27,8 @@ public: cmCTestRunTest(cmCTestTestHandler* handler); ~cmCTestRunTest(); + void SetNumberOfRuns(int n) {this->NumberOfRunsLeft = n;} + void SetRunUntilFailOn() { this->RunUntilFail = true;} void SetTestProperties(cmCTestTestHandler::cmCTestTestProperties * prop) { this->TestProperties = prop; } @@ -58,7 +60,10 @@ public: void ComputeArguments(); void ComputeWeightedCost(); + + bool StartAgain(); private: + bool NeedsToRerun(); void DartProcessing(); void ExeNotFound(std::string exe); // Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT) @@ -92,6 +97,10 @@ private: std::string ActualCommand; std::vector Arguments; bool StopTimePassed; + bool RunUntilFail; + int NumberOfRunsLeft; + bool RunAgain; + size_t TotalNumberOfTests; }; inline int getNumWidth(size_t n) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e6d3960..2f89963 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2005,6 +2005,12 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->SetParallelLevel(plevel); this->ParallelLevelSetInCli = true; } + if(this->CheckArgument(arg, "--repeat-until-fail") && i < args.size() - 1) + { + i++; + this->RepeatTests = atoi(args[i].c_str()); + this->RepeatUntilFail = true; + } if(this->CheckArgument(arg, "--no-compress-output")) { diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 88191c4..7fd84d8 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -429,8 +429,13 @@ public: { return this->Definitions; } - + // return the number of times a test should be run + int GetTestRepeat() { return this->RepeatTests;} + // return true if test should run until fail + bool GetRepeatUntilFail() { return this->RepeatUntilFail;} private: + int RepeatTests; + bool RepeatUntilFail; std::string ConfigType; std::string ScheduleType; std::string StopTime; diff --git a/Source/ctest.cxx b/Source/ctest.cxx index c0eb8ac..351b644 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -49,6 +49,9 @@ static const char * cmDocumentationOptions[][2] = {"-F", "Enable failover."}, {"-j , --parallel ", "Run the tests in parallel using the " "given number of jobs."}, + {"--repeat-until-fail ", "Run each test times " + "unless the test fails at that point stop repeating. Useful for finding" + " random failuers."}, {"-Q,--quiet", "Make ctest quiet."}, {"-O , --output-log ", "Output to log file"}, {"-N,--show-only", "Disable actual execution of tests."}, ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestMultiProcessHandler.cxx | 13 ++++- Source/CTest/cmCTestRunTest.cxx | 73 ++++++++++++++++++++++++--- Source/CTest/cmCTestRunTest.h | 9 ++++ Source/cmCTest.cxx | 8 +++ Source/cmCTest.h | 7 ++- Source/ctest.cxx | 3 ++ Tests/CMakeLists.txt | 7 +++ Tests/CTestTestRunUntilFail/CMakeLists.txt | 13 +++++ Tests/CTestTestRunUntilFail/init.cmake | 1 + Tests/CTestTestRunUntilFail/test1.cmake | 8 +++ 10 files changed, 133 insertions(+), 9 deletions(-) create mode 100644 Tests/CTestTestRunUntilFail/CMakeLists.txt create mode 100644 Tests/CTestTestRunUntilFail/init.cmake create mode 100644 Tests/CTestTestRunUntilFail/test1.cmake hooks/post-receive -- CMake From steveire at gmail.com Tue Mar 10 19:12:20 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 10 Mar 2015 19:12:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-980-g0f96f10 Message-ID: <20150310231220.5DDE1AA1F3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0f96f10ec66b118473fa349702fc8355e8f0412d (commit) via da12ae2f459d17c0775480df1fc71753fac813ed (commit) from ecce4291e6ccf51902d16cff862d3a0c729f4802 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f96f10ec66b118473fa349702fc8355e8f0412d commit 0f96f10ec66b118473fa349702fc8355e8f0412d Merge: ecce429 da12ae2 Author: Stephen Kelly AuthorDate: Tue Mar 10 19:12:18 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 19:12:18 2015 -0400 Merge topic 'refactor-cmGeneratorExpression' into next da12ae2f Add missing include. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=da12ae2f459d17c0775480df1fc71753fac813ed commit da12ae2f459d17c0775480df1fc71753fac813ed Author: Stephen Kelly AuthorDate: Wed Mar 11 00:11:41 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:11:41 2015 +0100 Add missing include. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 17254d2..673dcb9 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -12,6 +12,7 @@ #include "cmGeneratorExpressionNode.h" #include "cmGlobalGenerator.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- std::string cmGeneratorExpressionNode::EvaluateDependentExpression( ----------------------------------------------------------------------- Summary of changes: Source/cmGeneratorExpressionNode.cxx | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From steveire at gmail.com Tue Mar 10 19:13:29 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 10 Mar 2015 19:13:29 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-984-gd8c1133 Message-ID: <20150310231330.21C24AAB67@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d8c11333e86e6c8953900420228fdbc3bbe2f758 (commit) via ec428fafcf9f50c54b163dd16f68063cc387f779 (commit) via 082b6a9d78c6198dc7a9891615930c40a5c3b967 (commit) via 9df1f0fce19d893b75108fa29eb06cf6b2ce4997 (commit) from 0f96f10ec66b118473fa349702fc8355e8f0412d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d8c11333e86e6c8953900420228fdbc3bbe2f758 commit d8c11333e86e6c8953900420228fdbc3bbe2f758 Merge: 0f96f10 ec428fa Author: Stephen Kelly AuthorDate: Tue Mar 10 19:13:28 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 19:13:28 2015 -0400 Merge topic 'refactor-cmGeneratorExpression' into next ec428faf Genex: Extend cmGeneratorExpressionContext constructor. 082b6a9d Genex: Split cmGeneratorExpressionContext into own file. 9df1f0fc Genex: Split cmGeneratorExpressionNode into own file. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec428fafcf9f50c54b163dd16f68063cc387f779 commit ec428fafcf9f50c54b163dd16f68063cc387f779 Author: Stephen Kelly AuthorDate: Sun Feb 22 21:41:06 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:12:56 2015 +0100 Genex: Extend cmGeneratorExpressionContext constructor. Initialize the members in the appropriate place. diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index a4990dc..2d795cb 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -72,19 +72,10 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmGeneratorExpressionDAGChecker *dagChecker, std::string const& language) const { - cmGeneratorExpressionContext context; - context.Makefile = mf; - context.Config = config; - context.Quiet = quiet; - context.HadError = false; - context.HadContextSensitiveCondition = false; - context.HadHeadSensitiveCondition = false; - context.SourceSensitiveTargets.clear(); - context.HeadTarget = headTarget; - context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; - context.CurrentTarget = currentTarget ? currentTarget : headTarget; - context.Backtrace = this->Backtrace; - context.Language = language; + cmGeneratorExpressionContext context(mf, config, quiet, headTarget, + currentTarget ? currentTarget : headTarget, + this->EvaluateForBuildsystem, + this->Backtrace, language); return this->EvaluateWithContext(context, dagChecker); } diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx index 4ed8ff2..947015e 100644 --- a/Source/cmGeneratorExpressionContext.cxx +++ b/Source/cmGeneratorExpressionContext.cxx @@ -12,7 +12,23 @@ #include "cmGeneratorExpressionContext.h" -cmGeneratorExpressionContext::cmGeneratorExpressionContext(); - : Backtrace(NULL) +cmGeneratorExpressionContext::cmGeneratorExpressionContext( + cmMakefile* mf, std::string const& config, + bool quiet, cmTarget const* headTarget, + cmTarget const* currentTarget, + bool evaluateForBuildsystem, + cmListFileBacktrace const& backtrace, + std::string const& language) + : Backtrace(backtrace), + Makefile(mf), + Config(config), + Language(language), + HeadTarget(headTarget), + CurrentTarget(currentTarget), + Quiet(quiet), + HadError(false), + HadContextSensitiveCondition(false), + HadHeadSensitiveCondition(false), + EvaluateForBuildsystem(evaluateForBuildsystem) { } diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h index ce6f376..ed83509 100644 --- a/Source/cmGeneratorExpressionContext.h +++ b/Source/cmGeneratorExpressionContext.h @@ -23,7 +23,13 @@ class cmTarget; //---------------------------------------------------------------------------- struct cmGeneratorExpressionContext { - cmGeneratorExpressionContext(); + cmGeneratorExpressionContext(cmMakefile* mf, std::string const& config, + bool quiet, cmTarget const* headTarget, + cmTarget const* currentTarget, + bool evaluateForBuildsystem, + cmListFileBacktrace const& backtrace, + std::string const& language); + cmListFileBacktrace Backtrace; std::set DependTargets; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=082b6a9d78c6198dc7a9891615930c40a5c3b967 commit 082b6a9d78c6198dc7a9891615930c40a5c3b967 Author: Stephen Kelly AuthorDate: Wed Mar 4 23:53:22 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:12:56 2015 +0100 Genex: Split cmGeneratorExpressionContext into own file. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8d0d484..482bd39 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -238,6 +238,8 @@ set(SRCS cmFileTimeComparison.cxx cmFileTimeComparison.h cmGeneratedFileStream.cxx + cmGeneratorExpressionContext.cxx + cmGeneratorExpressionContext.h cmGeneratorExpressionDAGChecker.cxx cmGeneratorExpressionDAGChecker.h cmGeneratorExpressionEvaluator.cxx diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx new file mode 100644 index 0000000..4ed8ff2 --- /dev/null +++ b/Source/cmGeneratorExpressionContext.cxx @@ -0,0 +1,18 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmGeneratorExpressionContext.h" + +cmGeneratorExpressionContext::cmGeneratorExpressionContext(); + : Backtrace(NULL) +{ +} diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h new file mode 100644 index 0000000..ce6f376 --- /dev/null +++ b/Source/cmGeneratorExpressionContext.h @@ -0,0 +1,48 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionContext_h +#define cmGeneratorExpressionContext_h + +#include "cmListFileCache.h" + +#include +#include +#include + +class cmTarget; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionContext +{ + cmGeneratorExpressionContext(); + + cmListFileBacktrace Backtrace; + std::set DependTargets; + std::set AllTargets; + std::set SeenTargetProperties; + std::set SourceSensitiveTargets; + std::map > + MaxLanguageStandard; + cmMakefile *Makefile; + std::string Config; + std::string Language; + cmTarget const* HeadTarget; // The target whose property is being evaluated. + cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears + // directly or indirectly in the property. + bool Quiet; + bool HadError; + bool HadContextSensitiveCondition; + bool HadHeadSensitiveCondition; + bool EvaluateForBuildsystem; +}; + +#endif diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index b1fec0b..7c1bd8c 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -16,37 +16,10 @@ #include #include "cmListFileCache.h" +#include "cmGeneratorExpressionContext.h" class cmTarget; -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionContext -{ - cmGeneratorExpressionContext() - : Backtrace(NULL) - { - } - - cmListFileBacktrace Backtrace; - std::set DependTargets; - std::set AllTargets; - std::set SeenTargetProperties; - std::set SourceSensitiveTargets; - std::map > - MaxLanguageStandard; - cmMakefile *Makefile; - std::string Config; - std::string Language; - cmTarget const* HeadTarget; // The target whose property is being evaluated. - cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears - // directly or indirectly in the property. - bool Quiet; - bool HadError; - bool HadContextSensitiveCondition; - bool HadHeadSensitiveCondition; - bool EvaluateForBuildsystem; -}; - struct cmGeneratorExpressionDAGChecker; struct cmGeneratorExpressionNode; diff --git a/bootstrap b/bootstrap index 6bc87ed..4239802 100755 --- a/bootstrap +++ b/bootstrap @@ -267,6 +267,7 @@ CMAKE_CXX_SOURCES="\ cmInstallDirectoryGenerator \ cmGeneratedFileStream \ cmGeneratorTarget \ + cmGeneratorExpressionContext \ cmGeneratorExpressionDAGChecker \ cmGeneratorExpressionEvaluator \ cmGeneratorExpressionLexer \ http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9df1f0fce19d893b75108fa29eb06cf6b2ce4997 commit 9df1f0fce19d893b75108fa29eb06cf6b2ce4997 Author: Stephen Kelly AuthorDate: Sun Feb 22 23:32:11 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:12:56 2015 +0100 Genex: Split cmGeneratorExpressionNode into own file. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 5b518b8..8d0d484 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -244,6 +244,8 @@ set(SRCS cmGeneratorExpressionEvaluator.h cmGeneratorExpressionLexer.cxx cmGeneratorExpressionLexer.h + cmGeneratorExpressionNode.cxx + cmGeneratorExpressionNode.h cmGeneratorExpressionParser.cxx cmGeneratorExpressionParser.h cmGeneratorExpression.cxx diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 756d932..f2ffeef 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -24,1894 +24,7 @@ #include #include -//---------------------------------------------------------------------------- -static void reportError(cmGeneratorExpressionContext *context, - const std::string &expr, const std::string &result) -{ - context->HadError = true; - if (context->Quiet) - { - return; - } - - std::ostringstream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); -} - -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionNode -{ - enum { - DynamicParameters = 0, - OneOrMoreParameters = -1, - OneOrZeroParameters = -2 - }; - virtual ~cmGeneratorExpressionNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool RequiresLiteralInput() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const - { return false; } - - virtual int NumExpectedParameters() const { return 1; } - - virtual std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker - ) const = 0; - - static std::string EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker); -}; - -//---------------------------------------------------------------------------- -std::string cmGeneratorExpressionNode::EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker) -{ - cmGeneratorExpression ge(&context->Backtrace); - cmsys::auto_ptr cge = ge.Parse(prop); - cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); - std::string result = cge->Evaluate(makefile, - context->Config, - context->Quiet, - headTarget, - currentTarget, - dagChecker, - context->Language); - if (cge->GetHadContextSensitiveCondition()) - { - context->HadContextSensitiveCondition = true; - } - if (cge->GetHadHeadSensitiveCondition()) - { - context->HadHeadSensitiveCondition = true; - } - return result; -} - -//---------------------------------------------------------------------------- -static const struct ZeroNode : public cmGeneratorExpressionNode -{ - ZeroNode() {} - - virtual bool GeneratesContent() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return std::string(); - } -} zeroNode; - -//---------------------------------------------------------------------------- -static const struct OneNode : public cmGeneratorExpressionNode -{ - OneNode() {} - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } -} oneNode; - -//---------------------------------------------------------------------------- -static const struct OneNode buildInterfaceNode; - -//---------------------------------------------------------------------------- -static const struct ZeroNode installInterfaceNode; - -//---------------------------------------------------------------------------- -#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ -static const struct OP ## Node : public cmGeneratorExpressionNode \ -{ \ - OP ## Node () {} \ - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \ - \ - std::string Evaluate(const std::vector ¶meters, \ - cmGeneratorExpressionContext *context, \ - const GeneratorExpressionContent *content, \ - cmGeneratorExpressionDAGChecker *) const \ - { \ - std::vector::const_iterator it = parameters.begin(); \ - const std::vector::const_iterator end = parameters.end(); \ - for ( ; it != end; ++it) \ - { \ - if (*it == #FAILURE_VALUE) \ - { \ - return #FAILURE_VALUE; \ - } \ - else if (*it != #SUCCESS_VALUE) \ - { \ - reportError(context, content->GetOriginalExpression(), \ - "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ - return std::string(); \ - } \ - } \ - return #SUCCESS_VALUE; \ - } \ -} OPNAME; - -BOOLEAN_OP_NODE(andNode, AND, 1, 0) -BOOLEAN_OP_NODE(orNode, OR, 0, 1) - -#undef BOOLEAN_OP_NODE - -//---------------------------------------------------------------------------- -static const struct NotNode : public cmGeneratorExpressionNode -{ - NotNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (*parameters.begin() != "0" && *parameters.begin() != "1") - { - reportError(context, content->GetOriginalExpression(), - "$ parameter must resolve to exactly one '0' or '1' value."); - return std::string(); - } - return *parameters.begin() == "0" ? "1" : "0"; - } -} notNode; - -//---------------------------------------------------------------------------- -static const struct BoolNode : public cmGeneratorExpressionNode -{ - BoolNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0"; - } -} boolNode; - -//---------------------------------------------------------------------------- -static const struct StrEqualNode : public cmGeneratorExpressionNode -{ - StrEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return *parameters.begin() == parameters[1] ? "1" : "0"; - } -} strEqualNode; - -//---------------------------------------------------------------------------- -static const struct EqualNode : public cmGeneratorExpressionNode -{ - EqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - char *pEnd; - - int base = 0; - bool flipSign = false; - - const char *lhs = parameters[0].c_str(); - if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B")) - { - base = 2; - lhs += 2; - } - if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B")) - { - base = 2; - lhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B")) - { - base = 2; - lhs += 3; - } - - long lnum = strtol(lhs, &pEnd, base); - if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[0] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - lnum = -lnum; - } - - base = 0; - flipSign = false; - - const char *rhs = parameters[1].c_str(); - if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B")) - { - base = 2; - rhs += 2; - } - if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B")) - { - base = 2; - rhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B")) - { - base = 2; - rhs += 3; - } - - long rnum = strtol(rhs, &pEnd, base); - if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE) - { - reportError(context, content->GetOriginalExpression(), - "$ parameter " + parameters[1] + " is not a valid integer."); - return std::string(); - } - - if (flipSign) - { - rnum = -rnum; - } - - return lnum == rnum ? "1" : "0"; - } -} equalNode; - -//---------------------------------------------------------------------------- -static const struct LowerCaseNode : public cmGeneratorExpressionNode -{ - LowerCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::LowerCase(parameters.front()); - } -} lowerCaseNode; - -//---------------------------------------------------------------------------- -static const struct UpperCaseNode : public cmGeneratorExpressionNode -{ - UpperCaseNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::UpperCase(parameters.front()); - } -} upperCaseNode; - -//---------------------------------------------------------------------------- -static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode -{ - MakeCIdentifierNode() {} - - bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::MakeCidentifier(parameters.front()); - } -} makeCIdentifierNode; - -//---------------------------------------------------------------------------- -static const struct Angle_RNode : public cmGeneratorExpressionNode -{ - Angle_RNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ">"; - } -} angle_rNode; - -//---------------------------------------------------------------------------- -static const struct CommaNode : public cmGeneratorExpressionNode -{ - CommaNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ","; - } -} commaNode; - -//---------------------------------------------------------------------------- -static const struct SemicolonNode : public cmGeneratorExpressionNode -{ - SemicolonNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return ";"; - } -} semicolonNode; - -//---------------------------------------------------------------------------- -struct CompilerIdNode : public cmGeneratorExpressionNode -{ - CompilerIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerId = - context->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER_ID"); - if (parameters.empty()) - { - return compilerId ? compilerId : ""; - } - static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), compilerId) == 0) - { - return "1"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), compilerId) == 0) - { - switch(context->Makefile->GetPolicyStatus(cmPolicies::CMP0044)) - { - case cmPolicies::WARN: - { - std::ostringstream e; - e << context->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0044); - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::AUTHOR_WARNING, - e.str(), context->Backtrace); - } - case cmPolicies::OLD: - return "1"; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; - } - } - return "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerIdNode : public CompilerIdNode -{ - CCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerIdNode; - -//---------------------------------------------------------------------------- -static const struct CXXCompilerIdNode : public CompilerIdNode -{ - CXXCompilerIdNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerIdNode; - -//---------------------------------------------------------------------------- -struct CompilerVersionNode : public cmGeneratorExpressionNode -{ - CompilerVersionNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string EvaluateWithLanguage(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *, - const std::string &lang) const - { - const char *compilerVersion = context->Makefile->GetSafeDefinition( - "CMAKE_" + lang + "_COMPILER_VERSION"); - if (parameters.empty()) - { - return compilerVersion ? compilerVersion : ""; - } - - static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$"); - if (!compilerIdValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - if (!compilerVersion) - { - return parameters.front().empty() ? "1" : "0"; - } - - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.begin()->c_str(), - compilerVersion) ? "1" : "0"; - } -}; - -//---------------------------------------------------------------------------- -static const struct CCompilerVersionNode : public CompilerVersionNode -{ - CCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "C"); - } -} cCompilerVersionNode; - -//---------------------------------------------------------------------------- -static const struct CxxCompilerVersionNode : public CompilerVersionNode -{ - CxxCompilerVersionNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, - dagChecker, "CXX"); - } -} cxxCompilerVersionNode; - - -//---------------------------------------------------------------------------- -struct PlatformIdNode : public cmGeneratorExpressionNode -{ - PlatformIdNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - const char *platformId = - context->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); - if (parameters.empty()) - { - return platformId ? platformId : ""; - } - - if (!platformId) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (strcmp(parameters.begin()->c_str(), platformId) == 0) - { - return "1"; - } - return "0"; - } -} platformIdNode; - -//---------------------------------------------------------------------------- -static const struct VersionGreaterNode : public cmGeneratorExpressionNode -{ - VersionGreaterNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionGreaterNode; - -//---------------------------------------------------------------------------- -static const struct VersionLessNode : public cmGeneratorExpressionNode -{ - VersionLessNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionLessNode; - -//---------------------------------------------------------------------------- -static const struct VersionEqualNode : public cmGeneratorExpressionNode -{ - VersionEqualNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.front().c_str(), - parameters[1].c_str()) ? "1" : "0"; - } -} versionEqualNode; - -//---------------------------------------------------------------------------- -static const struct LinkOnlyNode : public cmGeneratorExpressionNode -{ - LinkOnlyNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(!dagChecker->GetTransitivePropertiesOnly()) - { - return parameters.front(); - } - return ""; - } -} linkOnlyNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationNode : public cmGeneratorExpressionNode -{ - ConfigurationNode() {} - - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - context->HadContextSensitiveCondition = true; - return context->Config; - } -} configurationNode; - -//---------------------------------------------------------------------------- -static const struct ConfigurationTestNode : public cmGeneratorExpressionNode -{ - ConfigurationTestNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (parameters.empty()) - { - return configurationNode.Evaluate(parameters, context, content, 0); - } - static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$"); - if (!configValidator.find(*parameters.begin())) - { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - context->HadContextSensitiveCondition = true; - if (context->Config.empty()) - { - return parameters.front().empty() ? "1" : "0"; - } - - if (cmsysString_strcasecmp(parameters.begin()->c_str(), - context->Config.c_str()) == 0) - { - return "1"; - } - - if (context->CurrentTarget - && context->CurrentTarget->IsImported()) - { - const char* loc = 0; - const char* imp = 0; - std::string suffix; - if (context->CurrentTarget->GetMappedConfig(context->Config, - &loc, - &imp, - suffix)) - { - // This imported target has an appropriate location - // for this (possibly mapped) config. - // Check if there is a proper config mapping for the tested config. - std::vector mappedConfigs; - std::string mapProp = "MAP_IMPORTED_CONFIG_"; - mapProp += cmSystemTools::UpperCase(context->Config); - if(const char* mapValue = - context->CurrentTarget->GetProperty(mapProp)) - { - cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), - mappedConfigs); - return std::find(mappedConfigs.begin(), mappedConfigs.end(), - cmSystemTools::UpperCase(parameters.front())) - != mappedConfigs.end() ? "1" : "0"; - } - } - } - return "0"; - } -} configurationTestNode; - -static const struct JoinNode : public cmGeneratorExpressionNode -{ - JoinNode() {} - - virtual int NumExpectedParameters() const { return 2; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - std::vector list; - cmSystemTools::ExpandListArgument(parameters.front(), list); - return cmJoin(list, parameters[1]); - } -} joinNode; - -static const struct CompileLanguageNode : public cmGeneratorExpressionNode -{ - CompileLanguageNode() {} - - virtual int NumExpectedParameters() const { return OneOrZeroParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - if(context->Language.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used to specify include " - "directories compile definitions, compile options and to evaluate " - "components of the file(GENERATE) command."); - return std::string(); - } - - std::vector enabledLanguages; - cmGlobalGenerator* gg - = context->Makefile->GetLocalGenerator()->GetGlobalGenerator(); - gg->GetEnabledLanguages(enabledLanguages); - if (!parameters.empty() && - std::find(enabledLanguages.begin(), enabledLanguages.end(), - parameters.front()) == enabledLanguages.end()) - { - reportError(context, content->GetOriginalExpression(), - "$ Unknown language."); - return std::string(); - } - - std::string genName = gg->GetName(); - if (genName.find("Visual Studio") != std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ may not be used with Visual Studio " - "generators."); - return std::string(); - } - else if (genName.find("Xcode") != std::string::npos) - { - if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() - || dagChecker->EvaluatingIncludeDirectories())) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with COMPILE_OPTIONS " - "with the Xcode generator."); - return std::string(); - } - } - else - { - if(genName.find("Makefiles") == std::string::npos && - genName.find("Ninja") == std::string::npos && - genName.find("Watcom WMake") == std::string::npos) - { - reportError(context, content->GetOriginalExpression(), - "$ not supported for this generator."); - return std::string(); - } - } - if (parameters.empty()) - { - return context->Language; - } - return context->Language == parameters.front() ? "1" : "0"; - } -} languageNode; - -#define TRANSITIVE_PROPERTY_NAME(PROPERTY) \ - , "INTERFACE_" #PROPERTY - -//---------------------------------------------------------------------------- -static const char* targetPropertyTransitiveWhitelist[] = { - 0 - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME) -}; - -#undef TRANSITIVE_PROPERTY_NAME - -template -std::string -getLinkedTargetsContent( - std::vector const &libraries, - cmTarget const* target, - cmTarget const* headTarget, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string &interfacePropertyName) -{ - std::string linkedTargetsContent; - std::string sep; - std::string depString; - for (typename std::vector::const_iterator it = libraries.begin(); - it != libraries.end(); ++it) - { - // Broken code can have a target in its own link interface. - // Don't follow such link interface entries so as not to create a - // self-referencing loop. - if (it->Target && it->Target != target) - { - depString += - sep + "$Target->GetName() + "," + interfacePropertyName + ">"; - sep = ";"; - } - } - if(!depString.empty()) - { - linkedTargetsContent = - cmGeneratorExpressionNode::EvaluateDependentExpression(depString, - target->GetMakefile(), context, - headTarget, target, dagChecker); - } - linkedTargetsContent = - cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); - return linkedTargetsContent; -} - -//---------------------------------------------------------------------------- -static const struct TargetPropertyNode : public cmGeneratorExpressionNode -{ - TargetPropertyNode() {} - - // This node handles errors on parameter count itself. - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagCheckerParent - ) const - { - if (parameters.size() != 1 && parameters.size() != 2) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires one or two parameters"); - return std::string(); - } - static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); - - cmTarget const* target = context->HeadTarget; - std::string propertyName = *parameters.begin(); - - if (parameters.size() == 1) - { - context->HadHeadSensitiveCondition = true; - } - if (!target && parameters.size() == 1) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. " - "It may not be used with add_custom_command or add_custom_target. " - "Specify the target to read a property from using the " - "$ signature instead."); - return std::string(); - } - - if (parameters.size() == 2) - { - if (parameters.begin()->empty() && parameters[1].empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name and property name."); - return std::string(); - } - if (parameters.begin()->empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty " - "target name."); - return std::string(); - } - - std::string targetName = parameters.front(); - propertyName = parameters[1]; - if (!cmGeneratorExpression::IsValidTargetName(targetName)) - { - if (!propertyNameValidator.find(propertyName.c_str())) - { - ::reportError(context, content->GetOriginalExpression(), - "Target name and property name not supported."); - return std::string(); - } - ::reportError(context, content->GetOriginalExpression(), - "Target name not supported."); - return std::string(); - } - if(propertyName == "ALIASED_TARGET") - { - if(context->Makefile->IsAlias(targetName)) - { - if(cmTarget* tgt = context->Makefile->FindTargetToUse(targetName)) - { - return tgt->GetName(); - } - } - return ""; - } - target = context->Makefile->FindTargetToUse(targetName); - - if (!target) - { - std::ostringstream e; - e << "Target \"" - << targetName - << "\" not found."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - context->AllTargets.insert(target); - } - - if (target == context->HeadTarget) - { - // Keep track of the properties seen while processing. - // The evaluation of the LINK_LIBRARIES generator expressions - // will check this to ensure that properties have one consistent - // value for all evaluations. - context->SeenTargetProperties.insert(propertyName); - } - if (propertyName == "SOURCES") - { - context->SourceSensitiveTargets.insert(target); - } - - if (propertyName.empty()) - { - reportError(context, content->GetOriginalExpression(), - "$ expression requires a non-empty property " - "name."); - return std::string(); - } - - if (!propertyNameValidator.find(propertyName)) - { - ::reportError(context, content->GetOriginalExpression(), - "Property name not supported."); - return std::string(); - } - - assert(target); - - if (propertyName == "LINKER_LANGUAGE") - { - if (target->LinkLanguagePropagatesToDependents() && - dagCheckerParent && (dagCheckerParent->EvaluatingLinkLibraries() - || dagCheckerParent->EvaluatingSources())) - { - reportError(context, content->GetOriginalExpression(), - "LINKER_LANGUAGE target property can not be used while evaluating " - "link libraries for a static library"); - return std::string(); - } - return target->GetLinkerLanguage(context->Config); - } - - cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, - target->GetName(), - propertyName, - content, - dagCheckerParent); - - switch (dagChecker.Check()) - { - case cmGeneratorExpressionDAGChecker::SELF_REFERENCE: - dagChecker.ReportError(context, content->GetOriginalExpression()); - return std::string(); - case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: - // No error. We just skip cyclic references. - return std::string(); - case cmGeneratorExpressionDAGChecker::ALREADY_SEEN: - for (size_t i = 1; - i < cmArraySize(targetPropertyTransitiveWhitelist); - ++i) - { - if (targetPropertyTransitiveWhitelist[i] == propertyName) - { - // No error. We're not going to find anything new here. - return std::string(); - } - } - case cmGeneratorExpressionDAGChecker::DAG: - break; - } - - const char *prop = target->GetProperty(propertyName); - - if (dagCheckerParent) - { - if (dagCheckerParent->EvaluatingLinkLibraries()) - { -#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ - (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || - if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE) - false) - { - reportError(context, content->GetOriginalExpression(), - "$ expression in link libraries " - "evaluation depends on target property which is transitive " - "over the link libraries, creating a recursion."); - return std::string(); - } -#undef TRANSITIVE_PROPERTY_COMPARE - - if(!prop) - { - return std::string(); - } - } - else - { -#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) \ - dagCheckerParent->METHOD () || - - assert( - CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( - ASSERT_TRANSITIVE_PROPERTY_METHOD) - false); -#undef ASSERT_TRANSITIVE_PROPERTY_METHOD - } - } - - std::string linkedTargetsContent; - - std::string interfacePropertyName; - bool isInterfaceProperty = false; - -#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \ - if (propertyName == #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - } \ - else if (propertyName == "INTERFACE_" #prop) \ - { \ - interfacePropertyName = "INTERFACE_" #prop; \ - isInterfaceProperty = true; \ - } \ - else - - CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME) - // Note that the above macro terminates with an else - /* else */ if (cmHasLiteralPrefix(propertyName.c_str(), - "COMPILE_DEFINITIONS_")) - { - cmPolicies::PolicyStatus polSt = - context->Makefile->GetPolicyStatus(cmPolicies::CMP0043); - if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) - { - interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; - } - } -#undef POPULATE_INTERFACE_PROPERTY_NAME - cmTarget const* headTarget = context->HeadTarget && isInterfaceProperty - ? context->HeadTarget : target; - - if(isInterfaceProperty) - { - if(cmTarget::LinkInterfaceLibraries const* iface = - target->GetLinkInterfaceLibraries(context->Config, headTarget, true)) - { - linkedTargetsContent = - getLinkedTargetsContent(iface->Libraries, target, - headTarget, - context, &dagChecker, - interfacePropertyName); - } - } - else if(!interfacePropertyName.empty()) - { - if(cmTarget::LinkImplementationLibraries const* impl = - target->GetLinkImplementationLibraries(context->Config)) - { - linkedTargetsContent = - getLinkedTargetsContent(impl->Libraries, target, - target, - context, &dagChecker, - interfacePropertyName); - } - } - - if (!prop) - { - if (target->IsImported() - || target->GetType() == cmTarget::INTERFACE_LIBRARY) - { - return linkedTargetsContent; - } - if (target->IsLinkInterfaceDependentBoolProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - return target->GetLinkInterfaceDependentBoolProperty( - propertyName, - context->Config) ? "1" : "0"; - } - if (target->IsLinkInterfaceDependentStringProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentStringProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - - return linkedTargetsContent; - } - - if (!target->IsImported() - && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) - { - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMinProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) - { - context->HadContextSensitiveCondition = true; - const char *propContent = - target->GetLinkInterfaceDependentNumberMaxProperty( - propertyName, - context->Config); - return propContent ? propContent : ""; - } - } - if(!interfacePropertyName.empty()) - { - std::string result = this->EvaluateDependentExpression(prop, - context->Makefile, context, - headTarget, target, &dagChecker); - if (!linkedTargetsContent.empty()) - { - result += (result.empty() ? "" : ";") + linkedTargetsContent; - } - return result; - } - return prop; - } -} targetPropertyNode; - -//---------------------------------------------------------------------------- -static const struct TargetNameNode : public cmGeneratorExpressionNode -{ - TargetNameNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool AcceptsArbitraryContentParameter() const { return true; } - virtual bool RequiresLiteralInput() const { return true; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *, - const GeneratorExpressionContent *, - cmGeneratorExpressionDAGChecker *) const - { - return parameters.front(); - } - - virtual int NumExpectedParameters() const { return 1; } - -} targetNameNode; - -//---------------------------------------------------------------------------- -static const struct TargetObjectsNode : public cmGeneratorExpressionNode -{ - TargetObjectsNode() {} - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->EvaluateForBuildsystem) - { - std::ostringstream e; - e << "The evaluation of the TARGET_OBJECTS generator expression " - "is only suitable for consumption by CMake. It is not suitable " - "for writing out elsewhere."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::string tgtName = parameters.front(); - cmGeneratorTarget* gt = - context->Makefile->FindGeneratorTargetToUse(tgtName); - if (!gt) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but no such target exists."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - if (gt->GetType() != cmTarget::OBJECT_LIBRARY) - { - std::ostringstream e; - e << "Objects of target \"" << tgtName - << "\" referenced but is not an OBJECT library."; - reportError(context, content->GetOriginalExpression(), e.str()); - return std::string(); - } - - std::vector objectSources; - gt->GetObjectSources(objectSources, context->Config); - std::map mapping; - - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - mapping[*it]; - } - - gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - - std::string obj_dir = gt->ObjectDirectory; - std::string result; - const char* sep = ""; - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - // Find the object file name corresponding to this source file. - std::map::const_iterator - map_it = mapping.find(*it); - // It must exist because we populated the mapping just above. - assert(!map_it->second.empty()); - result += sep; - std::string objFile = obj_dir + map_it->second; - cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true); - sf->SetObjectLibrary(tgtName); - sf->SetProperty("EXTERNAL_OBJECT", "1"); - result += objFile; - sep = ";"; - } - return result; - } -} targetObjectsNode; - -//---------------------------------------------------------------------------- -static const struct CompileFeaturesNode : public cmGeneratorExpressionNode -{ - CompileFeaturesNode() {} - - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - cmTarget const* target = context->HeadTarget; - if (!target) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - context->HadHeadSensitiveCondition = true; - - typedef std::map > LangMap; - static LangMap availableFeatures; - - LangMap testedFeatures; - - for (std::vector::const_iterator it = parameters.begin(); - it != parameters.end(); ++it) - { - std::string error; - std::string lang; - if (!context->Makefile->CompileFeatureKnown(context->HeadTarget, - *it, lang, &error)) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - testedFeatures[lang].push_back(*it); - - if (availableFeatures.find(lang) == availableFeatures.end()) - { - const char* featuresKnown - = context->Makefile->CompileFeaturesAvailable(lang, &error); - if (!featuresKnown) - { - reportError(context, content->GetOriginalExpression(), error); - return std::string(); - } - cmSystemTools::ExpandListArgument(featuresKnown, - availableFeatures[lang]); - } - } - - bool evalLL = dagChecker && dagChecker->EvaluatingLinkLibraries(); - - std::string result; - - for (LangMap::const_iterator lit = testedFeatures.begin(); - lit != testedFeatures.end(); ++lit) - { - std::vector const& langAvailable - = availableFeatures[lit->first]; - const char* standardDefault = context->Makefile - ->GetDefinition("CMAKE_" + lit->first + "_STANDARD_DEFAULT"); - for (std::vector::const_iterator it = lit->second.begin(); - it != lit->second.end(); ++it) - { - if (std::find(langAvailable.begin(), langAvailable.end(), *it) - == langAvailable.end()) - { - return "0"; - } - if (standardDefault && !*standardDefault) - { - // This compiler has no notion of language standard levels. - // All features known for the language are always available. - continue; - } - if (!context->Makefile->HaveStandardAvailable(target, - lit->first, *it)) - { - if (evalLL) - { - const char* l = target->GetProperty(lit->first + "_STANDARD"); - if (!l) - { - l = standardDefault; - } - assert(l); - context->MaxLanguageStandard[target][lit->first] = l; - } - else - { - return "0"; - } - } - } - } - return "1"; - } -} compileFeaturesNode; - -//---------------------------------------------------------------------------- -static const char* targetPolicyWhitelist[] = { - 0 -#define TARGET_POLICY_STRING(POLICY) \ - , #POLICY - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING) - -#undef TARGET_POLICY_STRING -}; - -cmPolicies::PolicyStatus statusForTarget(cmTarget const* tgt, - const char *policy) -{ -#define RETURN_POLICY(POLICY) \ - if (strcmp(policy, #POLICY) == 0) \ - { \ - return tgt->GetPolicyStatus ## POLICY (); \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY) - -#undef RETURN_POLICY - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::WARN; -} - -cmPolicies::PolicyID policyForString(const char *policy_id) -{ -#define RETURN_POLICY_ID(POLICY_ID) \ - if (strcmp(policy_id, #POLICY_ID) == 0) \ - { \ - return cmPolicies:: POLICY_ID; \ - } \ - - CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID) - -#undef RETURN_POLICY_ID - - assert(0 && "Unreachable code. Not a valid policy"); - return cmPolicies::CMP0002; -} - -//---------------------------------------------------------------------------- -static const struct TargetPolicyNode : public cmGeneratorExpressionNode -{ - TargetPolicyNode() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context , - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - if (!context->HeadTarget) - { - reportError(context, content->GetOriginalExpression(), - "$ may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - - context->HadContextSensitiveCondition = true; - context->HadHeadSensitiveCondition = true; - - for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) - { - const char *policy = targetPolicyWhitelist[i]; - if (parameters.front() == policy) - { - cmMakefile *mf = context->HeadTarget->GetMakefile(); - switch(statusForTarget(context->HeadTarget, policy)) - { - case cmPolicies::WARN: - mf->IssueMessage(cmake::AUTHOR_WARNING, - mf->GetPolicies()-> - GetPolicyWarning(policyForString(policy))); - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::OLD: - return "0"; - case cmPolicies::NEW: - return "1"; - } - } - } - reportError(context, content->GetOriginalExpression(), - "$ may only be used with a limited number of " - "policies. Currently it may be used with the following policies:\n" - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -#define TARGET_POLICY_LIST_ITEM(POLICY) \ - " * " STRINGIFY(POLICY) "\n" - - CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM) - -#undef TARGET_POLICY_LIST_ITEM - ); - return std::string(); - } - -} targetPolicyNode; - -//---------------------------------------------------------------------------- -static const struct InstallPrefixNode : public cmGeneratorExpressionNode -{ - InstallPrefixNode() {} - - virtual bool GeneratesContent() const { return true; } - virtual int NumExpectedParameters() const { return 0; } - - std::string Evaluate(const std::vector &, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *) const - { - reportError(context, content->GetOriginalExpression(), - "INSTALL_PREFIX is a marker for install(EXPORT) only. It " - "should never be evaluated."); - return std::string(); - } - -} installPrefixNode; - -//---------------------------------------------------------------------------- -class ArtifactNameTag; -class ArtifactLinkerTag; -class ArtifactSonameTag; -class ArtifactPdbTag; - -class ArtifactPathTag; -class ArtifactDirTag; -class ArtifactNameTag; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The target soname file (.so.1). - if(target->IsDLLPlatform()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is not allowed " - "for DLL target platforms."); - return std::string(); - } - if(target->GetType() != cmTarget::SHARED_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_SONAME_FILE is allowed only for " - "SHARED libraries."); - return std::string(); - } - std::string result = target->GetDirectory(context->Config); - result += "/"; - result += target->GetSOName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - std::string language = target->GetLinkerLanguage(context->Config); - - std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; - - if(!context->Makefile->IsOn(pdbSupportVar)) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is not supported by the target linker."); - return std::string(); - } - - cmTarget::TargetType targetType = target->GetType(); - - if(targetType != cmTarget::SHARED_LIBRARY && - targetType != cmTarget::MODULE_LIBRARY && - targetType != cmTarget::EXECUTABLE) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_FILE is allowed only for " - "targets with linker created artifacts."); - return std::string(); - } - - std::string result = target->GetPDBDirectory(context->Config); - result += "/"; - result += target->GetPDBName(context->Config); - return result; - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content) - { - // The file used to link to the target (.so, .lib, .a). - if(!target->IsLinkable()) - { - ::reportError(context, content->GetOriginalExpression(), - "TARGET_LINKER_FILE is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); - return std::string(); - } - return target->GetFullPath(context->Config, - target->HasImportLibrary()); - } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultCreator -{ - static std::string Create(cmTarget* target, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *) - { - return target->GetFullPath(context->Config, false, true); - } -}; - - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result); -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenameName(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return cmSystemTools::GetFilenamePath(result); } -}; - -//---------------------------------------------------------------------------- -template<> -struct TargetFilesystemArtifactResultGetter -{ - static std::string Get(const std::string &result) - { return result; } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifact : public cmGeneratorExpressionNode -{ - TargetFilesystemArtifact() {} - - virtual int NumExpectedParameters() const { return 1; } - - std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker) const - { - // Lookup the referenced target. - std::string name = *parameters.begin(); - - if (!cmGeneratorExpression::IsValidTargetName(name)) - { - ::reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } - cmTarget* target = context->Makefile->FindTargetToUse(name); - if(!target) - { - ::reportError(context, content->GetOriginalExpression(), - "No target \"" + name + "\""); - return std::string(); - } - if(target->GetType() >= cmTarget::OBJECT_LIBRARY && - target->GetType() != cmTarget::UNKNOWN_LIBRARY) - { - ::reportError(context, content->GetOriginalExpression(), - "Target \"" + name + "\" is not an executable or library."); - return std::string(); - } - if (dagChecker && (dagChecker->EvaluatingLinkLibraries(name.c_str()) - || (dagChecker->EvaluatingSources() - && name == dagChecker->TopTarget()))) - { - ::reportError(context, content->GetOriginalExpression(), - "Expressions which require the linker language may not " - "be used while evaluating link libraries"); - return std::string(); - } - context->DependTargets.insert(target); - context->AllTargets.insert(target); - - std::string result = - TargetFilesystemArtifactResultCreator::Create( - target, - context, - content); - if (context->HadError) - { - return std::string(); - } - return - TargetFilesystemArtifactResultGetter::Get(result); - } -}; - -//---------------------------------------------------------------------------- -template -struct TargetFilesystemArtifactNodeGroup -{ - TargetFilesystemArtifactNodeGroup() - { - } - - TargetFilesystemArtifact File; - TargetFilesystemArtifact FileName; - TargetFilesystemArtifact FileDir; -}; - -//---------------------------------------------------------------------------- -static const -TargetFilesystemArtifactNodeGroup targetNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetLinkerNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetSoNameNodeGroup; - -static const -TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; - -//---------------------------------------------------------------------------- -static const -cmGeneratorExpressionNode* GetNode(const std::string &identifier) -{ - typedef std::map NodeMap; - static NodeMap nodeMap; - if (nodeMap.empty()) - { - nodeMap["0"] = &zeroNode; - nodeMap["1"] = &oneNode; - nodeMap["AND"] = &andNode; - nodeMap["OR"] = &orNode; - nodeMap["NOT"] = ¬Node; - nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; - nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; - nodeMap["VERSION_GREATER"] = &versionGreaterNode; - nodeMap["VERSION_LESS"] = &versionLessNode; - nodeMap["VERSION_EQUAL"] = &versionEqualNode; - nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; - nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; - nodeMap["PLATFORM_ID"] = &platformIdNode; - nodeMap["COMPILE_FEATURES"] = &compileFeaturesNode; - nodeMap["CONFIGURATION"] = &configurationNode; - nodeMap["CONFIG"] = &configurationTestNode; - nodeMap["TARGET_FILE"] = &targetNodeGroup.File; - nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; - nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; - nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; - nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; - nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; - nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; - nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; - nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; - nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; - nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; - nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; - nodeMap["STREQUAL"] = &strEqualNode; - nodeMap["EQUAL"] = &equalNode; - nodeMap["LOWER_CASE"] = &lowerCaseNode; - nodeMap["UPPER_CASE"] = &upperCaseNode; - nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; - nodeMap["BOOL"] = &boolNode; - nodeMap["ANGLE-R"] = &angle_rNode; - nodeMap["COMMA"] = &commaNode; - nodeMap["SEMICOLON"] = &semicolonNode; - nodeMap["TARGET_PROPERTY"] = &targetPropertyNode; - nodeMap["TARGET_NAME"] = &targetNameNode; - nodeMap["TARGET_OBJECTS"] = &targetObjectsNode; - nodeMap["TARGET_POLICY"] = &targetPolicyNode; - nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; - nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; - nodeMap["INSTALL_PREFIX"] = &installPrefixNode; - nodeMap["JOIN"] = &joinNode; - nodeMap["LINK_ONLY"] = &linkOnlyNode; - nodeMap["COMPILE_LANGUAGE"] = &languageNode; - } - NodeMap::const_iterator i = nodeMap.find(identifier); - if (i == nodeMap.end()) - { - return 0; - } - return i->second; - -} +#include "cmGeneratorExpressionNode.h" //---------------------------------------------------------------------------- GeneratorExpressionContent::GeneratorExpressionContent( @@ -2000,7 +113,8 @@ std::string GeneratorExpressionContent::Evaluate( } } - const cmGeneratorExpressionNode *node = GetNode(identifier); + const cmGeneratorExpressionNode *node = + cmGeneratorExpressionNode::GetNode(identifier); if (!node) { diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionNode.cxx similarity index 87% copy from Source/cmGeneratorExpressionEvaluator.cxx copy to Source/cmGeneratorExpressionNode.cxx index 756d932..673dcb9 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -9,71 +9,10 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "cmMakefile.h" -#include "cmGeneratorExpressionEvaluator.h" -#include "cmGeneratorExpressionParser.h" -#include "cmGeneratorExpressionDAGChecker.h" -#include "cmGeneratorExpression.h" -#include "cmLocalGenerator.h" +#include "cmGeneratorExpressionNode.h" #include "cmGlobalGenerator.h" -#include "cmSourceFile.h" - -#include - -#include -#include - -//---------------------------------------------------------------------------- -static void reportError(cmGeneratorExpressionContext *context, - const std::string &expr, const std::string &result) -{ - context->HadError = true; - if (context->Quiet) - { - return; - } - - std::ostringstream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), - context->Backtrace); -} - -//---------------------------------------------------------------------------- -struct cmGeneratorExpressionNode -{ - enum { - DynamicParameters = 0, - OneOrMoreParameters = -1, - OneOrZeroParameters = -2 - }; - virtual ~cmGeneratorExpressionNode() {} - - virtual bool GeneratesContent() const { return true; } - - virtual bool RequiresLiteralInput() const { return false; } - - virtual bool AcceptsArbitraryContentParameter() const - { return false; } - - virtual int NumExpectedParameters() const { return 1; } - - virtual std::string Evaluate(const std::vector ¶meters, - cmGeneratorExpressionContext *context, - const GeneratorExpressionContent *content, - cmGeneratorExpressionDAGChecker *dagChecker - ) const = 0; - - static std::string EvaluateDependentExpression( - std::string const& prop, cmMakefile *makefile, - cmGeneratorExpressionContext *context, - cmTarget const* headTarget, cmTarget const* currentTarget, - cmGeneratorExpressionDAGChecker *dagChecker); -}; +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- std::string cmGeneratorExpressionNode::EvaluateDependentExpression( @@ -840,7 +779,6 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode "$ Unknown language."); return std::string(); } - std::string genName = gg->GetName(); if (genName.find("Visual Studio") != std::string::npos) { @@ -1849,8 +1787,8 @@ static const TargetFilesystemArtifactNodeGroup targetPdbNodeGroup; //---------------------------------------------------------------------------- -static const -cmGeneratorExpressionNode* GetNode(const std::string &identifier) +const cmGeneratorExpressionNode* +cmGeneratorExpressionNode::GetNode(const std::string &identifier) { typedef std::map NodeMap; static NodeMap nodeMap; @@ -1910,229 +1848,23 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) return 0; } return i->second; - -} - -//---------------------------------------------------------------------------- -GeneratorExpressionContent::GeneratorExpressionContent( - const char *startContent, - size_t length) - : StartContent(startContent), ContentLength(length) -{ - -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::GetOriginalExpression() const -{ - return std::string(this->StartContent, this->ContentLength); -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::ProcessArbitraryContent( - const cmGeneratorExpressionNode *node, - const std::string &identifier, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - std::vector >::const_iterator - pit) const -{ - std::string result; - - const - std::vector >::const_iterator - pend = this->ParamChildren.end(); - for ( ; pit != pend; ++pit) - { - std::vector::const_iterator it - = pit->begin(); - const std::vector::const_iterator end - = pit->end(); - for ( ; it != end; ++it) - { - if (node->RequiresLiteralInput()) - { - if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires literal input."); - return std::string(); - } - } - result += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - if ((pit + 1) != pend) - { - result += ","; - } - } - if (node->RequiresLiteralInput()) - { - std::vector parameters; - parameters.push_back(result); - return node->Evaluate(parameters, context, this, dagChecker); - } - return result; -} - -//---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::Evaluate( - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker) const -{ - std::string identifier; - { - std::vector::const_iterator it - = this->IdentifierChildren.begin(); - const std::vector::const_iterator end - = this->IdentifierChildren.end(); - for ( ; it != end; ++it) - { - identifier += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - } - - const cmGeneratorExpressionNode *node = GetNode(identifier); - - if (!node) - { - reportError(context, this->GetOriginalExpression(), - "Expression did not evaluate to a known generator expression"); - return std::string(); - } - - if (!node->GeneratesContent()) - { - if (node->NumExpectedParameters() == 1 - && node->AcceptsArbitraryContentParameter()) - { - if (this->ParamChildren.empty()) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires a parameter."); - } - } - else - { - std::vector parameters; - this->EvaluateParameters(node, identifier, context, dagChecker, - parameters); - } - return std::string(); - } - - std::vector parameters; - this->EvaluateParameters(node, identifier, context, dagChecker, parameters); - if (context->HadError) - { - return std::string(); - } - - return node->Evaluate(parameters, context, this, dagChecker); } //---------------------------------------------------------------------------- -std::string GeneratorExpressionContent::EvaluateParameters( - const cmGeneratorExpressionNode *node, - const std::string &identifier, - cmGeneratorExpressionContext *context, - cmGeneratorExpressionDAGChecker *dagChecker, - std::vector ¶meters) const +void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result) { - const int numExpected = node->NumExpectedParameters(); - { - std::vector >::const_iterator - pit = this->ParamChildren.begin(); - const - std::vector >::const_iterator - pend = this->ParamChildren.end(); - const bool acceptsArbitraryContent - = node->AcceptsArbitraryContentParameter(); - int counter = 1; - for ( ; pit != pend; ++pit, ++counter) - { - if (acceptsArbitraryContent && counter == numExpected) - { - std::string lastParam = this->ProcessArbitraryContent(node, identifier, - context, - dagChecker, - pit); - parameters.push_back(lastParam); - return std::string(); - } - else - { - std::string parameter; - std::vector::const_iterator it = - pit->begin(); - const std::vector::const_iterator end = - pit->end(); - for ( ; it != end; ++it) - { - parameter += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - parameters.push_back(parameter); - } - } - } - - if ((numExpected > cmGeneratorExpressionNode::DynamicParameters - && (unsigned int)numExpected != parameters.size())) - { - if (numExpected == 0) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires no parameters."); - } - else if (numExpected == 1) - { - reportError(context, this->GetOriginalExpression(), - "$<" + identifier + "> expression requires " - "exactly one parameter."); - } - else - { - std::ostringstream e; - e << "$<" + identifier + "> expression requires " - << numExpected - << " comma separated parameters, but got " - << parameters.size() << " instead."; - reportError(context, this->GetOriginalExpression(), e.str()); - } - return std::string(); - } - - if (numExpected == cmGeneratorExpressionNode::OneOrMoreParameters - && parameters.empty()) - { - reportError(context, this->GetOriginalExpression(), "$<" + identifier - + "> expression requires at least one parameter."); - } - if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters - && parameters.size() > 1) + context->HadError = true; + if (context->Quiet) { - reportError(context, this->GetOriginalExpression(), "$<" + identifier - + "> expression requires one or zero parameters."); + return; } - return std::string(); -} -//---------------------------------------------------------------------------- -GeneratorExpressionContent::~GeneratorExpressionContent() -{ - cmDeleteAll(this->IdentifierChildren); - std::for_each(this->ParamChildren.begin(), this->ParamChildren.end(), - cmDeleteAll >); + std::ostringstream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << result; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str(), + context->Backtrace); } diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h new file mode 100644 index 0000000..847a00a --- /dev/null +++ b/Source/cmGeneratorExpressionNode.h @@ -0,0 +1,70 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorExpressionNode_h +#define cmGeneratorExpressionNode_h + +#include "cmMakefile.h" + +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionParser.h" +#include "cmGeneratorExpressionDAGChecker.h" +#include "cmGeneratorExpression.h" +#include "cmLocalGenerator.h" +#include "cmSourceFile.h" + +#include + +#include +#include + +#include "cmListFileCache.h" + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionNode +{ + enum { + DynamicParameters = 0, + OneOrMoreParameters = -1, + OneOrZeroParameters = -2 + }; + virtual ~cmGeneratorExpressionNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool RequiresLiteralInput() const { return false; } + + virtual bool AcceptsArbitraryContentParameter() const + { return false; } + + virtual int NumExpectedParameters() const { return 1; } + + virtual std::string Evaluate(const std::vector ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content, + cmGeneratorExpressionDAGChecker *dagChecker + ) const = 0; + + static std::string EvaluateDependentExpression( + std::string const& prop, cmMakefile *makefile, + cmGeneratorExpressionContext *context, + cmTarget const* headTarget, cmTarget const* currentTarget, + cmGeneratorExpressionDAGChecker *dagChecker); + + static const cmGeneratorExpressionNode* GetNode( + const std::string &identifier); +}; + +//---------------------------------------------------------------------------- +void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result); + +#endif diff --git a/bootstrap b/bootstrap index 320552a..6bc87ed 100755 --- a/bootstrap +++ b/bootstrap @@ -270,6 +270,7 @@ CMAKE_CXX_SOURCES="\ cmGeneratorExpressionDAGChecker \ cmGeneratorExpressionEvaluator \ cmGeneratorExpressionLexer \ + cmGeneratorExpressionNode \ cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Tue Mar 10 19:15:49 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 10 Mar 2015 19:15:49 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-988-g94425f4 Message-ID: <20150310231549.885F0AB0EE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 94425f4dc9e3812818f15bf57cf01236ce86d3db (commit) via ed6c614f7b76a0ca8ab82acb36c62c1775f22c75 (commit) via 1a8073bea3764f60b1110ef86c6ab2e81eef59e9 (commit) via c1a0315c964dc76d3531ab412eb152444f2b241e (commit) from d8c11333e86e6c8953900420228fdbc3bbe2f758 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94425f4dc9e3812818f15bf57cf01236ce86d3db commit 94425f4dc9e3812818f15bf57cf01236ce86d3db Merge: d8c1133 ed6c614 Author: Stephen Kelly AuthorDate: Tue Mar 10 19:15:46 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 19:15:46 2015 -0400 Merge topic 'cmAlgorithms-cleanup' into next ed6c614f cmRemoveDuplicates: Fix iterator -> const_iterator. 1a8073be cmInstalledFile: Move Property implementation out of line. c1a0315c Include cmAlgorithms where it is used. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed6c614f7b76a0ca8ab82acb36c62c1775f22c75 commit ed6c614f7b76a0ca8ab82acb36c62c1775f22c75 Author: Stephen Kelly AuthorDate: Sun Mar 8 14:04:54 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:14:41 2015 +0100 cmRemoveDuplicates: Fix iterator -> const_iterator. diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index b9d7e78..f032de7 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -269,7 +269,7 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) unique.reserve(r.size()); std::vector indices; size_t count = 0; - const typename Range::iterator end = r.end(); + const typename Range::const_iterator end = r.end(); for(typename Range::const_iterator it = r.begin(); it != end; ++it, ++count) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a8073bea3764f60b1110ef86c6ab2e81eef59e9 commit 1a8073bea3764f60b1110ef86c6ab2e81eef59e9 Author: Stephen Kelly AuthorDate: Sun Mar 8 13:37:44 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:14:41 2015 +0100 cmInstalledFile: Move Property implementation out of line. Don't require re-building the world when changing cmAlgorithms.h. diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index 4b53752..8c52b48 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -12,6 +12,7 @@ #include "cmInstalledFile.h" #include "cmSystemTools.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmInstalledFile::cmInstalledFile(): @@ -29,6 +30,16 @@ cmInstalledFile::~cmInstalledFile() } } +cmInstalledFile::Property::Property() +{ + +} + +cmInstalledFile::Property::~Property() +{ + cmDeleteAll(this->ValueExpressions); +} + //---------------------------------------------------------------------------- void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) { diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index cdb0866..3af90a7 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -13,7 +13,6 @@ #define cmInstalledFile_h #include "cmGeneratorExpression.h" -#include "cmAlgorithms.h" /** \class cmInstalledFile * \brief Represents a file intended for installation. @@ -32,15 +31,8 @@ public: struct Property { - Property() - { - - } - - ~Property() - { - cmDeleteAll(this->ValueExpressions); - } + Property(); + ~Property(); ExpressionVectorType ValueExpressions; }; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1a0315c964dc76d3531ab412eb152444f2b241e commit c1a0315c964dc76d3531ab412eb152444f2b241e Author: Stephen Kelly AuthorDate: Sun Mar 8 13:51:20 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:14:41 2015 +0100 Include cmAlgorithms where it is used. diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index fe27e2b..29e07ef 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -20,6 +20,7 @@ #include "cmGeneratedFileStream.h" #include "cmXMLSafe.h" #include "cmFileTimeComparison.h" +#include "cmAlgorithms.h" //#include #include diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index dcd0b6c..d60062e 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -22,6 +22,7 @@ #include "cmCursesDummyWidget.h" #include "cmCursesCacheEntryComposite.h" #include "cmCursesLongMessageForm.h" +#include "cmAlgorithms.h" inline int ctrl(int z) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e6d3960..1d0df69 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -26,6 +26,7 @@ #include "cmVersionMacros.h" #include "cmCTestCommand.h" #include "cmCTestStartCommand.h" +#include "cmAlgorithms.h" #include "cmCTestBuildHandler.h" #include "cmCTestBuildAndTestHandler.h" diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index be28b2f..6005d5f 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -17,6 +17,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 479da75..b0e0f36 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -19,6 +19,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index e9390e4..59efa52 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -14,6 +14,7 @@ #include "cmCacheManager.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" +#include "cmAlgorithms.h" #include "cmExportTryCompileFileGenerator.h" #include diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 6dde349..63d8fa6 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -15,6 +15,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include #include // isspace diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index f4e3a75..8c17536 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -14,6 +14,7 @@ #include "cmSystemTools.h" #include "cmVersion.h" #include "cmRST.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 71728be..b4fad98 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -22,6 +22,7 @@ #include "cmTargetExport.h" #include "cmVersion.h" #include "cmComputeLinkInformation.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ba1dde2..6d639c9 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -19,6 +19,7 @@ #include "cmInstallExportGenerator.h" #include "cmInstallTargetGenerator.h" #include "cmTargetExport.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmExportInstallFileGenerator diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 0290c92..ec22ea0 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -16,6 +16,7 @@ #include "cmInstallType.h" #include "cmFileTimeComparison.h" #include "cmCryptoHash.h" +#include "cmAlgorithms.h" #include "cmTimestamp.h" diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index ffc641c..f63df61 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmFindBase.h" +#include "cmAlgorithms.h" + cmFindBase::cmFindBase() { this->AlreadyInCache = false; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 26bd4b9..87f9037 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -14,6 +14,7 @@ #include #include #include +#include "cmAlgorithms.h" #ifdef CMAKE_BUILD_WITH_CMAKE #include "cmVariableWatch.h" diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 0a27016..b72c269 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -14,6 +14,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "assert.h" +#include "cmAlgorithms.h" #include "cmGeneratorExpressionEvaluator.h" #include "cmGeneratorExpressionLexer.h" diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index c8b9949..ff8790c 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -13,6 +13,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 756d932..cd0e982 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -18,6 +18,7 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmSourceFile.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b7b2eff..e0af47a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -20,6 +20,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index fd18596..85aa31f 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmake.h" +#include "cmAlgorithms.h" // cmGetCMakePropertyCommand bool cmGetCMakePropertyCommand diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 36395aa..0b247c2 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -32,6 +32,7 @@ #include "cmGeneratorExpressionEvaluationFile.h" #include "cmExportBuildFileGenerator.h" #include "cmCPackPropertiesGenerator.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 5701564..7648813 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -18,6 +18,7 @@ #include "cmSourceFile.h" #include "cmTarget.h" #include "cmGeneratorTarget.h" +#include "cmAlgorithms.h" cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() { diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 17617aa..d18269d 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -12,6 +12,7 @@ #include "cmListCommand.h" #include #include +#include "cmAlgorithms.h" #include // required for atoi #include diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 37cc2c6..e1998e4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -25,6 +25,7 @@ #include "cmCustomCommandGenerator.h" #include "cmVersion.h" #include "cmake.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # define CM_LG_ENCODE_OBJECT_NAMES diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5550070..8938e67 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -20,6 +20,7 @@ #include "cmVersion.h" #include "cmFileTimeComparison.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" // Include dependency scanners for supported languages. Only the // C/C++ scanner is needed for bootstrapping CMake. diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 12c8576..b7cbae6 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -12,6 +12,7 @@ #include "cmMacroCommand.h" #include "cmake.h" +#include "cmAlgorithms.h" // define the class for macro commands class cmMacroHelperCommand : public cmCommand diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 31bbb73..a6d4e58 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -12,6 +12,7 @@ #include "cmMakeDepend.h" #include "cmSystemTools.h" #include "cmGeneratorExpression.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ccfe2b1..0fd06d7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -30,6 +30,7 @@ #include "cmInstallGenerator.h" #include "cmTestGenerator.h" #include "cmDefinitions.h" +#include "cmAlgorithms.h" #include "cmake.h" #include // required for atoi diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index c352c1a..155a30e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -19,6 +19,7 @@ #include "cmOSXBundleGenerator.h" #include "cmGeneratorTarget.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 23f8526..a612437 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmSystemTools.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 5016493..df531e7 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmOutputRequiredFilesCommand.h" #include "cmMakeDepend.h" +#include "cmAlgorithms.h" #include class cmLBDepend : public cmMakeDepend diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3a48101..c680523 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -4,6 +4,7 @@ #include "cmSourceFile.h" #include "cmVersion.h" #include "cmVersionMacros.h" +#include "cmAlgorithms.h" #include #include #include diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 844d708..42c18f7 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -16,6 +16,7 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #if defined(_WIN32) && !defined(__CYGWIN__) # include "cmLocalVisualStudioGenerator.h" diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 1e777ab..045c82e 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -12,6 +12,7 @@ #include "cmSearchPath.h" #include "cmFindCommon.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmSearchPath::cmSearchPath(cmFindCommon* findCmd) diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index b81951d..9d67c1e 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -15,6 +15,7 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include "assert.h" diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7a6ad8b..b70f60d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -19,6 +19,7 @@ #include "cmListFileCache.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" +#include "cmAlgorithms.h" #include #include #include diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx index dc19720..394a166 100644 --- a/Source/cmTargetCompileDefinitionsCommand.cxx +++ b/Source/cmTargetCompileDefinitionsCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileDefinitionsCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileDefinitionsCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx index 6ebc31e..823afa1 100644 --- a/Source/cmTargetCompileFeaturesCommand.cxx +++ b/Source/cmTargetCompileFeaturesCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileFeaturesCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileFeaturesCommand::InitialPass( std::vector const& args, cmExecutionStatus &) diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index 8c6fc06..a85153d 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileOptionsCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileOptionsCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 80e90a8..11196e4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -20,6 +20,7 @@ #include "cmSourceFile.h" #include "cmTest.h" #include "cmDocumentationFormatter.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmGraphVizWriter.h" diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index e0bd55b..ac73ad0 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -24,6 +24,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" #include #ifdef CMAKE_BUILD_WITH_CMAKE diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 7d67bd8..9f2ea46 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -15,6 +15,7 @@ #include "cmGlobalGenerator.h" #include "cmQtAutoGenerators.h" #include "cmVersion.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Tue Mar 10 19:16:18 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 10 Mar 2015 19:16:18 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-993-gb6e28c1 Message-ID: <20150310231629.9DBAAAB12A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b6e28c13f00cdfb3299ba280395333d648385be8 (commit) via 0a73c85ddcec8bc343fb8e59815df97a32e19f53 (commit) via b3ed7733f0809ea9abe62f2f8871d6f5b3121513 (commit) via c15de1b00bfc57444dc9b422db5f61a597aa801d (commit) via 4be6ad4591871762f70a562456b5082e52a6ce80 (commit) from 94425f4dc9e3812818f15bf57cf01236ce86d3db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b6e28c13f00cdfb3299ba280395333d648385be8 commit b6e28c13f00cdfb3299ba280395333d648385be8 Merge: 94425f4 0a73c85 Author: Stephen Kelly AuthorDate: Tue Mar 10 19:16:15 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 19:16:15 2015 -0400 Merge topic 'cmRemoveDuplicates-improvement' into next 0a73c85d includes b3ed7733 cmRemoveDuplicates: Partially specialize the API for pointer types. c15de1b0 cmRemoveDuplicates: Type-parameterize all uniq-operations 4be6ad45 cmRemoveDuplicates: Store unique iterators instead of values. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a73c85ddcec8bc343fb8e59815df97a32e19f53 commit 0a73c85ddcec8bc343fb8e59815df97a32e19f53 Author: Stephen Kelly AuthorDate: Sun Mar 8 16:15:56 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:15:59 2015 +0100 includes diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7df2073..18d40e1 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -17,6 +17,7 @@ #include "cmVisualStudioSlnData.h" #include "cmVisualStudioSlnParser.h" #include "cmake.h" +#include "cmAlgorithms.h" static const char vs10generatorName[] = "Visual Studio 10 2010"; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 3013200..ed828b6 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio11Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs11generatorName[] = "Visual Studio 11 2012"; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 2bc9379..c2e6f47 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio12Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs12generatorName[] = "Visual Studio 12 2013"; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index fe702c0..b551c65 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio14Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs14generatorName[] = "Visual Studio 14 2015"; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b3ed7733f0809ea9abe62f2f8871d6f5b3121513 commit b3ed7733f0809ea9abe62f2f8871d6f5b3121513 Author: Stephen Kelly AuthorDate: Sun Mar 8 09:43:11 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:15:58 2015 +0100 cmRemoveDuplicates: Partially specialize the API for pointer types. If de-duplicating a container of pointers, there is no need to store iterators to them, as that is just more 'pointer chasing'. Store the pointers themselves and use API which compares the pointers in the specialization. diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 5504fee..0cf7701 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -263,7 +263,7 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) namespace ContainerAlgorithms { -template +template struct RemoveDuplicatesAPI { typedef typename Range::const_iterator const_iterator; @@ -275,6 +275,18 @@ struct RemoveDuplicatesAPI static bool valueCompare(It it, const_iterator it2) { return **it != *it2; } }; +template +struct RemoveDuplicatesAPI +{ + typedef typename Range::const_iterator const_iterator; + typedef T* value_type; + + static bool lessThan(value_type a, value_type b) { return a < b; } + static value_type uniqueValue(const_iterator a) { return *a; } + template + static bool valueCompare(It it, const_iterator it2) { return *it != *it2; } +}; + } template http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c15de1b00bfc57444dc9b422db5f61a597aa801d commit c15de1b00bfc57444dc9b422db5f61a597aa801d Author: Stephen Kelly AuthorDate: Sun Mar 1 21:57:16 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:15:58 2015 +0100 cmRemoveDuplicates: Type-parameterize all uniq-operations diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 1b7029b..5504fee 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -176,12 +176,6 @@ private: Range const& m_range; }; -struct IterLess -{ - template - bool operator()(It const& a, It const& b) const { return *a < *b; } -}; - } template @@ -267,10 +261,27 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) ContainerAlgorithms::BinarySearcher(m)); } +namespace ContainerAlgorithms { + +template +struct RemoveDuplicatesAPI +{ + typedef typename Range::const_iterator const_iterator; + typedef typename Range::const_iterator value_type; + + static bool lessThan(value_type a, value_type b) { return *a < *b; } + static value_type uniqueValue(const_iterator a) { return a; } + template + static bool valueCompare(It it, const_iterator it2) { return **it != *it2; } +}; + +} + template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - typedef typename Range::const_iterator T; + typedef typename ContainerAlgorithms::RemoveDuplicatesAPI API; + typedef typename API::value_type T; std::vector unique; unique.reserve(r.size()); std::vector indices; @@ -280,11 +291,11 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) it != end; ++it, ++count) { const typename std::vector::iterator low = - std::lower_bound(unique.begin(), unique.end(), it, - ContainerAlgorithms::IterLess()); - if (low == unique.end() || **low != *it) + std::lower_bound(unique.begin(), unique.end(), + API::uniqueValue(it), API::lessThan); + if (low == unique.end() || API::valueCompare(low, it)) { - unique.insert(low, it); + unique.insert(low, API::uniqueValue(it)); } else { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4be6ad4591871762f70a562456b5082e52a6ce80 commit 4be6ad4591871762f70a562456b5082e52a6ce80 Author: Stephen Kelly AuthorDate: Sun Mar 1 21:53:04 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:15:58 2015 +0100 cmRemoveDuplicates: Store unique iterators instead of values. There is no need to copy all of the values in the container in order to determine uniqueness. Iterators can be stored instead and can be used with standard algorithms with custom comparison methods. This also means that we use less space in case the value_type size is greater than sizeof(iterator). That is common for std::string which may require up to 32 bytes (libstdc++ 5.0 and MSVC at least). With libstdc++ 4.9 and older, std::string is 8 bytes, so we likely don't gain anything here. Inspired-by: Daniel Pfeifer diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index f032de7..1b7029b 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -176,6 +176,12 @@ private: Range const& m_range; }; +struct IterLess +{ + template + bool operator()(It const& a, It const& b) const { return *a < *b; } +}; + } template @@ -264,8 +270,8 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - typedef std::vector UniqueVector; - UniqueVector unique; + typedef typename Range::const_iterator T; + std::vector unique; unique.reserve(r.size()); std::vector indices; size_t count = 0; @@ -273,11 +279,12 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) for(typename Range::const_iterator it = r.begin(); it != end; ++it, ++count) { - const typename UniqueVector::iterator low = - std::lower_bound(unique.begin(), unique.end(), *it); - if (low == unique.end() || *low != *it) + const typename std::vector::iterator low = + std::lower_bound(unique.begin(), unique.end(), it, + ContainerAlgorithms::IterLess()); + if (low == unique.end() || **low != *it) { - unique.insert(low, *it); + unique.insert(low, it); } else { ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Tue Mar 10 19:18:36 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 10 Mar 2015 19:18:36 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-997-g60a0124 Message-ID: <20150310231837.041D6AB1C2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 60a0124433790253adab5901ca1c068903b517d7 (commit) via 95dd238f5cde3aef28f09a2367ac7467d064ea10 (commit) via 4448f175c8d8ee2bfce920a5e7b7e57aa923a19d (commit) via 7916d7bac602e71be359e12600b19d823327bdf8 (commit) from b6e28c13f00cdfb3299ba280395333d648385be8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60a0124433790253adab5901ca1c068903b517d7 commit 60a0124433790253adab5901ca1c068903b517d7 Merge: b6e28c1 95dd238 Author: Stephen Kelly AuthorDate: Tue Mar 10 19:18:33 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 19:18:33 2015 -0400 Merge topic 'cmAlgorithms-cleanup' into next 95dd238f cmRemoveDuplicates: Fix iterator -> const_iterator. 4448f175 cmInstalledFile: Move Property implementation out of line. 7916d7ba Include cmAlgorithms where it is used. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95dd238f5cde3aef28f09a2367ac7467d064ea10 commit 95dd238f5cde3aef28f09a2367ac7467d064ea10 Author: Stephen Kelly AuthorDate: Sun Mar 8 14:04:54 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:17:30 2015 +0100 cmRemoveDuplicates: Fix iterator -> const_iterator. diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index b9d7e78..f032de7 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -269,7 +269,7 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) unique.reserve(r.size()); std::vector indices; size_t count = 0; - const typename Range::iterator end = r.end(); + const typename Range::const_iterator end = r.end(); for(typename Range::const_iterator it = r.begin(); it != end; ++it, ++count) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4448f175c8d8ee2bfce920a5e7b7e57aa923a19d commit 4448f175c8d8ee2bfce920a5e7b7e57aa923a19d Author: Stephen Kelly AuthorDate: Sun Mar 8 13:37:44 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:17:29 2015 +0100 cmInstalledFile: Move Property implementation out of line. Don't require re-building the world when changing cmAlgorithms.h. diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index 4b53752..8c52b48 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -12,6 +12,7 @@ #include "cmInstalledFile.h" #include "cmSystemTools.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmInstalledFile::cmInstalledFile(): @@ -29,6 +30,16 @@ cmInstalledFile::~cmInstalledFile() } } +cmInstalledFile::Property::Property() +{ + +} + +cmInstalledFile::Property::~Property() +{ + cmDeleteAll(this->ValueExpressions); +} + //---------------------------------------------------------------------------- void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) { diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index cdb0866..3af90a7 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -13,7 +13,6 @@ #define cmInstalledFile_h #include "cmGeneratorExpression.h" -#include "cmAlgorithms.h" /** \class cmInstalledFile * \brief Represents a file intended for installation. @@ -32,15 +31,8 @@ public: struct Property { - Property() - { - - } - - ~Property() - { - cmDeleteAll(this->ValueExpressions); - } + Property(); + ~Property(); ExpressionVectorType ValueExpressions; }; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7916d7bac602e71be359e12600b19d823327bdf8 commit 7916d7bac602e71be359e12600b19d823327bdf8 Author: Stephen Kelly AuthorDate: Sun Mar 8 13:51:20 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:17:29 2015 +0100 Include cmAlgorithms where it is used. diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index fe27e2b..29e07ef 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -20,6 +20,7 @@ #include "cmGeneratedFileStream.h" #include "cmXMLSafe.h" #include "cmFileTimeComparison.h" +#include "cmAlgorithms.h" //#include #include diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index dcd0b6c..d60062e 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -22,6 +22,7 @@ #include "cmCursesDummyWidget.h" #include "cmCursesCacheEntryComposite.h" #include "cmCursesLongMessageForm.h" +#include "cmAlgorithms.h" inline int ctrl(int z) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e6d3960..1d0df69 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -26,6 +26,7 @@ #include "cmVersionMacros.h" #include "cmCTestCommand.h" #include "cmCTestStartCommand.h" +#include "cmAlgorithms.h" #include "cmCTestBuildHandler.h" #include "cmCTestBuildAndTestHandler.h" diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index be28b2f..6005d5f 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -17,6 +17,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 479da75..b0e0f36 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -19,6 +19,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index e9390e4..59efa52 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -14,6 +14,7 @@ #include "cmCacheManager.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" +#include "cmAlgorithms.h" #include "cmExportTryCompileFileGenerator.h" #include diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 6dde349..63d8fa6 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -15,6 +15,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include #include // isspace diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index f4e3a75..8c17536 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -14,6 +14,7 @@ #include "cmSystemTools.h" #include "cmVersion.h" #include "cmRST.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 71728be..b4fad98 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -22,6 +22,7 @@ #include "cmTargetExport.h" #include "cmVersion.h" #include "cmComputeLinkInformation.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ba1dde2..6d639c9 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -19,6 +19,7 @@ #include "cmInstallExportGenerator.h" #include "cmInstallTargetGenerator.h" #include "cmTargetExport.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmExportInstallFileGenerator diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 0290c92..ec22ea0 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -16,6 +16,7 @@ #include "cmInstallType.h" #include "cmFileTimeComparison.h" #include "cmCryptoHash.h" +#include "cmAlgorithms.h" #include "cmTimestamp.h" diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index ffc641c..f63df61 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmFindBase.h" +#include "cmAlgorithms.h" + cmFindBase::cmFindBase() { this->AlreadyInCache = false; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 26bd4b9..87f9037 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -14,6 +14,7 @@ #include #include #include +#include "cmAlgorithms.h" #ifdef CMAKE_BUILD_WITH_CMAKE #include "cmVariableWatch.h" diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 0a27016..b72c269 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -14,6 +14,7 @@ #include "cmMakefile.h" #include "cmTarget.h" #include "assert.h" +#include "cmAlgorithms.h" #include "cmGeneratorExpressionEvaluator.h" #include "cmGeneratorExpressionLexer.h" diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index c8b9949..ff8790c 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -13,6 +13,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 756d932..cd0e982 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -18,6 +18,7 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmSourceFile.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b7b2eff..e0af47a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -20,6 +20,7 @@ #include "cmGeneratorExpressionDAGChecker.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index fd18596..85aa31f 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmake.h" +#include "cmAlgorithms.h" // cmGetCMakePropertyCommand bool cmGetCMakePropertyCommand diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 36395aa..0b247c2 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -32,6 +32,7 @@ #include "cmGeneratorExpressionEvaluationFile.h" #include "cmExportBuildFileGenerator.h" #include "cmCPackPropertiesGenerator.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 5701564..7648813 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -18,6 +18,7 @@ #include "cmSourceFile.h" #include "cmTarget.h" #include "cmGeneratorTarget.h" +#include "cmAlgorithms.h" cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7df2073..18d40e1 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -17,6 +17,7 @@ #include "cmVisualStudioSlnData.h" #include "cmVisualStudioSlnParser.h" #include "cmake.h" +#include "cmAlgorithms.h" static const char vs10generatorName[] = "Visual Studio 10 2010"; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 3013200..ed828b6 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio11Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs11generatorName[] = "Visual Studio 11 2012"; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 2bc9379..c2e6f47 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio12Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs12generatorName[] = "Visual Studio 12 2013"; diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index fe702c0..b551c65 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -12,6 +12,7 @@ #include "cmGlobalVisualStudio14Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" static const char vs14generatorName[] = "Visual Studio 14 2015"; diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 17617aa..d18269d 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -12,6 +12,7 @@ #include "cmListCommand.h" #include #include +#include "cmAlgorithms.h" #include // required for atoi #include diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 37cc2c6..e1998e4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -25,6 +25,7 @@ #include "cmCustomCommandGenerator.h" #include "cmVersion.h" #include "cmake.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # define CM_LG_ENCODE_OBJECT_NAMES diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5550070..8938e67 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -20,6 +20,7 @@ #include "cmVersion.h" #include "cmFileTimeComparison.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" // Include dependency scanners for supported languages. Only the // C/C++ scanner is needed for bootstrapping CMake. diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 12c8576..b7cbae6 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -12,6 +12,7 @@ #include "cmMacroCommand.h" #include "cmake.h" +#include "cmAlgorithms.h" // define the class for macro commands class cmMacroHelperCommand : public cmCommand diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 31bbb73..a6d4e58 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -12,6 +12,7 @@ #include "cmMakeDepend.h" #include "cmSystemTools.h" #include "cmGeneratorExpression.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ccfe2b1..0fd06d7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -30,6 +30,7 @@ #include "cmInstallGenerator.h" #include "cmTestGenerator.h" #include "cmDefinitions.h" +#include "cmAlgorithms.h" #include "cmake.h" #include // required for atoi diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index c352c1a..155a30e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -19,6 +19,7 @@ #include "cmOSXBundleGenerator.h" #include "cmGeneratorTarget.h" #include "cmCustomCommandGenerator.h" +#include "cmAlgorithms.h" #include #include diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 23f8526..a612437 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -14,6 +14,7 @@ #include "cmGlobalGenerator.h" #include "cmSystemTools.h" #include "cmake.h" +#include "cmAlgorithms.h" #include diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 5016493..df531e7 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmOutputRequiredFilesCommand.h" #include "cmMakeDepend.h" +#include "cmAlgorithms.h" #include class cmLBDepend : public cmMakeDepend diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3a48101..c680523 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -4,6 +4,7 @@ #include "cmSourceFile.h" #include "cmVersion.h" #include "cmVersionMacros.h" +#include "cmAlgorithms.h" #include #include #include diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 844d708..42c18f7 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -16,6 +16,7 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #if defined(_WIN32) && !defined(__CYGWIN__) # include "cmLocalVisualStudioGenerator.h" diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 1e777ab..045c82e 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -12,6 +12,7 @@ #include "cmSearchPath.h" #include "cmFindCommon.h" +#include "cmAlgorithms.h" //---------------------------------------------------------------------------- cmSearchPath::cmSearchPath(cmFindCommon* findCmd) diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index b81951d..9d67c1e 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -15,6 +15,7 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmSystemTools.h" +#include "cmAlgorithms.h" #include "assert.h" diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7a6ad8b..b70f60d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -19,6 +19,7 @@ #include "cmListFileCache.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" +#include "cmAlgorithms.h" #include #include #include diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx index dc19720..394a166 100644 --- a/Source/cmTargetCompileDefinitionsCommand.cxx +++ b/Source/cmTargetCompileDefinitionsCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileDefinitionsCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileDefinitionsCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx index 6ebc31e..823afa1 100644 --- a/Source/cmTargetCompileFeaturesCommand.cxx +++ b/Source/cmTargetCompileFeaturesCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileFeaturesCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileFeaturesCommand::InitialPass( std::vector const& args, cmExecutionStatus &) diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index 8c6fc06..a85153d 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmTargetCompileOptionsCommand.h" +#include "cmAlgorithms.h" + bool cmTargetCompileOptionsCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 80e90a8..11196e4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -20,6 +20,7 @@ #include "cmSourceFile.h" #include "cmTest.h" #include "cmDocumentationFormatter.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmGraphVizWriter.h" diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index e0bd55b..ac73ad0 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -24,6 +24,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmAlgorithms.h" #include #ifdef CMAKE_BUILD_WITH_CMAKE diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 7d67bd8..9f2ea46 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -15,6 +15,7 @@ #include "cmGlobalGenerator.h" #include "cmQtAutoGenerators.h" #include "cmVersion.h" +#include "cmAlgorithms.h" #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From steveire at gmail.com Tue Mar 10 19:18:58 2015 From: steveire at gmail.com (Stephen Kelly) Date: Tue, 10 Mar 2015 19:18:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-1001-gfefa015 Message-ID: <20150310231859.94A9DAB1C6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via fefa0152b87e56facf57e87f78f1acb78e87f8b4 (commit) via 8701a3f468a4fb684442a8a9c5d4c8d15c72eb7b (commit) via eec7091d76fc3db6535eec3f78fd2585b9c0c38a (commit) via 7cbafa8c65751d2eda7a17753c384da1fc91f695 (commit) from 60a0124433790253adab5901ca1c068903b517d7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fefa0152b87e56facf57e87f78f1acb78e87f8b4 commit fefa0152b87e56facf57e87f78f1acb78e87f8b4 Merge: 60a0124 8701a3f Author: Stephen Kelly AuthorDate: Tue Mar 10 19:18:56 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 19:18:56 2015 -0400 Merge topic 'cmRemoveDuplicates-improvement' into next 8701a3f4 cmRemoveDuplicates: Partially specialize the API for pointer types. eec7091d cmRemoveDuplicates: Type-parameterize all uniq-operations 7cbafa8c cmRemoveDuplicates: Store unique iterators instead of values. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8701a3f468a4fb684442a8a9c5d4c8d15c72eb7b commit 8701a3f468a4fb684442a8a9c5d4c8d15c72eb7b Author: Stephen Kelly AuthorDate: Sun Mar 8 09:43:11 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:17:55 2015 +0100 cmRemoveDuplicates: Partially specialize the API for pointer types. If de-duplicating a container of pointers, there is no need to store iterators to them, as that is just more 'pointer chasing'. Store the pointers themselves and use API which compares the pointers in the specialization. diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 5504fee..0cf7701 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -263,7 +263,7 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) namespace ContainerAlgorithms { -template +template struct RemoveDuplicatesAPI { typedef typename Range::const_iterator const_iterator; @@ -275,6 +275,18 @@ struct RemoveDuplicatesAPI static bool valueCompare(It it, const_iterator it2) { return **it != *it2; } }; +template +struct RemoveDuplicatesAPI +{ + typedef typename Range::const_iterator const_iterator; + typedef T* value_type; + + static bool lessThan(value_type a, value_type b) { return a < b; } + static value_type uniqueValue(const_iterator a) { return *a; } + template + static bool valueCompare(It it, const_iterator it2) { return *it != *it2; } +}; + } template http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eec7091d76fc3db6535eec3f78fd2585b9c0c38a commit eec7091d76fc3db6535eec3f78fd2585b9c0c38a Author: Stephen Kelly AuthorDate: Sun Mar 1 21:57:16 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:17:55 2015 +0100 cmRemoveDuplicates: Type-parameterize all uniq-operations diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 1b7029b..5504fee 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -176,12 +176,6 @@ private: Range const& m_range; }; -struct IterLess -{ - template - bool operator()(It const& a, It const& b) const { return *a < *b; } -}; - } template @@ -267,10 +261,27 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) ContainerAlgorithms::BinarySearcher(m)); } +namespace ContainerAlgorithms { + +template +struct RemoveDuplicatesAPI +{ + typedef typename Range::const_iterator const_iterator; + typedef typename Range::const_iterator value_type; + + static bool lessThan(value_type a, value_type b) { return *a < *b; } + static value_type uniqueValue(const_iterator a) { return a; } + template + static bool valueCompare(It it, const_iterator it2) { return **it != *it2; } +}; + +} + template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - typedef typename Range::const_iterator T; + typedef typename ContainerAlgorithms::RemoveDuplicatesAPI API; + typedef typename API::value_type T; std::vector unique; unique.reserve(r.size()); std::vector indices; @@ -280,11 +291,11 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) it != end; ++it, ++count) { const typename std::vector::iterator low = - std::lower_bound(unique.begin(), unique.end(), it, - ContainerAlgorithms::IterLess()); - if (low == unique.end() || **low != *it) + std::lower_bound(unique.begin(), unique.end(), + API::uniqueValue(it), API::lessThan); + if (low == unique.end() || API::valueCompare(low, it)) { - unique.insert(low, it); + unique.insert(low, API::uniqueValue(it)); } else { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7cbafa8c65751d2eda7a17753c384da1fc91f695 commit 7cbafa8c65751d2eda7a17753c384da1fc91f695 Author: Stephen Kelly AuthorDate: Sun Mar 1 21:53:04 2015 +0100 Commit: Stephen Kelly CommitDate: Wed Mar 11 00:17:55 2015 +0100 cmRemoveDuplicates: Store unique iterators instead of values. There is no need to copy all of the values in the container in order to determine uniqueness. Iterators can be stored instead and can be used with standard algorithms with custom comparison methods. This also means that we use less space in case the value_type size is greater than sizeof(iterator). That is common for std::string which may require up to 32 bytes (libstdc++ 5.0 and MSVC at least). With libstdc++ 4.9 and older, std::string is 8 bytes, so we likely don't gain anything here. Inspired-by: Daniel Pfeifer diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index f032de7..1b7029b 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -176,6 +176,12 @@ private: Range const& m_range; }; +struct IterLess +{ + template + bool operator()(It const& a, It const& b) const { return *a < *b; } +}; + } template @@ -264,8 +270,8 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m) template typename Range::const_iterator cmRemoveDuplicates(Range& r) { - typedef std::vector UniqueVector; - UniqueVector unique; + typedef typename Range::const_iterator T; + std::vector unique; unique.reserve(r.size()); std::vector indices; size_t count = 0; @@ -273,11 +279,12 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) for(typename Range::const_iterator it = r.begin(); it != end; ++it, ++count) { - const typename UniqueVector::iterator low = - std::lower_bound(unique.begin(), unique.end(), *it); - if (low == unique.end() || *low != *it) + const typename std::vector::iterator low = + std::lower_bound(unique.begin(), unique.end(), it, + ContainerAlgorithms::IterLess()); + if (low == unique.end() || **low != *it) { - unique.insert(low, *it); + unique.insert(low, it); } else { ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From bill.hoffman at kitware.com Tue Mar 10 20:58:37 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Tue, 10 Mar 2015 20:58:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-1003-gb94fa03 Message-ID: <20150311005838.080D2AB9C8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b94fa03c9363908624585311954eeca0c209c3d7 (commit) via 9eabfb57e72158c58c59631390c0dea969d9ecb4 (commit) from fefa0152b87e56facf57e87f78f1acb78e87f8b4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b94fa03c9363908624585311954eeca0c209c3d7 commit b94fa03c9363908624585311954eeca0c209c3d7 Merge: fefa015 9eabfb5 Author: Bill Hoffman AuthorDate: Tue Mar 10 20:58:36 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 10 20:58:36 2015 -0400 Merge topic 'add_repeat_testing' into next 9eabfb57 Fix the project name to match the test name. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9eabfb57e72158c58c59631390c0dea969d9ecb4 commit 9eabfb57e72158c58c59631390c0dea969d9ecb4 Author: Bill Hoffman AuthorDate: Tue Mar 10 20:56:58 2015 -0400 Commit: Bill Hoffman CommitDate: Tue Mar 10 20:56:58 2015 -0400 Fix the project name to match the test name. diff --git a/Tests/CTestTestRunUntilFail/CMakeLists.txt b/Tests/CTestTestRunUntilFail/CMakeLists.txt index 7788d73..62f4814 100644 --- a/Tests/CTestTestRunUntilFail/CMakeLists.txt +++ b/Tests/CTestTestRunUntilFail/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8.12) -project(CTestTestSerialOrder) +project(CTestTestRunUntilFail) enable_testing() set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") add_test(NAME initialization ----------------------------------------------------------------------- Summary of changes: Tests/CTestTestRunUntilFail/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 11 00:01:06 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 11 Mar 2015 00:01:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.0-405-g80e8e7e Message-ID: <20150311040106.1E836ABB2C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 80e8e7e9561afbc0e621fedab99b96177061ed93 (commit) from 1a8e4c86921e8b018be950924dc54c532134feb5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80e8e7e9561afbc0e621fedab99b96177061ed93 commit 80e8e7e9561afbc0e621fedab99b96177061ed93 Author: Kitware Robot AuthorDate: Wed Mar 11 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Wed Mar 11 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8fcdac9..32e4efc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150310) +set(CMake_VERSION_PATCH 20150311) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 11 08:54:30 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 11 Mar 2015 08:54:30 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.0-1007-g6a6face Message-ID: <20150311125430.79016AB744@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6a6face475ced78e5fa599eceecf7f59974bf6bb (commit) via e433223d1ef9d3cba35a610d9ecd483cd99e39fe (commit) via 9a427f86199913d6674d09a66d97d761c38c77c7 (commit) via 80e8e7e9561afbc0e621fedab99b96177061ed93 (commit) from b94fa03c9363908624585311954eeca0c209c3d7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a6face475ced78e5fa599eceecf7f59974bf6bb commit 6a6face475ced78e5fa599eceecf7f59974bf6bb Merge: b94fa03 e433223 Author: Brad King AuthorDate: Wed Mar 11 08:54:29 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 11 08:54:29 2015 -0400 Merge topic 'update-kwsys' into next e433223d Merge branch 'upstream-kwsys' into update-kwsys 9a427f86 KWSys 2015-03-10 (4a698414) 80e8e7e9 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e433223d1ef9d3cba35a610d9ecd483cd99e39fe commit e433223d1ef9d3cba35a610d9ecd483cd99e39fe Merge: 80e8e7e 9a427f8 Author: Brad King AuthorDate: Wed Mar 11 08:41:16 2015 -0400 Commit: Brad King CommitDate: Wed Mar 11 08:41:16 2015 -0400 Merge branch 'upstream-kwsys' into update-kwsys http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a427f86199913d6674d09a66d97d761c38c77c7 commit 9a427f86199913d6674d09a66d97d761c38c77c7 Author: KWSys Robot AuthorDate: Tue Mar 10 14:16:53 2015 -0400 Commit: Brad King CommitDate: Wed Mar 11 08:41:11 2015 -0400 KWSys 2015-03-10 (4a698414) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 4a698414 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 4890f30c..4a698414 Brad King (1): 4a698414 hashtable: Give prime number table functions internal linkage Change-Id: I9f06cdf8c8b5fbe7e1f07afbcc77457f5ee6445f diff --git a/hashtable.hxx.in b/hashtable.hxx.in index b93e9be..7e7dc42 100644 --- a/hashtable.hxx.in +++ b/hashtable.hxx.in @@ -408,7 +408,7 @@ enum { _stl_num_primes = 31 }; // create a function with a static local to that function that returns // the static -inline const unsigned long* get_stl_prime_list() { +static inline const unsigned long* get_stl_prime_list() { static const unsigned long _stl_prime_list[_stl_num_primes] = { @@ -423,7 +423,7 @@ static const unsigned long _stl_prime_list[_stl_num_primes] = return &_stl_prime_list[0]; } -inline size_t _stl_next_prime(size_t __n) +static inline size_t _stl_next_prime(size_t __n) { const unsigned long* __first = get_stl_prime_list(); const unsigned long* __last = get_stl_prime_list() + (int)_stl_num_primes; ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/kwsys/hashtable.hxx.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From robert.maynard at kitware.com Wed Mar 11 09:18:46 2015 From: robert.maynard at kitware.com (Robert Maynard) Date: Wed, 11 Mar 2015 09:18:46 -0400 (EDT) Subject: [Cmake-commits] CMake annotated tag, v3.2.1, created. v3.2.1 Message-ID: <20150311131846.658E7AB10C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The annotated tag, v3.2.1 has been created at 730e5cea3eabe3d1e2a39984c92404a5c29fce92 (tag) tagging 732d8a467ab8a295b1bbf580f865980f8a1a9b29 (commit) replaces v3.2.0 tagged by Brad King on Tue Mar 10 14:28:53 2015 -0400 - Log ----------------------------------------------------------------- CMake 3.2.1 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJU/zflAAoJEOyP7zp7+07aeUgP/3UV3i6AVLEyd4GMWaRc7w4A q8P4h5kzgQ6fboqQ26+e73Nz4i1jdR/0+1FWCfot9kIg9Yur8x+mdTRCZGEwAG4i ZotCsWANyBqqDEgoTntfX3OcebE5kGAsZeVGXAQ75RE5m5VKw4S5TOYENof+fx/j VCXBTtGdryqU2rvLfuQ/hYkM+2ke6afe2a+ZeZAF7a0Vg2g7JJVt7P3ntD7FfAxN QUx6hxMVY6mfQ9osTRQbRmFfhuLZo8m4xFIqTTxcwWESTW28OePvHCDWH2Ql2tp7 8uDVtXoyFMYuRrCSY5nHkOaZSYumE1Z5vYcZLZA6UcjDv3VW+H3KpxTbJvN/aZXD k3AIlkedRtuCPIUg17wjpeYuF73hSEipRdBF25L7qGyUlNl7tj26rmI37nVD9WSz SBnXL5arsn3QrbeguDthTfyoak6BNtcxEyILxGq+QOCBLTnFh9eSq1bH/MYY0kjK 2PCfK4L0IKbtqBeSWd7L8w7K2FCJ5FjzrAzw3mp6iWtNbPnyQKQrIJVRsFeasfox 9cU1vIffX2a5qjMGC/GQUnR8CU7qkahlWYkOFd9AoBu6BKLwqahjHIW9mlONYZmZ XCNWulZwVY4OmOR8k8kV186EZH23PbIm5i+5U2yxEwXks6hzW8uHl6KCexl8laGO QWLudfzgitZNQvvmdICu =AUL6 -----END PGP SIGNATURE----- Brad King (10): Makefile: Fix multiple custom command outputs regression (#15116) Merge branch 'custom-command-multiple-outputs' into release configure_file: Do not warn about newline style arguments Tests: Add more signature tests to RunCMake.configure_file test Merge branch 'configure_file-NEWLINE_STYLE-no-warn' into release Ninja: Improve internal check for generating at the top-level (#15436) Merge branch 'ninja-check-root-robustly' into release UseSWIG: Avoid if() auto-dereferene in quoted arguments Merge branch 'UseSWIG-fix-CMP0054-warnings' into release CMake 3.2.1 ----------------------------------------------------------------------- hooks/post-receive -- CMake From joe.snyder at kitware.com Wed Mar 11 09:31:21 2015 From: joe.snyder at kitware.com (Joe Snyder) Date: Wed, 11 Mar 2015 09:31:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-999-ge0c3dda Message-ID: <20150311133121.90457ABE61@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e0c3ddaa028b3fefa03e38e407b91b2679839fe8 (commit) via c771f9d945444f6cfe41195e26653f368aff7f42 (commit) from 6a6face475ced78e5fa599eceecf7f59974bf6bb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e0c3ddaa028b3fefa03e38e407b91b2679839fe8 commit e0c3ddaa028b3fefa03e38e407b91b2679839fe8 Merge: 6a6face c771f9d Author: Joe Snyder AuthorDate: Wed Mar 11 09:31:20 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 11 09:31:20 2015 -0400 Merge topic 'fix_jacoco_coverage_process' into next c771f9d9 CTest: Fix Jacoco Coverage http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c771f9d945444f6cfe41195e26653f368aff7f42 commit c771f9d945444f6cfe41195e26653f368aff7f42 Author: Joseph Snyder AuthorDate: Fri Mar 6 11:18:19 2015 -0500 Commit: Joseph Snyder CommitDate: Fri Mar 6 11:18:19 2015 -0500 CTest: Fix Jacoco Coverage Rename the example jacoco.xml file to be jacoco.xml.in to stop CMake from apptempting to calculate Jacoco Coverage when running over itself. Enclose a push of -1 to the coverage vector to only happen if there is a fin to calculate for. This prevents a crash if the target file doesn't exist. diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index ec4cfad..31ad9fe 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -78,7 +78,10 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser std::string line; FileLinesType& curFileLines = this->Coverage.TotalCoverage[this->CurFileName]; - curFileLines.push_back(-1); + if(fin) + { + curFileLines.push_back(-1); + } while(cmSystemTools::GetLineFromStream(fin, line)) { curFileLines.push_back(-1); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 08765de..703c548 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2409,6 +2409,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "${CMake_BINARY_DIR}/Testing/JacocoCoverage/DartConfiguration.tcl") file(COPY "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/Coverage" DESTINATION "${CMake_BINARY_DIR}/Testing/JacocoCoverage") + configure_file("${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml.in" + "${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml") add_test(NAME CTestJacocoCoverage COMMAND cmake -E chdir ${CMake_BINARY_DIR}/Testing/JacocoCoverage diff --git a/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml b/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in similarity index 100% rename from Tests/JacocoCoverage/Coverage/target/site/jacoco.xml rename to Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmParseJacocoCoverage.cxx | 5 ++++- Tests/CMakeLists.txt | 2 ++ .../Coverage/target/site/{jacoco.xml => jacoco.xml.in} | 0 3 files changed, 6 insertions(+), 1 deletion(-) rename Tests/JacocoCoverage/Coverage/target/site/{jacoco.xml => jacoco.xml.in} (100%) hooks/post-receive -- CMake From bill.hoffman at kitware.com Wed Mar 11 18:57:12 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Wed, 11 Mar 2015 18:57:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1001-gab5aa68 Message-ID: <20150311225718.EF360AB83D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ab5aa681784f35ea9177a7242d4c92354e0110c5 (commit) via c82b25a69a79e7affae4c350ff7a3ae6e5672e00 (commit) from e0c3ddaa028b3fefa03e38e407b91b2679839fe8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ab5aa681784f35ea9177a7242d4c92354e0110c5 commit ab5aa681784f35ea9177a7242d4c92354e0110c5 Merge: e0c3dda c82b25a Author: Bill Hoffman AuthorDate: Wed Mar 11 18:57:07 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 11 18:57:07 2015 -0400 Merge topic 'add_repeat_testing' into next c82b25a6 Fix up documentation. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c82b25a69a79e7affae4c350ff7a3ae6e5672e00 commit c82b25a69a79e7affae4c350ff7a3ae6e5672e00 Author: Bill Hoffman AuthorDate: Wed Mar 11 18:55:37 2015 -0400 Commit: Bill Hoffman CommitDate: Wed Mar 11 18:55:37 2015 -0400 Fix up documentation. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index cc132c2..99d33e7 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -194,6 +194,12 @@ Options subsequent calls to ctest with the --rerun-failed option will run the set of tests that most recently failed (if any). +``--repeat-until-fail N`` + Run each test N times until N runs or a test fails. + + This option allows you to run each test multiple times until a test failes. + This is useful in finding random failures in test cases. + ``--max-width `` Set the max width for a test name to output diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 351b644..069c45e 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -49,9 +49,6 @@ static const char * cmDocumentationOptions[][2] = {"-F", "Enable failover."}, {"-j , --parallel ", "Run the tests in parallel using the " "given number of jobs."}, - {"--repeat-until-fail ", "Run each test times " - "unless the test fails at that point stop repeating. Useful for finding" - " random failuers."}, {"-Q,--quiet", "Make ctest quiet."}, {"-O , --output-log ", "Output to log file"}, {"-N,--show-only", "Disable actual execution of tests."}, @@ -78,6 +75,8 @@ static const char * cmDocumentationOptions[][2] = "Run a specific number of tests by number."}, {"-U, --union", "Take the Union of -I and -R"}, {"--rerun-failed", "Run only the tests that failed previously"}, + {"--repeat-until-fail N", "Run each test N times" + " until the test runs N times or the test fails."}, {"--max-width ", "Set the max width for a test name to output"}, {"--interactive-debug-mode [0|1]", "Set the interactive mode to 0 or 1."}, {"--no-label-summary", "Disable timing summary information for labels."}, ----------------------------------------------------------------------- Summary of changes: Help/manual/ctest.1.rst | 6 ++++++ Source/ctest.cxx | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 12 00:01:05 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 12 Mar 2015 00:01:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-396-g36d4cda Message-ID: <20150312040105.CE8C4ABF6E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 36d4cdad0ed4fbd232142a0247209c68b9c9eee3 (commit) from 80e8e7e9561afbc0e621fedab99b96177061ed93 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36d4cdad0ed4fbd232142a0247209c68b9c9eee3 commit 36d4cdad0ed4fbd232142a0247209c68b9c9eee3 Author: Kitware Robot AuthorDate: Thu Mar 12 00:01:03 2015 -0400 Commit: Kitware Robot CommitDate: Thu Mar 12 00:01:03 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 32e4efc..ca66478 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150311) +set(CMake_VERSION_PATCH 20150312) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:25 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-398-gaddf4db Message-ID: <20150312192625.85977ABAAA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via addf4db06cb3d4e7482ed54a12a21aaa9110f6a4 (commit) via c771f9d945444f6cfe41195e26653f368aff7f42 (commit) from 36d4cdad0ed4fbd232142a0247209c68b9c9eee3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=addf4db06cb3d4e7482ed54a12a21aaa9110f6a4 commit addf4db06cb3d4e7482ed54a12a21aaa9110f6a4 Merge: 36d4cda c771f9d Author: Brad King AuthorDate: Thu Mar 12 15:26:24 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:24 2015 -0400 Merge topic 'fix_jacoco_coverage_process' c771f9d9 CTest: Fix Jacoco Coverage ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmParseJacocoCoverage.cxx | 5 ++++- Tests/CMakeLists.txt | 2 ++ .../Coverage/target/site/{jacoco.xml => jacoco.xml.in} | 0 3 files changed, 6 insertions(+), 1 deletion(-) rename Tests/JacocoCoverage/Coverage/target/site/{jacoco.xml => jacoco.xml.in} (100%) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:28 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-400-g7b185d5 Message-ID: <20150312192628.9A9BFABAA8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 7b185d50170366ae57c43295db788ea2038a858b (commit) via 242c396656783b1b3d542b14bc62710a46a87518 (commit) from addf4db06cb3d4e7482ed54a12a21aaa9110f6a4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b185d50170366ae57c43295db788ea2038a858b commit 7b185d50170366ae57c43295db788ea2038a858b Merge: addf4db 242c396 Author: Brad King AuthorDate: Thu Mar 12 15:26:26 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:26 2015 -0400 Merge topic 'main_dependency_diagnostic' 242c3966 add_custom_command: Diagnose MAIN_DEPENDENCY limitation. ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0057.rst | 21 +++++++++++++++ Help/release/dev/main_dependency_diagnostic.rst | 6 +++++ Source/cmMakefile.cxx | 27 ++++++++++++++++++++ Source/cmPolicies.cxx | 5 ++++ Source/cmPolicies.h | 2 ++ .../CMP0057-NEW-result.txt} | 0 Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt | 4 +++ Tests/RunCMake/CMP0057/CMP0057-NEW.cmake | 13 ++++++++++ Tests/RunCMake/CMP0057/CMP0057-OLD.cmake | 13 ++++++++++ Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt | 9 +++++++ Tests/RunCMake/CMP0057/CMP0057-WARN.cmake | 11 ++++++++ Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake | 8 ++++++ Tests/RunCMake/{CMP0055 => CMP0057}/CMakeLists.txt | 0 Tests/RunCMake/CMP0057/RunCMakeTest.cmake | 7 +++++ .../hello.f => Tests/RunCMake/CMP0057/input.txt | 0 Tests/RunCMake/CMakeLists.txt | 1 + 17 files changed, 128 insertions(+) create mode 100644 Help/policy/CMP0057.rst create mode 100644 Help/release/dev/main_dependency_diagnostic.rst copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CMP0057/CMP0057-NEW-result.txt} (100%) create mode 100644 Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt create mode 100644 Tests/RunCMake/CMP0057/CMP0057-NEW.cmake create mode 100644 Tests/RunCMake/CMP0057/CMP0057-OLD.cmake create mode 100644 Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt create mode 100644 Tests/RunCMake/CMP0057/CMP0057-WARN.cmake create mode 100644 Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake copy Tests/RunCMake/{CMP0055 => CMP0057}/CMakeLists.txt (100%) create mode 100644 Tests/RunCMake/CMP0057/RunCMakeTest.cmake copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/CMP0057/input.txt (100%) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:30 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:30 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-402-g119f45c Message-ID: <20150312192630.84842ABAF6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 119f45ce2a7209739f79d93a63c4d029c459bbb3 (commit) via 18d5a4bcfd688687d334d645dfdaa7fd5a207bd9 (commit) from 7b185d50170366ae57c43295db788ea2038a858b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=119f45ce2a7209739f79d93a63c4d029c459bbb3 commit 119f45ce2a7209739f79d93a63c4d029c459bbb3 Merge: 7b185d5 18d5a4b Author: Brad King AuthorDate: Thu Mar 12 15:26:29 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:29 2015 -0400 Merge topic 'vs-Intel-Fortran-map-more-flags' 18d5a4bc VS: Add more Fortran compiler flags to flag table (#15381) ----------------------------------------------------------------------- Summary of changes: Source/cmLocalVisualStudio7Generator.cxx | 7 +++++++ 1 file changed, 7 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:32 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:32 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-404-gdfeeda3 Message-ID: <20150312192632.738C9ABAF6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via dfeeda3778e4b436add8ad95a1c9daab52309901 (commit) via 77534e84b27701e371ccee780be5acffe7cced59 (commit) from 119f45ce2a7209739f79d93a63c4d029c459bbb3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dfeeda3778e4b436add8ad95a1c9daab52309901 commit dfeeda3778e4b436add8ad95a1c9daab52309901 Merge: 119f45c 77534e8 Author: Brad King AuthorDate: Thu Mar 12 15:26:31 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:31 2015 -0400 Merge topic 'allow-no-language-standard' 77534e84 Add options to build CMake without any language dialects ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:34 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:34 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-406-g153e2dc Message-ID: <20150312192634.425CCABAF5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 153e2dc3fc73fdb778e56e238441aab2a9f673dc (commit) via 3ff95f3b0b1eed95aa6e4d6baa59c68a047072ea (commit) from dfeeda3778e4b436add8ad95a1c9daab52309901 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=153e2dc3fc73fdb778e56e238441aab2a9f673dc commit 153e2dc3fc73fdb778e56e238441aab2a9f673dc Merge: dfeeda3 3ff95f3 Author: Brad King AuthorDate: Thu Mar 12 15:26:33 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:33 2015 -0400 Merge topic 'cmAlgorithms-early-return' 3ff95f3b cmAlgorithms: Add early return in cmRemoveIndices. ----------------------------------------------------------------------- Summary of changes: Source/cmAlgorithms.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:37 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-410-g15b06bc Message-ID: <20150312192637.03305ABAF5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 15b06bc01278bafda15ff1fcece808959422d927 (commit) via 95dd238f5cde3aef28f09a2367ac7467d064ea10 (commit) via 4448f175c8d8ee2bfce920a5e7b7e57aa923a19d (commit) via 7916d7bac602e71be359e12600b19d823327bdf8 (commit) from 153e2dc3fc73fdb778e56e238441aab2a9f673dc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15b06bc01278bafda15ff1fcece808959422d927 commit 15b06bc01278bafda15ff1fcece808959422d927 Merge: 153e2dc 95dd238 Author: Brad King AuthorDate: Thu Mar 12 15:26:35 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:35 2015 -0400 Merge topic 'cmAlgorithms-cleanup' 95dd238f cmRemoveDuplicates: Fix iterator -> const_iterator. 4448f175 cmInstalledFile: Move Property implementation out of line. 7916d7ba Include cmAlgorithms where it is used. ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestBuildHandler.cxx | 1 + Source/CursesDialog/cmCursesMainForm.cxx | 1 + Source/cmAlgorithms.h | 2 +- Source/cmCTest.cxx | 1 + Source/cmComputeLinkDepends.cxx | 1 + Source/cmComputeLinkInformation.cxx | 1 + Source/cmCoreTryCompile.cxx | 1 + Source/cmDependsC.cxx | 1 + Source/cmDocumentation.cxx | 1 + Source/cmExportFileGenerator.cxx | 1 + Source/cmExportInstallFileGenerator.cxx | 1 + Source/cmFileCommand.cxx | 1 + Source/cmFindBase.cxx | 2 ++ Source/cmFindPackageCommand.cxx | 1 + Source/cmGeneratorExpression.cxx | 1 + Source/cmGeneratorExpressionDAGChecker.cxx | 1 + Source/cmGeneratorExpressionEvaluator.cxx | 1 + Source/cmGeneratorTarget.cxx | 1 + Source/cmGetCMakePropertyCommand.cxx | 1 + Source/cmGlobalGenerator.cxx | 1 + Source/cmGlobalUnixMakefileGenerator3.cxx | 1 + Source/cmGlobalVisualStudio10Generator.cxx | 1 + Source/cmGlobalVisualStudio11Generator.cxx | 1 + Source/cmGlobalVisualStudio12Generator.cxx | 1 + Source/cmGlobalVisualStudio14Generator.cxx | 1 + Source/cmInstalledFile.cxx | 11 +++++++++++ Source/cmInstalledFile.h | 12 ++---------- Source/cmListCommand.cxx | 1 + Source/cmLocalGenerator.cxx | 1 + Source/cmLocalUnixMakefileGenerator3.cxx | 1 + Source/cmMacroCommand.cxx | 1 + Source/cmMakeDepend.cxx | 1 + Source/cmMakefile.cxx | 1 + Source/cmNinjaNormalTargetGenerator.cxx | 1 + Source/cmOrderDirectories.cxx | 1 + Source/cmOutputRequiredFilesCommand.cxx | 1 + Source/cmPolicies.cxx | 1 + Source/cmQtAutoGenerators.cxx | 1 + Source/cmSearchPath.cxx | 1 + Source/cmSourceFileLocation.cxx | 1 + Source/cmTarget.cxx | 1 + Source/cmTargetCompileDefinitionsCommand.cxx | 2 ++ Source/cmTargetCompileFeaturesCommand.cxx | 2 ++ Source/cmTargetCompileOptionsCommand.cxx | 2 ++ Source/cmake.cxx | 1 + Source/cmakemain.cxx | 1 + Source/cmcmd.cxx | 1 + 47 files changed, 62 insertions(+), 11 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:38 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-414-g18e8525 Message-ID: <20150312192638.C4E93ABAEB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 18e85253c3d232d56768316a1b26a0646ad6d233 (commit) via 8701a3f468a4fb684442a8a9c5d4c8d15c72eb7b (commit) via eec7091d76fc3db6535eec3f78fd2585b9c0c38a (commit) via 7cbafa8c65751d2eda7a17753c384da1fc91f695 (commit) from 15b06bc01278bafda15ff1fcece808959422d927 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18e85253c3d232d56768316a1b26a0646ad6d233 commit 18e85253c3d232d56768316a1b26a0646ad6d233 Merge: 15b06bc 8701a3f Author: Brad King AuthorDate: Thu Mar 12 15:26:37 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:37 2015 -0400 Merge topic 'cmRemoveDuplicates-improvement' 8701a3f4 cmRemoveDuplicates: Partially specialize the API for pointer types. eec7091d cmRemoveDuplicates: Type-parameterize all uniq-operations 7cbafa8c cmRemoveDuplicates: Store unique iterators instead of values. ----------------------------------------------------------------------- Summary of changes: Source/cmAlgorithms.h | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:40 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:40 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-416-gf25aa20 Message-ID: <20150312192640.B885DABAF4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f25aa204a284e601f5b0debc3709f725e2b1d300 (commit) via 94887cb6f1200c505d86e3e52f7abf88cb5e2a72 (commit) from 18e85253c3d232d56768316a1b26a0646ad6d233 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f25aa204a284e601f5b0debc3709f725e2b1d300 commit f25aa204a284e601f5b0debc3709f725e2b1d300 Merge: 18e8525 94887cb Author: Brad King AuthorDate: Thu Mar 12 15:26:39 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:39 2015 -0400 Merge topic 'vs-express-build-output' 94887cb6 cmake: Teach --build to get VCExpress output (#15437) ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGenerator.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:42 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:42 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-419-g0d58b08 Message-ID: <20150312192644.B3C70ABAEB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 0d58b082d00b8dc0fc678911e6e3c489c0bd5a9a (commit) via e433223d1ef9d3cba35a610d9ecd483cd99e39fe (commit) via 9a427f86199913d6674d09a66d97d761c38c77c7 (commit) from f25aa204a284e601f5b0debc3709f725e2b1d300 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d58b082d00b8dc0fc678911e6e3c489c0bd5a9a commit 0d58b082d00b8dc0fc678911e6e3c489c0bd5a9a Merge: f25aa20 e433223 Author: Brad King AuthorDate: Thu Mar 12 15:26:41 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:41 2015 -0400 Merge topic 'update-kwsys' e433223d Merge branch 'upstream-kwsys' into update-kwsys 9a427f86 KWSys 2015-03-10 (4a698414) ----------------------------------------------------------------------- Summary of changes: Source/kwsys/hashtable.hxx.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:26:46 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:26:46 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-425-g6390d5f Message-ID: <20150312192646.F04A3ABAF5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6390d5f5cb107dcc4a0bc6124ab5f17370dcadcd (commit) via ec428fafcf9f50c54b163dd16f68063cc387f779 (commit) via 082b6a9d78c6198dc7a9891615930c40a5c3b967 (commit) via 9df1f0fce19d893b75108fa29eb06cf6b2ce4997 (commit) via 80b9f0cbe263c64613acd18e4e94505924fce40e (commit) via 642048ce356304155bf67b85deeacb9d030c3300 (commit) from 0d58b082d00b8dc0fc678911e6e3c489c0bd5a9a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6390d5f5cb107dcc4a0bc6124ab5f17370dcadcd commit 6390d5f5cb107dcc4a0bc6124ab5f17370dcadcd Merge: 0d58b08 ec428fa Author: Brad King AuthorDate: Thu Mar 12 15:26:45 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:26:45 2015 -0400 Merge topic 'refactor-cmGeneratorExpression' ec428faf Genex: Extend cmGeneratorExpressionContext constructor. 082b6a9d Genex: Split cmGeneratorExpressionContext into own file. 9df1f0fc Genex: Split cmGeneratorExpressionNode into own file. 80b9f0cb Genex: Extract an evaluateWithContext method. 642048ce Help: Move docs of $<0:...> and $<1:...> to output section. ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 8 +- Source/CMakeLists.txt | 4 + Source/cmGeneratorExpression.cxx | 27 +- Source/cmGeneratorExpression.h | 4 + Source/cmGeneratorExpressionContext.cxx | 34 + Source/cmGeneratorExpressionContext.h | 54 + Source/cmGeneratorExpressionEvaluator.cxx | 1892 +------------------- Source/cmGeneratorExpressionEvaluator.h | 29 +- ...Evaluator.cxx => cmGeneratorExpressionNode.cxx} | 299 +--- Source/cmGeneratorExpressionNode.h | 70 + bootstrap | 2 + 11 files changed, 204 insertions(+), 2219 deletions(-) create mode 100644 Source/cmGeneratorExpressionContext.cxx create mode 100644 Source/cmGeneratorExpressionContext.h copy Source/{cmGeneratorExpressionEvaluator.cxx => cmGeneratorExpressionNode.cxx} (87%) create mode 100644 Source/cmGeneratorExpressionNode.h hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 15:27:24 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 15:27:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1013-g388339d Message-ID: <20150312192724.3B6F7ABAF4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 388339d0539cdba1ae195e025e50c1263a85dd2c (commit) via 6390d5f5cb107dcc4a0bc6124ab5f17370dcadcd (commit) via 0d58b082d00b8dc0fc678911e6e3c489c0bd5a9a (commit) via f25aa204a284e601f5b0debc3709f725e2b1d300 (commit) via 18e85253c3d232d56768316a1b26a0646ad6d233 (commit) via 15b06bc01278bafda15ff1fcece808959422d927 (commit) via 153e2dc3fc73fdb778e56e238441aab2a9f673dc (commit) via dfeeda3778e4b436add8ad95a1c9daab52309901 (commit) via 119f45ce2a7209739f79d93a63c4d029c459bbb3 (commit) via 7b185d50170366ae57c43295db788ea2038a858b (commit) via addf4db06cb3d4e7482ed54a12a21aaa9110f6a4 (commit) via 36d4cdad0ed4fbd232142a0247209c68b9c9eee3 (commit) from ab5aa681784f35ea9177a7242d4c92354e0110c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=388339d0539cdba1ae195e025e50c1263a85dd2c commit 388339d0539cdba1ae195e025e50c1263a85dd2c Merge: ab5aa68 6390d5f Author: Brad King AuthorDate: Thu Mar 12 15:27:12 2015 -0400 Commit: Brad King CommitDate: Thu Mar 12 15:27:12 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Thu Mar 12 15:46:52 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Thu, 12 Mar 2015 15:46:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1015-g76f1200 Message-ID: <20150312194652.1E0CCAB149@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 76f12008700b61362056b2d84420becd0983c3e6 (commit) via 1bda8f1fdbfdeef82766e5db542b1946d5e2167d (commit) from 388339d0539cdba1ae195e025e50c1263a85dd2c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76f12008700b61362056b2d84420becd0983c3e6 commit 76f12008700b61362056b2d84420becd0983c3e6 Merge: 388339d 1bda8f1 Author: Nils Gladitz AuthorDate: Thu Mar 12 15:46:50 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 15:46:50 2015 -0400 Merge topic 'wix-installer-theme' into next 1bda8f1f CPackWIX: Customize CMake installer theme. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bda8f1fdbfdeef82766e5db542b1946d5e2167d commit 1bda8f1fdbfdeef82766e5db542b1946d5e2167d Author: Nils Gladitz AuthorDate: Thu Mar 12 20:44:27 2015 +0100 Commit: Nils Gladitz CommitDate: Thu Mar 12 20:44:27 2015 +0100 CPackWIX: Customize CMake installer theme. diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index cc8f5e9..5600b35 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -109,4 +109,12 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") ) set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") + + set(CPACK_WIX_UI_BANNER + "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_banner.jpg" + ) + + set(CPACK_WIX_UI_DIALOG + "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_dialog.jpg" + ) endif() diff --git a/Utilities/Release/cpack_wix_ui_banner.jpg b/Utilities/Release/cpack_wix_ui_banner.jpg new file mode 100644 index 0000000..8d950a6 Binary files /dev/null and b/Utilities/Release/cpack_wix_ui_banner.jpg differ diff --git a/Utilities/Release/cpack_wix_ui_dialog.jpg b/Utilities/Release/cpack_wix_ui_dialog.jpg new file mode 100644 index 0000000..bb6fa5b Binary files /dev/null and b/Utilities/Release/cpack_wix_ui_dialog.jpg differ ----------------------------------------------------------------------- Summary of changes: CMakeCPackOptions.cmake.in | 8 ++++++++ Utilities/Release/cpack_wix_ui_banner.jpg | Bin 0 -> 2607 bytes Utilities/Release/cpack_wix_ui_dialog.jpg | Bin 0 -> 13369 bytes 3 files changed, 8 insertions(+) create mode 100644 Utilities/Release/cpack_wix_ui_banner.jpg create mode 100644 Utilities/Release/cpack_wix_ui_dialog.jpg hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 12 16:00:28 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 12 Mar 2015 16:00:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1019-g259cff6 Message-ID: <20150312200028.AB6F5ABE59@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 259cff6357cba8ca026d1fe9dc98002c861b4c3d (commit) via 3743aa11fb04cd8823ccfd44a5ca19f3f9e14d1e (commit) via 842ab1091e7fae4e2622ffa2ac65bfa0c5f3a578 (commit) via 3c025a5f6ef26e1f1c40024699559f2b7eb82aa2 (commit) from 76f12008700b61362056b2d84420becd0983c3e6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=259cff6357cba8ca026d1fe9dc98002c861b4c3d commit 259cff6357cba8ca026d1fe9dc98002c861b4c3d Merge: 76f1200 3743aa1 Author: Brad King AuthorDate: Thu Mar 12 16:00:26 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 12 16:00:26 2015 -0400 Merge topic 'FindMatlab-rewrite' into next 3743aa11 FindMatlab: Further revisions 842ab109 FindMatlab: Further revisions 3c025a5f FindMatlab: Rewrite module and provide a usage API http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3743aa11fb04cd8823ccfd44a5ca19f3f9e14d1e commit 3743aa11fb04cd8823ccfd44a5ca19f3f9e14d1e Author: Raffi Enficiaud AuthorDate: Thu Mar 12 17:08:44 2015 +0100 Commit: Brad King CommitDate: Thu Mar 12 15:57:32 2015 -0400 FindMatlab: Further revisions * Simplified workflow, better isolation of the code when Matlab is to be found from the PATH * Removing the "which matlab" as the find_program was erroneous * MATLAB_USER_ROOT renamed to Matlab_ROOT_DIR, which now reflects the found root, removed Matlab_ROOT * Reduced the number of find_program(matlab) * Nulled the input stream of the execute_process in order to avoid the troubleshooting with the terminal * Clearing all the cached variables in case the Matlab_ROOT_DIR is changed by the user * Marking all but Matlab_ROOT_DIR variable as advanced * Hiding all internal cache entries * Avoiding the computation of the version (Matlab_ROOT_DIR set) if the first pass produced the version automatically * Windows: now versions are ordered starting from the most recent diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 9686a76..d08423b 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -28,14 +28,15 @@ # :command:`matlab_get_release_name_from_version` allow a mapping # from the release name to the version. # -# The variable :variable:`MATLAB_USER_ROOT` may be specified in order to give +# The variable :variable:`Matlab_ROOT_DIR` may be specified in order to give # the path of the desired Matlab version. Otherwise, the behaviour is platform # specific: # # * Windows: The installed versions of Matlab are retrieved from the # Windows registry # * OS X: The installed versions of Matlab are given by the MATLAB -# paths in ``/Application`` +# paths in ``/Application``. If no such application is found, it falls back +# to the one that might be accessible from the PATH. # * Unix: The desired Matlab should be accessible from the PATH. # # Additional information is provided when :variable:`MATLAB_FIND_DEBUG` is set. @@ -59,7 +60,7 @@ # Users or projects may set the following variables to configure the module # behaviour: # -# :variable:`MATLAB_USER_ROOT` +# :variable:`Matlab_ROOT_DIR` # the root of the Matlab installation. # :variable:`MATLAB_FIND_DEBUG` # outputs debug information @@ -77,14 +78,15 @@ # ``TRUE`` if the Matlab installation is found, ``FALSE`` # otherwise. All variable below are defined if Matlab is found. # ``Matlab_ROOT_DIR`` -# the root of the Matlab installation determined by the FindMatlab module. +# the final root of the Matlab installation determined by the FindMatlab +# module. # ``Matlab_MAIN_PROGRAM`` # the Matlab binary program. Available only if the component ``MAIN_PROGRAM`` # is given in the :command:`find_package` directive. # ``Matlab_INCLUDE_DIRS`` # the path of the Matlab libraries headers # ``Matlab_MEX_LIBRARY`` -# library for mex +# library for mex, always available. # ``Matlab_MX_LIBRARY`` # mx library of Matlab (arrays). Available only if the component # ``MX_LIBRARY`` has been requested. @@ -102,6 +104,9 @@ # # ``Matlab_MEX_EXTENSION`` # the extension of the mex files for the current platform (given by Matlab). +# ``Matlab_ROOT_DIR`` +# the location of the root of the Matlab installation found. If this value +# is changed by the user, the result variables are recomputed. # # Provided macros # --------------- @@ -162,10 +167,11 @@ # Reference # -------------- # -# .. variable:: MATLAB_USER_ROOT +# .. variable:: Matlab_ROOT_DIR # -# The root folder of the Matlab installation. This is set before the call to -# :command:`find_package`. If not set, then an automatic search of Matlab +# The root folder of the Matlab installation. If set before the call to +# :command:`find_package`, the module will look for the components in that +# path. If not set, then an automatic search of Matlab # will be performed. If set, it should point to a valid version of Matlab. # # .. variable:: MATLAB_FIND_DEBUG @@ -176,7 +182,6 @@ # .. variable:: MATLAB_ADDITIONAL_VERSIONS # # If set, specifies additional versions of Matlab that may be looked for. -# This variable will be used if :variable:`MATLAB_USER_ROOT` is not set. # The variable should be a list of strings, organised by pairs of release # name and versions, such as follows:: # @@ -192,6 +197,10 @@ # "R2013b=8.2" # "R2013a=8.1" # "R2012b=8.0") +# +# The order of entries in this list matters when several versions of +# Matlab are installed. The priority is set according to the ordering in +# this list. #============================================================================= # Copyright 2014-2015 Raffi Enficiaud, Max Planck Society @@ -254,6 +263,7 @@ macro (matlab_get_version_from_release_name release_name version_name) else() message(WARNING "The release name ${release_name} is not registered") endif() + unset(_matched) endmacro() @@ -356,8 +366,8 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio RESULT_VARIABLE resultMatlab OUTPUT_VARIABLE varMatlab ERROR_VARIABLE errMatlab + INPUT_FILE NUL ) - #message("Matlabs = ${varMatlab} | ${resultMatlab}") set(matlabs_from_registry) @@ -385,6 +395,12 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio endif() + if(matlabs_from_registry) + list(REMOVE_DUPLICATES matlabs_from_registry) + list(SORT matlabs_from_registry) + list(REVERSE matlabs_from_registry) + endif() + set(${matlab_versions} ${matlabs_from_registry} PARENT_SCOPE) endfunction() @@ -424,9 +440,11 @@ macro(extract_matlab_versions_from_registry_brute_force matlab_versions) # we order from more recent to older - list(REMOVE_DUPLICATES matlab_supported_versions) - list(SORT matlab_supported_versions) - list(REVERSE matlab_supported_versions) + if(matlab_supported_versions) + list(REMOVE_DUPLICATES matlab_supported_versions) + list(SORT matlab_supported_versions) + list(REVERSE matlab_supported_versions) + endif() set(${matlab_versions} ${matlab_supported_versions}) @@ -508,7 +526,7 @@ function(matlab_get_mex_suffix matlab_root mex_suffix) # we first try without suffix, since cmake does not understand a list with # one empty string element find_program( - MATLAB_MEXEXTENSIONS_PROG + Matlab_MEXEXTENSIONS_PROG NAMES mexext PATHS ${matlab_root}/bin DOC "Matlab MEX extension provider" @@ -516,10 +534,10 @@ function(matlab_get_mex_suffix matlab_root mex_suffix) ) foreach(current_mexext_suffix IN LISTS mexext_suffix) - if(NOT DEFINED MATLAB_MEXEXTENSIONS_PROG OR NOT MATLAB_MEXEXTENSIONS_PROG) + if(NOT DEFINED Matlab_MEXEXTENSIONS_PROG OR NOT Matlab_MEXEXTENSIONS_PROG) # this call should populate the cache automatically find_program( - MATLAB_MEXEXTENSIONS_PROG + Matlab_MEXEXTENSIONS_PROG "mexext${current_mexext_suffix}" PATHS ${matlab_root}/bin DOC "Matlab MEX extension provider" @@ -530,22 +548,31 @@ function(matlab_get_mex_suffix matlab_root mex_suffix) # the program has been found? - if((NOT MATLAB_MEXEXTENSIONS_PROG) OR (NOT EXISTS ${MATLAB_MEXEXTENSIONS_PROG})) + if((NOT Matlab_MEXEXTENSIONS_PROG) OR (NOT EXISTS ${Matlab_MEXEXTENSIONS_PROG})) if(MATLAB_FIND_DEBUG) message(WARNING "[MATLAB] Cannot found mexext program. Matlab root is ${matlab_root}") endif() + unset(Matlab_MEXEXTENSIONS_PROG CACHE) return() endif() set(_matlab_mex_extension) + set(devnull) + if(UNIX) + set(devnull INPUT_FILE /dev/null) + elseif(WIN32) + set(devnull INPUT_FILE NUL) + endif() execute_process( - COMMAND ${MATLAB_MEXEXTENSIONS_PROG} + COMMAND ${Matlab_MEXEXTENSIONS_PROG} OUTPUT_VARIABLE _matlab_mex_extension - ERROR_VARIABLE _matlab_mex_extension_error) + ERROR_VARIABLE _matlab_mex_extension_error + ${devnull}) string(STRIP ${_matlab_mex_extension} _matlab_mex_extension) + unset(Matlab_MEXEXTENSIONS_PROG CACHE) set(${mex_suffix} ${_matlab_mex_extension} PARENT_SCOPE) endfunction() @@ -593,6 +620,13 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve set(_matlab_additional_commands "-wait") endif() + set(devnull) + if(UNIX) + set(devnull INPUT_FILE /dev/null) + elseif(WIN32) + set(devnull INPUT_FILE NUL) + endif() + # timeout set to 30 seconds, in case it does not start # note as said before OUTPUT_VARIABLE cannot be used in a platform # independent manner however, not setting it would flush the output of Matlab @@ -604,6 +638,7 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve ERROR_VARIABLE _matlab_result_version_call_error TIMEOUT 30 WORKING_DIRECTORY "${_matlab_temporary_folder}" + ${devnull} ) @@ -646,7 +681,9 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve list(APPEND matlab_list_of_all_versions_tmp ${CMAKE_MATCH_1}) endforeach() - list(REMOVE_DUPLICATES matlab_list_of_all_versions_tmp) + if(matlab_list_of_all_versions_tmp) + list(REMOVE_DUPLICATES matlab_list_of_all_versions_tmp) + endif() set(${matlab_list_versions} ${matlab_list_of_all_versions_tmp} PARENT_SCOPE) endif() @@ -918,245 +955,286 @@ function(matlab_add_mex ) endfunction() +# (internal) +# Used to get the version of matlab, using caching. This basically transforms the +# output of the root list, with possible unknown version, to a version +# +function(_Matlab_get_version_from_root matlab_root matlab_known_version matlab_final_version) + # if the version is not trivial, we query matlab for that + # we keep track of the location of matlab that induced this version + #if(NOT DEFINED Matlab_PROG_VERSION_STRING_AUTO_DETECT) + # set(Matlab_PROG_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version") + #endif() + if(NOT ${matlab_known_version} STREQUAL "NOTFOUND") + # the version is known, we just return it + set(${matlab_final_version} ${matlab_known_version} PARENT_SCOPE) + set(Matlab_VERSION_STRING_INTERNAL ${matlab_known_version} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) + return() + endif() + # + set(_matlab_current_program ${Matlab_MAIN_PROGRAM}) + # do we already have a matlab program? + if(NOT _matlab_current_program) + set(_find_matlab_options) + if(matlab_root AND EXISTS ${matlab_root}) + set(_find_matlab_options PATHS ${matlab_root} ${matlab_root}/bin NO_DEFAULT_PATH) + endif() -# this variable will get all Matlab installations found in the current system. -set(_matlab_possible_roots) + find_program( + _matlab_current_program + matlab + ${_find_matlab_options} + DOC "Matlab main program" + ) + endif() + if(NOT _matlab_current_program OR NOT EXISTS ${_matlab_current_program}) + # if not found, clear the dependent variables + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Cannot find the main matlab program under ${matlab_root}") + endif() + set(Matlab_PROG_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version" FORCE) + set(Matlab_VERSION_STRING_INTERNAL "" CACHE INTERNAL "internal matlab location for the discovered version" FORCE) + unset(_matlab_current_program) + unset(_matlab_current_program CACHE) + return() + endif() -# listing the Matlab versions installed on the WIN machine if MATLAB_USER_ROOT -# is not set -if(WIN32) + # full real path for path comparison + get_filename_component(_matlab_main_real_path_tmp "${_matlab_current_program}" REALPATH) + unset(_matlab_current_program) + unset(_matlab_current_program CACHE) - # for windows + # is it the same as the previous one? + if(_matlab_main_real_path_tmp STREQUAL Matlab_PROG_VERSION_STRING_AUTO_DETECT) + set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE) + return() + endif() + # update the location of the program + set(Matlab_PROG_VERSION_STRING_AUTO_DETECT ${_matlab_main_real_path_tmp} CACHE INTERNAL "internal matlab location for the discovered version" FORCE) - if(NOT MATLAB_USER_ROOT) - # if MATLAB_USER_ROOT not specified, we look for Matlab installation in - # the registry - # if unsuccessful, we look for all known revision and filter the existing - # ones. + set(matlab_list_of_all_versions) + matlab_get_version_from_matlab_run("${Matlab_PROG_VERSION_STRING_AUTO_DETECT}" matlab_list_of_all_versions) - # testing if we are able to extract the needed information from the registry - set(matlab_versions_from_registry) - matlab_extract_all_installed_versions_from_registry(CMAKE_CL_64 matlab_versions_from_registry) + list(GET matlab_list_of_all_versions 0 _matlab_version_tmp) + + # set the version into the cache + set(Matlab_VERSION_STRING_INTERNAL ${_matlab_version_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) + + # warning, just in case several versions found (should not happen) + list(LENGTH matlab_list_of_all_versions list_of_all_versions_length) + if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${matlab_list_of_all_versions})") + endif() + + # return the updated value + set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE) + +endfunction() - # the returned list is empty, doing the search on all known versions - if(NOT matlab_versions_from_registry) - if(MATLAB_FIND_DEBUG) - message(STATUS "[MATLAB] Search for Matlab from the registry unsuccessful, testing all supported versions") - endif() - extract_matlab_versions_from_registry_brute_force(matlab_versions_from_registry) - endif() - # filtering the results with the registry keys - matlab_get_all_valid_matlab_roots_from_registry("${matlab_versions_from_registry}" _matlab_possible_roots) - elseif(NOT EXISTS ${MATLAB_USER_ROOT}) +# ################################### +# Exploring the possible Matlab_ROOTS - # if MATLAB_USER_ROOT specified but erroneous +# this variable will get all Matlab installations found in the current system. +set(_matlab_possible_roots) + + + +if(Matlab_ROOT_DIR) + # if the user specifies a possible root, we keep this one + + if(NOT EXISTS ${Matlab_ROOT_DIR}) + # if Matlab_ROOT_DIR specified but erroneous if(MATLAB_FIND_DEBUG) - message(WARNING "[MATLAB] the specified path for MATLAB_USER_ROOT does not exist (${MATLAB_USER_ROOT})") + message(WARNING "[MATLAB] the specified path for Matlab_ROOT_DIR does not exist (${Matlab_ROOT_DIR})") endif() else() - list(APPEND _matlab_possible_roots "NOTFOUND" ${MATLAB_USER_ROOT}) # empty version + # NOTFOUND indicates the code below to search for the version automatically + if(NOT DEFINED Matlab_VERSION_STRING_INTERNAL) + list(APPEND _matlab_possible_roots "NOTFOUND" ${Matlab_ROOT_DIR}) # empty version + else() + list(APPEND _matlab_possible_roots ${Matlab_VERSION_STRING_INTERNAL} ${Matlab_ROOT_DIR}) # cached version + endif() endif() else() - # for linux/osx - if(NOT MATLAB_USER_ROOT) + # if the user does not specify the possible installation root, we look for + # one installation using the appropriate heuristics - # if MATLAB_USER_ROOT not specified, we look for Matlab from the command - # line PATH - # maybe using CMAKE_PROGRAM_PATH to add some more hints + if(WIN32) - set(_matlab_main_tmp "") - if(Matlab_MAIN_PROGRAM) - set(_matlab_main_tmp ${Matlab_MAIN_PROGRAM}) - endif() + # On WIN32, we look for Matlab installation in the registry + # if unsuccessful, we look for all known revision and filter the existing + # ones. - if(NOT _matlab_main_tmp) + # testing if we are able to extract the needed information from the registry + set(_matlab_versions_from_registry) + matlab_extract_all_installed_versions_from_registry(CMAKE_CL_64 _matlab_versions_from_registry) - find_program( - _matlab_main_tmp - NAMES matlab) - - if(NOT _matlab_main_tmp) - execute_process( - COMMAND "which" matlab - OUTPUT_VARIABLE _matlab_main_tmp - ERROR_VARIABLE _matlab_main_tmp_err) - # the output should be cleaned up - string(STRIP "${_matlab_main_tmp}" _matlab_main_tmp) - endif() + # the returned list is empty, doing the search on all known versions + if(NOT _matlab_versions_from_registry) - if(EXISTS ${_matlab_main_tmp}) - if(MATLAB_FIND_DEBUG) - message(STATUS "[MATLAB] matlab found from PATH: ${_matlab_main_tmp}") - endif() - else() - # found candidate is not good, we remove it - unset(_matlab_main_tmp) - unset(_matlab_main_tmp CACHE) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Search for Matlab from the registry unsuccessful, testing all supported versions") endif() - endif() # if(NOT _matlab_main_tmp) - - if(_matlab_main_tmp AND EXISTS ${_matlab_main_tmp}) - # resolve symlinks - get_filename_component(_matlab_current_location "${_matlab_main_tmp}" REALPATH) - set(_directory_alias DIRECTORY) - - # get the directory (the command below has to be run twice) - get_filename_component(_matlab_current_location "${_matlab_current_location}" ${_directory_alias}) - get_filename_component(_matlab_current_location "${_matlab_current_location}" ${_directory_alias}) # Matlab should be in bin - list(APPEND _matlab_possible_roots "NOTFOUND" ${_matlab_current_location}) # empty version + extract_matlab_versions_from_registry_brute_force(_matlab_versions_from_registry) endif() + # filtering the results with the registry keys + matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots) + unset(_matlab_versions_from_registry) + + elseif(APPLE) # on mac, we look for the /Application paths # this corresponds to the behaviour on Windows. On Linux, we do not have # any other guess. - if((NOT _matlab_possible_roots) AND APPLE) + matlab_get_supported_releases(_matlab_releases) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Matlab supported versions ${_matlab_releases}. If more version should be supported " + "the variable MATLAB_ADDITIONAL_VERSIONS can be set according to the documentation") + endif() - matlab_get_supported_releases(_matlab_releases) - if(MATLAB_FIND_DEBUG) - message(STATUS "[MATLAB] Matlab supported versions ${_matlab_releases}. If more version should be supported " - "the variable MATLAB_ADDITIONAL_VERSIONS can be set according to the documentation") + foreach(_matlab_current_release IN LISTS _matlab_releases) + set(_matlab_full_string "/Applications/MATLAB_${_matlab_current_release}.app") + if(EXISTS ${_matlab_full_string}) + set(_matlab_current_version) + matlab_get_version_from_release_name("${_matlab_current_release}" _matlab_current_version) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Found version ${_matlab_current_release} (${_matlab_current_version}) in ${_matlab_full_string}") + endif() + list(APPEND _matlab_possible_roots ${_matlab_current_version} ${_matlab_full_string}) + unset(_matlab_current_version) endif() - foreach(_matlab_current_release IN LISTS _matlab_releases) - set(_matlab_full_string "/Applications/MATLAB_${_matlab_current_release}.app") - if(EXISTS ${_matlab_full_string}) - set(_matlab_current_version) - matlab_get_version_from_release_name("${_matlab_current_release}" _matlab_current_version) - if(MATLAB_FIND_DEBUG) - message(STATUS "[MATLAB] Found version ${_matlab_current_release} (${_matlab_current_version}) in ${_matlab_full_string}") - endif() - list(APPEND _matlab_possible_roots ${_matlab_current_version}) - list(APPEND _matlab_possible_roots ${_matlab_full_string}) - unset(_matlab_current_version) - endif() + unset(_matlab_full_string) + endforeach(_matlab_current_release) - unset(_matlab_full_string) - endforeach(_matlab_current_release) - unset(_matlab_current_release) - unset(_matlab_releases) - endif() + unset(_matlab_current_release) + unset(_matlab_releases) + + endif() + +endif() + + + +list(LENGTH _matlab_possible_roots _numbers_of_matlab_roots) +if(_numbers_of_matlab_roots EQUAL 0) + # if we have not found anything, we fall back on the PATH + + + # At this point, we have no other choice than trying to find it from PATH. + # If set by the user, this wont change + find_program( + _matlab_main_tmp + NAMES matlab) - # we need to clear _matlab_main_tmp here - unset(_matlab_main_tmp CACHE) - unset(_matlab_main_tmp) - elseif(NOT EXISTS ${MATLAB_USER_ROOT}) - # if MATLAB_USER_ROOT specified but erroneous + if(_matlab_main_tmp) + # we then populate the list of roots, with empty version if(MATLAB_FIND_DEBUG) - message(WARNING "[MATLAB] the specified path for MATLAB_USER_ROOT does not exist (${MATLAB_USER_ROOT})") + message(STATUS "[MATLAB] matlab found from PATH: ${_matlab_main_tmp}") endif() - else() - list(APPEND _matlab_possible_roots "NOTFOUND" ${MATLAB_USER_ROOT}) # empty version + + # resolve symlinks + get_filename_component(_matlab_current_location "${_matlab_main_tmp}" REALPATH) + + # get the directory (the command below has to be run twice) + # this will be the matlab root + get_filename_component(_matlab_current_location "${_matlab_current_location}" DIRECTORY) + get_filename_component(_matlab_current_location "${_matlab_current_location}" DIRECTORY) # Matlab should be in bin + + list(APPEND _matlab_possible_roots "NOTFOUND" ${_matlab_current_location}) + + unset(_matlab_current_location) + endif() + unset(_matlab_main_tmp CACHE) + endif() + + + if(MATLAB_FIND_DEBUG) message(STATUS "[MATLAB] Matlab root folders are ${_matlab_possible_roots}") endif() -if(DEFINED Matlab_ROOT_DIR) - unset(Matlab_ROOT_DIR) -endif() + # take the first possible Matlab root -if(_matlab_possible_roots) +list(LENGTH _matlab_possible_roots _numbers_of_matlab_roots) +set(Matlab_VERSION_STRING "NOTFOUND") +if(_numbers_of_matlab_roots GREATER 0) list(GET _matlab_possible_roots 0 Matlab_VERSION_STRING) list(GET _matlab_possible_roots 1 Matlab_ROOT_DIR) - list(LENGTH _matlab_possible_roots numbers_of_matlab_roots) # adding a warning in case of ambiguity - if(numbers_of_matlab_roots GREATER 2 AND MATLAB_FIND_DEBUG) + if(_numbers_of_matlab_roots GREATER 2 AND MATLAB_FIND_DEBUG) message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})." - " If this is not the desired behaviour, provide the -DMATLAB_USER_ROOT on the command line") + " If this is not the desired behaviour, provide the -DMatlab_ROOT_DIR=... on the command line") endif() endif() -if((NOT (DEFINED Matlab_VERSION_STRING)) OR (NOT Matlab_VERSION_STRING)) - set(Matlab_VERSION_STRING "NOTFOUND") -endif() - - - -# if the version is not trivial, we query matlab for that -# we keep track of the location of matlab that induced this version -set(Matlab_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version") - -set(_matlab_version_should_be_recomputed FALSE) -if(${Matlab_VERSION_STRING} STREQUAL "NOTFOUND") - set(_matlab_version_should_be_recomputed TRUE) -elseif((NOT Matlab_MAIN_PROGRAM) OR (NOT EXISTS ${Matlab_MAIN_PROGRAM})) - set(_matlab_version_should_be_recomputed TRUE) -else() - # just in case the variable is modified to a symlink - get_filename_component(_matlab_main_tmp "${Matlab_MAIN_PROGRAM}" REALPATH) - if(NOT (_matlab_main_tmp STREQUAL Matlab_VERSION_STRING_AUTO_DETECT)) - set(_matlab_version_should_be_recomputed TRUE) +# check if the root changed against the previous defined one, if so +# clear all the cached variables +if(DEFINED Matlab_ROOT_DIR_LAST_CACHED) + + if(NOT Matlab_ROOT_DIR_LAST_CACHED STREQUAL Matlab_ROOT_DIR) + set(_Matlab_cached_vars + Matlab_INCLUDE_DIRS + Matlab_MEX_LIBRARY + Matlab_MEX_COMPILER + Matlab_MAIN_PROGRAM + Matlab_MX_LIBRARY + Matlab_ENG_LIBRARY + Matlab_MEX_EXTENSION + + # internal + Matlab_MEXEXTENSIONS_PROG + Matlab_ROOT_DIR_LAST_CACHED + #Matlab_PROG_VERSION_STRING_AUTO_DETECT + Matlab_VERSION_STRING_INTERNAL + ) + foreach(_var IN LISTS _Matlab_cached_vars) + if(DEFINED ${_var}) + unset(${_var} CACHE) + endif() + endforeach() endif() endif() -if(_matlab_version_should_be_recomputed) - if(MATLAB_FIND_DEBUG) - message(STATUS "[MATLAB] querying for version from Matlab root = ${Matlab_ROOT_DIR}") - endif() - - if(Matlab_MAIN_PROGRAM) - set(_matlab_main_tmp ${Matlab_MAIN_PROGRAM}) - else() - find_program( - _matlab_main_tmp - matlab - PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin - DOC "Matlab main program" - NO_DEFAULT_PATH - ) - endif() - - if(_matlab_main_tmp) - set(matlab_list_of_all_versions) - matlab_get_version_from_matlab_run("${_matlab_main_tmp}" matlab_list_of_all_versions) - - list(GET matlab_list_of_all_versions 0 MATLAB_VERSION_tmp) +set(Matlab_ROOT_DIR_LAST_CACHED ${Matlab_ROOT_DIR} CACHE INTERNAL "last Matlab root dir location") +set(Matlab_ROOT_DIR ${Matlab_ROOT_DIR} CACHE PATH "Matlab installation root path" FORCE) - # set the version into the cache - set(Matlab_VERSION_STRING ${MATLAB_VERSION_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) - list(LENGTH list_of_all_versions list_of_all_versions_length) - if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG) - message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${list_of_all_versions})") - endif() +# Fix the version, in case this one is NOTFOUND +_Matlab_get_version_from_root( + "${Matlab_ROOT_DIR}" + ${Matlab_VERSION_STRING} + Matlab_VERSION_STRING +) - # update the location of Matlab that produced this value - # we store the real path for comparison - get_filename_component(_matlab_main_tmp1 "${_matlab_main_tmp}" REALPATH) - set(Matlab_VERSION_STRING_AUTO_DETECT ${_matlab_main_tmp1} CACHE INTERNAL "internal matlab location for the discovered version" FORCE) - # these are internal variables - unset(_matlab_main_tmp) - unset(_matlab_main_tmp CACHE) - unset(_matlab_main_tmp1) - endif() -endif() if(MATLAB_FIND_DEBUG) @@ -1289,16 +1367,15 @@ unset(_matlab_find_mex_compiler) # component Matlab program list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program) if(_matlab_find_matlab_program GREATER -1) - # todo cleanup with code above - if(NOT DEFINED Matlab_MAIN_PROGRAM) - find_program( - Matlab_MAIN_PROGRAM - matlab - PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin - DOC "Matlab main program" - NO_DEFAULT_PATH - ) - endif() + + find_program( + Matlab_MAIN_PROGRAM + matlab + PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin + DOC "Matlab main program" + NO_DEFAULT_PATH + ) + if(Matlab_MAIN_PROGRAM) set(Matlab_MAIN_PROGRAM_FOUND TRUE) endif() @@ -1349,19 +1426,13 @@ unset(_matlab_lib_dir_for_search) set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY}) -if(CMAKE_VERSION VERSION_LESS "2.8.11") - find_package_handle_standard_args( - Matlab - REQUIRED_VARS ${_matlab_required_variables} - VERSION_VAR Matlab_VERSION_STRING) -else() - find_package_handle_standard_args( - Matlab - FOUND_VAR Matlab_FOUND - REQUIRED_VARS ${_matlab_required_variables} #MATLAB_REQUIRED_PROGRAMS MATLAB_REQUIRED_LIBRARIES MATLAB_REQUIRED_INCLUDE_DIRS - VERSION_VAR Matlab_VERSION_STRING - HANDLE_COMPONENTS) -endif() + +find_package_handle_standard_args( + Matlab + FOUND_VAR Matlab_FOUND + REQUIRED_VARS ${_matlab_required_variables} + VERSION_VAR Matlab_VERSION_STRING + HANDLE_COMPONENTS) unset(_matlab_required_variables) unset(_matlab_bin_prefix) @@ -1373,17 +1444,18 @@ unset(_matlab_lib_prefix_for_search) if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES) mark_as_advanced( - Matlab_LIBRARIES + #Matlab_LIBRARIES Matlab_MEX_LIBRARY Matlab_MX_LIBRARY Matlab_ENG_LIBRARY Matlab_INCLUDE_DIRS Matlab_FOUND - MATLAB_USER_ROOT - Matlab_ROOT_DIR - Matlab_VERSION_STRING + #Matlab_ROOT_DIR + #Matlab_VERSION_STRING Matlab_MAIN_PROGRAM + #Matlab_MEX_EXTENSION + Matlab_MEXEXTENSIONS_PROG Matlab_MEX_EXTENSION - Matlab_BINARIES_DIR + #Matlab_BINARIES_DIR ) endif() diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake index 804101c..ebccbf6 100644 --- a/Modules/MatlabTestsRedirect.cmake +++ b/Modules/MatlabTestsRedirect.cmake @@ -62,12 +62,20 @@ set(Matlab_SCRIPT_TO_RUN set(Matlab_LOG_FILE "${output_directory}/${test_name}.log") +set(devnull) +if(UNIX) + set(devnull INPUT_FILE /dev/null) +elseif(WIN32) + set(devnull INPUT_FILE NUL) +endif() + execute_process( COMMAND "${Matlab_PROGRAM}" ${Matlab_UNIT_TESTS_CMD} -logfile "${test_name}.log" -r "${Matlab_SCRIPT_TO_RUN}" RESULT_VARIABLE res TIMEOUT ${test_timeout} OUTPUT_QUIET # we do not want the output twice WORKING_DIRECTORY "${output_directory}" + ${devnull} ) if(NOT EXISTS ${Matlab_LOG_FILE}) diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m b/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m index 66be1bb..11d5e9e 100644 --- a/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m +++ b/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m @@ -9,7 +9,8 @@ classdef cmake_matlab_unit_tests_timeout < matlab.unittest.TestCase function testCallHangsShouldBeTimedOut(testCase) cmake_matlab_mex1(rand(3,3)); disp('Will now wait.'); - input('Testing the cmake Matlab package timeout - do not press anything'); + disp('Testing the cmake Matlab package timeout - do not kill'); + pause(20); % supposed to be killed after 15s end end end http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=842ab1091e7fae4e2622ffa2ac65bfa0c5f3a578 commit 842ab1091e7fae4e2622ffa2ac65bfa0c5f3a578 Author: Raffi Enficiaud AuthorDate: Thu Feb 19 14:36:27 2015 +0100 Commit: Brad King CommitDate: Thu Mar 12 15:30:23 2015 -0400 FindMatlab: Further revisions - Adding R2014a - Stripping the output of the which commando - Simplifying the registry query - Silencing the stderr of the execute_process commands - Condition on the recomputation of the version fixed - Fixed the space issues for the matlab temporary folder diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 6185935..9686a76 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -219,6 +219,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS) endif() set(MATLAB_VERSIONS_MAPPING + "R2014a=8.3" "R2013b=8.2" "R2013a=8.1" "R2012b=8.0" @@ -235,8 +236,8 @@ set(MATLAB_VERSIONS_MAPPING # temporary folder for all Matlab runs set(_matlab_temporary_folder ${CMAKE_BINARY_DIR}/Matlab) -if(NOT EXISTS ${_matlab_temporary_folder}) - file(MAKE_DIRECTORY ${_matlab_temporary_folder}) +if(NOT EXISTS "${_matlab_temporary_folder}") + file(MAKE_DIRECTORY "${_matlab_temporary_folder}") endif() #.rst: @@ -341,21 +342,6 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio message(FATAL_ERROR "This macro can only be called by a windows host (call to reg.exe") endif() - # list the keys under HKEY_LOCAL_MACHINE\SOFTWARE\mathworks but the call to - # reg does not work from cmake, curiously, as is. The command provides the - # desired result under the command line though. - # Fix: this is because "/reg:64" should appended to the command, otherwise - # it gets on the 32 bits software key (curiously again) - find_program(MATLAB_REG_EXE_LOCATION "reg") - - # if reg.exe is not found, then it is impossible to use this method. - if(NOT MATLAB_REG_EXE_LOCATION) - if(MATLAB_FIND_DEBUG) - message(WARNING "[MATLAB] reg.exe not found") - endif() - set(${matlab_versions} "" PARENT_SCOPE) - return() - endif() if(${win64} AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "64") set(APPEND_REG "/reg:64") @@ -366,7 +352,7 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio # /reg:64 should be added on 64 bits capable OSs in order to enable the # redirection of 64 bits applications execute_process( - COMMAND ${MATLAB_REG_EXE_LOCATION} query HKEY_LOCAL_MACHINE\\SOFTWARE\\Mathworks\\MATLAB /f * /k ${APPEND_REG} + COMMAND reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Mathworks\\MATLAB /f * /k ${APPEND_REG} RESULT_VARIABLE resultMatlab OUTPUT_VARIABLE varMatlab ERROR_VARIABLE errMatlab @@ -523,7 +509,7 @@ function(matlab_get_mex_suffix matlab_root mex_suffix) # one empty string element find_program( MATLAB_MEXEXTENSIONS_PROG - "mexext" + NAMES mexext PATHS ${matlab_root}/bin DOC "Matlab MEX extension provider" NO_DEFAULT_PATH @@ -556,7 +542,8 @@ function(matlab_get_mex_suffix matlab_root mex_suffix) execute_process( COMMAND ${MATLAB_MEXEXTENSIONS_PROG} - OUTPUT_VARIABLE _matlab_mex_extension) + OUTPUT_VARIABLE _matlab_mex_extension + ERROR_VARIABLE _matlab_mex_extension_error) string(STRIP ${_matlab_mex_extension} _matlab_mex_extension) set(${mex_suffix} ${_matlab_mex_extension} PARENT_SCOPE) @@ -590,11 +577,11 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve message(STATUS "[MATLAB] Determining the version of Matlab from ${matlab_binary_program}") endif() - if(EXISTS ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp) + if(EXISTS "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") if(MATLAB_FIND_DEBUG) message(STATUS "[MATLAB] Removing previous ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp file") endif() - file(REMOVE ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp) + file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") endif() @@ -611,10 +598,12 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve # independent manner however, not setting it would flush the output of Matlab # in the current console (unix variant) execute_process( - COMMAND ${matlab_binary_program} -nosplash -nojvm ${_matlab_additional_commands} -logfile ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp -nodesktop -nodisplay -r "version, exit" + COMMAND "${matlab_binary_program}" -nosplash -nojvm ${_matlab_additional_commands} -logfile "matlabVersionLog.cmaketmp" -nodesktop -nodisplay -r "version, exit" OUTPUT_VARIABLE _matlab_version_from_cmd_dummy RESULT_VARIABLE _matlab_result_version_call + ERROR_VARIABLE _matlab_result_version_call_error TIMEOUT 30 + WORKING_DIRECTORY "${_matlab_temporary_folder}" ) @@ -623,7 +612,7 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve message(WARNING "[MATLAB] Unable to determine the version of Matlab. Matlab call returned with error ${_matlab_result_version_call}.") endif() return() - elseif(NOT EXISTS ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp) + elseif(NOT EXISTS "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") if(MATLAB_FIND_DEBUG) message(WARNING "[MATLAB] Unable to determine the version of Matlab. The log file does not exist.") endif() @@ -631,8 +620,8 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve endif() # if successful, read back the log - file(READ ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp _matlab_version_from_cmd) - file(REMOVE ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp) + file(READ "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp" _matlab_version_from_cmd) + file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") set(index -1) string(FIND ${_matlab_version_from_cmd} "ans" index) @@ -997,28 +986,20 @@ else() endif() if(NOT _matlab_main_tmp) - # if we get there a second time and the folder matlab is created here, - # and then the find_program does not find it, - # the get_filename_component (... PROGRAM) finds this directory instead. + find_program( _matlab_main_tmp - "matlab") + NAMES matlab) if(NOT _matlab_main_tmp) - #execute_process(COMMAND which matlab OUTPUT_VARIABLE _which_matlab - # RESULT_VARIABLE _which_matlab_result) - get_filename_component(_matlab_main_tmp "matlab" PROGRAM) - - # "bug" of cmake: if we call get_filename_component with PROGRAM, it can - # return us a directory - if((NOT EXISTS ${_matlab_main_tmp}) OR (IS_DIRECTORY ${_matlab_main_tmp})) - execute_process( - COMMAND "which matlab" - OUTPUT_VARIABLE _matlab_main_tmp) - endif() + execute_process( + COMMAND "which" matlab + OUTPUT_VARIABLE _matlab_main_tmp + ERROR_VARIABLE _matlab_main_tmp_err) + # the output should be cleaned up + string(STRIP "${_matlab_main_tmp}" _matlab_main_tmp) endif() - if(EXISTS ${_matlab_main_tmp}) if(MATLAB_FIND_DEBUG) message(STATUS "[MATLAB] matlab found from PATH: ${_matlab_main_tmp}") @@ -1032,7 +1013,6 @@ else() endif() # if(NOT _matlab_main_tmp) if(_matlab_main_tmp AND EXISTS ${_matlab_main_tmp}) - # resolve symlinks get_filename_component(_matlab_current_location "${_matlab_main_tmp}" REALPATH) set(_directory_alias DIRECTORY) @@ -1141,7 +1121,7 @@ if(_matlab_version_should_be_recomputed) message(STATUS "[MATLAB] querying for version from Matlab root = ${Matlab_ROOT_DIR}") endif() - if(NOT Matlab_MAIN_PROGRAM) + if(Matlab_MAIN_PROGRAM) set(_matlab_main_tmp ${Matlab_MAIN_PROGRAM}) else() find_program( @@ -1155,7 +1135,7 @@ if(_matlab_version_should_be_recomputed) if(_matlab_main_tmp) set(matlab_list_of_all_versions) - matlab_get_version_from_matlab_run(${_matlab_main_tmp} matlab_list_of_all_versions) + matlab_get_version_from_matlab_run("${_matlab_main_tmp}" matlab_list_of_all_versions) list(GET matlab_list_of_all_versions 0 MATLAB_VERSION_tmp) diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake index 46d1ef8..804101c 100644 --- a/Modules/MatlabTestsRedirect.cmake +++ b/Modules/MatlabTestsRedirect.cmake @@ -60,13 +60,14 @@ set(Matlab_SCRIPT_TO_RUN "addpath(${concat_string}), path, ${cmd_to_run_before_test}, ${unittest_to_run}" ) -set(Matlab_LOG_FILE ${output_directory}/${test_name}.log) +set(Matlab_LOG_FILE "${output_directory}/${test_name}.log") execute_process( - COMMAND ${Matlab_PROGRAM} ${Matlab_UNIT_TESTS_CMD} -logfile ${Matlab_LOG_FILE} -r ${Matlab_SCRIPT_TO_RUN} + COMMAND "${Matlab_PROGRAM}" ${Matlab_UNIT_TESTS_CMD} -logfile "${test_name}.log" -r "${Matlab_SCRIPT_TO_RUN}" RESULT_VARIABLE res TIMEOUT ${test_timeout} OUTPUT_QUIET # we do not want the output twice + WORKING_DIRECTORY "${output_directory}" ) if(NOT EXISTS ${Matlab_LOG_FILE}) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3c025a5f6ef26e1f1c40024699559f2b7eb82aa2 commit 3c025a5f6ef26e1f1c40024699559f2b7eb82aa2 Author: Raffi Enficiaud AuthorDate: Thu Feb 12 17:13:31 2015 +0100 Commit: Brad King CommitDate: Thu Mar 12 15:30:23 2015 -0400 FindMatlab: Rewrite module and provide a usage API Implementation of the new FindMatlab module - FindMatlab learned about versions and components - ability to find Matlab and its version in a more precise and multiplatform way - ability to add new mex extension with a macro - ability to add a documentation - ability to add matlab unit tests (with or without the unit test framework) - reworked documentation diff --git a/Help/release/dev/FindMatlab-rewrite.rst b/Help/release/dev/FindMatlab-rewrite.rst new file mode 100644 index 0000000..07727b8 --- /dev/null +++ b/Help/release/dev/FindMatlab-rewrite.rst @@ -0,0 +1,7 @@ +FindMatlab-rewrite +------------------ + +* The :module:`FindMatlab` module was completely rewritten. It learned + about versions and components and to find Matlab in a more precise and + multiplatform way. The module now offers APIs to create mex extensions, + documentation, and unit tests. diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 73b3a5b..6185935 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -2,20 +2,199 @@ # FindMatlab # ---------- # -# this module looks for Matlab +# Finds Matlab installations and provides Matlab tools and libraries to cmake. # -# Defines: +# This package first intention is to find the libraries associated with Matlab +# in order to be able to build Matlab extensions (mex files). It can also be +# used: # -# :: +# * run specific commands in Matlab +# * declare Matlab unit test +# * retrieve various information from Matlab (mex extensions, versions and +# release queries, ...) # -# MATLAB_INCLUDE_DIR: include path for mex.h, engine.h -# MATLAB_LIBRARIES: required libraries: libmex, etc -# MATLAB_MEX_LIBRARY: path to libmex.lib -# MATLAB_MX_LIBRARY: path to libmx.lib -# MATLAB_ENG_LIBRARY: path to libeng.lib +# The module supports the following components: +# +# * ``MX_LIBRARY`` and ``ENG_LIBRARY`` respectively the MX and ENG libraries of +# Matlab +# * ``MAIN_PROGRAM`` the Matlab binary program. +# +# .. note:: +# +# The version given to the :command:`find_package` directive is the Matlab +# **version**, which should not be confused with the Matlab *release* name +# (eg. `R2014`). +# The :command:`matlab_get_version_from_release_name` and +# :command:`matlab_get_release_name_from_version` allow a mapping +# from the release name to the version. +# +# The variable :variable:`MATLAB_USER_ROOT` may be specified in order to give +# the path of the desired Matlab version. Otherwise, the behaviour is platform +# specific: +# +# * Windows: The installed versions of Matlab are retrieved from the +# Windows registry +# * OS X: The installed versions of Matlab are given by the MATLAB +# paths in ``/Application`` +# * Unix: The desired Matlab should be accessible from the PATH. +# +# Additional information is provided when :variable:`MATLAB_FIND_DEBUG` is set. +# When a Matlab binary is found automatically and the ``MATLAB_VERSION`` +# is not given, the version is queried from Matlab directly. +# On Windows, it can make a window running Matlab appear. +# +# The mapping of the release names and the version of Matlab is performed by +# defining pairs (name, version). The variable +# :variable:`MATLAB_ADDITIONAL_VERSIONS` may be provided before the call to +# the :command:`find_package` in order to handle additional versions. +# +# A Matlab scripts can be added to the set of tests using the +# :command:`matlab_add_unit_test`. By default, the Matlab unit test framework +# will be used (>= 2013a) to run this script, but regular ``.m`` files +# returning an exit code can be used as well (0 indicating a success). +# +# Module Input Variables +# ---------------------- +# +# Users or projects may set the following variables to configure the module +# behaviour: +# +# :variable:`MATLAB_USER_ROOT` +# the root of the Matlab installation. +# :variable:`MATLAB_FIND_DEBUG` +# outputs debug information +# :variable:`MATLAB_ADDITIONAL_VERSIONS` +# additional versions of Matlab for the automatic retrieval of the installed +# versions. +# +# Variables defined by the module +# ------------------------------- +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# ``Matlab_FOUND`` +# ``TRUE`` if the Matlab installation is found, ``FALSE`` +# otherwise. All variable below are defined if Matlab is found. +# ``Matlab_ROOT_DIR`` +# the root of the Matlab installation determined by the FindMatlab module. +# ``Matlab_MAIN_PROGRAM`` +# the Matlab binary program. Available only if the component ``MAIN_PROGRAM`` +# is given in the :command:`find_package` directive. +# ``Matlab_INCLUDE_DIRS`` +# the path of the Matlab libraries headers +# ``Matlab_MEX_LIBRARY`` +# library for mex +# ``Matlab_MX_LIBRARY`` +# mx library of Matlab (arrays). Available only if the component +# ``MX_LIBRARY`` has been requested. +# ``Matlab_ENG_LIBRARY`` +# Matlab engine library. Available only if the component ``ENG_LIBRARY`` +# is requested. +# ``Matlab_LIBRARIES`` +# the whole set of libraries of Matlab +# ``Matlab_MEX_COMPILER`` +# the mex compiler of Matlab. Currently not used. +# Available only if the component ``MEX_COMPILER`` is asked +# +# Cached variables +# ^^^^^^^^^^^^^^^^ +# +# ``Matlab_MEX_EXTENSION`` +# the extension of the mex files for the current platform (given by Matlab). +# +# Provided macros +# --------------- +# +# :command:`matlab_get_version_from_release_name` +# returns the version from the release name +# :command:`matlab_get_release_name_from_version` +# returns the release name from the Matlab version +# +# Provided functions +# ------------------ +# +# :command:`matlab_add_mex` +# adds a target compiling a MEX file. +# :command:`matlab_add_unit_test` +# adds a Matlab unit test file as a test to the project. +# :command:`matlab_extract_all_installed_versions_from_registry` +# parses the registry for all Matlab versions. Available on Windows only. +# The part of the registry parsed is dependent on the host processor +# :command:`matlab_get_all_valid_matlab_roots_from_registry` +# returns all the possible Matlab paths, according to a previously +# given list. Only the existing/accessible paths are kept. This is mainly +# useful for the searching all possible Matlab installation. +# :command:`matlab_get_mex_suffix` +# returns the suffix to be used for the mex files +# (platform/architecture dependant) +# :command:`matlab_get_version_from_matlab_run` +# returns the version of Matlab, given the full directory of the Matlab program. +# +# +# Known issues +# ------------ +# +# **Symbol clash in a MEX target** +# By default, every symbols inside a MEX +# file defined with the command :command:`matlab_add_mex` have hidden +# visibility, except for the entry point. This is the default behaviour of +# the MEX compiler, which lowers the risk of symbol collision between the +# libraries shipped with Matlab, and the libraries to which the MEX file is +# linking to. This is also the default on Windows platforms. +# +# However, this is not sufficient in certain case, where for instance your +# MEX file is linking against libraries that are already loaded by Matlab, +# even if those libraries have different SONAMES. +# A possible solution is to hide the symbols of the libraries to which the +# MEX target is linking to. This can be achieved in GNU GCC compilers with +# the linker option ``-Wl,--exclude-libs,ALL``. +# +# **Tests using GPU resources** +# in case your MEX file is using the GPU and +# in order to be able to run unit tests on this MEX file, the GPU resources +# should be properly released by Matlab. A possible solution is to make +# Matlab aware of the use of the GPU resources in the session, which can be +# performed by a command such as ``D = gpuDevice()`` at the beginning of +# the test script (or via a fixture). +# +# +# Reference +# -------------- +# +# .. variable:: MATLAB_USER_ROOT +# +# The root folder of the Matlab installation. This is set before the call to +# :command:`find_package`. If not set, then an automatic search of Matlab +# will be performed. If set, it should point to a valid version of Matlab. +# +# .. variable:: MATLAB_FIND_DEBUG +# +# If set, the lookup of Matlab and the intermediate configuration steps are +# outputted to the console. +# +# .. variable:: MATLAB_ADDITIONAL_VERSIONS +# +# If set, specifies additional versions of Matlab that may be looked for. +# This variable will be used if :variable:`MATLAB_USER_ROOT` is not set. +# The variable should be a list of strings, organised by pairs of release +# name and versions, such as follows:: +# +# set(MATLAB_ADDITIONAL_VERSIONS +# "release_name1=corresponding_version1" +# "release_name2=corresponding_version2" +# ... +# ) +# +# Example:: +# +# set(MATLAB_ADDITIONAL_VERSIONS +# "R2013b=8.2" +# "R2013a=8.1" +# "R2012b=8.0") #============================================================================= -# Copyright 2005-2009 Kitware, Inc. +# Copyright 2014-2015 Raffi Enficiaud, Max Planck Society # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -27,101 +206,1204 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -set(MATLAB_FOUND 0) -if(WIN32) - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") - set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc60") +set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}") + +include(FindPackageHandleStandardArgs) +include(CheckCXXCompilerFlag) + + +# The currently supported versions. Other version can be added by the user by +# providing MATLAB_ADDITIONAL_VERSIONS +if(NOT MATLAB_ADDITIONAL_VERSIONS) + set(MATLAB_ADDITIONAL_VERSIONS) +endif() + +set(MATLAB_VERSIONS_MAPPING + "R2013b=8.2" + "R2013a=8.1" + "R2012b=8.0" + "R2012a=7.14" + + "R2011b=7.13" + "R2011a=7.12" + "R2010b=7.11" + + ${MATLAB_ADDITIONAL_VERSIONS} + ) + + +# temporary folder for all Matlab runs +set(_matlab_temporary_folder ${CMAKE_BINARY_DIR}/Matlab) + +if(NOT EXISTS ${_matlab_temporary_folder}) + file(MAKE_DIRECTORY ${_matlab_temporary_folder}) +endif() + +#.rst: +# .. command:: matlab_get_version_from_release_name +# +# Returns the version of Matlab (17.58) from a release name (R2017k) +macro (matlab_get_version_from_release_name release_name version_name) + + string(REGEX MATCHALL "${release_name}=([0-9]+\\.?[0-9]*)" _matched ${MATLAB_VERSIONS_MAPPING}) + + set(${version_name} "") + if(NOT _matched STREQUAL "") + set(${version_name} ${CMAKE_MATCH_1}) else() - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 7") - # Assume people are generally using 7.1, - # if using 7.0 need to link to: ../extern/lib/win32/microsoft/msvc70 - set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc71") - else() - if(${CMAKE_GENERATOR} MATCHES "Borland") - # Same here, there are also: bcc50 and bcc51 directories - set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/bcc54") - else() - if(MATLAB_FIND_REQUIRED) - message(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}") - endif() + message(WARNING "The release name ${release_name} is not registered") + endif() + +endmacro() + + + + + +#.rst: +# .. command:: matlab_get_release_name_from_version +# +# Returns the release name (R2017k) from the version of Matlab (17.58) +macro (matlab_get_release_name_from_version version release_name) + + set(${release_name} "") + foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING) + string(REGEX MATCHALL "(.+)=${version}" _matched ${_var}) + if(NOT _matched STREQUAL "") + set(${release_name} ${CMAKE_MATCH_1}) + break() + endif() + endforeach(_var) + + unset(_var) + unset(_matched) + if(${release_name} STREQUAL "") + message(WARNING "The version ${version} is not registered") + endif() + +endmacro() + + + + + +# extracts all the supported release names (R2017k...) of Matlab +# internal use +macro(matlab_get_supported_releases list_releases) + set(${list_releases}) + foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING) + string(REGEX MATCHALL "(.+)=([0-9]+\\.?[0-9]*)" _matched ${_var}) + if(NOT _matched STREQUAL "") + list(APPEND ${list_releases} ${CMAKE_MATCH_1}) + endif() + unset(_matched) + unset(CMAKE_MATCH_1) + endforeach(_var) + unset(_var) +endmacro() + + + +# extracts all the supported versions of Matlab +# internal use +macro(matlab_get_supported_versions list_versions) + set(${list_versions}) + foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING) + string(REGEX MATCHALL "(.+)=([0-9]+\\.?[0-9]*)" _matched ${_var}) + if(NOT _matched STREQUAL "") + list(APPEND ${list_versions} ${CMAKE_MATCH_2}) + endif() + unset(_matched) + unset(CMAKE_MATCH_1) + endforeach(_var) + unset(_var) +endmacro() + + +#.rst: +# .. command:: matlab_extract_all_installed_versions_from_registry +# +# This function parses the registry and founds the Matlab versions that are +# installed. The found versions are returned in `matlab_versions`. +# Set `win64` to `TRUE` if the 64 bit version of Matlab should be looked for +# The returned list contains all versions under +# ``HKLM\\SOFTWARE\\Mathworks\\MATLAB`` or an empty list in case an error +# occurred (or nothing found). +# +# .. note:: +# +# Only the versions are provided. No check is made over the existence of the +# installation referenced in the registry, +# +function(matlab_extract_all_installed_versions_from_registry win64 matlab_versions) + + if(NOT CMAKE_HOST_WIN32) + message(FATAL_ERROR "This macro can only be called by a windows host (call to reg.exe") + endif() + + # list the keys under HKEY_LOCAL_MACHINE\SOFTWARE\mathworks but the call to + # reg does not work from cmake, curiously, as is. The command provides the + # desired result under the command line though. + # Fix: this is because "/reg:64" should appended to the command, otherwise + # it gets on the 32 bits software key (curiously again) + find_program(MATLAB_REG_EXE_LOCATION "reg") + + # if reg.exe is not found, then it is impossible to use this method. + if(NOT MATLAB_REG_EXE_LOCATION) + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] reg.exe not found") + endif() + set(${matlab_versions} "" PARENT_SCOPE) + return() + endif() + + if(${win64} AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "64") + set(APPEND_REG "/reg:64") + else() + set(APPEND_REG "/reg:32") + endif() + + # /reg:64 should be added on 64 bits capable OSs in order to enable the + # redirection of 64 bits applications + execute_process( + COMMAND ${MATLAB_REG_EXE_LOCATION} query HKEY_LOCAL_MACHINE\\SOFTWARE\\Mathworks\\MATLAB /f * /k ${APPEND_REG} + RESULT_VARIABLE resultMatlab + OUTPUT_VARIABLE varMatlab + ERROR_VARIABLE errMatlab + ) + #message("Matlabs = ${varMatlab} | ${resultMatlab}") + + + set(matlabs_from_registry) + if(${resultMatlab} EQUAL 0) + + string( + REGEX MATCHALL "MATLAB\\\\([0-9]+(\\.[0-9]+)?)" + matlab_versions_regex ${varMatlab}) + + foreach(match IN LISTS matlab_versions_regex) + string( + REGEX MATCH "MATLAB\\\\(([0-9]+)(\\.([0-9]+))?)" + current_match ${match}) + + set(_matlab_current_version ${CMAKE_MATCH_1}) + set(current_matlab_version_major ${CMAKE_MATCH_2}) + set(current_matlab_version_minor ${CMAKE_MATCH_4}) + if(NOT current_matlab_version_minor) + set(current_matlab_version_minor "0") endif() + + list(APPEND matlabs_from_registry ${_matlab_current_version}) + unset(_matlab_current_version) + endforeach(match) + + endif() + + set(${matlab_versions} ${matlabs_from_registry} PARENT_SCOPE) + +endfunction() + + + +# (internal) +macro(extract_matlab_versions_from_registry_brute_force matlab_versions) + # get the supported versions + set(matlab_supported_versions) + matlab_get_supported_versions(matlab_supported_versions) + + + # this is a manual population of the versions we want to look for + # this can be done as is, but preferably with the call to + # matlab_get_supported_versions and variable + + # populating the versions we want to look for + # set(matlab_supported_versions) + + # # Matlab 7 + # set(matlab_major 7) + # foreach(current_matlab_minor RANGE 4 20) + # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") + # endforeach(current_matlab_minor) + + # # Matlab 8 + # set(matlab_major 8) + # foreach(current_matlab_minor RANGE 0 5) + # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") + # endforeach(current_matlab_minor) + + # # taking into account the possible additional versions provided by the user + # if(DEFINED MATLAB_ADDITIONAL_VERSIONS) + # list(APPEND matlab_supported_versions MATLAB_ADDITIONAL_VERSIONS) + # endif() + + + # we order from more recent to older + list(REMOVE_DUPLICATES matlab_supported_versions) + list(SORT matlab_supported_versions) + list(REVERSE matlab_supported_versions) + + + set(${matlab_versions} ${matlab_supported_versions}) + + +endmacro() + + + + +#.rst: +# .. command:: matlab_get_all_valid_matlab_roots_from_registry +# +# Populates the Matlab root with valid versions of Matlab. +# The returned matlab_roots is organized in pairs +# ``(version_number,matlab_root_path)``. +# +# :: +# +# matlab_get_all_valid_matlab_roots_from_registry( +# matlab_versions +# matlab_roots) +# +# ``matlab_versions`` +# the versions of each of the Matlab installations +# ``matlab_roots`` +# the location of each of the Matlab installations +function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_roots) + + # The matlab_versions comes either from + # extract_matlab_versions_from_registry_brute_force or + # matlab_extract_all_installed_versions_from_registry. + + + set(_matlab_roots_list ) + foreach(_matlab_current_version ${matlab_versions}) + get_filename_component( + current_MATLAB_ROOT + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${_matlab_current_version};MATLABROOT]" + ABSOLUTE) + + if(EXISTS ${current_MATLAB_ROOT}) + list(APPEND _matlab_roots_list ${_matlab_current_version} ${current_MATLAB_ROOT}) + endif() + + endforeach(_matlab_current_version) + unset(_matlab_current_version) + set(${matlab_roots} ${_matlab_roots_list} PARENT_SCOPE) + unset(_matlab_roots_list) +endfunction() + +#.rst: +# .. command:: matlab_get_mex_suffix +# +# Returns the extension of the mex files (the suffixes). +# This function should not be called before the appropriate Matlab root has +# been found. +# +# :: +# +# matlab_get_mex_suffix( +# matlab_root +# mex_suffix) +# +# ``matlab_root`` +# the root of the Matlab installation +# ``mex_suffix`` +# the variable name in which the suffix will be returned. +function(matlab_get_mex_suffix matlab_root mex_suffix) + + # todo setup the extension properly. Currently I do not know if this is + # sufficient for all win32 distributions. + # there is also CMAKE_EXECUTABLE_SUFFIX that could be tweaked + set(mexext_suffix "") + if(WIN32) + list(APPEND mexext_suffix ".bat") + endif() + + # we first try without suffix, since cmake does not understand a list with + # one empty string element + find_program( + MATLAB_MEXEXTENSIONS_PROG + "mexext" + PATHS ${matlab_root}/bin + DOC "Matlab MEX extension provider" + NO_DEFAULT_PATH + ) + + foreach(current_mexext_suffix IN LISTS mexext_suffix) + if(NOT DEFINED MATLAB_MEXEXTENSIONS_PROG OR NOT MATLAB_MEXEXTENSIONS_PROG) + # this call should populate the cache automatically + find_program( + MATLAB_MEXEXTENSIONS_PROG + "mexext${current_mexext_suffix}" + PATHS ${matlab_root}/bin + DOC "Matlab MEX extension provider" + NO_DEFAULT_PATH + ) endif() + endforeach(current_mexext_suffix) + + + # the program has been found? + if((NOT MATLAB_MEXEXTENSIONS_PROG) OR (NOT EXISTS ${MATLAB_MEXEXTENSIONS_PROG})) + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Cannot found mexext program. Matlab root is ${matlab_root}") + endif() + return() endif() - find_library(MATLAB_MEX_LIBRARY - libmex - ${MATLAB_ROOT} + + set(_matlab_mex_extension) + + + execute_process( + COMMAND ${MATLAB_MEXEXTENSIONS_PROG} + OUTPUT_VARIABLE _matlab_mex_extension) + string(STRIP ${_matlab_mex_extension} _matlab_mex_extension) + + set(${mex_suffix} ${_matlab_mex_extension} PARENT_SCOPE) +endfunction() + + + + +#.rst: +# .. command:: matlab_get_version_from_matlab_run +# +# This function runs Matlab program specified on arguments and extracts its +# version. +# +# :: +# +# matlab_get_version_from_matlab_run( +# matlab_binary_path +# matlab_list_versions) +# +# ``matlab_binary_path`` +# the location of the `matlab` binary executable +# ``matlab_list_versions`` +# the version extracted from Matlab +function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_versions) + + set(${matlab_list_versions} "" PARENT_SCOPE) + + + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Determining the version of Matlab from ${matlab_binary_program}") + endif() + + if(EXISTS ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Removing previous ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp file") + endif() + file(REMOVE ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp) + endif() + + + # the log file is needed since on windows the command executes in a new + # window and it is not possible to get back the answer of Matlab + # the -wait command is needed on windows, otherwise the call returns + # immediately after the program launches itself. + if(WIN32) + set(_matlab_additional_commands "-wait") + endif() + + # timeout set to 30 seconds, in case it does not start + # note as said before OUTPUT_VARIABLE cannot be used in a platform + # independent manner however, not setting it would flush the output of Matlab + # in the current console (unix variant) + execute_process( + COMMAND ${matlab_binary_program} -nosplash -nojvm ${_matlab_additional_commands} -logfile ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp -nodesktop -nodisplay -r "version, exit" + OUTPUT_VARIABLE _matlab_version_from_cmd_dummy + RESULT_VARIABLE _matlab_result_version_call + TIMEOUT 30 ) - find_library(MATLAB_MX_LIBRARY - libmx - ${MATLAB_ROOT} + + + if(${_matlab_result_version_call}) + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Unable to determine the version of Matlab. Matlab call returned with error ${_matlab_result_version_call}.") + endif() + return() + elseif(NOT EXISTS ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp) + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Unable to determine the version of Matlab. The log file does not exist.") + endif() + return() + endif() + + # if successful, read back the log + file(READ ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp _matlab_version_from_cmd) + file(REMOVE ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp) + + set(index -1) + string(FIND ${_matlab_version_from_cmd} "ans" index) + if(index EQUAL -1) + + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Cannot find the version of Matlab returned by the run.") + endif() + + else() + set(matlab_list_of_all_versions_tmp) + + string(SUBSTRING ${_matlab_version_from_cmd} ${index} -1 substring_ans) + string( + REGEX MATCHALL "ans[\r\n\t ]*=[\r\n\t ]*([0-9]+(\\.[0-9]+)?)" + matlab_versions_regex + ${substring_ans}) + foreach(match IN LISTS matlab_versions_regex) + string( + REGEX MATCH "ans[\r\n\t ]*=[\r\n\t ]*(([0-9]+)(\\.([0-9]+))?)" + current_match ${match}) + + list(APPEND matlab_list_of_all_versions_tmp ${CMAKE_MATCH_1}) + endforeach() + list(REMOVE_DUPLICATES matlab_list_of_all_versions_tmp) + set(${matlab_list_versions} ${matlab_list_of_all_versions_tmp} PARENT_SCOPE) + + endif() + +endfunction() + + +#.rst: +# .. command:: matlab_add_unit_test +# +# Adds a Matlab unit test to the test set of cmake/ctest. +# This command requires the component ``MAIN_PROGRAM``. +# The unit test uses the Matlab unittest framework (default, available +# starting Matlab 2013b+) except if the option ``NO_UNITTEST_FRAMEWORK`` +# is given. +# +# The function expects one Matlab test script file to be given. +# In the case ``NO_UNITTEST_FRAMEWORK`` is given, the unittest script file +# should contain the script to be run, plus an exit command with the exit +# value. This exit value will be passed to the ctest framework (0 success, +# non 0 failure). Additional arguments accepted by :command:`add_test` can be +# passed through ``TEST_ARGS`` (eg. ``CONFIGURATION ...``). +# +# :: +# +# matlab_add_unit_test( +# NAME +# UNITTEST_FILE matlab_file_containing_unittest.m +# [UNITTEST_PRECOMMAND matlab_command_to_run] +# [TIMEOUT timeout] +# [ADDITIONAL_PATH path1 [path2 ...]] +# [MATLAB_ADDITIONAL_STARTUP_OPTIONS option1 [option2 ...]] +# [TEST_ARGS arg1 [arg2 ...]] +# [NO_UNITTEST_FRAMEWORK] +# ) +# +# The function arguments are: +# +# ``NAME`` +# name of the unittest in ctest. +# ``UNITTEST_FILE`` +# the matlab unittest file. Its path will be automatically +# added to the Matlab path. +# ``UNITTEST_PRECOMMAND`` +# Matlab script command to be ran before the file +# containing the test (eg. GPU device initialisation based on CMake +# variables). +# ``TIMEOUT`` +# the test timeout in seconds. Defaults to 180 seconds as the +# Matlab unit test may hang. +# ``ADDITIONAL_PATH`` +# a list of paths to add to the Matlab path prior to +# running the unit test. +# ``MATLAB_ADDITIONAL_STARTUP_OPTIONS`` +# a list of additional option in order +# to run Matlab from the command line. +# ``TEST_ARGS`` +# Additional options provided to the add_test command. These +# options are added to the default options (eg. "CONFIGURATIONS Release") +# ``NO_UNITTEST_FRAMEWORK`` +# when set, indicates that the test should not +# use the unittest framework of Matlab (available for versions >= R2013a). +# +function(matlab_add_unit_test) + + if(NOT Matlab_MAIN_PROGRAM) + message(FATAL_ERROR "[MATLAB] This functionality needs the MAIN_PROGRAM component (not default)") + endif() + + set(options NO_UNITTEST_FRAMEWORK) + set(oneValueArgs NAME UNITTEST_PRECOMMAND UNITTEST_FILE TIMEOUT) + set(multiValueArgs ADDITIONAL_PATH MATLAB_ADDITIONAL_STARTUP_OPTIONS TEST_ARGS) + + set(prefix _matlab_unittest_prefix) + cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + if(NOT ${prefix}_NAME) + message(FATAL_ERROR "[MATLAB] The Matlab test name cannot be empty") + endif() + + add_test(NAME ${${prefix}_NAME} + COMMAND ${CMAKE_COMMAND} + -Dtest_name=${${prefix}_NAME} + -Dadditional_paths=${${prefix}_ADDITIONAL_PATH} + -Dtest_timeout=${${prefix}_TIMEOUT} + -Doutput_directory=${_matlab_temporary_folder} + -DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM} + -Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK} + -DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS} + -Dunittest_file_to_run=${${prefix}_UNITTEST_FILE} + -Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND} + -P ${_FindMatlab_SELF_DIR}/MatlabTestsRedirect.cmake + ${${prefix}_TEST_ARGS} + ${${prefix}_UNPARSED_ARGUMENTS} + ) +endfunction() + + +#.rst: +# .. command:: matlab_add_mex +# +# Adds a Matlab MEX target. +# This commands compiles the given sources with the current tool-chain in +# order to produce a MEX file. The final name of the produced output may be +# specified, as well as additional link libraries, and a documentation entry +# for the MEX file. Remaining arguments of the call are passed to the +# :command:`add_library` command. +# +# :: +# +# matlab_add_mex( +# NAME +# SRC src1 [src2 ...] +# [OUTPUT_NAME output_name] +# [DOCUMENTATION file.txt] +# [LINK_TO target1 target2 ...] +# [...] +# ) +# +# ``NAME`` +# name of the target. +# ``SRC`` +# list of tje source files. +# ``LINK_TO`` +# a list of additional link dependencies. The target links to ``libmex`` +# by default. If ``Matlab_MX_LIBRARY`` is defined, it also +# links to ``libmx``. +# ``OUTPUT_NAME`` +# if given, overrides the default name. The default name is +# the name of the target without any prefix and +# with ``Matlab_MEX_EXTENSION`` suffix. +# ``DOCUMENTATION`` +# if given, the file ``file.txt`` will be considered as +# being the documentation file for the MEX file. This file is copied into +# the same folder without any processing, with the same name as the final +# mex file, and with extension `.m`. In that case, typing ``help `` +# in Matlab prints the documentation contained in this file. +# +# The documentation file is not processed and should be in the following +# format: +# +# :: +# +# % This is the documentation +# function ret = mex_target_output_name(input1) +# +function(matlab_add_mex ) + + if(NOT WIN32) + # we do not need all this on Windows + # pthread options + check_cxx_compiler_flag(-pthread HAS_MINUS_PTHREAD) + # we should use try_compile instead, the link flags are discarded from + # this compiler_flag function. + #check_cxx_compiler_flag(-Wl,--exclude-libs,ALL HAS_SYMBOL_HIDING_CAPABILITY) + + endif() + + set(oneValueArgs NAME DOCUMENTATION OUTPUT_NAME) + set(multiValueArgs LINK_TO SRC) + + set(prefix _matlab_addmex_prefix) + cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + if(NOT ${prefix}_NAME) + message(FATAL_ERROR "[MATLAB] The MEX target name cannot be empty") + endif() + + if(NOT ${prefix}_OUTPUT_NAME) + set(${prefix}_OUTPUT_NAME ${${prefix}_NAME}) + endif() + + add_library(${${prefix}_NAME} + SHARED + ${${prefix}_SRC} + ${${prefix}_DOCUMENTATION} + ${${prefix}_UNPARSED_ARGUMENTS}) + target_include_directories(${${prefix}_NAME} PRIVATE ${Matlab_INCLUDE_DIRS}) + + if(DEFINED Matlab_MX_LIBRARY) + target_link_libraries(${${prefix}_NAME} ${Matlab_MX_LIBRARY}) + endif() + + target_link_libraries(${${prefix}_NAME} ${Matlab_MEX_LIBRARY} ${${prefix}_LINK_TO}) + set_target_properties(${${prefix}_NAME} + PROPERTIES + PREFIX "" + OUTPUT_NAME ${${prefix}_OUTPUT_NAME} + SUFFIX ".${Matlab_MEX_EXTENSION}") + + + # documentation + if(NOT ${${prefix}_DOCUMENTATION} STREQUAL "") + get_target_property(output_name ${${prefix}_NAME} OUTPUT_NAME) + add_custom_command( + TARGET ${${prefix}_NAME} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${${prefix}_DOCUMENTATION} $/${output_name}.m + COMMENT "Copy ${${prefix}_NAME} documentation file into the output folder" ) - find_library(MATLAB_ENG_LIBRARY - libeng - ${MATLAB_ROOT} + endif() # documentation + + # entry point in the mex file + taking care of visibility and symbol clashes. + if(WIN32) + set_target_properties(${${prefix}_NAME} + PROPERTIES + DEFINE_SYMBOL "DLL_EXPORT_SYM=__declspec(dllexport)") + else() + + if(HAS_MINUS_PTHREAD AND NOT APPLE) + # Apparently, compiling with -pthread generated the proper link flags + # and some defines at compilation + target_compile_options(${${prefix}_NAME} PRIVATE "-pthread") + endif() + + + # if we do not do that, the symbols linked from eg. boost remain weak and + # then clash with the ones defined in the matlab process. So by default + # the symbols are hidden. + # This also means that for shared libraries (like MEX), the entry point + # should be explicitly declared with default visibility, otherwise Matlab + # cannot find the entry point. + # Note that this is particularly meaningful if the MEX wrapper itself + # contains symbols that are clashing with Matlab (that are compiled in the + # MEX file). In order to propagate the visibility options to the libraries + # to which the MEX file is linked against, the -Wl,--exclude-libs,ALL + # option should also be specified. + + set_target_properties(${${prefix}_NAME} + PROPERTIES + CXX_VISIBILITY_PRESET "hidden" + C_VISIBILITY_PRESET "hidden" + VISIBILITY_INLINES_HIDDEN "hidden" ) - find_path(MATLAB_INCLUDE_DIR - "mex.h" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/include" + # get_target_property( + # _previous_link_flags + # ${${prefix}_NAME} + # LINK_FLAGS) + # if(NOT _previous_link_flags) + # set(_previous_link_flags) + # endif() + + # if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # set_target_properties(${${prefix}_NAME} + # PROPERTIES + # LINK_FLAGS "${_previous_link_flags} -Wl,--exclude-libs,ALL" + # # -Wl,--version-script=${_FindMatlab_SELF_DIR}/MatlabLinuxVisibility.map" + # ) + # elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # # in this case, all other symbols become hidden. + # set_target_properties(${${prefix}_NAME} + # PROPERTIES + # LINK_FLAGS "${_previous_link_flags} -Wl,-exported_symbol,_mexFunction" + # #-Wl,-exported_symbols_list,${_FindMatlab_SELF_DIR}/MatlabOSXVisilibity.map" + # ) + # endif() + + + + set_target_properties(${${prefix}_NAME} + PROPERTIES + DEFINE_SYMBOL "DLL_EXPORT_SYM=__attribute__ ((visibility (\"default\")))" ) + + + endif() + +endfunction() + + + + + + + + +# this variable will get all Matlab installations found in the current system. +set(_matlab_possible_roots) + + +# listing the Matlab versions installed on the WIN machine if MATLAB_USER_ROOT +# is not set +if(WIN32) + + # for windows + + + if(NOT MATLAB_USER_ROOT) + # if MATLAB_USER_ROOT not specified, we look for Matlab installation in + # the registry + # if unsuccessful, we look for all known revision and filter the existing + # ones. + + # testing if we are able to extract the needed information from the registry + set(matlab_versions_from_registry) + matlab_extract_all_installed_versions_from_registry(CMAKE_CL_64 matlab_versions_from_registry) + + # the returned list is empty, doing the search on all known versions + if(NOT matlab_versions_from_registry) + + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Search for Matlab from the registry unsuccessful, testing all supported versions") + endif() + + extract_matlab_versions_from_registry_brute_force(matlab_versions_from_registry) + endif() + + # filtering the results with the registry keys + matlab_get_all_valid_matlab_roots_from_registry("${matlab_versions_from_registry}" _matlab_possible_roots) + + + + elseif(NOT EXISTS ${MATLAB_USER_ROOT}) + + # if MATLAB_USER_ROOT specified but erroneous + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] the specified path for MATLAB_USER_ROOT does not exist (${MATLAB_USER_ROOT})") + endif() + else() + list(APPEND _matlab_possible_roots "NOTFOUND" ${MATLAB_USER_ROOT}) # empty version + endif() + + else() - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - # Regular x86 - set(MATLAB_ROOT - /usr/local/matlab-7sp1/bin/glnx86/ - /opt/matlab-7sp1/bin/glnx86/ - $ENV{HOME}/matlab-7sp1/bin/glnx86/ - $ENV{HOME}/redhat-matlab/bin/glnx86/ - ) + # for linux/osx + + if(NOT MATLAB_USER_ROOT) + + # if MATLAB_USER_ROOT not specified, we look for Matlab from the command + # line PATH + # maybe using CMAKE_PROGRAM_PATH to add some more hints + + set(_matlab_main_tmp "") + if(Matlab_MAIN_PROGRAM) + set(_matlab_main_tmp ${Matlab_MAIN_PROGRAM}) + endif() + + if(NOT _matlab_main_tmp) + # if we get there a second time and the folder matlab is created here, + # and then the find_program does not find it, + # the get_filename_component (... PROGRAM) finds this directory instead. + find_program( + _matlab_main_tmp + "matlab") + + if(NOT _matlab_main_tmp) + #execute_process(COMMAND which matlab OUTPUT_VARIABLE _which_matlab + # RESULT_VARIABLE _which_matlab_result) + get_filename_component(_matlab_main_tmp "matlab" PROGRAM) + + # "bug" of cmake: if we call get_filename_component with PROGRAM, it can + # return us a directory + if((NOT EXISTS ${_matlab_main_tmp}) OR (IS_DIRECTORY ${_matlab_main_tmp})) + execute_process( + COMMAND "which matlab" + OUTPUT_VARIABLE _matlab_main_tmp) + endif() + endif() + + + if(EXISTS ${_matlab_main_tmp}) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] matlab found from PATH: ${_matlab_main_tmp}") + endif() + else() + # found candidate is not good, we remove it + unset(_matlab_main_tmp) + unset(_matlab_main_tmp CACHE) + endif() + + endif() # if(NOT _matlab_main_tmp) + + if(_matlab_main_tmp AND EXISTS ${_matlab_main_tmp}) + + # resolve symlinks + get_filename_component(_matlab_current_location "${_matlab_main_tmp}" REALPATH) + set(_directory_alias DIRECTORY) + + # get the directory (the command below has to be run twice) + get_filename_component(_matlab_current_location "${_matlab_current_location}" ${_directory_alias}) + get_filename_component(_matlab_current_location "${_matlab_current_location}" ${_directory_alias}) # Matlab should be in bin + list(APPEND _matlab_possible_roots "NOTFOUND" ${_matlab_current_location}) # empty version + endif() + + + # on mac, we look for the /Application paths + # this corresponds to the behaviour on Windows. On Linux, we do not have + # any other guess. + if((NOT _matlab_possible_roots) AND APPLE) + + matlab_get_supported_releases(_matlab_releases) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Matlab supported versions ${_matlab_releases}. If more version should be supported " + "the variable MATLAB_ADDITIONAL_VERSIONS can be set according to the documentation") + endif() + + foreach(_matlab_current_release IN LISTS _matlab_releases) + set(_matlab_full_string "/Applications/MATLAB_${_matlab_current_release}.app") + if(EXISTS ${_matlab_full_string}) + set(_matlab_current_version) + matlab_get_version_from_release_name("${_matlab_current_release}" _matlab_current_version) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Found version ${_matlab_current_release} (${_matlab_current_version}) in ${_matlab_full_string}") + endif() + list(APPEND _matlab_possible_roots ${_matlab_current_version}) + list(APPEND _matlab_possible_roots ${_matlab_full_string}) + unset(_matlab_current_version) + endif() + + unset(_matlab_full_string) + endforeach(_matlab_current_release) + unset(_matlab_current_release) + unset(_matlab_releases) + endif() + + # we need to clear _matlab_main_tmp here + unset(_matlab_main_tmp CACHE) + unset(_matlab_main_tmp) + + elseif(NOT EXISTS ${MATLAB_USER_ROOT}) + # if MATLAB_USER_ROOT specified but erroneous + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] the specified path for MATLAB_USER_ROOT does not exist (${MATLAB_USER_ROOT})") + endif() else() - # AMD64: - set(MATLAB_ROOT - /usr/local/matlab-7sp1/bin/glnxa64/ - /opt/matlab-7sp1/bin/glnxa64/ - $ENV{HOME}/matlab7_64/bin/glnxa64/ - $ENV{HOME}/matlab-7sp1/bin/glnxa64/ - $ENV{HOME}/redhat-matlab/bin/glnxa64/ - ) + list(APPEND _matlab_possible_roots "NOTFOUND" ${MATLAB_USER_ROOT}) # empty version endif() - find_library(MATLAB_MEX_LIBRARY - mex - ${MATLAB_ROOT} - ) - find_library(MATLAB_MX_LIBRARY - mx - ${MATLAB_ROOT} - ) - find_library(MATLAB_ENG_LIBRARY - eng - ${MATLAB_ROOT} - ) - find_path(MATLAB_INCLUDE_DIR - "mex.h" - "/usr/local/matlab-7sp1/extern/include/" - "/opt/matlab-7sp1/extern/include/" - "$ENV{HOME}/matlab-7sp1/extern/include/" - "$ENV{HOME}/redhat-matlab/extern/include/" +endif() + + +if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Matlab root folders are ${_matlab_possible_roots}") +endif() + + + +if(DEFINED Matlab_ROOT_DIR) + unset(Matlab_ROOT_DIR) +endif() + +# take the first possible Matlab root +if(_matlab_possible_roots) + list(GET _matlab_possible_roots 0 Matlab_VERSION_STRING) + list(GET _matlab_possible_roots 1 Matlab_ROOT_DIR) + list(LENGTH _matlab_possible_roots numbers_of_matlab_roots) + + # adding a warning in case of ambiguity + if(numbers_of_matlab_roots GREATER 2 AND MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})." + " If this is not the desired behaviour, provide the -DMATLAB_USER_ROOT on the command line") + endif() +endif() + + +if((NOT (DEFINED Matlab_VERSION_STRING)) OR (NOT Matlab_VERSION_STRING)) + set(Matlab_VERSION_STRING "NOTFOUND") +endif() + + + +# if the version is not trivial, we query matlab for that +# we keep track of the location of matlab that induced this version +set(Matlab_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version") + +set(_matlab_version_should_be_recomputed FALSE) +if(${Matlab_VERSION_STRING} STREQUAL "NOTFOUND") + set(_matlab_version_should_be_recomputed TRUE) +elseif((NOT Matlab_MAIN_PROGRAM) OR (NOT EXISTS ${Matlab_MAIN_PROGRAM})) + set(_matlab_version_should_be_recomputed TRUE) +else() + # just in case the variable is modified to a symlink + get_filename_component(_matlab_main_tmp "${Matlab_MAIN_PROGRAM}" REALPATH) + if(NOT (_matlab_main_tmp STREQUAL Matlab_VERSION_STRING_AUTO_DETECT)) + set(_matlab_version_should_be_recomputed TRUE) + endif() +endif() + +if(_matlab_version_should_be_recomputed) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] querying for version from Matlab root = ${Matlab_ROOT_DIR}") + endif() + + if(NOT Matlab_MAIN_PROGRAM) + set(_matlab_main_tmp ${Matlab_MAIN_PROGRAM}) + else() + find_program( + _matlab_main_tmp + matlab + PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin + DOC "Matlab main program" + NO_DEFAULT_PATH ) + endif() + + if(_matlab_main_tmp) + set(matlab_list_of_all_versions) + matlab_get_version_from_matlab_run(${_matlab_main_tmp} matlab_list_of_all_versions) + + list(GET matlab_list_of_all_versions 0 MATLAB_VERSION_tmp) + # set the version into the cache + set(Matlab_VERSION_STRING ${MATLAB_VERSION_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) + list(LENGTH list_of_all_versions list_of_all_versions_length) + if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${list_of_all_versions})") + endif() + + # update the location of Matlab that produced this value + # we store the real path for comparison + get_filename_component(_matlab_main_tmp1 "${_matlab_main_tmp}" REALPATH) + set(Matlab_VERSION_STRING_AUTO_DETECT ${_matlab_main_tmp1} CACHE INTERNAL "internal matlab location for the discovered version" FORCE) + + # these are internal variables + unset(_matlab_main_tmp) + unset(_matlab_main_tmp CACHE) + unset(_matlab_main_tmp1) + endif() endif() -# This is common to UNIX and Win32: -set(MATLAB_LIBRARIES - ${MATLAB_MEX_LIBRARY} - ${MATLAB_MX_LIBRARY} - ${MATLAB_ENG_LIBRARY} -) -if(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES) - set(MATLAB_FOUND 1) +if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Current version is ${Matlab_VERSION_STRING} located ${Matlab_ROOT_DIR}") +endif() + + + +if(Matlab_ROOT_DIR) + file(TO_CMAKE_PATH ${Matlab_ROOT_DIR} Matlab_ROOT_DIR) +endif() + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(_matlab_64Build FALSE) +else() + set(_matlab_64Build TRUE) +endif() + +if(APPLE) + set(_matlab_bin_prefix "mac") # i should be for intel + set(_matlab_bin_suffix_32bits "i") + set(_matlab_bin_suffix_64bits "i64") +elseif(UNIX) + set(_matlab_bin_prefix "gln") + set(_matlab_bin_suffix_32bits "x86") + set(_matlab_bin_suffix_64bits "xa64") +else() + set(_matlab_bin_prefix "win") + set(_matlab_bin_suffix_32bits "32") + set(_matlab_bin_suffix_64bits "64") +endif() + + + +set(MATLAB_INCLUDE_DIR_TO_LOOK ${Matlab_ROOT_DIR}/extern/include) +if(_matlab_64Build) + set(_matlab_current_suffix ${_matlab_bin_suffix_64bits}) +else() + set(_matlab_current_suffix ${_matlab_bin_suffix_32bits}) endif() -mark_as_advanced( - MATLAB_LIBRARIES - MATLAB_MEX_LIBRARY - MATLAB_MX_LIBRARY - MATLAB_ENG_LIBRARY - MATLAB_INCLUDE_DIR - MATLAB_FOUND - MATLAB_ROOT +set(Matlab_BINARIES_DIR + ${Matlab_ROOT_DIR}/bin/${_matlab_bin_prefix}${_matlab_current_suffix}) +set(Matlab_EXTERN_LIBRARY_DIR + ${Matlab_ROOT_DIR}/extern/lib/${_matlab_bin_prefix}${_matlab_current_suffix}) + +if(WIN32) + set(_matlab_lib_dir_for_search ${Matlab_EXTERN_LIBRARY_DIR}/microsoft) + set(_matlab_lib_prefix_for_search "lib") +else() + set(_matlab_lib_dir_for_search ${Matlab_BINARIES_DIR}) + set(_matlab_lib_prefix_for_search "lib") +endif() + +unset(_matlab_64Build) + + +if(NOT DEFINED Matlab_MEX_EXTENSION) + set(_matlab_mex_extension "") + matlab_get_mex_suffix("${Matlab_ROOT_DIR}" _matlab_mex_extension) + + # This variable goes to the cache. + set(Matlab_MEX_EXTENSION ${_matlab_mex_extension} CACHE STRING "Extensions for the mex targets (automatically given by Matlab)") + unset(_matlab_mex_extension) +endif() + + +if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] [DEBUG]_matlab_lib_prefix_for_search = ${_matlab_lib_prefix_for_search} | _matlab_lib_dir_for_search = ${_matlab_lib_dir_for_search}") +endif() + + + +# internal +# This small stub around find_library is to prevent any pollution of CMAKE_FIND_LIBRARY_PREFIXES in the global scope. +# This is the function to be used below instead of the find_library directives. +function(_Matlab_find_library _matlab_library_prefix) + set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} ${_matlab_library_prefix}) + find_library(${ARGN}) +endfunction() + + +set(_matlab_required_variables) + + +# the MEX library/header are required +find_path( + Matlab_INCLUDE_DIRS + mex.h + PATHS ${MATLAB_INCLUDE_DIR_TO_LOOK} + NO_DEFAULT_PATH + ) +list(APPEND _matlab_required_variables Matlab_INCLUDE_DIRS) + +_Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_MEX_LIBRARY + mex + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH ) + + +list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY) + +# the MEX extension is required +list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION) + +# the matlab root is required +list(APPEND _matlab_required_variables Matlab_ROOT_DIR) + + +# component Mex Compiler +list(FIND Matlab_FIND_COMPONENTS MEX_COMPILER _matlab_find_mex_compiler) +if(_matlab_find_mex_compiler GREATER -1) + find_program( + Matlab_MEX_COMPILER + "mex" + PATHS ${Matlab_BINARIES_DIR} + DOC "Matlab MEX compiler" + NO_DEFAULT_PATH + ) + + if(Matlab_MEX_COMPILER) + set(Matlab_MEX_COMPILER_FOUND TRUE) + endif() +endif() +unset(_matlab_find_mex_compiler) + +# component Matlab program +list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program) +if(_matlab_find_matlab_program GREATER -1) + # todo cleanup with code above + if(NOT DEFINED Matlab_MAIN_PROGRAM) + find_program( + Matlab_MAIN_PROGRAM + matlab + PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin + DOC "Matlab main program" + NO_DEFAULT_PATH + ) + endif() + if(Matlab_MAIN_PROGRAM) + set(Matlab_MAIN_PROGRAM_FOUND TRUE) + endif() + +endif() +unset(_matlab_find_matlab_program) + +# Component MX library +list(FIND Matlab_FIND_COMPONENTS MX_LIBRARY _matlab_find_mx) +if(_matlab_find_mx GREATER -1) + _Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_MX_LIBRARY + mx + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH + ) + + if(Matlab_MX_LIBRARY) + set(Matlab_MX_LIBRARY_FOUND TRUE) + endif() +endif() +unset(_matlab_find_mx) + + +# Component ENG library +list(FIND Matlab_FIND_COMPONENTS ENG_LIBRARY _matlab_find_eng) +if(_matlab_find_eng GREATER -1) + _Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_ENG_LIBRARY + eng + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH + ) + if(Matlab_ENG_LIBRARY) + set(Matlab_ENG_LIBRARY_FOUND TRUE) + endif() +endif() +unset(_matlab_find_eng) + + + + + +unset(_matlab_lib_dir_for_search) + + +set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY}) + +if(CMAKE_VERSION VERSION_LESS "2.8.11") + find_package_handle_standard_args( + Matlab + REQUIRED_VARS ${_matlab_required_variables} + VERSION_VAR Matlab_VERSION_STRING) +else() + find_package_handle_standard_args( + Matlab + FOUND_VAR Matlab_FOUND + REQUIRED_VARS ${_matlab_required_variables} #MATLAB_REQUIRED_PROGRAMS MATLAB_REQUIRED_LIBRARIES MATLAB_REQUIRED_INCLUDE_DIRS + VERSION_VAR Matlab_VERSION_STRING + HANDLE_COMPONENTS) +endif() + +unset(_matlab_required_variables) +unset(_matlab_bin_prefix) +unset(_matlab_bin_suffix_32bits) +unset(_matlab_bin_suffix_64bits) +unset(_matlab_current_suffix) +unset(_matlab_lib_dir_for_search) +unset(_matlab_lib_prefix_for_search) + +if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES) + mark_as_advanced( + Matlab_LIBRARIES + Matlab_MEX_LIBRARY + Matlab_MX_LIBRARY + Matlab_ENG_LIBRARY + Matlab_INCLUDE_DIRS + Matlab_FOUND + MATLAB_USER_ROOT + Matlab_ROOT_DIR + Matlab_VERSION_STRING + Matlab_MAIN_PROGRAM + Matlab_MEX_EXTENSION + Matlab_BINARIES_DIR + ) +endif() diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake new file mode 100644 index 0000000..46d1ef8 --- /dev/null +++ b/Modules/MatlabTestsRedirect.cmake @@ -0,0 +1,83 @@ +# This is an undocumented internal helper for the FindMatlab +# module ``matlab_add_unit_test`` command. + +#============================================================================= +# Copyright 2014-2015 Raffi Enficiaud, Max Planck Society +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +# Usage: cmake +# -Dtest_timeout=180 +# -Dworking_directory="." +# -Doutput_directory= +# -Dadditional_paths="" +# -Dno_unittest_framework="" +# -DMatlab_PROGRAM=matlab_exe_location +# -DMatlab_ADDITIONNAL_STARTUP_OPTIONS="" +# -Dtest_name=name_of_the_test +# -Dcmd_to_run_before_test="" +# -Dunittest_file_to_run +# -P FindMatlab_TestsRedirect.cmake + +set(Matlab_UNIT_TESTS_CMD -nosplash -nojvm -nodesktop -nodisplay ${Matlab_ADDITIONNAL_STARTUP_OPTIONS}) +if(WIN32) + set(Matlab_UNIT_TESTS_CMD ${Matlab_UNIT_TESTS_CMD} -wait) +endif() + +if(NOT test_timeout) + set(test_timeout 180) +endif() + +if(NOT cmd_to_run_before_test) + set(cmd_to_run_before_test) +endif() + +get_filename_component(unittest_file_directory "${unittest_file_to_run}" DIRECTORY) +get_filename_component(unittest_file_to_run_name "${unittest_file_to_run}" NAME_WE) + +set(concat_string '${unittest_file_directory}') +foreach(s IN LISTS additional_paths) + if(NOT "${s}" STREQUAL "") + set(concat_string "${concat_string}, '${s}'") + endif() +endforeach() + +set(unittest_to_run "runtests('${unittest_file_to_run_name}'), exit(max([ans(1,:).Failed]))") +if(no_unittest_framework) + set(unittest_to_run "try, ${unittest_file_to_run_name}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)") +endif() + +set(Matlab_SCRIPT_TO_RUN + "addpath(${concat_string}), path, ${cmd_to_run_before_test}, ${unittest_to_run}" + ) + +set(Matlab_LOG_FILE ${output_directory}/${test_name}.log) + +execute_process( + COMMAND ${Matlab_PROGRAM} ${Matlab_UNIT_TESTS_CMD} -logfile ${Matlab_LOG_FILE} -r ${Matlab_SCRIPT_TO_RUN} + RESULT_VARIABLE res + TIMEOUT ${test_timeout} + OUTPUT_QUIET # we do not want the output twice + ) + +if(NOT EXISTS ${Matlab_LOG_FILE}) + message( FATAL_ERROR "[MATLAB] ERROR: cannot find the log file ${Matlab_LOG_FILE}") +endif() + +# print the output in any case. +file(READ ${Matlab_LOG_FILE} matlab_log_content) +message("Matlab test ${name_of_the_test} output:\n${matlab_log_content}") # if we put FATAL_ERROR here, the file is indented. + + +if(NOT (res EQUAL 0)) + message( FATAL_ERROR "[MATLAB] TEST FAILED" ) +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 703c548..414f625 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1256,6 +1256,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindJsonCpp) endif() + # Matlab module + if(CMake_TEST_FindMatlab) + ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $) + ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -C $) + endif() + find_package(GTK2 QUIET) if(GTK2_FOUND) add_subdirectory(FindGTK2) diff --git a/Tests/FindMatlab/basic_checks/CMakeLists.txt b/Tests/FindMatlab/basic_checks/CMakeLists.txt new file mode 100644 index 0000000..acf71ea --- /dev/null +++ b/Tests/FindMatlab/basic_checks/CMakeLists.txt @@ -0,0 +1,57 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(basic_checks) + +set(MATLAB_FIND_DEBUG TRUE) + +# the success of the following command is dependent on the current configuration: +# - on 32bits builds (cmake is building with 32 bits), it looks for 32 bits Matlab +# - on 64bits builds (cmake is building with 64 bits), it looks for 64 bits Matlab +find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY MAIN_PROGRAM) + + + +matlab_add_mex( + # target name + NAME cmake_matlab_test_wrapper1 + # output name + OUTPUT_NAME cmake_matlab_mex1 + SRC ${CMAKE_CURRENT_SOURCE_DIR}/../matlab_wrapper1.cpp + DOCUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/../help_text1.m.txt + ) + + +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-1 + TIMEOUT 30 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests1.m + ADDITIONAL_PATH $ + ) + +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-2 + TIMEOUT 15 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests_timeout.m + ADDITIONAL_PATH $ + ) +set_tests_properties(${PROJECT_NAME}_matlabtest-2 PROPERTIES WILL_FAIL TRUE) + + +# testing the test without the unittest framework of Matlab +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-3 + TIMEOUT 30 + NO_UNITTEST_FRAMEWORK + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests2.m + ADDITIONAL_PATH $ + ) + +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-4 + TIMEOUT 30 + NO_UNITTEST_FRAMEWORK + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests3.m + ADDITIONAL_PATH $ + ) +set_tests_properties(${PROJECT_NAME}_matlabtest-4 PROPERTIES WILL_FAIL TRUE) diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests1.m b/Tests/FindMatlab/cmake_matlab_unit_tests1.m new file mode 100644 index 0000000..2371c3a --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests1.m @@ -0,0 +1,33 @@ + +classdef cmake_matlab_unit_tests1 < matlab.unittest.TestCase + % some simple unit test for CMake Matlab wrapper + properties + end + + methods (Test) + function testDummyCall(testCase) + % very simple call test + cmake_matlab_mex1(rand(3,3)); + end + + function testDummyCall2(testCase) + % very simple call test 2 + ret = cmake_matlab_mex1(rand(3,3)); + testCase.verifyEqual(size(ret), size(rand(3,3))); + + testCase.verifyEqual(size(cmake_matlab_mex1(rand(4,3))), [4,3] ); + end + + function testFailTest(testCase) + testCase.verifyError(@() cmake_matlab_mex1(10), 'cmake_matlab:configuration'); + testCase.verifyError(@() cmake_matlab_mex1([10]), 'cmake_matlab:configuration'); + end + + function testHelpContent(testCase) + % testing the help feature + testCase.verifySubstring(evalc('help cmake_matlab_mex1'), 'Dummy matlab extension in cmake'); + end + + + end +end diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests2.m b/Tests/FindMatlab/cmake_matlab_unit_tests2.m new file mode 100644 index 0000000..7a8a342 --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests2.m @@ -0,0 +1,6 @@ + +ret = cmake_matlab_mex1(rand(3,3)); + +if(size(ret) ~= size(rand(3,3))) + error('Dimension mismatch!'); +end diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests3.m b/Tests/FindMatlab/cmake_matlab_unit_tests3.m new file mode 100644 index 0000000..2639325 --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests3.m @@ -0,0 +1,5 @@ + +cmake_matlab_mex1(10); + +% should not reach this point +exit(0); diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m b/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m new file mode 100644 index 0000000..66be1bb --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m @@ -0,0 +1,15 @@ + +classdef cmake_matlab_unit_tests_timeout < matlab.unittest.TestCase + % timeout tests + + properties + end + + methods (Test) + function testCallHangsShouldBeTimedOut(testCase) + cmake_matlab_mex1(rand(3,3)); + disp('Will now wait.'); + input('Testing the cmake Matlab package timeout - do not press anything'); + end + end +end diff --git a/Tests/FindMatlab/help_text1.m.txt b/Tests/FindMatlab/help_text1.m.txt new file mode 100644 index 0000000..a924355 --- /dev/null +++ b/Tests/FindMatlab/help_text1.m.txt @@ -0,0 +1,2 @@ +% Dummy matlab extension in cmake +function ret = cmake_matlab_mex1(X) diff --git a/Tests/FindMatlab/matlab_wrapper1.cpp b/Tests/FindMatlab/matlab_wrapper1.cpp new file mode 100644 index 0000000..4149bb9 --- /dev/null +++ b/Tests/FindMatlab/matlab_wrapper1.cpp @@ -0,0 +1,26 @@ + +// simple workaround to some compiler specific problems +// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 +#include + +#include "mex.h" + +// this test should return a matrix of 10 x 10 and should check some of the arguments + +void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[]) +{ + if(nrhs != 1) + { + mexErrMsgTxt("Incorrect arguments"); + } + + size_t dim1 = mxGetM(prhs[0]); + size_t dim2 = mxGetN(prhs[0]); + + if(dim1 == 1 || dim2 == 1) + { + mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments"); + } + + plhs[0] = mxCreateNumericMatrix(dim1, dim2, mxGetClassID(prhs[0]), mxREAL); +} diff --git a/Tests/FindMatlab/versions_checks/CMakeLists.txt b/Tests/FindMatlab/versions_checks/CMakeLists.txt new file mode 100644 index 0000000..5d20685 --- /dev/null +++ b/Tests/FindMatlab/versions_checks/CMakeLists.txt @@ -0,0 +1,52 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(versions_checks) + +set(MATLAB_FIND_DEBUG TRUE) +set(MATLAB_ADDITIONAL_VERSIONS + "dummy=14.9") + +# the success of the following command is dependent on the current configuration +# in this case, we are only interested in the version macros +find_package(Matlab) + + + +if(NOT COMMAND matlab_get_version_from_release_name) + message(FATAL_ERROR "The macro matlab_get_version_from_release_name should be defined") +endif() + +if(NOT COMMAND matlab_get_release_name_from_version) + message(FATAL_ERROR "The macro matlab_get_release_name_from_version should be defined") +endif() + + +# matlab_get_release_name_from_version +matlab_get_release_name_from_version("7.13" release_name) +if(NOT release_name STREQUAL "R2011b") + message(FATAL_ERROR "version 7.13 does not give release R2011b : '${release_name}' != R2011b") +endif() + +matlab_get_release_name_from_version("14.9" release_name) +if(NOT release_name STREQUAL "dummy") + message(FATAL_ERROR "version 14.9 does not give release dummy : '${release_name}' != dummy") +endif() + +matlab_get_release_name_from_version("14.10" release_name) +if(NOT release_name STREQUAL "") + message(FATAL_ERROR "version 14.10 does not give empty release: '${release_name}' != ''") +endif() + + +# matlab_get_version_from_release_name +matlab_get_version_from_release_name("R2011a" version) +if(NOT version STREQUAL "7.12") + message(FATAL_ERROR "Release R2011a does not give version 7.12 : '${version}' != 7.12") +endif() + +matlab_get_version_from_release_name("dummy" version) +#message(FATAL_ERROR "versionversion = ${version}") +if(NOT version STREQUAL "14.9") + message(FATAL_ERROR "Release dummy does not give version 14.9 : '${version}' != 14.9") +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 1bcc3f3..7cbc9fe 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -211,3 +211,8 @@ if(RPMBUILD_EXECUTABLE) endif() add_RunCMake_test(COMPILE_LANGUAGE-genex) + +# Matlab module related tests +if(CMake_TEST_FindMatlab) + add_RunCMake_test(FindMatlab) +endif() diff --git a/Tests/RunCMake/FindMatlab/CMakeLists.txt b/Tests/RunCMake/FindMatlab/CMakeLists.txt new file mode 100644 index 0000000..1b9a957 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/CMakeLists.txt @@ -0,0 +1,3 @@ + +cmake_minimum_required(VERSION 2.8.12) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1-result.txt b/Tests/RunCMake/FindMatlab/MatlabTest1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FindMatlab/MatlabTest1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt b/Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt new file mode 100644 index 0000000..95a787f --- /dev/null +++ b/Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*FindMatlab.cmake:[0-9]+ \(message\): + \[MATLAB\] This functionality needs the MAIN_PROGRAM component \(not default\) diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1.cmake b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake new file mode 100644 index 0000000..1cbc1c2 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake @@ -0,0 +1,22 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(test_should_fail) + +find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY) + +matlab_add_mex( + # target name + NAME cmake_matlab_test_wrapper1 + # output name + OUTPUT_NAME cmake_matlab_mex1 + SRC ${CMAKE_CURRENT_SOURCE_DIR}/matlab_wrapper1.cpp + ) + +# this command should raise a FATAL_ERROR, component MAIN_PROGRAM is missing +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-1 + TIMEOUT 1 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake_matlab_unit_tests2.m + ADDITIONAL_PATH $ + ) diff --git a/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake new file mode 100644 index 0000000..33dbb77 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake @@ -0,0 +1,3 @@ + +include(RunCMake) +run_cmake(MatlabTest1) diff --git a/Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m b/Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m new file mode 100644 index 0000000..7a8a342 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m @@ -0,0 +1,6 @@ + +ret = cmake_matlab_mex1(rand(3,3)); + +if(size(ret) ~= size(rand(3,3))) + error('Dimension mismatch!'); +end diff --git a/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp new file mode 100644 index 0000000..4149bb9 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp @@ -0,0 +1,26 @@ + +// simple workaround to some compiler specific problems +// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 +#include + +#include "mex.h" + +// this test should return a matrix of 10 x 10 and should check some of the arguments + +void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[]) +{ + if(nrhs != 1) + { + mexErrMsgTxt("Incorrect arguments"); + } + + size_t dim1 = mxGetM(prhs[0]); + size_t dim2 = mxGetN(prhs[0]); + + if(dim1 == 1 || dim2 == 1) + { + mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments"); + } + + plhs[0] = mxCreateNumericMatrix(dim1, dim2, mxGetClassID(prhs[0]), mxREAL); +} ----------------------------------------------------------------------- Summary of changes: Help/release/dev/FindMatlab-rewrite.rst | 7 + Modules/FindMatlab.cmake | 1508 ++++++++++++++++++-- Modules/MatlabTestsRedirect.cmake | 92 ++ Tests/CMakeLists.txt | 6 + Tests/FindMatlab/basic_checks/CMakeLists.txt | 57 + Tests/FindMatlab/cmake_matlab_unit_tests1.m | 33 + Tests/FindMatlab/cmake_matlab_unit_tests2.m | 6 + Tests/FindMatlab/cmake_matlab_unit_tests3.m | 5 + Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m | 16 + Tests/FindMatlab/help_text1.m.txt | 2 + Tests/FindMatlab/matlab_wrapper1.cpp | 26 + Tests/FindMatlab/versions_checks/CMakeLists.txt | 52 + Tests/RunCMake/CMakeLists.txt | 5 + .../{CMP0038 => FindMatlab}/CMakeLists.txt | 2 +- .../MatlabTest1-result.txt} | 0 Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt | 2 + Tests/RunCMake/FindMatlab/MatlabTest1.cmake | 22 + Tests/RunCMake/FindMatlab/RunCMakeTest.cmake | 3 + .../RunCMake/FindMatlab/cmake_matlab_unit_tests2.m | 6 + Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp | 26 + 20 files changed, 1788 insertions(+), 88 deletions(-) create mode 100644 Help/release/dev/FindMatlab-rewrite.rst create mode 100644 Modules/MatlabTestsRedirect.cmake create mode 100644 Tests/FindMatlab/basic_checks/CMakeLists.txt create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests1.m create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests2.m create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests3.m create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m create mode 100644 Tests/FindMatlab/help_text1.m.txt create mode 100644 Tests/FindMatlab/matlab_wrapper1.cpp create mode 100644 Tests/FindMatlab/versions_checks/CMakeLists.txt copy Tests/RunCMake/{CMP0038 => FindMatlab}/CMakeLists.txt (70%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => FindMatlab/MatlabTest1-result.txt} (100%) create mode 100644 Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt create mode 100644 Tests/RunCMake/FindMatlab/MatlabTest1.cmake create mode 100644 Tests/RunCMake/FindMatlab/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m create mode 100644 Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 13 00:01:05 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 13 Mar 2015 00:01:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-426-g0769644 Message-ID: <20150313040105.DBA4DABDCD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 07696442124e63f6498109480e4adabf4fd00a8c (commit) from 6390d5f5cb107dcc4a0bc6124ab5f17370dcadcd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07696442124e63f6498109480e4adabf4fd00a8c commit 07696442124e63f6498109480e4adabf4fd00a8c Author: Kitware Robot AuthorDate: Fri Mar 13 00:01:03 2015 -0400 Commit: Kitware Robot CommitDate: Fri Mar 13 00:01:03 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ca66478..4880660 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150312) +set(CMake_VERSION_PATCH 20150313) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From bill.hoffman at kitware.com Fri Mar 13 20:01:14 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Fri, 13 Mar 2015 20:01:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1021-g0a9885a Message-ID: <20150314000118.92DA8AB76F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0a9885ab197a880c0841aeb93841e8744466fa94 (commit) via 0b65f7fe6aa3f696ffa4dc9e461873050c15745e (commit) from 259cff6357cba8ca026d1fe9dc98002c861b4c3d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a9885ab197a880c0841aeb93841e8744466fa94 commit 0a9885ab197a880c0841aeb93841e8744466fa94 Merge: 259cff6 0b65f7f Author: Bill Hoffman AuthorDate: Fri Mar 13 20:01:08 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 13 20:01:08 2015 -0400 Merge topic 'add_repeat_testing' into next 0b65f7fe Add error checking to repeat until fail ctest option along with tests. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0b65f7fe6aa3f696ffa4dc9e461873050c15745e commit 0b65f7fe6aa3f696ffa4dc9e461873050c15745e Author: Bill Hoffman AuthorDate: Fri Mar 13 19:58:39 2015 -0400 Commit: Bill Hoffman CommitDate: Fri Mar 13 19:58:39 2015 -0400 Add error checking to repeat until fail ctest option along with tests. diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 55e2a44..5f094e0 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1985,11 +1985,11 @@ bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, //---------------------------------------------------------------------- // Processes one command line argument (and its arguments if any) // for many simple options and then returns -void cmCTest::HandleCommandLineArguments(size_t &i, - std::vector &args) +bool cmCTest::HandleCommandLineArguments(size_t &i, + std::vector &args, + std::string& errormsg) { std::string arg = args[i]; - if(this->CheckArgument(arg, "-F")) { this->Failover = true; @@ -2007,11 +2007,25 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->SetParallelLevel(plevel); this->ParallelLevelSetInCli = true; } - if(this->CheckArgument(arg, "--repeat-until-fail") && i < args.size() - 1) + if(this->CheckArgument(arg, "--repeat-until-fail")) { + if( i >= args.size() - 1) + { + errormsg = "Usage: ctest --repeat-until-fail N"; + return false; + } i++; - this->RepeatTests = atoi(args[i].c_str()); - this->RepeatUntilFail = true; + long repeat = 1; + if(!cmSystemTools::StringToLong(args[i].c_str(), &repeat)) + { + errormsg = "Usage: ctest --repeat-until-fail N"; + return false; + } + this->RepeatTests = repeat; + if(repeat > 1) + { + this->RepeatUntilFail = true; + } } if(this->CheckArgument(arg, "--no-compress-output")) @@ -2198,6 +2212,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->GetHandler("test")->SetPersistentOption("RerunFailed", "true"); this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true"); } + return true; } //---------------------------------------------------------------------- @@ -2280,7 +2295,12 @@ int cmCTest::Run(std::vector &args, std::string* output) for(size_t i=1; i < args.size(); ++i) { // handle the simple commandline arguments - this->HandleCommandLineArguments(i,args); + std::string errormsg; + if(!this->HandleCommandLineArguments(i,args, errormsg)) + { + cmSystemTools::Error(errormsg.c_str()); + return 1; + } // handle the script arguments -S -SR -SP this->HandleScriptArguments(i,args,SRArgumentSpecified); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 7fd84d8..3f033d9 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -540,8 +540,9 @@ private: bool AddVariableDefinition(const std::string &arg); //! parse and process most common command line arguments - void HandleCommandLineArguments(size_t &i, - std::vector &args); + bool HandleCommandLineArguments(size_t &i, + std::vector &args, + std::string& errormsg); //! hande the -S -SP and -SR arguments void HandleScriptArguments(size_t &i, diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057..ffda31f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -198,6 +198,7 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) +add_RunCMake_test(CTestCommandLine) set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt new file mode 100644 index 0000000..6610d46 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) +add_test(hello ${CMAKE_COMMAND} -E echo hello) +add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) \ No newline at end of file diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake new file mode 100644 index 0000000..f56db82 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake_command(repeat-until-fail-bad ${CMAKE_CTEST_COMMAND} + --repeat-until-fail) +run_cmake_command(repeat-until-fail-bad2 ${CMAKE_CTEST_COMMAND} + --repeat-until-fail foo) +run_cmake_command(repeat-until-fail-good ${CMAKE_CTEST_COMMAND} + --repeat-until-fail 2) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt new file mode 100644 index 0000000..723291f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt @@ -0,0 +1 @@ +CMake Error: Usage: ctest --repeat-until-fail N diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt new file mode 100644 index 0000000..723291f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt @@ -0,0 +1 @@ +CMake Error: Usage: ctest --repeat-until-fail N diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt new file mode 100644 index 0000000..eafba1c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! ----------------------------------------------------------------------- Summary of changes: Source/cmCTest.cxx | 34 ++++++++++++++++---- Source/cmCTest.h | 5 +-- Tests/RunCMake/CMakeLists.txt | 1 + .../CMakeLists.txt | 2 ++ Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 8 +++++ .../repeat-until-fail-bad-result.txt} | 0 .../repeat-until-fail-bad-stderr.txt | 1 + .../repeat-until-fail-bad2-result.txt} | 0 .../repeat-until-fail-bad2-stderr.txt | 1 + .../repeat-until-fail-good-result.txt} | 0 .../repeat-until-fail-good-stderr.txt | 1 + 11 files changed, 44 insertions(+), 9 deletions(-) copy Tests/RunCMake/{CommandLine => CTestCommandLine}/CMakeLists.txt (50%) create mode 100644 Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CTestCommandLine/repeat-until-fail-bad-result.txt} (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CTestCommandLine/repeat-until-fail-bad2-result.txt} (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => CTestCommandLine/repeat-until-fail-good-result.txt} (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 14 00:01:06 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 14 Mar 2015 00:01:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-427-g262656b Message-ID: <20150314040106.D45A5ABC6C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 262656b2d64e605579f1e8cc6ee32edcb64aa1c2 (commit) from 07696442124e63f6498109480e4adabf4fd00a8c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=262656b2d64e605579f1e8cc6ee32edcb64aa1c2 commit 262656b2d64e605579f1e8cc6ee32edcb64aa1c2 Author: Kitware Robot AuthorDate: Sat Mar 14 00:01:05 2015 -0400 Commit: Kitware Robot CommitDate: Sat Mar 14 00:01:05 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4880660..67f8d1d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150313) +set(CMake_VERSION_PATCH 20150314) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Mar 15 00:01:04 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 15 Mar 2015 00:01:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-428-g607131b Message-ID: <20150315040104.9B7A4ABBC3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 607131bf8c806b6227e56089eab9252537bd31d8 (commit) from 262656b2d64e605579f1e8cc6ee32edcb64aa1c2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=607131bf8c806b6227e56089eab9252537bd31d8 commit 607131bf8c806b6227e56089eab9252537bd31d8 Author: Kitware Robot AuthorDate: Sun Mar 15 00:01:03 2015 -0400 Commit: Kitware Robot CommitDate: Sun Mar 15 00:01:03 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 67f8d1d..d1bca5f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150314) +set(CMake_VERSION_PATCH 20150315) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From zach.mullen at kitware.com Sun Mar 15 13:06:22 2015 From: zach.mullen at kitware.com (Zach Mullen) Date: Sun, 15 Mar 2015 13:06:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1026-g8e743b9 Message-ID: <20150315170622.3E275ABED0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8e743b99e4c688892ef05271b8dae5adb112f2c2 (commit) via 64e22138a7dfb5d23940ffb52b8b83f4b10e2b67 (commit) via 607131bf8c806b6227e56089eab9252537bd31d8 (commit) via 262656b2d64e605579f1e8cc6ee32edcb64aa1c2 (commit) via 07696442124e63f6498109480e4adabf4fd00a8c (commit) from 0a9885ab197a880c0841aeb93841e8744466fa94 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e743b99e4c688892ef05271b8dae5adb112f2c2 commit 8e743b99e4c688892ef05271b8dae5adb112f2c2 Merge: 0a9885a 64e2213 Author: Zach Mullen AuthorDate: Sun Mar 15 13:06:20 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun Mar 15 13:06:20 2015 -0400 Merge topic 'output-ctest-env-vars' into next 64e22138 CTest: Output test-specific env vars in verbose mode (#15446) 607131bf CMake Nightly Date Stamp 262656b2 CMake Nightly Date Stamp 07696442 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=64e22138a7dfb5d23940ffb52b8b83f4b10e2b67 commit 64e22138a7dfb5d23940ffb52b8b83f4b10e2b67 Author: Zach Mullen AuthorDate: Sun Mar 15 13:00:31 2015 -0400 Commit: Zach Mullen CommitDate: Sun Mar 15 13:04:41 2015 -0400 CTest: Output test-specific env vars in verbose mode (#15446) Any environment vars that were configured for a test via the ENVIRONMENT property will now be output when the test is run with verbose logging enabled. diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 03131fd..01a7884 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -536,11 +536,26 @@ void cmCTestRunTest::ComputeArguments() } this->TestResult.FullCommandLine = testCommand; + // Print the test command in verbose mode cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl << this->Index << ": " << (this->TestHandler->MemCheck?"MemCheck":"Test") << " command: " << testCommand << std::endl); + + // Print any test-specific env vars in verbose mode + if (this->TestProperties->Environment.size()) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " + << "Environment variables: " << std::endl); + } + for(std::vector::const_iterator e = + this->TestProperties->Environment.begin(); + e != this->TestProperties->Environment.end(); ++e) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << *e + << std::endl); + } } //---------------------------------------------------------------------- diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 703c548..4f1adf3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2561,6 +2561,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestVerboseOutput/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" @ONLY ESCAPE_QUOTES) + add_test(CTestTestVerboseOutput ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" -VV + --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log" + ) + set_property(TEST CTestTestVerboseOutput PROPERTY PASS_REGULAR_EXPRESSION + "Environment variables:.*foo=bar.*this=that" + ) + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestSkipReturnCode/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake" diff --git a/Tests/CTestTestVerboseOutput/CMakeLists.txt b/Tests/CTestTestVerboseOutput/CMakeLists.txt new file mode 100644 index 0000000..4cdd29c --- /dev/null +++ b/Tests/CTestTestVerboseOutput/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required (VERSION 2.6) +project(CTestTestVerboseOutput) +include(CTest) + +add_executable(nop nop.c) + +add_test(NAME TestWithProperties COMMAND nop) +set_property(TEST TestWithProperties PROPERTY ENVIRONMENT + "foo=bar" + "this=that" +) diff --git a/Tests/CTestTestVerboseOutput/CTestConfig.cmake b/Tests/CTestTestVerboseOutput/CTestConfig.cmake new file mode 100644 index 0000000..4f96c79 --- /dev/null +++ b/Tests/CTestTestVerboseOutput/CTestConfig.cmake @@ -0,0 +1,7 @@ +set(CTEST_PROJECT_NAME "CTestTestVerboseOutput") +set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set(CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestVerboseOutput/nop.c b/Tests/CTestTestVerboseOutput/nop.c new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/CTestTestVerboseOutput/nop.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/CTestTestVerboseOutput/test.cmake.in b/Tests/CTestTestVerboseOutput/test.cmake.in new file mode 100644 index 0000000..7f49548 --- /dev/null +++ b/Tests/CTestTestVerboseOutput/test.cmake.in @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 2.4) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest- at BUILDNAME@-VerboseOutput") + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestVerboseOutput") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestVerboseOutput") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}") +CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}") +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}") ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/CTest/cmCTestRunTest.cxx | 15 +++++++++++++++ Tests/CMakeLists.txt | 10 ++++++++++ Tests/CTestTestVerboseOutput/CMakeLists.txt | 11 +++++++++++ .../CTestConfig.cmake | 2 +- .../CTestTestVerboseOutput/nop.c | 0 .../test.cmake.in} | 13 ++++++------- 7 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 Tests/CTestTestVerboseOutput/CMakeLists.txt copy Tests/{CTestTestScheduler => CTestTestVerboseOutput}/CTestConfig.cmake (83%) copy Modules/DummyCXXFile.cxx => Tests/CTestTestVerboseOutput/nop.c (100%) copy Tests/{CTestTestFailure/testNoExe.cmake.in => CTestTestVerboseOutput/test.cmake.in} (72%) hooks/post-receive -- CMake From domen.vrankar at gmail.com Sun Mar 15 16:10:09 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Sun, 15 Mar 2015 16:10:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1029-g0122877 Message-ID: <20150315201009.373D318C63@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 012287707792efea6ed928ceff52cc15364e7eb5 (commit) via 140a53a810ea7449c26e6e572918df3bb20e86d1 (commit) via 4552bc886d1bd8966f6ef2f7790835dfdb2e6d8b (commit) from 8e743b99e4c688892ef05271b8dae5adb112f2c2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=012287707792efea6ed928ceff52cc15364e7eb5 commit 012287707792efea6ed928ceff52cc15364e7eb5 Merge: 8e743b9 140a53a Author: Domen Vrankar AuthorDate: Sun Mar 15 16:10:08 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun Mar 15 16:10:08 2015 -0400 Merge topic 'cpack_rpm_old_version_tests' into next 140a53a8 CPack/RPM architecture test fixup 4552bc88 CPack/RPM relocation paths test fixup http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=140a53a810ea7449c26e6e572918df3bb20e86d1 commit 140a53a810ea7449c26e6e572918df3bb20e86d1 Author: Domen Vrankar AuthorDate: Sun Mar 15 21:08:19 2015 +0100 Commit: Domen Vrankar CommitDate: Sun Mar 15 21:08:19 2015 +0100 CPack/RPM architecture test fixup Fixed architecture test that was missing architecture in regular expressions - bug was detected on older rpm versions where the check failed. Extended architecture test that takes into account older versions of rpm. This patch is related to 15442. diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 079b819..9261d11 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -158,6 +158,12 @@ if(CPackGen MATCHES "RPM") ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${RPM_EXECUTABLE} -pqa ${check_file} + RESULT_VARIABLE check_package_architecture_result + OUTPUT_VARIABLE check_package_architecture + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${check_file} OUTPUT_VARIABLE check_package_content ERROR_QUIET @@ -169,28 +175,28 @@ if(CPackGen MATCHES "RPM") set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") - set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_applications_PACKAGE_ARCHITECTURE}") + set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") - set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_libraries_PACKAGE_ARCHITECTURE}") + set(check_file_match_expected_architecture "noarch") set(spec_regex "*headers*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/include\n/usr/foo/bar/include/mylib.h$") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}.*") - set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_headers_PACKAGE_ARCHITECTURE}") + set(check_file_match_expected_architecture "armv7hf") set(spec_regex "*applications*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") - set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_Unspecified_PACKAGE_ARCHITECTURE}") + set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*Unspecified*") set(check_content_list "^/usr/foo/bar /usr/foo/bar/bin @@ -230,9 +236,22 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package relocation path does not match expected value - regex '${check_file_match_expected_relocation_path}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") endif() - string(REGEX MATCH ${check_file_match_expected_architecture} check_file_match_architecture ${check_file_content}) - if (NOT check_file_match_architecture) + ####################### + # test package architecture + ####################### + string(REGEX MATCH "Architecture${whitespaces}:" check_info_contains_arch ${check_file_content}) + if(check_info_contains_arch) # test for rpm versions that contain architecture in package info (e.g. 4.11.x) + string(REGEX MATCH "Architecture${whitespaces}:${whitespaces}${check_file_match_expected_architecture}" check_file_match_architecture ${check_file_content}) + if(NOT check_file_match_architecture) message(FATAL_ERROR "error: '${check_file}' Architecture does not match expected value - '${check_file_match_expected_architecture}'; RPM output: '${check_file_content}'; generated spec file: '${spec_file_content}'") + endif() + elseif(NOT check_package_architecture_result) # test result only on platforms that support -pqa rpm query + # test for rpm versions that do not contain architecture in package info (e.g. 4.8.x) + string(REGEX MATCH ".*${check_file_match_expected_architecture}" check_file_match_architecture "${check_package_architecture}") + if(NOT check_file_match_architecture) + message(FATAL_ERROR "error: '${check_file}' Architecture does not match expected value - '${check_file_match_expected_architecture}'; RPM output: '${check_package_architecture}'; generated spec file: '${spec_file_content}'") + endif() + # else rpm version too old (e.g. 4.4.x) - skip test endif() ####################### http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4552bc886d1bd8966f6ef2f7790835dfdb2e6d8b commit 4552bc886d1bd8966f6ef2f7790835dfdb2e6d8b Author: Domen Vrankar AuthorDate: Sun Mar 15 20:37:16 2015 +0100 Commit: Domen Vrankar CommitDate: Sun Mar 15 20:37:16 2015 +0100 CPack/RPM relocation paths test fixup Patch fixes bug in test reported with id 15442 - older versions of rpm print out package info a bit differently so we should ignore white spaces diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index c7ec709..079b819 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -163,31 +163,33 @@ if(CPackGen MATCHES "RPM") ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + set(whitespaces "[\\t\\n\\r ]*") + if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_applications_PACKAGE_ARCHITECTURE}") set(spec_regex "*libraries*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_libraries_PACKAGE_ARCHITECTURE}") set(spec_regex "*headers*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/include\n/usr/foo/bar/include/mylib.h$") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}.*") set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_headers_PACKAGE_ARCHITECTURE}") set(spec_regex "*applications*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") - set(check_file_match_expected_relocation_path "Relocations : ${CPACK_PACKAGING_INSTALL_PREFIX} ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") set(check_file_match_expected_architecture "Architecture: ${CPACK_RPM_Unspecified_PACKAGE_ARCHITECTURE}") set(spec_regex "*Unspecified*") set(check_content_list "^/usr/foo/bar ----------------------------------------------------------------------- Summary of changes: .../RunCPackVerifyResult.cmake | 41 +++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 16 00:01:05 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 16 Mar 2015 00:01:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-429-g0ac7d87 Message-ID: <20150316040105.B89D3ABB52@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 0ac7d871fae9589bbdf22518360818f9b1423bd8 (commit) from 607131bf8c806b6227e56089eab9252537bd31d8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0ac7d871fae9589bbdf22518360818f9b1423bd8 commit 0ac7d871fae9589bbdf22518360818f9b1423bd8 Author: Kitware Robot AuthorDate: Mon Mar 16 00:01:03 2015 -0400 Commit: Kitware Robot CommitDate: Mon Mar 16 00:01:03 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d1bca5f..bbb2fed 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150315) +set(CMake_VERSION_PATCH 20150316) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From zach.mullen at kitware.com Mon Mar 16 09:44:35 2015 From: zach.mullen at kitware.com (Zach Mullen) Date: Mon, 16 Mar 2015 09:44:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1031-g21d33bf Message-ID: <20150316134435.54F7BAB3B8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 21d33bf37b0a254b68a3dbaaeb085970503b52d8 (commit) via 373eb5496726103d42f447c5a6cd47b8ac5ac138 (commit) from 012287707792efea6ed928ceff52cc15364e7eb5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=21d33bf37b0a254b68a3dbaaeb085970503b52d8 commit 21d33bf37b0a254b68a3dbaaeb085970503b52d8 Merge: 0122877 373eb54 Author: Zach Mullen AuthorDate: Mon Mar 16 09:44:34 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 16 09:44:34 2015 -0400 Merge topic 'output-ctest-env-vars' into next 373eb549 CTest: Specify configuration in new test http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=373eb5496726103d42f447c5a6cd47b8ac5ac138 commit 373eb5496726103d42f447c5a6cd47b8ac5ac138 Author: Zach Mullen AuthorDate: Mon Mar 16 09:43:19 2015 -0400 Commit: Zach Mullen CommitDate: Mon Mar 16 09:43:19 2015 -0400 CTest: Specify configuration in new test diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4f1adf3..c4e4d5c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2566,6 +2566,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_test(CTestTestVerboseOutput ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" -VV --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log" + -C "\${CTestTest_CONFIG}" ) set_property(TEST CTestTestVerboseOutput PROPERTY PASS_REGULAR_EXPRESSION "Environment variables:.*foo=bar.*this=that" ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 17 00:01:05 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 17 Mar 2015 00:01:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-430-g4fb9abc Message-ID: <20150317040105.ED0BBABC5E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 4fb9abc5629ee5c046292adc77b2583ffc15c230 (commit) from 0ac7d871fae9589bbdf22518360818f9b1423bd8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4fb9abc5629ee5c046292adc77b2583ffc15c230 commit 4fb9abc5629ee5c046292adc77b2583ffc15c230 Author: Kitware Robot AuthorDate: Tue Mar 17 00:01:03 2015 -0400 Commit: Kitware Robot CommitDate: Tue Mar 17 00:01:03 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bbb2fed..35ae8b9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150316) +set(CMake_VERSION_PATCH 20150317) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 09:52:53 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 09:52:53 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1033-g100f5b6 Message-ID: <20150317135253.2514EAB9D2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 100f5b6c1f44e7b49f0e95e6b4e9f18e4599b05f (commit) via 49c8dcf7bb8ae9e7584286e552769a61bf23e61b (commit) from 21d33bf37b0a254b68a3dbaaeb085970503b52d8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=100f5b6c1f44e7b49f0e95e6b4e9f18e4599b05f commit 100f5b6c1f44e7b49f0e95e6b4e9f18e4599b05f Merge: 21d33bf 49c8dcf Author: Brad King AuthorDate: Tue Mar 17 09:52:52 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 09:52:52 2015 -0400 Merge topic 'FindMatlab-rewrite' into next 49c8dcf7 FindMatlab: Rewrite module and provide a usage API http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49c8dcf7bb8ae9e7584286e552769a61bf23e61b commit 49c8dcf7bb8ae9e7584286e552769a61bf23e61b Author: Raffi Enficiaud AuthorDate: Thu Feb 12 17:13:31 2015 +0100 Commit: Brad King CommitDate: Tue Mar 17 09:47:04 2015 -0400 FindMatlab: Rewrite module and provide a usage API Implement a brand new FindMatlab module: - Add support for versions and components. - Find Matlab and its version in a more precise and multiplatform way. - Add API to create a new mex extension with documentation. - Add API to add matlab unit tests (with or without the unit test framework). - Find as much as possible based on a single Matlab_ROOT_DIR cache entry and allow the user to change it to re-find everything. diff --git a/Help/release/dev/FindMatlab-rewrite.rst b/Help/release/dev/FindMatlab-rewrite.rst new file mode 100644 index 0000000..07727b8 --- /dev/null +++ b/Help/release/dev/FindMatlab-rewrite.rst @@ -0,0 +1,7 @@ +FindMatlab-rewrite +------------------ + +* The :module:`FindMatlab` module was completely rewritten. It learned + about versions and components and to find Matlab in a more precise and + multiplatform way. The module now offers APIs to create mex extensions, + documentation, and unit tests. diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 73b3a5b..d08423b 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -2,20 +2,208 @@ # FindMatlab # ---------- # -# this module looks for Matlab +# Finds Matlab installations and provides Matlab tools and libraries to cmake. # -# Defines: +# This package first intention is to find the libraries associated with Matlab +# in order to be able to build Matlab extensions (mex files). It can also be +# used: # -# :: +# * run specific commands in Matlab +# * declare Matlab unit test +# * retrieve various information from Matlab (mex extensions, versions and +# release queries, ...) # -# MATLAB_INCLUDE_DIR: include path for mex.h, engine.h -# MATLAB_LIBRARIES: required libraries: libmex, etc -# MATLAB_MEX_LIBRARY: path to libmex.lib -# MATLAB_MX_LIBRARY: path to libmx.lib -# MATLAB_ENG_LIBRARY: path to libeng.lib +# The module supports the following components: +# +# * ``MX_LIBRARY`` and ``ENG_LIBRARY`` respectively the MX and ENG libraries of +# Matlab +# * ``MAIN_PROGRAM`` the Matlab binary program. +# +# .. note:: +# +# The version given to the :command:`find_package` directive is the Matlab +# **version**, which should not be confused with the Matlab *release* name +# (eg. `R2014`). +# The :command:`matlab_get_version_from_release_name` and +# :command:`matlab_get_release_name_from_version` allow a mapping +# from the release name to the version. +# +# The variable :variable:`Matlab_ROOT_DIR` may be specified in order to give +# the path of the desired Matlab version. Otherwise, the behaviour is platform +# specific: +# +# * Windows: The installed versions of Matlab are retrieved from the +# Windows registry +# * OS X: The installed versions of Matlab are given by the MATLAB +# paths in ``/Application``. If no such application is found, it falls back +# to the one that might be accessible from the PATH. +# * Unix: The desired Matlab should be accessible from the PATH. +# +# Additional information is provided when :variable:`MATLAB_FIND_DEBUG` is set. +# When a Matlab binary is found automatically and the ``MATLAB_VERSION`` +# is not given, the version is queried from Matlab directly. +# On Windows, it can make a window running Matlab appear. +# +# The mapping of the release names and the version of Matlab is performed by +# defining pairs (name, version). The variable +# :variable:`MATLAB_ADDITIONAL_VERSIONS` may be provided before the call to +# the :command:`find_package` in order to handle additional versions. +# +# A Matlab scripts can be added to the set of tests using the +# :command:`matlab_add_unit_test`. By default, the Matlab unit test framework +# will be used (>= 2013a) to run this script, but regular ``.m`` files +# returning an exit code can be used as well (0 indicating a success). +# +# Module Input Variables +# ---------------------- +# +# Users or projects may set the following variables to configure the module +# behaviour: +# +# :variable:`Matlab_ROOT_DIR` +# the root of the Matlab installation. +# :variable:`MATLAB_FIND_DEBUG` +# outputs debug information +# :variable:`MATLAB_ADDITIONAL_VERSIONS` +# additional versions of Matlab for the automatic retrieval of the installed +# versions. +# +# Variables defined by the module +# ------------------------------- +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# ``Matlab_FOUND`` +# ``TRUE`` if the Matlab installation is found, ``FALSE`` +# otherwise. All variable below are defined if Matlab is found. +# ``Matlab_ROOT_DIR`` +# the final root of the Matlab installation determined by the FindMatlab +# module. +# ``Matlab_MAIN_PROGRAM`` +# the Matlab binary program. Available only if the component ``MAIN_PROGRAM`` +# is given in the :command:`find_package` directive. +# ``Matlab_INCLUDE_DIRS`` +# the path of the Matlab libraries headers +# ``Matlab_MEX_LIBRARY`` +# library for mex, always available. +# ``Matlab_MX_LIBRARY`` +# mx library of Matlab (arrays). Available only if the component +# ``MX_LIBRARY`` has been requested. +# ``Matlab_ENG_LIBRARY`` +# Matlab engine library. Available only if the component ``ENG_LIBRARY`` +# is requested. +# ``Matlab_LIBRARIES`` +# the whole set of libraries of Matlab +# ``Matlab_MEX_COMPILER`` +# the mex compiler of Matlab. Currently not used. +# Available only if the component ``MEX_COMPILER`` is asked +# +# Cached variables +# ^^^^^^^^^^^^^^^^ +# +# ``Matlab_MEX_EXTENSION`` +# the extension of the mex files for the current platform (given by Matlab). +# ``Matlab_ROOT_DIR`` +# the location of the root of the Matlab installation found. If this value +# is changed by the user, the result variables are recomputed. +# +# Provided macros +# --------------- +# +# :command:`matlab_get_version_from_release_name` +# returns the version from the release name +# :command:`matlab_get_release_name_from_version` +# returns the release name from the Matlab version +# +# Provided functions +# ------------------ +# +# :command:`matlab_add_mex` +# adds a target compiling a MEX file. +# :command:`matlab_add_unit_test` +# adds a Matlab unit test file as a test to the project. +# :command:`matlab_extract_all_installed_versions_from_registry` +# parses the registry for all Matlab versions. Available on Windows only. +# The part of the registry parsed is dependent on the host processor +# :command:`matlab_get_all_valid_matlab_roots_from_registry` +# returns all the possible Matlab paths, according to a previously +# given list. Only the existing/accessible paths are kept. This is mainly +# useful for the searching all possible Matlab installation. +# :command:`matlab_get_mex_suffix` +# returns the suffix to be used for the mex files +# (platform/architecture dependant) +# :command:`matlab_get_version_from_matlab_run` +# returns the version of Matlab, given the full directory of the Matlab program. +# +# +# Known issues +# ------------ +# +# **Symbol clash in a MEX target** +# By default, every symbols inside a MEX +# file defined with the command :command:`matlab_add_mex` have hidden +# visibility, except for the entry point. This is the default behaviour of +# the MEX compiler, which lowers the risk of symbol collision between the +# libraries shipped with Matlab, and the libraries to which the MEX file is +# linking to. This is also the default on Windows platforms. +# +# However, this is not sufficient in certain case, where for instance your +# MEX file is linking against libraries that are already loaded by Matlab, +# even if those libraries have different SONAMES. +# A possible solution is to hide the symbols of the libraries to which the +# MEX target is linking to. This can be achieved in GNU GCC compilers with +# the linker option ``-Wl,--exclude-libs,ALL``. +# +# **Tests using GPU resources** +# in case your MEX file is using the GPU and +# in order to be able to run unit tests on this MEX file, the GPU resources +# should be properly released by Matlab. A possible solution is to make +# Matlab aware of the use of the GPU resources in the session, which can be +# performed by a command such as ``D = gpuDevice()`` at the beginning of +# the test script (or via a fixture). +# +# +# Reference +# -------------- +# +# .. variable:: Matlab_ROOT_DIR +# +# The root folder of the Matlab installation. If set before the call to +# :command:`find_package`, the module will look for the components in that +# path. If not set, then an automatic search of Matlab +# will be performed. If set, it should point to a valid version of Matlab. +# +# .. variable:: MATLAB_FIND_DEBUG +# +# If set, the lookup of Matlab and the intermediate configuration steps are +# outputted to the console. +# +# .. variable:: MATLAB_ADDITIONAL_VERSIONS +# +# If set, specifies additional versions of Matlab that may be looked for. +# The variable should be a list of strings, organised by pairs of release +# name and versions, such as follows:: +# +# set(MATLAB_ADDITIONAL_VERSIONS +# "release_name1=corresponding_version1" +# "release_name2=corresponding_version2" +# ... +# ) +# +# Example:: +# +# set(MATLAB_ADDITIONAL_VERSIONS +# "R2013b=8.2" +# "R2013a=8.1" +# "R2012b=8.0") +# +# The order of entries in this list matters when several versions of +# Matlab are installed. The priority is set according to the ordering in +# this list. #============================================================================= -# Copyright 2005-2009 Kitware, Inc. +# Copyright 2014-2015 Raffi Enficiaud, Max Planck Society # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -27,101 +215,1247 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -set(MATLAB_FOUND 0) -if(WIN32) - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") - set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc60") +set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}") + +include(FindPackageHandleStandardArgs) +include(CheckCXXCompilerFlag) + + +# The currently supported versions. Other version can be added by the user by +# providing MATLAB_ADDITIONAL_VERSIONS +if(NOT MATLAB_ADDITIONAL_VERSIONS) + set(MATLAB_ADDITIONAL_VERSIONS) +endif() + +set(MATLAB_VERSIONS_MAPPING + "R2014a=8.3" + "R2013b=8.2" + "R2013a=8.1" + "R2012b=8.0" + "R2012a=7.14" + + "R2011b=7.13" + "R2011a=7.12" + "R2010b=7.11" + + ${MATLAB_ADDITIONAL_VERSIONS} + ) + + +# temporary folder for all Matlab runs +set(_matlab_temporary_folder ${CMAKE_BINARY_DIR}/Matlab) + +if(NOT EXISTS "${_matlab_temporary_folder}") + file(MAKE_DIRECTORY "${_matlab_temporary_folder}") +endif() + +#.rst: +# .. command:: matlab_get_version_from_release_name +# +# Returns the version of Matlab (17.58) from a release name (R2017k) +macro (matlab_get_version_from_release_name release_name version_name) + + string(REGEX MATCHALL "${release_name}=([0-9]+\\.?[0-9]*)" _matched ${MATLAB_VERSIONS_MAPPING}) + + set(${version_name} "") + if(NOT _matched STREQUAL "") + set(${version_name} ${CMAKE_MATCH_1}) else() - if(${CMAKE_GENERATOR} MATCHES "Visual Studio 7") - # Assume people are generally using 7.1, - # if using 7.0 need to link to: ../extern/lib/win32/microsoft/msvc70 - set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc71") - else() - if(${CMAKE_GENERATOR} MATCHES "Borland") - # Same here, there are also: bcc50 and bcc51 directories - set(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/bcc54") - else() - if(MATLAB_FIND_REQUIRED) - message(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}") - endif() + message(WARNING "The release name ${release_name} is not registered") + endif() + unset(_matched) + +endmacro() + + + + + +#.rst: +# .. command:: matlab_get_release_name_from_version +# +# Returns the release name (R2017k) from the version of Matlab (17.58) +macro (matlab_get_release_name_from_version version release_name) + + set(${release_name} "") + foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING) + string(REGEX MATCHALL "(.+)=${version}" _matched ${_var}) + if(NOT _matched STREQUAL "") + set(${release_name} ${CMAKE_MATCH_1}) + break() + endif() + endforeach(_var) + + unset(_var) + unset(_matched) + if(${release_name} STREQUAL "") + message(WARNING "The version ${version} is not registered") + endif() + +endmacro() + + + + + +# extracts all the supported release names (R2017k...) of Matlab +# internal use +macro(matlab_get_supported_releases list_releases) + set(${list_releases}) + foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING) + string(REGEX MATCHALL "(.+)=([0-9]+\\.?[0-9]*)" _matched ${_var}) + if(NOT _matched STREQUAL "") + list(APPEND ${list_releases} ${CMAKE_MATCH_1}) + endif() + unset(_matched) + unset(CMAKE_MATCH_1) + endforeach(_var) + unset(_var) +endmacro() + + + +# extracts all the supported versions of Matlab +# internal use +macro(matlab_get_supported_versions list_versions) + set(${list_versions}) + foreach(_var IN LISTS MATLAB_VERSIONS_MAPPING) + string(REGEX MATCHALL "(.+)=([0-9]+\\.?[0-9]*)" _matched ${_var}) + if(NOT _matched STREQUAL "") + list(APPEND ${list_versions} ${CMAKE_MATCH_2}) + endif() + unset(_matched) + unset(CMAKE_MATCH_1) + endforeach(_var) + unset(_var) +endmacro() + + +#.rst: +# .. command:: matlab_extract_all_installed_versions_from_registry +# +# This function parses the registry and founds the Matlab versions that are +# installed. The found versions are returned in `matlab_versions`. +# Set `win64` to `TRUE` if the 64 bit version of Matlab should be looked for +# The returned list contains all versions under +# ``HKLM\\SOFTWARE\\Mathworks\\MATLAB`` or an empty list in case an error +# occurred (or nothing found). +# +# .. note:: +# +# Only the versions are provided. No check is made over the existence of the +# installation referenced in the registry, +# +function(matlab_extract_all_installed_versions_from_registry win64 matlab_versions) + + if(NOT CMAKE_HOST_WIN32) + message(FATAL_ERROR "This macro can only be called by a windows host (call to reg.exe") + endif() + + + if(${win64} AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "64") + set(APPEND_REG "/reg:64") + else() + set(APPEND_REG "/reg:32") + endif() + + # /reg:64 should be added on 64 bits capable OSs in order to enable the + # redirection of 64 bits applications + execute_process( + COMMAND reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Mathworks\\MATLAB /f * /k ${APPEND_REG} + RESULT_VARIABLE resultMatlab + OUTPUT_VARIABLE varMatlab + ERROR_VARIABLE errMatlab + INPUT_FILE NUL + ) + + + set(matlabs_from_registry) + if(${resultMatlab} EQUAL 0) + + string( + REGEX MATCHALL "MATLAB\\\\([0-9]+(\\.[0-9]+)?)" + matlab_versions_regex ${varMatlab}) + + foreach(match IN LISTS matlab_versions_regex) + string( + REGEX MATCH "MATLAB\\\\(([0-9]+)(\\.([0-9]+))?)" + current_match ${match}) + + set(_matlab_current_version ${CMAKE_MATCH_1}) + set(current_matlab_version_major ${CMAKE_MATCH_2}) + set(current_matlab_version_minor ${CMAKE_MATCH_4}) + if(NOT current_matlab_version_minor) + set(current_matlab_version_minor "0") endif() + + list(APPEND matlabs_from_registry ${_matlab_current_version}) + unset(_matlab_current_version) + endforeach(match) + + endif() + + if(matlabs_from_registry) + list(REMOVE_DUPLICATES matlabs_from_registry) + list(SORT matlabs_from_registry) + list(REVERSE matlabs_from_registry) + endif() + + set(${matlab_versions} ${matlabs_from_registry} PARENT_SCOPE) + +endfunction() + + + +# (internal) +macro(extract_matlab_versions_from_registry_brute_force matlab_versions) + # get the supported versions + set(matlab_supported_versions) + matlab_get_supported_versions(matlab_supported_versions) + + + # this is a manual population of the versions we want to look for + # this can be done as is, but preferably with the call to + # matlab_get_supported_versions and variable + + # populating the versions we want to look for + # set(matlab_supported_versions) + + # # Matlab 7 + # set(matlab_major 7) + # foreach(current_matlab_minor RANGE 4 20) + # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") + # endforeach(current_matlab_minor) + + # # Matlab 8 + # set(matlab_major 8) + # foreach(current_matlab_minor RANGE 0 5) + # list(APPEND matlab_supported_versions "${matlab_major}.${current_matlab_minor}") + # endforeach(current_matlab_minor) + + # # taking into account the possible additional versions provided by the user + # if(DEFINED MATLAB_ADDITIONAL_VERSIONS) + # list(APPEND matlab_supported_versions MATLAB_ADDITIONAL_VERSIONS) + # endif() + + + # we order from more recent to older + if(matlab_supported_versions) + list(REMOVE_DUPLICATES matlab_supported_versions) + list(SORT matlab_supported_versions) + list(REVERSE matlab_supported_versions) + endif() + + + set(${matlab_versions} ${matlab_supported_versions}) + + +endmacro() + + + + +#.rst: +# .. command:: matlab_get_all_valid_matlab_roots_from_registry +# +# Populates the Matlab root with valid versions of Matlab. +# The returned matlab_roots is organized in pairs +# ``(version_number,matlab_root_path)``. +# +# :: +# +# matlab_get_all_valid_matlab_roots_from_registry( +# matlab_versions +# matlab_roots) +# +# ``matlab_versions`` +# the versions of each of the Matlab installations +# ``matlab_roots`` +# the location of each of the Matlab installations +function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_roots) + + # The matlab_versions comes either from + # extract_matlab_versions_from_registry_brute_force or + # matlab_extract_all_installed_versions_from_registry. + + + set(_matlab_roots_list ) + foreach(_matlab_current_version ${matlab_versions}) + get_filename_component( + current_MATLAB_ROOT + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${_matlab_current_version};MATLABROOT]" + ABSOLUTE) + + if(EXISTS ${current_MATLAB_ROOT}) + list(APPEND _matlab_roots_list ${_matlab_current_version} ${current_MATLAB_ROOT}) + endif() + + endforeach(_matlab_current_version) + unset(_matlab_current_version) + set(${matlab_roots} ${_matlab_roots_list} PARENT_SCOPE) + unset(_matlab_roots_list) +endfunction() + +#.rst: +# .. command:: matlab_get_mex_suffix +# +# Returns the extension of the mex files (the suffixes). +# This function should not be called before the appropriate Matlab root has +# been found. +# +# :: +# +# matlab_get_mex_suffix( +# matlab_root +# mex_suffix) +# +# ``matlab_root`` +# the root of the Matlab installation +# ``mex_suffix`` +# the variable name in which the suffix will be returned. +function(matlab_get_mex_suffix matlab_root mex_suffix) + + # todo setup the extension properly. Currently I do not know if this is + # sufficient for all win32 distributions. + # there is also CMAKE_EXECUTABLE_SUFFIX that could be tweaked + set(mexext_suffix "") + if(WIN32) + list(APPEND mexext_suffix ".bat") + endif() + + # we first try without suffix, since cmake does not understand a list with + # one empty string element + find_program( + Matlab_MEXEXTENSIONS_PROG + NAMES mexext + PATHS ${matlab_root}/bin + DOC "Matlab MEX extension provider" + NO_DEFAULT_PATH + ) + + foreach(current_mexext_suffix IN LISTS mexext_suffix) + if(NOT DEFINED Matlab_MEXEXTENSIONS_PROG OR NOT Matlab_MEXEXTENSIONS_PROG) + # this call should populate the cache automatically + find_program( + Matlab_MEXEXTENSIONS_PROG + "mexext${current_mexext_suffix}" + PATHS ${matlab_root}/bin + DOC "Matlab MEX extension provider" + NO_DEFAULT_PATH + ) + endif() + endforeach(current_mexext_suffix) + + + # the program has been found? + if((NOT Matlab_MEXEXTENSIONS_PROG) OR (NOT EXISTS ${Matlab_MEXEXTENSIONS_PROG})) + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Cannot found mexext program. Matlab root is ${matlab_root}") + endif() + unset(Matlab_MEXEXTENSIONS_PROG CACHE) + return() + endif() + + set(_matlab_mex_extension) + + set(devnull) + if(UNIX) + set(devnull INPUT_FILE /dev/null) + elseif(WIN32) + set(devnull INPUT_FILE NUL) + endif() + + execute_process( + COMMAND ${Matlab_MEXEXTENSIONS_PROG} + OUTPUT_VARIABLE _matlab_mex_extension + ERROR_VARIABLE _matlab_mex_extension_error + ${devnull}) + string(STRIP ${_matlab_mex_extension} _matlab_mex_extension) + + unset(Matlab_MEXEXTENSIONS_PROG CACHE) + set(${mex_suffix} ${_matlab_mex_extension} PARENT_SCOPE) +endfunction() + + + + +#.rst: +# .. command:: matlab_get_version_from_matlab_run +# +# This function runs Matlab program specified on arguments and extracts its +# version. +# +# :: +# +# matlab_get_version_from_matlab_run( +# matlab_binary_path +# matlab_list_versions) +# +# ``matlab_binary_path`` +# the location of the `matlab` binary executable +# ``matlab_list_versions`` +# the version extracted from Matlab +function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_versions) + + set(${matlab_list_versions} "" PARENT_SCOPE) + + + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Determining the version of Matlab from ${matlab_binary_program}") + endif() + + if(EXISTS "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Removing previous ${_matlab_temporary_folder}/matlabVersionLog.cmaketmp file") endif() + file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") + endif() + + + # the log file is needed since on windows the command executes in a new + # window and it is not possible to get back the answer of Matlab + # the -wait command is needed on windows, otherwise the call returns + # immediately after the program launches itself. + if(WIN32) + set(_matlab_additional_commands "-wait") endif() - find_library(MATLAB_MEX_LIBRARY - libmex - ${MATLAB_ROOT} + + set(devnull) + if(UNIX) + set(devnull INPUT_FILE /dev/null) + elseif(WIN32) + set(devnull INPUT_FILE NUL) + endif() + + # timeout set to 30 seconds, in case it does not start + # note as said before OUTPUT_VARIABLE cannot be used in a platform + # independent manner however, not setting it would flush the output of Matlab + # in the current console (unix variant) + execute_process( + COMMAND "${matlab_binary_program}" -nosplash -nojvm ${_matlab_additional_commands} -logfile "matlabVersionLog.cmaketmp" -nodesktop -nodisplay -r "version, exit" + OUTPUT_VARIABLE _matlab_version_from_cmd_dummy + RESULT_VARIABLE _matlab_result_version_call + ERROR_VARIABLE _matlab_result_version_call_error + TIMEOUT 30 + WORKING_DIRECTORY "${_matlab_temporary_folder}" + ${devnull} ) - find_library(MATLAB_MX_LIBRARY - libmx - ${MATLAB_ROOT} + + + if(${_matlab_result_version_call}) + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Unable to determine the version of Matlab. Matlab call returned with error ${_matlab_result_version_call}.") + endif() + return() + elseif(NOT EXISTS "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Unable to determine the version of Matlab. The log file does not exist.") + endif() + return() + endif() + + # if successful, read back the log + file(READ "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp" _matlab_version_from_cmd) + file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp") + + set(index -1) + string(FIND ${_matlab_version_from_cmd} "ans" index) + if(index EQUAL -1) + + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Cannot find the version of Matlab returned by the run.") + endif() + + else() + set(matlab_list_of_all_versions_tmp) + + string(SUBSTRING ${_matlab_version_from_cmd} ${index} -1 substring_ans) + string( + REGEX MATCHALL "ans[\r\n\t ]*=[\r\n\t ]*([0-9]+(\\.[0-9]+)?)" + matlab_versions_regex + ${substring_ans}) + foreach(match IN LISTS matlab_versions_regex) + string( + REGEX MATCH "ans[\r\n\t ]*=[\r\n\t ]*(([0-9]+)(\\.([0-9]+))?)" + current_match ${match}) + + list(APPEND matlab_list_of_all_versions_tmp ${CMAKE_MATCH_1}) + endforeach() + if(matlab_list_of_all_versions_tmp) + list(REMOVE_DUPLICATES matlab_list_of_all_versions_tmp) + endif() + set(${matlab_list_versions} ${matlab_list_of_all_versions_tmp} PARENT_SCOPE) + + endif() + +endfunction() + + +#.rst: +# .. command:: matlab_add_unit_test +# +# Adds a Matlab unit test to the test set of cmake/ctest. +# This command requires the component ``MAIN_PROGRAM``. +# The unit test uses the Matlab unittest framework (default, available +# starting Matlab 2013b+) except if the option ``NO_UNITTEST_FRAMEWORK`` +# is given. +# +# The function expects one Matlab test script file to be given. +# In the case ``NO_UNITTEST_FRAMEWORK`` is given, the unittest script file +# should contain the script to be run, plus an exit command with the exit +# value. This exit value will be passed to the ctest framework (0 success, +# non 0 failure). Additional arguments accepted by :command:`add_test` can be +# passed through ``TEST_ARGS`` (eg. ``CONFIGURATION ...``). +# +# :: +# +# matlab_add_unit_test( +# NAME +# UNITTEST_FILE matlab_file_containing_unittest.m +# [UNITTEST_PRECOMMAND matlab_command_to_run] +# [TIMEOUT timeout] +# [ADDITIONAL_PATH path1 [path2 ...]] +# [MATLAB_ADDITIONAL_STARTUP_OPTIONS option1 [option2 ...]] +# [TEST_ARGS arg1 [arg2 ...]] +# [NO_UNITTEST_FRAMEWORK] +# ) +# +# The function arguments are: +# +# ``NAME`` +# name of the unittest in ctest. +# ``UNITTEST_FILE`` +# the matlab unittest file. Its path will be automatically +# added to the Matlab path. +# ``UNITTEST_PRECOMMAND`` +# Matlab script command to be ran before the file +# containing the test (eg. GPU device initialisation based on CMake +# variables). +# ``TIMEOUT`` +# the test timeout in seconds. Defaults to 180 seconds as the +# Matlab unit test may hang. +# ``ADDITIONAL_PATH`` +# a list of paths to add to the Matlab path prior to +# running the unit test. +# ``MATLAB_ADDITIONAL_STARTUP_OPTIONS`` +# a list of additional option in order +# to run Matlab from the command line. +# ``TEST_ARGS`` +# Additional options provided to the add_test command. These +# options are added to the default options (eg. "CONFIGURATIONS Release") +# ``NO_UNITTEST_FRAMEWORK`` +# when set, indicates that the test should not +# use the unittest framework of Matlab (available for versions >= R2013a). +# +function(matlab_add_unit_test) + + if(NOT Matlab_MAIN_PROGRAM) + message(FATAL_ERROR "[MATLAB] This functionality needs the MAIN_PROGRAM component (not default)") + endif() + + set(options NO_UNITTEST_FRAMEWORK) + set(oneValueArgs NAME UNITTEST_PRECOMMAND UNITTEST_FILE TIMEOUT) + set(multiValueArgs ADDITIONAL_PATH MATLAB_ADDITIONAL_STARTUP_OPTIONS TEST_ARGS) + + set(prefix _matlab_unittest_prefix) + cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + if(NOT ${prefix}_NAME) + message(FATAL_ERROR "[MATLAB] The Matlab test name cannot be empty") + endif() + + add_test(NAME ${${prefix}_NAME} + COMMAND ${CMAKE_COMMAND} + -Dtest_name=${${prefix}_NAME} + -Dadditional_paths=${${prefix}_ADDITIONAL_PATH} + -Dtest_timeout=${${prefix}_TIMEOUT} + -Doutput_directory=${_matlab_temporary_folder} + -DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM} + -Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK} + -DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS} + -Dunittest_file_to_run=${${prefix}_UNITTEST_FILE} + -Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND} + -P ${_FindMatlab_SELF_DIR}/MatlabTestsRedirect.cmake + ${${prefix}_TEST_ARGS} + ${${prefix}_UNPARSED_ARGUMENTS} + ) +endfunction() + + +#.rst: +# .. command:: matlab_add_mex +# +# Adds a Matlab MEX target. +# This commands compiles the given sources with the current tool-chain in +# order to produce a MEX file. The final name of the produced output may be +# specified, as well as additional link libraries, and a documentation entry +# for the MEX file. Remaining arguments of the call are passed to the +# :command:`add_library` command. +# +# :: +# +# matlab_add_mex( +# NAME +# SRC src1 [src2 ...] +# [OUTPUT_NAME output_name] +# [DOCUMENTATION file.txt] +# [LINK_TO target1 target2 ...] +# [...] +# ) +# +# ``NAME`` +# name of the target. +# ``SRC`` +# list of tje source files. +# ``LINK_TO`` +# a list of additional link dependencies. The target links to ``libmex`` +# by default. If ``Matlab_MX_LIBRARY`` is defined, it also +# links to ``libmx``. +# ``OUTPUT_NAME`` +# if given, overrides the default name. The default name is +# the name of the target without any prefix and +# with ``Matlab_MEX_EXTENSION`` suffix. +# ``DOCUMENTATION`` +# if given, the file ``file.txt`` will be considered as +# being the documentation file for the MEX file. This file is copied into +# the same folder without any processing, with the same name as the final +# mex file, and with extension `.m`. In that case, typing ``help `` +# in Matlab prints the documentation contained in this file. +# +# The documentation file is not processed and should be in the following +# format: +# +# :: +# +# % This is the documentation +# function ret = mex_target_output_name(input1) +# +function(matlab_add_mex ) + + if(NOT WIN32) + # we do not need all this on Windows + # pthread options + check_cxx_compiler_flag(-pthread HAS_MINUS_PTHREAD) + # we should use try_compile instead, the link flags are discarded from + # this compiler_flag function. + #check_cxx_compiler_flag(-Wl,--exclude-libs,ALL HAS_SYMBOL_HIDING_CAPABILITY) + + endif() + + set(oneValueArgs NAME DOCUMENTATION OUTPUT_NAME) + set(multiValueArgs LINK_TO SRC) + + set(prefix _matlab_addmex_prefix) + cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + if(NOT ${prefix}_NAME) + message(FATAL_ERROR "[MATLAB] The MEX target name cannot be empty") + endif() + + if(NOT ${prefix}_OUTPUT_NAME) + set(${prefix}_OUTPUT_NAME ${${prefix}_NAME}) + endif() + + add_library(${${prefix}_NAME} + SHARED + ${${prefix}_SRC} + ${${prefix}_DOCUMENTATION} + ${${prefix}_UNPARSED_ARGUMENTS}) + target_include_directories(${${prefix}_NAME} PRIVATE ${Matlab_INCLUDE_DIRS}) + + if(DEFINED Matlab_MX_LIBRARY) + target_link_libraries(${${prefix}_NAME} ${Matlab_MX_LIBRARY}) + endif() + + target_link_libraries(${${prefix}_NAME} ${Matlab_MEX_LIBRARY} ${${prefix}_LINK_TO}) + set_target_properties(${${prefix}_NAME} + PROPERTIES + PREFIX "" + OUTPUT_NAME ${${prefix}_OUTPUT_NAME} + SUFFIX ".${Matlab_MEX_EXTENSION}") + + + # documentation + if(NOT ${${prefix}_DOCUMENTATION} STREQUAL "") + get_target_property(output_name ${${prefix}_NAME} OUTPUT_NAME) + add_custom_command( + TARGET ${${prefix}_NAME} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${${prefix}_DOCUMENTATION} $/${output_name}.m + COMMENT "Copy ${${prefix}_NAME} documentation file into the output folder" ) - find_library(MATLAB_ENG_LIBRARY - libeng - ${MATLAB_ROOT} + endif() # documentation + + # entry point in the mex file + taking care of visibility and symbol clashes. + if(WIN32) + set_target_properties(${${prefix}_NAME} + PROPERTIES + DEFINE_SYMBOL "DLL_EXPORT_SYM=__declspec(dllexport)") + else() + + if(HAS_MINUS_PTHREAD AND NOT APPLE) + # Apparently, compiling with -pthread generated the proper link flags + # and some defines at compilation + target_compile_options(${${prefix}_NAME} PRIVATE "-pthread") + endif() + + + # if we do not do that, the symbols linked from eg. boost remain weak and + # then clash with the ones defined in the matlab process. So by default + # the symbols are hidden. + # This also means that for shared libraries (like MEX), the entry point + # should be explicitly declared with default visibility, otherwise Matlab + # cannot find the entry point. + # Note that this is particularly meaningful if the MEX wrapper itself + # contains symbols that are clashing with Matlab (that are compiled in the + # MEX file). In order to propagate the visibility options to the libraries + # to which the MEX file is linked against, the -Wl,--exclude-libs,ALL + # option should also be specified. + + set_target_properties(${${prefix}_NAME} + PROPERTIES + CXX_VISIBILITY_PRESET "hidden" + C_VISIBILITY_PRESET "hidden" + VISIBILITY_INLINES_HIDDEN "hidden" ) - find_path(MATLAB_INCLUDE_DIR - "mex.h" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/include" + # get_target_property( + # _previous_link_flags + # ${${prefix}_NAME} + # LINK_FLAGS) + # if(NOT _previous_link_flags) + # set(_previous_link_flags) + # endif() + + # if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # set_target_properties(${${prefix}_NAME} + # PROPERTIES + # LINK_FLAGS "${_previous_link_flags} -Wl,--exclude-libs,ALL" + # # -Wl,--version-script=${_FindMatlab_SELF_DIR}/MatlabLinuxVisibility.map" + # ) + # elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # # in this case, all other symbols become hidden. + # set_target_properties(${${prefix}_NAME} + # PROPERTIES + # LINK_FLAGS "${_previous_link_flags} -Wl,-exported_symbol,_mexFunction" + # #-Wl,-exported_symbols_list,${_FindMatlab_SELF_DIR}/MatlabOSXVisilibity.map" + # ) + # endif() + + + + set_target_properties(${${prefix}_NAME} + PROPERTIES + DEFINE_SYMBOL "DLL_EXPORT_SYM=__attribute__ ((visibility (\"default\")))" ) -else() - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - # Regular x86 - set(MATLAB_ROOT - /usr/local/matlab-7sp1/bin/glnx86/ - /opt/matlab-7sp1/bin/glnx86/ - $ENV{HOME}/matlab-7sp1/bin/glnx86/ - $ENV{HOME}/redhat-matlab/bin/glnx86/ + + + endif() + +endfunction() + + +# (internal) +# Used to get the version of matlab, using caching. This basically transforms the +# output of the root list, with possible unknown version, to a version +# +function(_Matlab_get_version_from_root matlab_root matlab_known_version matlab_final_version) + + # if the version is not trivial, we query matlab for that + # we keep track of the location of matlab that induced this version + #if(NOT DEFINED Matlab_PROG_VERSION_STRING_AUTO_DETECT) + # set(Matlab_PROG_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version") + #endif() + + if(NOT ${matlab_known_version} STREQUAL "NOTFOUND") + # the version is known, we just return it + set(${matlab_final_version} ${matlab_known_version} PARENT_SCOPE) + set(Matlab_VERSION_STRING_INTERNAL ${matlab_known_version} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) + return() + endif() + + # + set(_matlab_current_program ${Matlab_MAIN_PROGRAM}) + + # do we already have a matlab program? + if(NOT _matlab_current_program) + + set(_find_matlab_options) + if(matlab_root AND EXISTS ${matlab_root}) + set(_find_matlab_options PATHS ${matlab_root} ${matlab_root}/bin NO_DEFAULT_PATH) + endif() + + find_program( + _matlab_current_program + matlab + ${_find_matlab_options} + DOC "Matlab main program" ) + endif() + + if(NOT _matlab_current_program OR NOT EXISTS ${_matlab_current_program}) + # if not found, clear the dependent variables + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Cannot find the main matlab program under ${matlab_root}") + endif() + set(Matlab_PROG_VERSION_STRING_AUTO_DETECT "" CACHE INTERNAL "internal matlab location for the discovered version" FORCE) + set(Matlab_VERSION_STRING_INTERNAL "" CACHE INTERNAL "internal matlab location for the discovered version" FORCE) + unset(_matlab_current_program) + unset(_matlab_current_program CACHE) + return() + endif() + + # full real path for path comparison + get_filename_component(_matlab_main_real_path_tmp "${_matlab_current_program}" REALPATH) + unset(_matlab_current_program) + unset(_matlab_current_program CACHE) + + # is it the same as the previous one? + if(_matlab_main_real_path_tmp STREQUAL Matlab_PROG_VERSION_STRING_AUTO_DETECT) + set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE) + return() + endif() + + # update the location of the program + set(Matlab_PROG_VERSION_STRING_AUTO_DETECT ${_matlab_main_real_path_tmp} CACHE INTERNAL "internal matlab location for the discovered version" FORCE) + + set(matlab_list_of_all_versions) + matlab_get_version_from_matlab_run("${Matlab_PROG_VERSION_STRING_AUTO_DETECT}" matlab_list_of_all_versions) + + list(GET matlab_list_of_all_versions 0 _matlab_version_tmp) + + # set the version into the cache + set(Matlab_VERSION_STRING_INTERNAL ${_matlab_version_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) + + # warning, just in case several versions found (should not happen) + list(LENGTH matlab_list_of_all_versions list_of_all_versions_length) + if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${matlab_list_of_all_versions})") + endif() + + # return the updated value + set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE) + +endfunction() + + + + + + + +# ################################### +# Exploring the possible Matlab_ROOTS + +# this variable will get all Matlab installations found in the current system. +set(_matlab_possible_roots) + + + +if(Matlab_ROOT_DIR) + # if the user specifies a possible root, we keep this one + + if(NOT EXISTS ${Matlab_ROOT_DIR}) + # if Matlab_ROOT_DIR specified but erroneous + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] the specified path for Matlab_ROOT_DIR does not exist (${Matlab_ROOT_DIR})") + endif() else() - # AMD64: - set(MATLAB_ROOT - /usr/local/matlab-7sp1/bin/glnxa64/ - /opt/matlab-7sp1/bin/glnxa64/ - $ENV{HOME}/matlab7_64/bin/glnxa64/ - $ENV{HOME}/matlab-7sp1/bin/glnxa64/ - $ENV{HOME}/redhat-matlab/bin/glnxa64/ - ) + # NOTFOUND indicates the code below to search for the version automatically + if(NOT DEFINED Matlab_VERSION_STRING_INTERNAL) + list(APPEND _matlab_possible_roots "NOTFOUND" ${Matlab_ROOT_DIR}) # empty version + else() + list(APPEND _matlab_possible_roots ${Matlab_VERSION_STRING_INTERNAL} ${Matlab_ROOT_DIR}) # cached version + endif() + endif() + + +else() + + # if the user does not specify the possible installation root, we look for + # one installation using the appropriate heuristics + + if(WIN32) + + # On WIN32, we look for Matlab installation in the registry + # if unsuccessful, we look for all known revision and filter the existing + # ones. + + # testing if we are able to extract the needed information from the registry + set(_matlab_versions_from_registry) + matlab_extract_all_installed_versions_from_registry(CMAKE_CL_64 _matlab_versions_from_registry) + + # the returned list is empty, doing the search on all known versions + if(NOT _matlab_versions_from_registry) + + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Search for Matlab from the registry unsuccessful, testing all supported versions") + endif() + + extract_matlab_versions_from_registry_brute_force(_matlab_versions_from_registry) + endif() + + # filtering the results with the registry keys + matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots) + unset(_matlab_versions_from_registry) + + elseif(APPLE) + + # on mac, we look for the /Application paths + # this corresponds to the behaviour on Windows. On Linux, we do not have + # any other guess. + matlab_get_supported_releases(_matlab_releases) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Matlab supported versions ${_matlab_releases}. If more version should be supported " + "the variable MATLAB_ADDITIONAL_VERSIONS can be set according to the documentation") + endif() + + foreach(_matlab_current_release IN LISTS _matlab_releases) + set(_matlab_full_string "/Applications/MATLAB_${_matlab_current_release}.app") + if(EXISTS ${_matlab_full_string}) + set(_matlab_current_version) + matlab_get_version_from_release_name("${_matlab_current_release}" _matlab_current_version) + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Found version ${_matlab_current_release} (${_matlab_current_version}) in ${_matlab_full_string}") + endif() + list(APPEND _matlab_possible_roots ${_matlab_current_version} ${_matlab_full_string}) + unset(_matlab_current_version) + endif() + + unset(_matlab_full_string) + endforeach(_matlab_current_release) + + unset(_matlab_current_release) + unset(_matlab_releases) + endif() - find_library(MATLAB_MEX_LIBRARY - mex - ${MATLAB_ROOT} - ) - find_library(MATLAB_MX_LIBRARY - mx - ${MATLAB_ROOT} - ) - find_library(MATLAB_ENG_LIBRARY - eng - ${MATLAB_ROOT} - ) - find_path(MATLAB_INCLUDE_DIR - "mex.h" - "/usr/local/matlab-7sp1/extern/include/" - "/opt/matlab-7sp1/extern/include/" - "$ENV{HOME}/matlab-7sp1/extern/include/" - "$ENV{HOME}/redhat-matlab/extern/include/" - ) endif() -# This is common to UNIX and Win32: -set(MATLAB_LIBRARIES - ${MATLAB_MEX_LIBRARY} - ${MATLAB_MX_LIBRARY} - ${MATLAB_ENG_LIBRARY} + + +list(LENGTH _matlab_possible_roots _numbers_of_matlab_roots) +if(_numbers_of_matlab_roots EQUAL 0) + # if we have not found anything, we fall back on the PATH + + + # At this point, we have no other choice than trying to find it from PATH. + # If set by the user, this wont change + find_program( + _matlab_main_tmp + NAMES matlab) + + + if(_matlab_main_tmp) + # we then populate the list of roots, with empty version + if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] matlab found from PATH: ${_matlab_main_tmp}") + endif() + + # resolve symlinks + get_filename_component(_matlab_current_location "${_matlab_main_tmp}" REALPATH) + + # get the directory (the command below has to be run twice) + # this will be the matlab root + get_filename_component(_matlab_current_location "${_matlab_current_location}" DIRECTORY) + get_filename_component(_matlab_current_location "${_matlab_current_location}" DIRECTORY) # Matlab should be in bin + + list(APPEND _matlab_possible_roots "NOTFOUND" ${_matlab_current_location}) + + unset(_matlab_current_location) + + endif() + unset(_matlab_main_tmp CACHE) + +endif() + + + + + +if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Matlab root folders are ${_matlab_possible_roots}") +endif() + + + + + +# take the first possible Matlab root +list(LENGTH _matlab_possible_roots _numbers_of_matlab_roots) +set(Matlab_VERSION_STRING "NOTFOUND") +if(_numbers_of_matlab_roots GREATER 0) + list(GET _matlab_possible_roots 0 Matlab_VERSION_STRING) + list(GET _matlab_possible_roots 1 Matlab_ROOT_DIR) + + # adding a warning in case of ambiguity + if(_numbers_of_matlab_roots GREATER 2 AND MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})." + " If this is not the desired behaviour, provide the -DMatlab_ROOT_DIR=... on the command line") + endif() +endif() + + +# check if the root changed against the previous defined one, if so +# clear all the cached variables +if(DEFINED Matlab_ROOT_DIR_LAST_CACHED) + + if(NOT Matlab_ROOT_DIR_LAST_CACHED STREQUAL Matlab_ROOT_DIR) + set(_Matlab_cached_vars + Matlab_INCLUDE_DIRS + Matlab_MEX_LIBRARY + Matlab_MEX_COMPILER + Matlab_MAIN_PROGRAM + Matlab_MX_LIBRARY + Matlab_ENG_LIBRARY + Matlab_MEX_EXTENSION + + # internal + Matlab_MEXEXTENSIONS_PROG + Matlab_ROOT_DIR_LAST_CACHED + #Matlab_PROG_VERSION_STRING_AUTO_DETECT + Matlab_VERSION_STRING_INTERNAL + ) + foreach(_var IN LISTS _Matlab_cached_vars) + if(DEFINED ${_var}) + unset(${_var} CACHE) + endif() + endforeach() + endif() +endif() + +set(Matlab_ROOT_DIR_LAST_CACHED ${Matlab_ROOT_DIR} CACHE INTERNAL "last Matlab root dir location") +set(Matlab_ROOT_DIR ${Matlab_ROOT_DIR} CACHE PATH "Matlab installation root path" FORCE) + +# Fix the version, in case this one is NOTFOUND +_Matlab_get_version_from_root( + "${Matlab_ROOT_DIR}" + ${Matlab_VERSION_STRING} + Matlab_VERSION_STRING ) -if(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES) - set(MATLAB_FOUND 1) + + + +if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] Current version is ${Matlab_VERSION_STRING} located ${Matlab_ROOT_DIR}") endif() -mark_as_advanced( - MATLAB_LIBRARIES - MATLAB_MEX_LIBRARY - MATLAB_MX_LIBRARY - MATLAB_ENG_LIBRARY - MATLAB_INCLUDE_DIR - MATLAB_FOUND - MATLAB_ROOT + + +if(Matlab_ROOT_DIR) + file(TO_CMAKE_PATH ${Matlab_ROOT_DIR} Matlab_ROOT_DIR) +endif() + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(_matlab_64Build FALSE) +else() + set(_matlab_64Build TRUE) +endif() + +if(APPLE) + set(_matlab_bin_prefix "mac") # i should be for intel + set(_matlab_bin_suffix_32bits "i") + set(_matlab_bin_suffix_64bits "i64") +elseif(UNIX) + set(_matlab_bin_prefix "gln") + set(_matlab_bin_suffix_32bits "x86") + set(_matlab_bin_suffix_64bits "xa64") +else() + set(_matlab_bin_prefix "win") + set(_matlab_bin_suffix_32bits "32") + set(_matlab_bin_suffix_64bits "64") +endif() + + + +set(MATLAB_INCLUDE_DIR_TO_LOOK ${Matlab_ROOT_DIR}/extern/include) +if(_matlab_64Build) + set(_matlab_current_suffix ${_matlab_bin_suffix_64bits}) +else() + set(_matlab_current_suffix ${_matlab_bin_suffix_32bits}) +endif() + +set(Matlab_BINARIES_DIR + ${Matlab_ROOT_DIR}/bin/${_matlab_bin_prefix}${_matlab_current_suffix}) +set(Matlab_EXTERN_LIBRARY_DIR + ${Matlab_ROOT_DIR}/extern/lib/${_matlab_bin_prefix}${_matlab_current_suffix}) + +if(WIN32) + set(_matlab_lib_dir_for_search ${Matlab_EXTERN_LIBRARY_DIR}/microsoft) + set(_matlab_lib_prefix_for_search "lib") +else() + set(_matlab_lib_dir_for_search ${Matlab_BINARIES_DIR}) + set(_matlab_lib_prefix_for_search "lib") +endif() + +unset(_matlab_64Build) + + +if(NOT DEFINED Matlab_MEX_EXTENSION) + set(_matlab_mex_extension "") + matlab_get_mex_suffix("${Matlab_ROOT_DIR}" _matlab_mex_extension) + + # This variable goes to the cache. + set(Matlab_MEX_EXTENSION ${_matlab_mex_extension} CACHE STRING "Extensions for the mex targets (automatically given by Matlab)") + unset(_matlab_mex_extension) +endif() + + +if(MATLAB_FIND_DEBUG) + message(STATUS "[MATLAB] [DEBUG]_matlab_lib_prefix_for_search = ${_matlab_lib_prefix_for_search} | _matlab_lib_dir_for_search = ${_matlab_lib_dir_for_search}") +endif() + + + +# internal +# This small stub around find_library is to prevent any pollution of CMAKE_FIND_LIBRARY_PREFIXES in the global scope. +# This is the function to be used below instead of the find_library directives. +function(_Matlab_find_library _matlab_library_prefix) + set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} ${_matlab_library_prefix}) + find_library(${ARGN}) +endfunction() + + +set(_matlab_required_variables) + + +# the MEX library/header are required +find_path( + Matlab_INCLUDE_DIRS + mex.h + PATHS ${MATLAB_INCLUDE_DIR_TO_LOOK} + NO_DEFAULT_PATH + ) +list(APPEND _matlab_required_variables Matlab_INCLUDE_DIRS) + +_Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_MEX_LIBRARY + mex + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH ) + + +list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY) + +# the MEX extension is required +list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION) + +# the matlab root is required +list(APPEND _matlab_required_variables Matlab_ROOT_DIR) + + +# component Mex Compiler +list(FIND Matlab_FIND_COMPONENTS MEX_COMPILER _matlab_find_mex_compiler) +if(_matlab_find_mex_compiler GREATER -1) + find_program( + Matlab_MEX_COMPILER + "mex" + PATHS ${Matlab_BINARIES_DIR} + DOC "Matlab MEX compiler" + NO_DEFAULT_PATH + ) + + if(Matlab_MEX_COMPILER) + set(Matlab_MEX_COMPILER_FOUND TRUE) + endif() +endif() +unset(_matlab_find_mex_compiler) + +# component Matlab program +list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program) +if(_matlab_find_matlab_program GREATER -1) + + find_program( + Matlab_MAIN_PROGRAM + matlab + PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin + DOC "Matlab main program" + NO_DEFAULT_PATH + ) + + if(Matlab_MAIN_PROGRAM) + set(Matlab_MAIN_PROGRAM_FOUND TRUE) + endif() + +endif() +unset(_matlab_find_matlab_program) + +# Component MX library +list(FIND Matlab_FIND_COMPONENTS MX_LIBRARY _matlab_find_mx) +if(_matlab_find_mx GREATER -1) + _Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_MX_LIBRARY + mx + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH + ) + + if(Matlab_MX_LIBRARY) + set(Matlab_MX_LIBRARY_FOUND TRUE) + endif() +endif() +unset(_matlab_find_mx) + + +# Component ENG library +list(FIND Matlab_FIND_COMPONENTS ENG_LIBRARY _matlab_find_eng) +if(_matlab_find_eng GREATER -1) + _Matlab_find_library( + ${_matlab_lib_prefix_for_search} + Matlab_ENG_LIBRARY + eng + PATHS ${_matlab_lib_dir_for_search} + NO_DEFAULT_PATH + ) + if(Matlab_ENG_LIBRARY) + set(Matlab_ENG_LIBRARY_FOUND TRUE) + endif() +endif() +unset(_matlab_find_eng) + + + + + +unset(_matlab_lib_dir_for_search) + + +set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY}) + + +find_package_handle_standard_args( + Matlab + FOUND_VAR Matlab_FOUND + REQUIRED_VARS ${_matlab_required_variables} + VERSION_VAR Matlab_VERSION_STRING + HANDLE_COMPONENTS) + +unset(_matlab_required_variables) +unset(_matlab_bin_prefix) +unset(_matlab_bin_suffix_32bits) +unset(_matlab_bin_suffix_64bits) +unset(_matlab_current_suffix) +unset(_matlab_lib_dir_for_search) +unset(_matlab_lib_prefix_for_search) + +if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES) + mark_as_advanced( + #Matlab_LIBRARIES + Matlab_MEX_LIBRARY + Matlab_MX_LIBRARY + Matlab_ENG_LIBRARY + Matlab_INCLUDE_DIRS + Matlab_FOUND + #Matlab_ROOT_DIR + #Matlab_VERSION_STRING + Matlab_MAIN_PROGRAM + #Matlab_MEX_EXTENSION + Matlab_MEXEXTENSIONS_PROG + Matlab_MEX_EXTENSION + #Matlab_BINARIES_DIR + ) +endif() diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake new file mode 100644 index 0000000..ebccbf6 --- /dev/null +++ b/Modules/MatlabTestsRedirect.cmake @@ -0,0 +1,92 @@ +# This is an undocumented internal helper for the FindMatlab +# module ``matlab_add_unit_test`` command. + +#============================================================================= +# Copyright 2014-2015 Raffi Enficiaud, Max Planck Society +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +# Usage: cmake +# -Dtest_timeout=180 +# -Dworking_directory="." +# -Doutput_directory= +# -Dadditional_paths="" +# -Dno_unittest_framework="" +# -DMatlab_PROGRAM=matlab_exe_location +# -DMatlab_ADDITIONNAL_STARTUP_OPTIONS="" +# -Dtest_name=name_of_the_test +# -Dcmd_to_run_before_test="" +# -Dunittest_file_to_run +# -P FindMatlab_TestsRedirect.cmake + +set(Matlab_UNIT_TESTS_CMD -nosplash -nojvm -nodesktop -nodisplay ${Matlab_ADDITIONNAL_STARTUP_OPTIONS}) +if(WIN32) + set(Matlab_UNIT_TESTS_CMD ${Matlab_UNIT_TESTS_CMD} -wait) +endif() + +if(NOT test_timeout) + set(test_timeout 180) +endif() + +if(NOT cmd_to_run_before_test) + set(cmd_to_run_before_test) +endif() + +get_filename_component(unittest_file_directory "${unittest_file_to_run}" DIRECTORY) +get_filename_component(unittest_file_to_run_name "${unittest_file_to_run}" NAME_WE) + +set(concat_string '${unittest_file_directory}') +foreach(s IN LISTS additional_paths) + if(NOT "${s}" STREQUAL "") + set(concat_string "${concat_string}, '${s}'") + endif() +endforeach() + +set(unittest_to_run "runtests('${unittest_file_to_run_name}'), exit(max([ans(1,:).Failed]))") +if(no_unittest_framework) + set(unittest_to_run "try, ${unittest_file_to_run_name}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)") +endif() + +set(Matlab_SCRIPT_TO_RUN + "addpath(${concat_string}), path, ${cmd_to_run_before_test}, ${unittest_to_run}" + ) + +set(Matlab_LOG_FILE "${output_directory}/${test_name}.log") + +set(devnull) +if(UNIX) + set(devnull INPUT_FILE /dev/null) +elseif(WIN32) + set(devnull INPUT_FILE NUL) +endif() + +execute_process( + COMMAND "${Matlab_PROGRAM}" ${Matlab_UNIT_TESTS_CMD} -logfile "${test_name}.log" -r "${Matlab_SCRIPT_TO_RUN}" + RESULT_VARIABLE res + TIMEOUT ${test_timeout} + OUTPUT_QUIET # we do not want the output twice + WORKING_DIRECTORY "${output_directory}" + ${devnull} + ) + +if(NOT EXISTS ${Matlab_LOG_FILE}) + message( FATAL_ERROR "[MATLAB] ERROR: cannot find the log file ${Matlab_LOG_FILE}") +endif() + +# print the output in any case. +file(READ ${Matlab_LOG_FILE} matlab_log_content) +message("Matlab test ${name_of_the_test} output:\n${matlab_log_content}") # if we put FATAL_ERROR here, the file is indented. + + +if(NOT (res EQUAL 0)) + message( FATAL_ERROR "[MATLAB] TEST FAILED" ) +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 703c548..414f625 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1256,6 +1256,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindJsonCpp) endif() + # Matlab module + if(CMake_TEST_FindMatlab) + ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $) + ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -C $) + endif() + find_package(GTK2 QUIET) if(GTK2_FOUND) add_subdirectory(FindGTK2) diff --git a/Tests/FindMatlab/basic_checks/CMakeLists.txt b/Tests/FindMatlab/basic_checks/CMakeLists.txt new file mode 100644 index 0000000..acf71ea --- /dev/null +++ b/Tests/FindMatlab/basic_checks/CMakeLists.txt @@ -0,0 +1,57 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(basic_checks) + +set(MATLAB_FIND_DEBUG TRUE) + +# the success of the following command is dependent on the current configuration: +# - on 32bits builds (cmake is building with 32 bits), it looks for 32 bits Matlab +# - on 64bits builds (cmake is building with 64 bits), it looks for 64 bits Matlab +find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY MAIN_PROGRAM) + + + +matlab_add_mex( + # target name + NAME cmake_matlab_test_wrapper1 + # output name + OUTPUT_NAME cmake_matlab_mex1 + SRC ${CMAKE_CURRENT_SOURCE_DIR}/../matlab_wrapper1.cpp + DOCUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/../help_text1.m.txt + ) + + +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-1 + TIMEOUT 30 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests1.m + ADDITIONAL_PATH $ + ) + +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-2 + TIMEOUT 15 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests_timeout.m + ADDITIONAL_PATH $ + ) +set_tests_properties(${PROJECT_NAME}_matlabtest-2 PROPERTIES WILL_FAIL TRUE) + + +# testing the test without the unittest framework of Matlab +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-3 + TIMEOUT 30 + NO_UNITTEST_FRAMEWORK + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests2.m + ADDITIONAL_PATH $ + ) + +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-4 + TIMEOUT 30 + NO_UNITTEST_FRAMEWORK + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_matlab_unit_tests3.m + ADDITIONAL_PATH $ + ) +set_tests_properties(${PROJECT_NAME}_matlabtest-4 PROPERTIES WILL_FAIL TRUE) diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests1.m b/Tests/FindMatlab/cmake_matlab_unit_tests1.m new file mode 100644 index 0000000..2371c3a --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests1.m @@ -0,0 +1,33 @@ + +classdef cmake_matlab_unit_tests1 < matlab.unittest.TestCase + % some simple unit test for CMake Matlab wrapper + properties + end + + methods (Test) + function testDummyCall(testCase) + % very simple call test + cmake_matlab_mex1(rand(3,3)); + end + + function testDummyCall2(testCase) + % very simple call test 2 + ret = cmake_matlab_mex1(rand(3,3)); + testCase.verifyEqual(size(ret), size(rand(3,3))); + + testCase.verifyEqual(size(cmake_matlab_mex1(rand(4,3))), [4,3] ); + end + + function testFailTest(testCase) + testCase.verifyError(@() cmake_matlab_mex1(10), 'cmake_matlab:configuration'); + testCase.verifyError(@() cmake_matlab_mex1([10]), 'cmake_matlab:configuration'); + end + + function testHelpContent(testCase) + % testing the help feature + testCase.verifySubstring(evalc('help cmake_matlab_mex1'), 'Dummy matlab extension in cmake'); + end + + + end +end diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests2.m b/Tests/FindMatlab/cmake_matlab_unit_tests2.m new file mode 100644 index 0000000..7a8a342 --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests2.m @@ -0,0 +1,6 @@ + +ret = cmake_matlab_mex1(rand(3,3)); + +if(size(ret) ~= size(rand(3,3))) + error('Dimension mismatch!'); +end diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests3.m b/Tests/FindMatlab/cmake_matlab_unit_tests3.m new file mode 100644 index 0000000..2639325 --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests3.m @@ -0,0 +1,5 @@ + +cmake_matlab_mex1(10); + +% should not reach this point +exit(0); diff --git a/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m b/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m new file mode 100644 index 0000000..11d5e9e --- /dev/null +++ b/Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m @@ -0,0 +1,16 @@ + +classdef cmake_matlab_unit_tests_timeout < matlab.unittest.TestCase + % timeout tests + + properties + end + + methods (Test) + function testCallHangsShouldBeTimedOut(testCase) + cmake_matlab_mex1(rand(3,3)); + disp('Will now wait.'); + disp('Testing the cmake Matlab package timeout - do not kill'); + pause(20); % supposed to be killed after 15s + end + end +end diff --git a/Tests/FindMatlab/help_text1.m.txt b/Tests/FindMatlab/help_text1.m.txt new file mode 100644 index 0000000..a924355 --- /dev/null +++ b/Tests/FindMatlab/help_text1.m.txt @@ -0,0 +1,2 @@ +% Dummy matlab extension in cmake +function ret = cmake_matlab_mex1(X) diff --git a/Tests/FindMatlab/matlab_wrapper1.cpp b/Tests/FindMatlab/matlab_wrapper1.cpp new file mode 100644 index 0000000..4149bb9 --- /dev/null +++ b/Tests/FindMatlab/matlab_wrapper1.cpp @@ -0,0 +1,26 @@ + +// simple workaround to some compiler specific problems +// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 +#include + +#include "mex.h" + +// this test should return a matrix of 10 x 10 and should check some of the arguments + +void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[]) +{ + if(nrhs != 1) + { + mexErrMsgTxt("Incorrect arguments"); + } + + size_t dim1 = mxGetM(prhs[0]); + size_t dim2 = mxGetN(prhs[0]); + + if(dim1 == 1 || dim2 == 1) + { + mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments"); + } + + plhs[0] = mxCreateNumericMatrix(dim1, dim2, mxGetClassID(prhs[0]), mxREAL); +} diff --git a/Tests/FindMatlab/versions_checks/CMakeLists.txt b/Tests/FindMatlab/versions_checks/CMakeLists.txt new file mode 100644 index 0000000..5d20685 --- /dev/null +++ b/Tests/FindMatlab/versions_checks/CMakeLists.txt @@ -0,0 +1,52 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(versions_checks) + +set(MATLAB_FIND_DEBUG TRUE) +set(MATLAB_ADDITIONAL_VERSIONS + "dummy=14.9") + +# the success of the following command is dependent on the current configuration +# in this case, we are only interested in the version macros +find_package(Matlab) + + + +if(NOT COMMAND matlab_get_version_from_release_name) + message(FATAL_ERROR "The macro matlab_get_version_from_release_name should be defined") +endif() + +if(NOT COMMAND matlab_get_release_name_from_version) + message(FATAL_ERROR "The macro matlab_get_release_name_from_version should be defined") +endif() + + +# matlab_get_release_name_from_version +matlab_get_release_name_from_version("7.13" release_name) +if(NOT release_name STREQUAL "R2011b") + message(FATAL_ERROR "version 7.13 does not give release R2011b : '${release_name}' != R2011b") +endif() + +matlab_get_release_name_from_version("14.9" release_name) +if(NOT release_name STREQUAL "dummy") + message(FATAL_ERROR "version 14.9 does not give release dummy : '${release_name}' != dummy") +endif() + +matlab_get_release_name_from_version("14.10" release_name) +if(NOT release_name STREQUAL "") + message(FATAL_ERROR "version 14.10 does not give empty release: '${release_name}' != ''") +endif() + + +# matlab_get_version_from_release_name +matlab_get_version_from_release_name("R2011a" version) +if(NOT version STREQUAL "7.12") + message(FATAL_ERROR "Release R2011a does not give version 7.12 : '${version}' != 7.12") +endif() + +matlab_get_version_from_release_name("dummy" version) +#message(FATAL_ERROR "versionversion = ${version}") +if(NOT version STREQUAL "14.9") + message(FATAL_ERROR "Release dummy does not give version 14.9 : '${version}' != 14.9") +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 1bcc3f3..7cbc9fe 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -211,3 +211,8 @@ if(RPMBUILD_EXECUTABLE) endif() add_RunCMake_test(COMPILE_LANGUAGE-genex) + +# Matlab module related tests +if(CMake_TEST_FindMatlab) + add_RunCMake_test(FindMatlab) +endif() diff --git a/Tests/RunCMake/FindMatlab/CMakeLists.txt b/Tests/RunCMake/FindMatlab/CMakeLists.txt new file mode 100644 index 0000000..1b9a957 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/CMakeLists.txt @@ -0,0 +1,3 @@ + +cmake_minimum_required(VERSION 2.8.12) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1-result.txt b/Tests/RunCMake/FindMatlab/MatlabTest1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FindMatlab/MatlabTest1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt b/Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt new file mode 100644 index 0000000..95a787f --- /dev/null +++ b/Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*FindMatlab.cmake:[0-9]+ \(message\): + \[MATLAB\] This functionality needs the MAIN_PROGRAM component \(not default\) diff --git a/Tests/RunCMake/FindMatlab/MatlabTest1.cmake b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake new file mode 100644 index 0000000..1cbc1c2 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/MatlabTest1.cmake @@ -0,0 +1,22 @@ + +cmake_minimum_required (VERSION 2.8.12) +enable_testing() +project(test_should_fail) + +find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY) + +matlab_add_mex( + # target name + NAME cmake_matlab_test_wrapper1 + # output name + OUTPUT_NAME cmake_matlab_mex1 + SRC ${CMAKE_CURRENT_SOURCE_DIR}/matlab_wrapper1.cpp + ) + +# this command should raise a FATAL_ERROR, component MAIN_PROGRAM is missing +matlab_add_unit_test( + NAME ${PROJECT_NAME}_matlabtest-1 + TIMEOUT 1 + UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake_matlab_unit_tests2.m + ADDITIONAL_PATH $ + ) diff --git a/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake new file mode 100644 index 0000000..33dbb77 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/RunCMakeTest.cmake @@ -0,0 +1,3 @@ + +include(RunCMake) +run_cmake(MatlabTest1) diff --git a/Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m b/Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m new file mode 100644 index 0000000..7a8a342 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m @@ -0,0 +1,6 @@ + +ret = cmake_matlab_mex1(rand(3,3)); + +if(size(ret) ~= size(rand(3,3))) + error('Dimension mismatch!'); +end diff --git a/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp new file mode 100644 index 0000000..4149bb9 --- /dev/null +++ b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp @@ -0,0 +1,26 @@ + +// simple workaround to some compiler specific problems +// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916 +#include + +#include "mex.h" + +// this test should return a matrix of 10 x 10 and should check some of the arguments + +void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[]) +{ + if(nrhs != 1) + { + mexErrMsgTxt("Incorrect arguments"); + } + + size_t dim1 = mxGetM(prhs[0]); + size_t dim2 = mxGetN(prhs[0]); + + if(dim1 == 1 || dim2 == 1) + { + mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments"); + } + + plhs[0] = mxCreateNumericMatrix(dim1, dim2, mxGetClassID(prhs[0]), mxREAL); +} ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 10:11:25 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 10:11:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1035-g987430c Message-ID: <20150317141125.91313AAEF9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 987430c70a226a5dcf88d04c3d1ab75ac1b142f4 (commit) via 5bc304f7fa8e3db252e2c469f9df0204853163cc (commit) from 100f5b6c1f44e7b49f0e95e6b4e9f18e4599b05f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=987430c70a226a5dcf88d04c3d1ab75ac1b142f4 commit 987430c70a226a5dcf88d04c3d1ab75ac1b142f4 Merge: 100f5b6 5bc304f Author: Brad King AuthorDate: Tue Mar 17 10:11:24 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 10:11:24 2015 -0400 Merge topic 'output-ctest-env-vars' into next 5bc304f7 fixup! CTest: Output test-specific env vars in verbose mode (#15446) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5bc304f7fa8e3db252e2c469f9df0204853163cc commit 5bc304f7fa8e3db252e2c469f9df0204853163cc Author: Brad King AuthorDate: Tue Mar 17 10:11:05 2015 -0400 Commit: Brad King CommitDate: Tue Mar 17 10:11:05 2015 -0400 fixup! CTest: Output test-specific env vars in verbose mode (#15446) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c4e4d5c..c755651 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2565,7 +2565,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" @ONLY ESCAPE_QUOTES) add_test(CTestTestVerboseOutput ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" -VV - --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log" + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/testOutput.log" -C "\${CTestTest_CONFIG}" ) set_property(TEST CTestTestVerboseOutput PROPERTY PASS_REGULAR_EXPRESSION ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 10:12:06 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 10:12:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1037-gb80194b Message-ID: <20150317141206.3AACDAB07D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b80194b8302ef3eb1c205008f238ead50f34d50d (commit) via 874fdd914a646d25096c34b97caafe43e2a77748 (commit) from 987430c70a226a5dcf88d04c3d1ab75ac1b142f4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b80194b8302ef3eb1c205008f238ead50f34d50d commit b80194b8302ef3eb1c205008f238ead50f34d50d Merge: 987430c 874fdd9 Author: Brad King AuthorDate: Tue Mar 17 10:12:05 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 10:12:05 2015 -0400 Merge topic 'output-ctest-env-vars' into next 874fdd91 CTest: Output test-specific env vars in verbose mode (#15446) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=874fdd914a646d25096c34b97caafe43e2a77748 commit 874fdd914a646d25096c34b97caafe43e2a77748 Author: Zach Mullen AuthorDate: Sun Mar 15 13:00:31 2015 -0400 Commit: Brad King CommitDate: Tue Mar 17 10:11:33 2015 -0400 CTest: Output test-specific env vars in verbose mode (#15446) Any environment vars that were configured for a test via the ENVIRONMENT property will now be output when the test is run with verbose logging enabled. diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 03131fd..01a7884 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -536,11 +536,26 @@ void cmCTestRunTest::ComputeArguments() } this->TestResult.FullCommandLine = testCommand; + // Print the test command in verbose mode cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl << this->Index << ": " << (this->TestHandler->MemCheck?"MemCheck":"Test") << " command: " << testCommand << std::endl); + + // Print any test-specific env vars in verbose mode + if (this->TestProperties->Environment.size()) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " + << "Environment variables: " << std::endl); + } + for(std::vector::const_iterator e = + this->TestProperties->Environment.begin(); + e != this->TestProperties->Environment.end(); ++e) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << *e + << std::endl); + } } //---------------------------------------------------------------------- diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 703c548..c755651 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2561,6 +2561,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) + configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestVerboseOutput/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" @ONLY ESCAPE_QUOTES) + add_test(CTestTestVerboseOutput ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/test.cmake" -VV + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestVerboseOutput/testOutput.log" + -C "\${CTestTest_CONFIG}" + ) + set_property(TEST CTestTestVerboseOutput PROPERTY PASS_REGULAR_EXPRESSION + "Environment variables:.*foo=bar.*this=that" + ) + configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestSkipReturnCode/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestSkipReturnCode/test.cmake" diff --git a/Tests/CTestTestVerboseOutput/CMakeLists.txt b/Tests/CTestTestVerboseOutput/CMakeLists.txt new file mode 100644 index 0000000..4cdd29c --- /dev/null +++ b/Tests/CTestTestVerboseOutput/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required (VERSION 2.6) +project(CTestTestVerboseOutput) +include(CTest) + +add_executable(nop nop.c) + +add_test(NAME TestWithProperties COMMAND nop) +set_property(TEST TestWithProperties PROPERTY ENVIRONMENT + "foo=bar" + "this=that" +) diff --git a/Tests/CTestTestVerboseOutput/CTestConfig.cmake b/Tests/CTestTestVerboseOutput/CTestConfig.cmake new file mode 100644 index 0000000..4f96c79 --- /dev/null +++ b/Tests/CTestTestVerboseOutput/CTestConfig.cmake @@ -0,0 +1,7 @@ +set(CTEST_PROJECT_NAME "CTestTestVerboseOutput") +set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set(CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestVerboseOutput/nop.c b/Tests/CTestTestVerboseOutput/nop.c new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/CTestTestVerboseOutput/nop.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/CTestTestVerboseOutput/test.cmake.in b/Tests/CTestTestVerboseOutput/test.cmake.in new file mode 100644 index 0000000..7f49548 --- /dev/null +++ b/Tests/CTestTestVerboseOutput/test.cmake.in @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 2.4) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest- at BUILDNAME@-VerboseOutput") + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestVerboseOutput") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestVerboseOutput") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}") +CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}") +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}") ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 10:14:51 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 10:14:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-432-ge9072d2 Message-ID: <20150317141451.2C059AC164@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e9072d26c0d90a8ff521d46347e5d1b3555f8099 (commit) via 874fdd914a646d25096c34b97caafe43e2a77748 (commit) from 4fb9abc5629ee5c046292adc77b2583ffc15c230 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e9072d26c0d90a8ff521d46347e5d1b3555f8099 commit e9072d26c0d90a8ff521d46347e5d1b3555f8099 Merge: 4fb9abc 874fdd9 Author: Brad King AuthorDate: Tue Mar 17 10:14:49 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 10:14:49 2015 -0400 Merge topic 'output-ctest-env-vars' 874fdd91 CTest: Output test-specific env vars in verbose mode (#15446) ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestRunTest.cxx | 15 +++++++++++++++ Tests/CMakeLists.txt | 11 +++++++++++ Tests/CTestTestVerboseOutput/CMakeLists.txt | 11 +++++++++++ .../CTestConfig.cmake | 2 +- .../CTestTestVerboseOutput/nop.c | 0 .../test.cmake.in} | 13 ++++++------- 6 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 Tests/CTestTestVerboseOutput/CMakeLists.txt copy Tests/{CTestTestScheduler => CTestTestVerboseOutput}/CTestConfig.cmake (83%) copy Modules/DummyCXXFile.cxx => Tests/CTestTestVerboseOutput/nop.c (100%) copy Tests/{CTestTestFailure/testNoExe.cmake.in => CTestTestVerboseOutput/test.cmake.in} (72%) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 10:14:53 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 10:14:53 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-434-g8915cdd Message-ID: <20150317141453.E3344AB089@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 8915cddcde6f8b0946e54f1cd6c9b8434bf4fd14 (commit) via 49c8dcf7bb8ae9e7584286e552769a61bf23e61b (commit) from e9072d26c0d90a8ff521d46347e5d1b3555f8099 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8915cddcde6f8b0946e54f1cd6c9b8434bf4fd14 commit 8915cddcde6f8b0946e54f1cd6c9b8434bf4fd14 Merge: e9072d2 49c8dcf Author: Brad King AuthorDate: Tue Mar 17 10:14:52 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 10:14:52 2015 -0400 Merge topic 'FindMatlab-rewrite' 49c8dcf7 FindMatlab: Rewrite module and provide a usage API ----------------------------------------------------------------------- Summary of changes: Help/release/dev/FindMatlab-rewrite.rst | 7 + Modules/FindMatlab.cmake | 1508 ++++++++++++++++++-- Modules/MatlabTestsRedirect.cmake | 92 ++ Tests/CMakeLists.txt | 6 + Tests/FindMatlab/basic_checks/CMakeLists.txt | 57 + Tests/FindMatlab/cmake_matlab_unit_tests1.m | 33 + Tests/FindMatlab/cmake_matlab_unit_tests2.m | 6 + Tests/FindMatlab/cmake_matlab_unit_tests3.m | 5 + Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m | 16 + Tests/FindMatlab/help_text1.m.txt | 2 + Tests/FindMatlab/matlab_wrapper1.cpp | 26 + Tests/FindMatlab/versions_checks/CMakeLists.txt | 52 + Tests/RunCMake/CMakeLists.txt | 5 + .../{CMP0038 => FindMatlab}/CMakeLists.txt | 2 +- .../MatlabTest1-result.txt} | 0 Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt | 2 + Tests/RunCMake/FindMatlab/MatlabTest1.cmake | 22 + Tests/RunCMake/FindMatlab/RunCMakeTest.cmake | 3 + .../RunCMake/FindMatlab/cmake_matlab_unit_tests2.m | 6 + Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp | 26 + 20 files changed, 1788 insertions(+), 88 deletions(-) create mode 100644 Help/release/dev/FindMatlab-rewrite.rst create mode 100644 Modules/MatlabTestsRedirect.cmake create mode 100644 Tests/FindMatlab/basic_checks/CMakeLists.txt create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests1.m create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests2.m create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests3.m create mode 100644 Tests/FindMatlab/cmake_matlab_unit_tests_timeout.m create mode 100644 Tests/FindMatlab/help_text1.m.txt create mode 100644 Tests/FindMatlab/matlab_wrapper1.cpp create mode 100644 Tests/FindMatlab/versions_checks/CMakeLists.txt copy Tests/RunCMake/{CMP0038 => FindMatlab}/CMakeLists.txt (70%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => FindMatlab/MatlabTest1-result.txt} (100%) create mode 100644 Tests/RunCMake/FindMatlab/MatlabTest1-stderr.txt create mode 100644 Tests/RunCMake/FindMatlab/MatlabTest1.cmake create mode 100644 Tests/RunCMake/FindMatlab/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/FindMatlab/cmake_matlab_unit_tests2.m create mode 100644 Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 10:14:55 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 10:14:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-437-g0320993 Message-ID: <20150317141455.D4D9BAC180@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 03209934560329aebd75dc74916e236e3b5c9b74 (commit) via 140a53a810ea7449c26e6e572918df3bb20e86d1 (commit) via 4552bc886d1bd8966f6ef2f7790835dfdb2e6d8b (commit) from 8915cddcde6f8b0946e54f1cd6c9b8434bf4fd14 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=03209934560329aebd75dc74916e236e3b5c9b74 commit 03209934560329aebd75dc74916e236e3b5c9b74 Merge: 8915cdd 140a53a Author: Brad King AuthorDate: Tue Mar 17 10:14:54 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 10:14:54 2015 -0400 Merge topic 'cpack_rpm_old_version_tests' 140a53a8 CPack/RPM architecture test fixup 4552bc88 CPack/RPM relocation paths test fixup ----------------------------------------------------------------------- Summary of changes: .../RunCPackVerifyResult.cmake | 41 +++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 10:14:58 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 10:14:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-439-ga5cab2e Message-ID: <20150317141458.40FECAC192@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a5cab2e7391df8d2072f1083c075a69bc746c7aa (commit) via 1bda8f1fdbfdeef82766e5db542b1946d5e2167d (commit) from 03209934560329aebd75dc74916e236e3b5c9b74 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5cab2e7391df8d2072f1083c075a69bc746c7aa commit a5cab2e7391df8d2072f1083c075a69bc746c7aa Merge: 0320993 1bda8f1 Author: Brad King AuthorDate: Tue Mar 17 10:14:56 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 10:14:56 2015 -0400 Merge topic 'wix-installer-theme' 1bda8f1f CPackWIX: Customize CMake installer theme. ----------------------------------------------------------------------- Summary of changes: CMakeCPackOptions.cmake.in | 8 ++++++++ Utilities/Release/cpack_wix_ui_banner.jpg | Bin 0 -> 2607 bytes Utilities/Release/cpack_wix_ui_dialog.jpg | Bin 0 -> 13369 bytes 3 files changed, 8 insertions(+) create mode 100644 Utilities/Release/cpack_wix_ui_banner.jpg create mode 100644 Utilities/Release/cpack_wix_ui_dialog.jpg hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 10:15:17 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 10:15:17 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1044-gffcab9b Message-ID: <20150317141517.D684AAC196@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ffcab9ba5822eec95d349d937b5cb11e7ca7c2a1 (commit) via a5cab2e7391df8d2072f1083c075a69bc746c7aa (commit) via 03209934560329aebd75dc74916e236e3b5c9b74 (commit) via 8915cddcde6f8b0946e54f1cd6c9b8434bf4fd14 (commit) via e9072d26c0d90a8ff521d46347e5d1b3555f8099 (commit) via 4fb9abc5629ee5c046292adc77b2583ffc15c230 (commit) via 0ac7d871fae9589bbdf22518360818f9b1423bd8 (commit) from b80194b8302ef3eb1c205008f238ead50f34d50d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ffcab9ba5822eec95d349d937b5cb11e7ca7c2a1 commit ffcab9ba5822eec95d349d937b5cb11e7ca7c2a1 Merge: b80194b a5cab2e Author: Brad King AuthorDate: Tue Mar 17 10:15:08 2015 -0400 Commit: Brad King CommitDate: Tue Mar 17 10:15:08 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 11:32:42 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 11:32:42 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1046-gee0d5f1 Message-ID: <20150317153242.4DA2BAC90B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ee0d5f1e984acfed8220bf474c5b32f583a584a8 (commit) via fd0b03f2f7a807c1bf56a44a129fad4ede55fe4b (commit) from ffcab9ba5822eec95d349d937b5cb11e7ca7c2a1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee0d5f1e984acfed8220bf474c5b32f583a584a8 commit ee0d5f1e984acfed8220bf474c5b32f583a584a8 Merge: ffcab9b fd0b03f Author: Brad King AuthorDate: Tue Mar 17 11:32:41 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 11:32:41 2015 -0400 Merge topic 'add_repeat_testing' into next fd0b03f2 fixup! Add error checking to repeat until fail ctest option along with tests. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd0b03f2f7a807c1bf56a44a129fad4ede55fe4b commit fd0b03f2f7a807c1bf56a44a129fad4ede55fe4b Author: Brad King AuthorDate: Tue Mar 17 10:21:40 2015 -0400 Commit: Brad King CommitDate: Tue Mar 17 11:31:47 2015 -0400 fixup! Add error checking to repeat until fail ctest option along with tests. diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 5f094e0..6946a20 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2011,14 +2011,15 @@ bool cmCTest::HandleCommandLineArguments(size_t &i, { if( i >= args.size() - 1) { - errormsg = "Usage: ctest --repeat-until-fail N"; + errormsg = "'--repeat-until-fail' requires an argument"; return false; } i++; long repeat = 1; if(!cmSystemTools::StringToLong(args[i].c_str(), &repeat)) { - errormsg = "Usage: ctest --repeat-until-fail N"; + errormsg = "'--repeat-until-fail' given non-integer value '" + + args[i] + "'"; return false; } this->RepeatTests = repeat; diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt index 6610d46..2843a51 100644 --- a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt +++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt @@ -2,4 +2,4 @@ cmake_minimum_required(VERSION 3.0) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) add_test(hello ${CMAKE_COMMAND} -E echo hello) -add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) \ No newline at end of file +add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index f56db82..7be07c1 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCMake) -run_cmake_command(repeat-until-fail-bad ${CMAKE_CTEST_COMMAND} +run_cmake_command(repeat-until-fail-bad1 ${CMAKE_CTEST_COMMAND} --repeat-until-fail) run_cmake_command(repeat-until-fail-bad2 ${CMAKE_CTEST_COMMAND} --repeat-until-fail foo) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt deleted file mode 100644 index 723291f..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -CMake Error: Usage: ctest --repeat-until-fail N diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt similarity index 100% rename from Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-result.txt rename to Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt new file mode 100644 index 0000000..5ea8816 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-until-fail' requires an argument$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt index 723291f..a79faae 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt @@ -1 +1 @@ -CMake Error: Usage: ctest --repeat-until-fail N +^CMake Error: '--repeat-until-fail' given non-integer value 'foo'$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt index eafba1c..a7c4b11 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt @@ -1 +1 @@ -No tests were found!!! +^No tests were found!!!$ ----------------------------------------------------------------------- Summary of changes: Source/cmCTest.cxx | 5 +++-- Tests/RunCMake/CTestCommandLine/CMakeLists.txt | 2 +- Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 2 +- Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt | 1 - ...ntil-fail-bad-result.txt => repeat-until-fail-bad1-result.txt} | 0 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt | 1 + Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt | 2 +- Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt | 1 - Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad-stderr.txt rename Tests/RunCMake/CTestCommandLine/{repeat-until-fail-bad-result.txt => repeat-until-fail-bad1-result.txt} (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt delete mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-result.txt hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 11:40:28 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 11:40:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1049-g53cbf3a Message-ID: <20150317154028.75CA1AADEF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 53cbf3a06bca2772947ccfa960523d09caa59285 (commit) via 98d240d859f0c462bed41edfdf19507043e10c04 (commit) via 7d6bb488e1754288574dccbb447b49388929af8b (commit) from ee0d5f1e984acfed8220bf474c5b32f583a584a8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53cbf3a06bca2772947ccfa960523d09caa59285 commit 53cbf3a06bca2772947ccfa960523d09caa59285 Merge: ee0d5f1 98d240d Author: Brad King AuthorDate: Tue Mar 17 11:40:27 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 11:40:27 2015 -0400 Merge topic 'ctest-repeat-until-fail' into next 98d240d8 Help: Add notes for topic 'ctest-repeat-until-fail' 7d6bb488 ctest: Refine --repeat-until-fail documentation http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98d240d859f0c462bed41edfdf19507043e10c04 commit 98d240d859f0c462bed41edfdf19507043e10c04 Author: Brad King AuthorDate: Tue Mar 17 11:39:43 2015 -0400 Commit: Brad King CommitDate: Tue Mar 17 11:39:43 2015 -0400 Help: Add notes for topic 'ctest-repeat-until-fail' diff --git a/Help/release/dev/ctest-repeat-until-fail.rst b/Help/release/dev/ctest-repeat-until-fail.rst new file mode 100644 index 0000000..8a679c6 --- /dev/null +++ b/Help/release/dev/ctest-repeat-until-fail.rst @@ -0,0 +1,5 @@ +ctest-repeat-until-fail +----------------------- + +* The :manual:`ctest(1)` tool learned a new ``--repeat-until-fail `` + option to help find sporadic test failures. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d6bb488e1754288574dccbb447b49388929af8b commit 7d6bb488e1754288574dccbb447b49388929af8b Author: Brad King AuthorDate: Tue Mar 17 11:38:33 2015 -0400 Commit: Brad King CommitDate: Tue Mar 17 11:38:33 2015 -0400 ctest: Refine --repeat-until-fail documentation diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 99d33e7..dd3bcfb 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -194,11 +194,10 @@ Options subsequent calls to ctest with the --rerun-failed option will run the set of tests that most recently failed (if any). -``--repeat-until-fail N`` - Run each test N times until N runs or a test fails. +``--repeat-until-fail `` + Require each test to run ```` times without failing in order to pass. - This option allows you to run each test multiple times until a test failes. - This is useful in finding random failures in test cases. + This is useful in finding sporadic failures in test cases. ``--max-width `` Set the max width for a test name to output diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 069c45e..0fc47b7 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -75,8 +75,8 @@ static const char * cmDocumentationOptions[][2] = "Run a specific number of tests by number."}, {"-U, --union", "Take the Union of -I and -R"}, {"--rerun-failed", "Run only the tests that failed previously"}, - {"--repeat-until-fail N", "Run each test N times" - " until the test runs N times or the test fails."}, + {"--repeat-until-fail ", "Require each test to run " + "times without failing in order to pass"}, {"--max-width ", "Set the max width for a test name to output"}, {"--interactive-debug-mode [0|1]", "Set the interactive mode to 0 or 1."}, {"--no-label-summary", "Disable timing summary information for labels."}, ----------------------------------------------------------------------- Summary of changes: Help/manual/ctest.1.rst | 7 +++---- Help/release/dev/ctest-repeat-until-fail.rst | 5 +++++ Source/ctest.cxx | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 Help/release/dev/ctest-repeat-until-fail.rst hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 11:43:25 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 11:43:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1052-g13af2b0 Message-ID: <20150317154325.7C4EBAB208@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 13af2b0fdf0695e57434a1280a3516639923d19c (commit) via 2bf0dec52a41c7eca81e5202c8036832c13ee8ba (commit) via 83620f005466912adc850cc84abb38e62ea988e0 (commit) from 53cbf3a06bca2772947ccfa960523d09caa59285 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13af2b0fdf0695e57434a1280a3516639923d19c commit 13af2b0fdf0695e57434a1280a3516639923d19c Merge: 53cbf3a 2bf0dec Author: Brad King AuthorDate: Tue Mar 17 11:43:24 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 11:43:24 2015 -0400 Merge topic 'ctest-repeat-until-fail' into next 2bf0dec5 Help: Add notes for topic 'ctest-repeat-until-fail' 83620f00 ctest: Add a new --repeat-until-fail option http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bf0dec52a41c7eca81e5202c8036832c13ee8ba commit 2bf0dec52a41c7eca81e5202c8036832c13ee8ba Author: Brad King AuthorDate: Tue Mar 17 11:39:43 2015 -0400 Commit: Brad King CommitDate: Tue Mar 17 11:41:24 2015 -0400 Help: Add notes for topic 'ctest-repeat-until-fail' diff --git a/Help/release/dev/ctest-repeat-until-fail.rst b/Help/release/dev/ctest-repeat-until-fail.rst new file mode 100644 index 0000000..8a679c6 --- /dev/null +++ b/Help/release/dev/ctest-repeat-until-fail.rst @@ -0,0 +1,5 @@ +ctest-repeat-until-fail +----------------------- + +* The :manual:`ctest(1)` tool learned a new ``--repeat-until-fail `` + option to help find sporadic test failures. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83620f005466912adc850cc84abb38e62ea988e0 commit 83620f005466912adc850cc84abb38e62ea988e0 Author: Bill Hoffman AuthorDate: Thu Mar 5 16:51:10 2015 -0500 Commit: Brad King CommitDate: Tue Mar 17 11:41:10 2015 -0400 ctest: Add a new --repeat-until-fail option This option tells ctest to run each test N times until the test fails or the N times have run. This is useful for finding random failing tests. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index cc132c2..dd3bcfb 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -194,6 +194,11 @@ Options subsequent calls to ctest with the --rerun-failed option will run the set of tests that most recently failed (if any). +``--repeat-until-fail `` + Require each test to run ```` times without failing in order to pass. + + This is useful in finding sporadic failures in test cases. + ``--max-width `` Set the max width for a test name to output diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index eb33d8e..bd090db 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -121,6 +121,11 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) this->RunningCount += GetProcessorsUsed(test); cmCTestRunTest* testRun = new cmCTestRunTest(this->TestHandler); + if(this->CTest->GetRepeatUntilFail()) + { + testRun->SetRunUntilFailOn(); + testRun->SetNumberOfRuns(this->CTest->GetTestRepeat()); + } testRun->SetIndex(test); testRun->SetTestProperties(this->Properties[test]); @@ -289,7 +294,13 @@ bool cmCTestMultiProcessHandler::CheckOutput() cmCTestRunTest* p = *i; int test = p->GetIndex(); - if(p->EndTest(this->Completed, this->Total, true)) + bool testResult = p->EndTest(this->Completed, this->Total, true); + if(p->StartAgain()) + { + this->Completed--; // remove the completed test because run again + continue; + } + if(testResult) { this->Passed->push_back(p->GetTestProperties()->Name); } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 03131fd..6f72684 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -33,6 +33,9 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) this->CompressedOutput = ""; this->CompressionRatio = 2; this->StopTimePassed = false; + this->NumberOfRunsLeft = 1; // default to 1 run of the test + this->RunUntilFail = false; // default to run the test once + this->RunAgain = false; // default to not having to run again } cmCTestRunTest::~cmCTestRunTest() @@ -357,13 +360,50 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) this->MemCheckPostProcess(); this->ComputeWeightedCost(); } - // Always push the current TestResult onto the + // If the test does not need to rerun push the current TestResult onto the // TestHandler vector - this->TestHandler->TestResults.push_back(this->TestResult); + if(!this->NeedsToRerun()) + { + this->TestHandler->TestResults.push_back(this->TestResult); + } delete this->TestProcess; return passed; } +bool cmCTestRunTest::StartAgain() +{ + if(!this->RunAgain) + { + return false; + } + this->RunAgain = false; // reset + // change to tests directory + std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); + cmSystemTools::ChangeDirectory(this->TestProperties->Directory); + this->StartTest(this->TotalNumberOfTests); + // change back + cmSystemTools::ChangeDirectory(current_dir); + return true; +} + +bool cmCTestRunTest::NeedsToRerun() +{ + this->NumberOfRunsLeft--; + if(this->NumberOfRunsLeft == 0) + { + return false; + } + // if number of runs left is not 0, and we are running until + // we find a failed test, then return true so the test can be + // restarted + if(this->RunUntilFail + && this->TestResult.Status == cmCTestTestHandler::COMPLETED) + { + this->RunAgain = true; + return true; + } + return false; +} //---------------------------------------------------------------------- void cmCTestRunTest::ComputeWeightedCost() { @@ -400,6 +440,7 @@ void cmCTestRunTest::MemCheckPostProcess() // Starts the execution of a test. Returns once it has started bool cmCTestRunTest::StartTest(size_t total) { + this->TotalNumberOfTests = total; // save for rerun case cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8) << "Start " << std::setw(getNumWidth(this->TestHandler->GetMaxIndex())) @@ -494,10 +535,10 @@ bool cmCTestRunTest::StartTest(size_t total) //---------------------------------------------------------------------- void cmCTestRunTest::ComputeArguments() { + this->Arguments.clear(); // reset becaue this might be a rerun std::vector::const_iterator j = this->TestProperties->Args.begin(); ++j; // skip test name - // find the test executable if(this->TestHandler->MemCheck) { @@ -682,10 +723,28 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) - << completed << "/"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) - << total << " "); + // if this is the last or only run of this test + // then print out completed / total + // Only issue is if a test fails and we are running until fail + // then it will never print out the completed / total, same would + // got for run until pass. Trick is when this is called we don't + // yet know if we are passing or failing. + if(this->NumberOfRunsLeft == 1) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << completed << "/"); + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << total << " "); + } + // if this is one of several runs of a test just print blank space + // to keep things neat + else + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << " " << " "); + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << " " << " "); + } if ( this->TestHandler->MemCheck ) { diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 476f3e1..3b5c831 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -27,6 +27,8 @@ public: cmCTestRunTest(cmCTestTestHandler* handler); ~cmCTestRunTest(); + void SetNumberOfRuns(int n) {this->NumberOfRunsLeft = n;} + void SetRunUntilFailOn() { this->RunUntilFail = true;} void SetTestProperties(cmCTestTestHandler::cmCTestTestProperties * prop) { this->TestProperties = prop; } @@ -58,7 +60,10 @@ public: void ComputeArguments(); void ComputeWeightedCost(); + + bool StartAgain(); private: + bool NeedsToRerun(); void DartProcessing(); void ExeNotFound(std::string exe); // Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT) @@ -92,6 +97,10 @@ private: std::string ActualCommand; std::vector Arguments; bool StopTimePassed; + bool RunUntilFail; + int NumberOfRunsLeft; + bool RunAgain; + size_t TotalNumberOfTests; }; inline int getNumWidth(size_t n) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e6d3960..6946a20 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -328,6 +328,8 @@ cmCTest::cmCTest() this->OutputTestOutputOnTestFailure = false; this->ComputedCompressTestOutput = false; this->ComputedCompressMemCheckOutput = false; + this->RepeatTests = 1; // default to run each test once + this->RepeatUntilFail = false; if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE")) { this->OutputTestOutputOnTestFailure = true; @@ -1983,11 +1985,11 @@ bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, //---------------------------------------------------------------------- // Processes one command line argument (and its arguments if any) // for many simple options and then returns -void cmCTest::HandleCommandLineArguments(size_t &i, - std::vector &args) +bool cmCTest::HandleCommandLineArguments(size_t &i, + std::vector &args, + std::string& errormsg) { std::string arg = args[i]; - if(this->CheckArgument(arg, "-F")) { this->Failover = true; @@ -2005,6 +2007,27 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->SetParallelLevel(plevel); this->ParallelLevelSetInCli = true; } + if(this->CheckArgument(arg, "--repeat-until-fail")) + { + if( i >= args.size() - 1) + { + errormsg = "'--repeat-until-fail' requires an argument"; + return false; + } + i++; + long repeat = 1; + if(!cmSystemTools::StringToLong(args[i].c_str(), &repeat)) + { + errormsg = "'--repeat-until-fail' given non-integer value '" + + args[i] + "'"; + return false; + } + this->RepeatTests = repeat; + if(repeat > 1) + { + this->RepeatUntilFail = true; + } + } if(this->CheckArgument(arg, "--no-compress-output")) { @@ -2190,6 +2213,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->GetHandler("test")->SetPersistentOption("RerunFailed", "true"); this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true"); } + return true; } //---------------------------------------------------------------------- @@ -2272,7 +2296,12 @@ int cmCTest::Run(std::vector &args, std::string* output) for(size_t i=1; i < args.size(); ++i) { // handle the simple commandline arguments - this->HandleCommandLineArguments(i,args); + std::string errormsg; + if(!this->HandleCommandLineArguments(i,args, errormsg)) + { + cmSystemTools::Error(errormsg.c_str()); + return 1; + } // handle the script arguments -S -SR -SP this->HandleScriptArguments(i,args,SRArgumentSpecified); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 88191c4..3f033d9 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -429,8 +429,13 @@ public: { return this->Definitions; } - + // return the number of times a test should be run + int GetTestRepeat() { return this->RepeatTests;} + // return true if test should run until fail + bool GetRepeatUntilFail() { return this->RepeatUntilFail;} private: + int RepeatTests; + bool RepeatUntilFail; std::string ConfigType; std::string ScheduleType; std::string StopTime; @@ -535,8 +540,9 @@ private: bool AddVariableDefinition(const std::string &arg); //! parse and process most common command line arguments - void HandleCommandLineArguments(size_t &i, - std::vector &args); + bool HandleCommandLineArguments(size_t &i, + std::vector &args, + std::string& errormsg); //! hande the -S -SP and -SR arguments void HandleScriptArguments(size_t &i, diff --git a/Source/ctest.cxx b/Source/ctest.cxx index c0eb8ac..0fc47b7 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -75,6 +75,8 @@ static const char * cmDocumentationOptions[][2] = "Run a specific number of tests by number."}, {"-U, --union", "Take the Union of -I and -R"}, {"--rerun-failed", "Run only the tests that failed previously"}, + {"--repeat-until-fail ", "Require each test to run " + "times without failing in order to pass"}, {"--max-width ", "Set the max width for a test name to output"}, {"--interactive-debug-mode [0|1]", "Set the interactive mode to 0 or 1."}, {"--no-label-summary", "Disable timing summary information for labels."}, diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 08765de..4300c7e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2583,6 +2583,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ADD_TEST_MACRO(CTestTestSerialOrder ${CMAKE_CTEST_COMMAND} --output-on-failure -C "\${CTestTest_CONFIG}") + add_test_macro(CTestTestRunUntilFail ${CMAKE_CTEST_COMMAND} + --repeat-until-fail 4 -C "\${CTestTest_CONFIG}") + set_tests_properties(CTestTestRunUntilFail PROPERTIES + PASS_REGULAR_EXPRESSION + "1/2.*Test #1:.* initialization.*Passed.*Test #2.*test1.*Failed" + ) + if(NOT BORLAND) set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process) add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4 diff --git a/Tests/CTestTestRunUntilFail/CMakeLists.txt b/Tests/CTestTestRunUntilFail/CMakeLists.txt new file mode 100644 index 0000000..62f4814 --- /dev/null +++ b/Tests/CTestTestRunUntilFail/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 2.8.12) +project(CTestTestRunUntilFail) +enable_testing() +set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") +add_test(NAME initialization + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/init.cmake") +add_test(NAME test1 + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/test1.cmake") +set_tests_properties(test1 PROPERTIES DEPENDS "initialization") diff --git a/Tests/CTestTestRunUntilFail/init.cmake b/Tests/CTestTestRunUntilFail/init.cmake new file mode 100644 index 0000000..560fb5e --- /dev/null +++ b/Tests/CTestTestRunUntilFail/init.cmake @@ -0,0 +1 @@ +file(WRITE "${TEST_OUTPUT_FILE}" "0") diff --git a/Tests/CTestTestRunUntilFail/test1.cmake b/Tests/CTestTestRunUntilFail/test1.cmake new file mode 100644 index 0000000..d7fafb8 --- /dev/null +++ b/Tests/CTestTestRunUntilFail/test1.cmake @@ -0,0 +1,8 @@ +message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}") +file(READ "${TEST_OUTPUT_FILE}" COUNT) +message("COUNT= ${COUNT}") +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}") +if(${COUNT} EQUAL 2) + message(FATAL_ERROR "this test fails on the 2nd run") +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057..ffda31f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -198,6 +198,7 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) +add_RunCMake_test(CTestCommandLine) set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt new file mode 100644 index 0000000..2843a51 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) +add_test(hello ${CMAKE_COMMAND} -E echo hello) +add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake new file mode 100644 index 0000000..7be07c1 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake_command(repeat-until-fail-bad1 ${CMAKE_CTEST_COMMAND} + --repeat-until-fail) +run_cmake_command(repeat-until-fail-bad2 ${CMAKE_CTEST_COMMAND} + --repeat-until-fail foo) +run_cmake_command(repeat-until-fail-good ${CMAKE_CTEST_COMMAND} + --repeat-until-fail 2) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt new file mode 100644 index 0000000..5ea8816 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-until-fail' requires an argument$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt new file mode 100644 index 0000000..a79faae --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-until-fail' given non-integer value 'foo'$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From domen.vrankar at gmail.com Tue Mar 17 12:41:24 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Tue, 17 Mar 2015 12:41:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1055-g8a82bf6 Message-ID: <20150317164124.527BBAB056@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8a82bf6a83fa1d9c3c53cc5373cc793366d6b954 (commit) via be089724e943da786c35fddceb8d9b0e7a9fb2f5 (commit) via ffc1b9451070d9da5860533da8c19c75583e5661 (commit) from 13af2b0fdf0695e57434a1280a3516639923d19c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a82bf6a83fa1d9c3c53cc5373cc793366d6b954 commit 8a82bf6a83fa1d9c3c53cc5373cc793366d6b954 Merge: 13af2b0 be08972 Author: Domen Vrankar AuthorDate: Tue Mar 17 12:41:23 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 12:41:23 2015 -0400 Merge topic 'cpack_rpm_component_fall_through' into next be089724 CPack/RPM prevent component attributes leakage ffc1b945 CPack/RPM improved component override test http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be089724e943da786c35fddceb8d9b0e7a9fb2f5 commit be089724e943da786c35fddceb8d9b0e7a9fb2f5 Author: Domen Vrankar AuthorDate: Mon Mar 16 22:17:17 2015 +0100 Commit: Domen Vrankar CommitDate: Tue Mar 17 17:36:36 2015 +0100 CPack/RPM prevent component attributes leakage Fixes mantis bug report with id 15169. Some component specific attributes were leaking to next component. Leakage handling was implemented in different locations but there were still attributes that leaked. Patch encapsulates generator into function so all current leaks are fixed and no future leaks can occur. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index fce8236..539a0aa 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -494,709 +494,687 @@ if(NOT UNIX) message(FATAL_ERROR "CPackRPM.cmake may only be used under UNIX.") endif() -# rpmbuild is the basic command for building RPM package -# it may be a simple (symbolic) link to rpm command. -find_program(RPMBUILD_EXECUTABLE rpmbuild) - -# Check version of the rpmbuild tool this would be easier to -# track bugs with users and CPackRPM debug mode. -# We may use RPM version in order to check for available version dependent features -if(RPMBUILD_EXECUTABLE) - execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version - OUTPUT_VARIABLE _TMP_VERSION - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "^.* " "" - RPMBUILD_EXECUTABLE_VERSION - ${_TMP_VERSION}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>") - endif() -endif() - -if(NOT RPMBUILD_EXECUTABLE) - message(FATAL_ERROR "RPM package requires rpmbuild executable") -endif() - -# Display lsb_release output if DEBUG mode enable -# This will help to diagnose problem with CPackRPM -# because we will know on which kind of Linux we are -if(CPACK_RPM_PACKAGE_DEBUG) - find_program(LSB_RELEASE_EXECUTABLE lsb_release) - if(LSB_RELEASE_EXECUTABLE) - execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -a - OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT +function(cpack_rpm_generate_package) + # rpmbuild is the basic command for building RPM package + # it may be a simple (symbolic) link to rpm command. + find_program(RPMBUILD_EXECUTABLE rpmbuild) + + # Check version of the rpmbuild tool this would be easier to + # track bugs with users and CPackRPM debug mode. + # We may use RPM version in order to check for available version dependent features + if(RPMBUILD_EXECUTABLE) + execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version + OUTPUT_VARIABLE _TMP_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "\n" ", " - LSB_RELEASE_OUTPUT - ${_TMP_LSB_RELEASE_OUTPUT}) - else () - set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!") + string(REGEX REPLACE "^.* " "" + RPMBUILD_EXECUTABLE_VERSION + ${_TMP_VERSION}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>") + endif() endif() - message("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}") -endif() - -# We may use RPM version in the future in order -# to shut down warning about space in buildtree -# some recent RPM version should support space in different places. -# not checked [yet]. -if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") - message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") -endif() - -# If rpmbuild is found -# we try to discover alien since we may be on non RPM distro like Debian. -# In this case we may try to to use more advanced features -# like generating RPM directly from DEB using alien. -# FIXME feature not finished (yet) -find_program(ALIEN_EXECUTABLE alien) -if(ALIEN_EXECUTABLE) - message(STATUS "alien found, we may be on a Debian based distro.") -endif() - -# Are we packaging components ? -if(CPACK_RPM_PACKAGE_COMPONENT) - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") - string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER) -else() - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") -endif() -set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") - -# -# Use user-defined RPM specific variables value -# or generate reasonable default value from -# CPACK_xxx generic values. -# The variables comes from the needed (mandatory or not) -# values found in the RPM specification file aka ".spec" file. -# The variables which may/should be defined are: -# + if(NOT RPMBUILD_EXECUTABLE) + message(FATAL_ERROR "RPM package requires rpmbuild executable") + endif() -# CPACK_RPM_PACKAGE_SUMMARY (mandatory) + # Display lsb_release output if DEBUG mode enable + # This will help to diagnose problem with CPackRPM + # because we will know on which kind of Linux we are + if(CPACK_RPM_PACKAGE_DEBUG) + find_program(LSB_RELEASE_EXECUTABLE lsb_release) + if(LSB_RELEASE_EXECUTABLE) + execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -a + OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX REPLACE "\n" ", " + LSB_RELEASE_OUTPUT + ${_TMP_LSB_RELEASE_OUTPUT}) + else () + set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!") + endif() + message("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}") + endif() -# CPACK_RPM_PACKAGE_SUMMARY_ is used only locally so that it can be unset each time before use otherwise -# component packaging could leak variable content between components -unset(CPACK_RPM_PACKAGE_SUMMARY_) -if(CPACK_RPM_PACKAGE_SUMMARY) - set(CPACK_RPM_PACKAGE_SUMMARY_ ${CPACK_RPM_PACKAGE_SUMMARY}) - unset(CPACK_RPM_PACKAGE_SUMMARY) -endif() + # We may use RPM version in the future in order + # to shut down warning about space in buildtree + # some recent RPM version should support space in different places. + # not checked [yet]. + if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") + message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") + endif() -#Check for component summary first. -#If not set, it will use regular package summary logic. -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY}) + # If rpmbuild is found + # we try to discover alien since we may be on non RPM distro like Debian. + # In this case we may try to to use more advanced features + # like generating RPM directly from DEB using alien. + # FIXME feature not finished (yet) + find_program(ALIEN_EXECUTABLE alien) + if(ALIEN_EXECUTABLE) + message(STATUS "alien found, we may be on a Debian based distro.") endif() -endif() -if(NOT CPACK_RPM_PACKAGE_SUMMARY) - if(CPACK_RPM_PACKAGE_SUMMARY_) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_PACKAGE_SUMMARY_}) - elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + # Are we packaging components ? + if(CPACK_RPM_PACKAGE_COMPONENT) + set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") + string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER) else() - # if neither var is defined lets use the name as summary - string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) + set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") endif() -endif() -# CPACK_RPM_PACKAGE_NAME (mandatory) -if(NOT CPACK_RPM_PACKAGE_NAME) - string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) -endif() + set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") + + # + # Use user-defined RPM specific variables value + # or generate reasonable default value from + # CPACK_xxx generic values. + # The variables comes from the needed (mandatory or not) + # values found in the RPM specification file aka ".spec" file. + # The variables which may/should be defined are: + # -# CPACK_RPM_PACKAGE_VERSION (mandatory) -if(NOT CPACK_RPM_PACKAGE_VERSION) - if(NOT CPACK_PACKAGE_VERSION) - message(FATAL_ERROR "RPM package requires a package version") + # CPACK_RPM_PACKAGE_SUMMARY (mandatory) + + #Check for component summary first. + #If not set, it will use regular package summary logic. + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY) + set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY}) + endif() endif() - set(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) -endif() -# Replace '-' in version with '_' -# '-' character is an Illegal RPM version character -# it is illegal because it is used to separate -# RPM "Version" from RPM "Release" -string(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}) - -# CPACK_RPM_PACKAGE_ARCHITECTURE (mandatory) -if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE) - execute_process(COMMAND uname "-m" - OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE - OUTPUT_STRIP_TRAILING_WHITESPACE) -else() - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") + + if(NOT CPACK_RPM_PACKAGE_SUMMARY) + if(CPACK_PACKAGE_DESCRIPTION_SUMMARY) + set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + else() + # if neither var is defined lets use the name as summary + string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) + endif() endif() -endif() -set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_PACKAGE_ARCHITECTURE}) + # CPACK_RPM_PACKAGE_NAME (mandatory) + if(NOT CPACK_RPM_PACKAGE_NAME) + string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) + endif() -#prefer component architecture -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE) - set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE}) + # CPACK_RPM_PACKAGE_VERSION (mandatory) + if(NOT CPACK_RPM_PACKAGE_VERSION) + if(NOT CPACK_PACKAGE_VERSION) + message(FATAL_ERROR "RPM package requires a package version") + endif() + set(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) + endif() + # Replace '-' in version with '_' + # '-' character is an Illegal RPM version character + # it is illegal because it is used to separate + # RPM "Version" from RPM "Release" + string(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}) + + # CPACK_RPM_PACKAGE_ARCHITECTURE (mandatory) + if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE) + execute_process(COMMAND uname "-m" + OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using component build arch = ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") + message("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") endif() endif() -endif() -if(${_CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch") - set(TMP_RPM_BUILDARCH "Buildarch: ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") -else() - set(TMP_RPM_BUILDARCH "") -endif() - -# CPACK_RPM_PACKAGE_RELEASE -# The RPM release is the numbering of the RPM package ITSELF -# this is the version of the PACKAGING and NOT the version -# of the CONTENT of the package. -# You may well need to generate a new RPM package release -# without changing the version of the packaged software. -# This is the case when the packaging is buggy (not) the software :=) -# If not set, 1 is a good candidate -if(NOT CPACK_RPM_PACKAGE_RELEASE) - set(CPACK_RPM_PACKAGE_RELEASE 1) -endif() -# CPACK_RPM_PACKAGE_LICENSE -if(NOT CPACK_RPM_PACKAGE_LICENSE) - set(CPACK_RPM_PACKAGE_LICENSE "unknown") -endif() + set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_PACKAGE_ARCHITECTURE}) -# CPACK_RPM_PACKAGE_GROUP -if(NOT CPACK_RPM_PACKAGE_GROUP) - set(CPACK_RPM_PACKAGE_GROUP "unknown") -endif() - -# CPACK_RPM_PACKAGE_VENDOR -if(NOT CPACK_RPM_PACKAGE_VENDOR) - if(CPACK_PACKAGE_VENDOR) - set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}") + #prefer component architecture + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE) + set(_CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using component build arch = ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") + endif() + endif() + endif() + if(${_CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch") + set(TMP_RPM_BUILDARCH "Buildarch: ${_CPACK_RPM_PACKAGE_ARCHITECTURE}") else() - set(CPACK_RPM_PACKAGE_VENDOR "unknown") + set(TMP_RPM_BUILDARCH "") endif() -endif() - -# CPACK_RPM_PACKAGE_SOURCE -# The name of the source tarball in case we generate a source RPM -# CPACK_RPM_PACKAGE_DESCRIPTION -# The variable content may be either -# - explicitly given by the user or -# - filled with the content of CPACK_PACKAGE_DESCRIPTION_FILE -# if it is defined -# - set to a default value -# + # CPACK_RPM_PACKAGE_RELEASE + # The RPM release is the numbering of the RPM package ITSELF + # this is the version of the PACKAGING and NOT the version + # of the CONTENT of the package. + # You may well need to generate a new RPM package release + # without changing the version of the packaged software. + # This is the case when the packaging is buggy (not) the software :=) + # If not set, 1 is a good candidate + if(NOT CPACK_RPM_PACKAGE_RELEASE) + set(CPACK_RPM_PACKAGE_RELEASE 1) + endif() -# CPACK_RPM_PACKAGE_DESCRIPTION_ is used only locally so that it can be unset each time before use otherwise -# component packaging could leak variable content between components -unset(CPACK_RPM_PACKAGE_DESCRIPTION_) -if(CPACK_RPM_PACKAGE_DESCRIPTION) - set(CPACK_RPM_PACKAGE_DESCRIPTION_ ${CPACK_RPM_PACKAGE_DESCRIPTION}) - unset(CPACK_RPM_PACKAGE_DESCRIPTION) -endif() + # CPACK_RPM_PACKAGE_LICENSE + if(NOT CPACK_RPM_PACKAGE_LICENSE) + set(CPACK_RPM_PACKAGE_LICENSE "unknown") + endif() -#Check for a component description first. -#If not set, it will use regular package description logic. -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION}) - elseif(CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION}) + # CPACK_RPM_PACKAGE_GROUP + if(NOT CPACK_RPM_PACKAGE_GROUP) + set(CPACK_RPM_PACKAGE_GROUP "unknown") endif() -endif() -if(NOT CPACK_RPM_PACKAGE_DESCRIPTION) - if(CPACK_RPM_PACKAGE_DESCRIPTION_) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_PACKAGE_DESCRIPTION_}) - elseif(CPACK_PACKAGE_DESCRIPTION_FILE) - file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION) - else () - set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available") - endif () -endif () + # CPACK_RPM_PACKAGE_VENDOR + if(NOT CPACK_RPM_PACKAGE_VENDOR) + if(CPACK_PACKAGE_VENDOR) + set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}") + else() + set(CPACK_RPM_PACKAGE_VENDOR "unknown") + endif() + endif() -# CPACK_RPM_COMPRESSION_TYPE -# -if (CPACK_RPM_COMPRESSION_TYPE) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio") - endif() -else() - set(CPACK_RPM_COMPRESSION_TYPE_TMP "") -endif() + # CPACK_RPM_PACKAGE_SOURCE + # The name of the source tarball in case we generate a source RPM + + # CPACK_RPM_PACKAGE_DESCRIPTION + # The variable content may be either + # - explicitly given by the user or + # - filled with the content of CPACK_PACKAGE_DESCRIPTION_FILE + # if it is defined + # - set to a default value + # + + #Check for a component description first. + #If not set, it will use regular package description logic. + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION) + set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION}) + elseif(CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION) + set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION}) + endif() + endif() -if(CPACK_PACKAGE_RELOCATABLE) - set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) -endif() -if(CPACK_RPM_PACKAGE_RELOCATABLE) - unset(TMP_RPM_PREFIXES) + if(NOT CPACK_RPM_PACKAGE_DESCRIPTION) + if(CPACK_PACKAGE_DESCRIPTION_FILE) + file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION) + else () + set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available") + endif () + endif () - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Trying to build a relocatable package") - endif() - if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) - message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") + # CPACK_RPM_COMPRESSION_TYPE + # + if (CPACK_RPM_COMPRESSION_TYPE) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio") + endif() + if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") + set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio") + endif() else() - set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files) - cpack_rpm_prepare_relocation_paths() + set(CPACK_RPM_COMPRESSION_TYPE_TMP "") endif() -endif() -# Check if additional fields for RPM spec header are given -# There may be some COMPONENT specific variables as well -# If component specific var is not provided we use the global one -# for each component -foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) + if(CPACK_PACKAGE_RELOCATABLE) + set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) + endif() + if(CPACK_RPM_PACKAGE_RELOCATABLE) if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") + message("CPackRPM:Debug: Trying to build a relocatable package") endif() - if(CPACK_RPM_PACKAGE_COMPONENT) - if(DEFINED CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}") - endif() - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}}) - else() - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) + message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") + else() + set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files) + cpack_rpm_prepare_relocation_paths() + endif() + endif() + + # Check if additional fields for RPM spec header are given + # There may be some COMPONENT specific variables as well + # If component specific var is not provided we use the global one + # for each component + foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") + endif() + if(CPACK_RPM_PACKAGE_COMPONENT) + if(DEFINED CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}) if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined") - message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") + message("CPackRPM:Debug: using CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}") endif() - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}}) + else() + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER} not defined") + message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") + endif() + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) + endif() + endif() + else() + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") endif() - endif() - else() - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") + set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) endif() - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) - endif() - endif() + endif() - # Do not forget to unset previously set header (from previous component) - unset(TMP_RPM_${_RPM_SPEC_HEADER}) - # Treat the RPM Spec keyword iff it has been properly defined - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) - # Transform NAME --> Name e.g. PROVIDES --> Provides - # The Upper-case first letter and lowercase tail is the - # appropriate value required in the final RPM spec file. - string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL) - string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) - string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) - set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") - # The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file. - set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) - list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND) - if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1) - string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}") - set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})") + # Treat the RPM Spec keyword iff it has been properly defined + if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) + # Transform NAME --> Name e.g. PROVIDES --> Provides + # The Upper-case first letter and lowercase tail is the + # appropriate value required in the final RPM spec file. + string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL) + string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) + string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) + set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") + # The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file. + set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) + list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND) + if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1) + string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}") + set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})") + endif() + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") + endif() + set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") + unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) endif() + endforeach() + + # CPACK_RPM_SPEC_INSTALL_POST + # May be used to define a RPM post intallation script + # for example setting it to "/bin/true" may prevent + # rpmbuild from stripping binaries. + if(CPACK_RPM_SPEC_INSTALL_POST) if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") + message("CPackRPM:Debug: User defined CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}") endif() - set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") - unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) + set(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}") endif() -endforeach() - -# CPACK_RPM_SPEC_INSTALL_POST -# May be used to define a RPM post intallation script -# for example setting it to "/bin/true" may prevent -# rpmbuild from stripping binaries. -if(CPACK_RPM_SPEC_INSTALL_POST) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User defined CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}") - endif() - set(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}") -endif() -# CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM__POST_INSTALL_SCRIPT_FILE) -# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__POST_UNINSTALL_SCRIPT_FILE) -# May be used to embed a post (un)installation script in the spec file. -# The refered script file(s) will be read and directly -# put after the %post or %postun section -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE) - set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE}) + # CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM__POST_INSTALL_SCRIPT_FILE) + # CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__POST_UNINSTALL_SCRIPT_FILE) + # May be used to embed a post (un)installation script in the spec file. + # The refered script file(s) will be read and directly + # put after the %post or %postun section + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE) + set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_INSTALL_SCRIPT_FILE}) + else() + set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) + endif() + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE) + set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE}) + else() + set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) + endif() else() set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) - endif() - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE) - set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_POST_UNINSTALL_SCRIPT_FILE}) - else() set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) endif() -else() - set(CPACK_RPM_POST_INSTALL_READ_FILE ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) - set(CPACK_RPM_POST_UNINSTALL_READ_FILE ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) -endif() -# Handle post-install file if it has been specified -if(CPACK_RPM_POST_INSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) - file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL) + # Handle post-install file if it has been specified + if(CPACK_RPM_POST_INSTALL_READ_FILE) + if(EXISTS ${CPACK_RPM_POST_INSTALL_READ_FILE}) + file(READ ${CPACK_RPM_POST_INSTALL_READ_FILE} CPACK_RPM_SPEC_POSTINSTALL) + else() + message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring") + endif() else() - message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_READ_FILE}> does not exists - ignoring") + # reset SPEC var value if no post install file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_POSTINSTALL "") endif() -else() - # reset SPEC var value if no post install file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_POSTINSTALL "") -endif() -# Handle post-uninstall file if it has been specified -if(CPACK_RPM_POST_UNINSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) - file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL) + # Handle post-uninstall file if it has been specified + if(CPACK_RPM_POST_UNINSTALL_READ_FILE) + if(EXISTS ${CPACK_RPM_POST_UNINSTALL_READ_FILE}) + file(READ ${CPACK_RPM_POST_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_POSTUNINSTALL) + else() + message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring") + endif() else() - message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_READ_FILE}> does not exists - ignoring") + # reset SPEC var value if no post uninstall file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_POSTUNINSTALL "") endif() -else() - # reset SPEC var value if no post uninstall file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_POSTUNINSTALL "") -endif() -# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_INSTALL_SCRIPT_FILE) -# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_UNINSTALL_SCRIPT_FILE) -# May be used to embed a pre (un)installation script in the spec file. -# The refered script file(s) will be read and directly -# put after the %pre or %preun section -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE) - set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE}) + # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_INSTALL_SCRIPT_FILE) + # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM__PRE_UNINSTALL_SCRIPT_FILE) + # May be used to embed a pre (un)installation script in the spec file. + # The refered script file(s) will be read and directly + # put after the %pre or %preun section + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE) + set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_INSTALL_SCRIPT_FILE}) + else() + set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) + endif() + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE) + set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE}) + else() + set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) + endif() else() set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) - endif() - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE) - set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PRE_UNINSTALL_SCRIPT_FILE}) - else() set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) endif() -else() - set(CPACK_RPM_PRE_INSTALL_READ_FILE ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) - set(CPACK_RPM_PRE_UNINSTALL_READ_FILE ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) -endif() -# Handle pre-install file if it has been specified -if(CPACK_RPM_PRE_INSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) - file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL) + # Handle pre-install file if it has been specified + if(CPACK_RPM_PRE_INSTALL_READ_FILE) + if(EXISTS ${CPACK_RPM_PRE_INSTALL_READ_FILE}) + file(READ ${CPACK_RPM_PRE_INSTALL_READ_FILE} CPACK_RPM_SPEC_PREINSTALL) + else() + message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring") + endif() else() - message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_READ_FILE}> does not exists - ignoring") + # reset SPEC var value if no pre-install file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_PREINSTALL "") endif() -else() - # reset SPEC var value if no pre-install file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_PREINSTALL "") -endif() -# Handle pre-uninstall file if it has been specified -if(CPACK_RPM_PRE_UNINSTALL_READ_FILE) - if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) - file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL) + # Handle pre-uninstall file if it has been specified + if(CPACK_RPM_PRE_UNINSTALL_READ_FILE) + if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_READ_FILE}) + file(READ ${CPACK_RPM_PRE_UNINSTALL_READ_FILE} CPACK_RPM_SPEC_PREUNINSTALL) + else() + message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring") + endif() else() - message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_READ_FILE}> does not exists - ignoring") + # reset SPEC var value if no pre-uninstall file has been specified + # (either globally or component-wise) + set(CPACK_RPM_SPEC_PREUNINSTALL "") endif() -else() - # reset SPEC var value if no pre-uninstall file has been specified - # (either globally or component-wise) - set(CPACK_RPM_SPEC_PREUNINSTALL "") -endif() -# CPACK_RPM_CHANGELOG_FILE -# May be used to embed a changelog in the spec file. -# The refered file will be read and directly put after the %changelog section -if(CPACK_RPM_CHANGELOG_FILE) - if(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) - file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG) + # CPACK_RPM_CHANGELOG_FILE + # May be used to embed a changelog in the spec file. + # The refered file will be read and directly put after the %changelog section + if(CPACK_RPM_CHANGELOG_FILE) + if(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) + file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG) + else() + message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring") + endif() else() - message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring") + set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Eric Noulard - ${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n Generated by CPack RPM (no Changelog file were provided)") endif() -else() - set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Eric Noulard - ${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n Generated by CPack RPM (no Changelog file were provided)") -endif() -# CPACK_RPM_SPEC_MORE_DEFINE -# This is a generated spec rpm file spaceholder -if(CPACK_RPM_SPEC_MORE_DEFINE) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}") + # CPACK_RPM_SPEC_MORE_DEFINE + # This is a generated spec rpm file spaceholder + if(CPACK_RPM_SPEC_MORE_DEFINE) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}") + endif() endif() -endif() -# Now we may create the RPM build tree structure -set(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") -message(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") -# Prepare RPM build tree -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) -file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) - -#set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${_CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") -set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") -# it seems rpmbuild can't handle spaces in the path -# neither escaping (as below) nor putting quotes around the path seem to help -#string(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") -set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") - -# if we are creating a relocatable package, omit parent directories of -# CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" -# which is passed to the find command that generates the content-list -if(CPACK_RPM_PACKAGE_RELOCATABLE) - # get a list of the elements in CPACK_RPM_PACKAGE_PREFIXES that are - # destinct parent paths of other relocation paths and remove the - # final element (so the install-prefix dir itself is not omitted - # from the RPM's content-list) - list(SORT RPM_USED_PACKAGE_PREFIXES) - set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) - if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") - set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") - - string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${_RPM_RELOCATION_PREFIX}") - list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) - unset(_TMP_LIST) - # Now generate all of the parent dirs of the relocation path - foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) - list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}") - string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") - list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND) - if(_DUPLICATE_FOUND EQUAL -1) - set(_OMIT_DIR "-o -path ${_OMIT_DIR}") - separate_arguments(_OMIT_DIR) - list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) - endif() - endforeach() - endif() - endforeach() -endif() + # Now we may create the RPM build tree structure + set(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") + message(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") + # Prepare RPM build tree + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) + file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) + + #set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${_CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") + set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") + # it seems rpmbuild can't handle spaces in the path + # neither escaping (as below) nor putting quotes around the path seem to help + #string(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") + set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") + + # if we are creating a relocatable package, omit parent directories of + # CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" + # which is passed to the find command that generates the content-list + if(CPACK_RPM_PACKAGE_RELOCATABLE) + # get a list of the elements in CPACK_RPM_PACKAGE_PREFIXES that are + # destinct parent paths of other relocation paths and remove the + # final element (so the install-prefix dir itself is not omitted + # from the RPM's content-list) + list(SORT RPM_USED_PACKAGE_PREFIXES) + set(_DISTINCT_PATH "NOT_SET") + foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) + if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") + set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") + + string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS ".${_RPM_RELOCATION_PREFIX}") + list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) + unset(_TMP_LIST) + # Now generate all of the parent dirs of the relocation path + foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) + list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}") + string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") + list(FIND _RPM_DIRS_TO_OMIT "${_OMIT_DIR}" _DUPLICATE_FOUND) + if(_DUPLICATE_FOUND EQUAL -1) + set(_OMIT_DIR "-o -path ${_OMIT_DIR}") + separate_arguments(_OMIT_DIR) + list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) + endif() + endforeach() + endif() + endforeach() + endif() -if (CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") -endif() + if (CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") + endif() -if (NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) - set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include) - if (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) - message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.") - list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}") + if (NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include) + if (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) + message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.") + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}") + endif() endif() -endif() -if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) + if (CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}") + endif() + foreach(_DIR ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) + list(APPEND _RPM_DIRS_TO_OMIT "-o;-path;.${_DIR}") + endforeach() + endif() if (CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}") - endif() - foreach(_DIR ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) - list(APPEND _RPM_DIRS_TO_OMIT "-o;-path;.${_DIR}") - endforeach() -endif() -if (CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") -endif() + message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") + endif() -# Use files tree to construct files command (spec file) -# We should not forget to include symlinks (thus -o -type l) -# We should include directory as well (thus -type d) -# but not the main local dir "." (thus -a -not -name ".") -# We must remove the './' due to the local search and escape the -# file name by enclosing it between double quotes (thus the sed) -# Then we must authorize any man pages extension (adding * at the end) -# because rpmbuild may automatically compress those files -execute_process(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) ) - COMMAND sed s:.*/man.*/.*:&*: - COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/ - WORKING_DIRECTORY "${WDIR}" - OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) - -# In component case, put CPACK_ABSOLUTE_DESTINATION_FILES_ -# into CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL -# otherwise, put CPACK_ABSOLUTE_DESTINATION_FILES -# This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL handling -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_ABSOLUTE_DESTINATION_FILES) - set(COMPONENT_FILES_TAG "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}") - set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}") - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>") - message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") - endif() + # Use files tree to construct files command (spec file) + # We should not forget to include symlinks (thus -o -type l) + # We should include directory as well (thus -type d) + # but not the main local dir "." (thus -a -not -name ".") + # We must remove the './' due to the local search and escape the + # file name by enclosing it between double quotes (thus the sed) + # Then we must authorize any man pages extension (adding * at the end) + # because rpmbuild may automatically compress those files + execute_process(COMMAND find . -type f -o -type l -o (-type d -a -not ( -name "." ${_RPM_DIRS_TO_OMIT} ) ) + COMMAND sed s:.*/man.*/.*:&*: + COMMAND sed s/\\.\\\(.*\\\)/\"\\1\"/ + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) + + # In component case, put CPACK_ABSOLUTE_DESTINATION_FILES_ + # into CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL + # otherwise, put CPACK_ABSOLUTE_DESTINATION_FILES + # This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL handling + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_ABSOLUTE_DESTINATION_FILES) + set(COMPONENT_FILES_TAG "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}") + set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}") + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>") + message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") + endif() + endif() + else() + if(CPACK_ABSOLUTE_DESTINATION_FILES) + set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${CPACK_ABSOLUTE_DESTINATION_FILES}") + endif() endif() -else() - if(CPACK_ABSOLUTE_DESTINATION_FILES) - set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${CPACK_ABSOLUTE_DESTINATION_FILES}") + + # In component case, set CPACK_RPM_USER_FILELIST_INTERNAL with CPACK_RPM__USER_FILELIST. + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST) + set(CPACK_RPM_USER_FILELIST_INTERNAL ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") + message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") + endif() + else() + set(CPACK_RPM_USER_FILELIST_INTERNAL "") + endif() + else() + if(CPACK_RPM_USER_FILELIST) + set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}") + else() + set(CPACK_RPM_USER_FILELIST_INTERNAL "") + endif() endif() -endif() -# In component case, set CPACK_RPM_USER_FILELIST_INTERNAL with CPACK_RPM__USER_FILELIST. -if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST) - set(CPACK_RPM_USER_FILELIST_INTERNAL ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST}) + # Handle user specified file line list in CPACK_RPM_USER_FILELIST_INTERNAL + # Remove those files from CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL + # or CPACK_RPM_INSTALL_FILES, + # hence it must be done before these auto-generated lists are processed. + if(CPACK_RPM_USER_FILELIST_INTERNAL) if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") - message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") endif() + + # Create CMake list from CPACK_RPM_INSTALL_FILES + string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) + string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST + "${CPACK_RPM_INSTALL_FILES_LIST}") + string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST + "${CPACK_RPM_INSTALL_FILES_LIST}") + + set(CPACK_RPM_USER_INSTALL_FILES "") + foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL) + string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F}) + string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F}) + + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") + endif() + if(F_PREFIX) + set(F_PREFIX "${F_PREFIX} ") + endif() + # Rebuild the user list file + set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n") + + # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL + list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH}) + # ABSOLUTE destination files list may not exists at all + if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) + endif() + + endforeach() + + # Rebuild CPACK_RPM_INSTALL_FILES + set(CPACK_RPM_INSTALL_FILES "") + foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + endforeach() else() - set(CPACK_RPM_USER_FILELIST_INTERNAL "") + set(CPACK_RPM_USER_INSTALL_FILES "") endif() -else() - if(CPACK_RPM_USER_FILELIST) - set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}") + + if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}") + endif() + # Remove trailing space + string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) + # Transform endline separated - string into CMake List + string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") + # Remove unecessary quotes + string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") + # Remove ABSOLUTE install file from INSTALL FILE LIST + list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}) + # Rebuild INSTALL_FILES + set(CPACK_RPM_INSTALL_FILES "") + foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + endforeach() + # Build ABSOLUTE_INSTALL_FILES + set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") + foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n") + endforeach() + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}") + message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}") + endif() else() - set(CPACK_RPM_USER_FILELIST_INTERNAL "") + # reset vars in order to avoid leakage of value(s) from one component to another + set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") endif() -endif() -# Handle user specified file line list in CPACK_RPM_USER_FILELIST_INTERNAL -# Remove those files from CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL -# or CPACK_RPM_INSTALL_FILES, -# hence it must be done before these auto-generated lists are processed. -if(CPACK_RPM_USER_FILELIST_INTERNAL) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") - endif() - # Create CMake list from CPACK_RPM_INSTALL_FILES + # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir + # This is necessary to avoid duplicate files since rpmbuild do + # recursion on its own when encountering a pathname which is a directory + # which is not flagged as %dir string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") - - set(CPACK_RPM_USER_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL) - string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F}) - string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F}) - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") - endif() - if(F_PREFIX) - set(F_PREFIX "${F_PREFIX} ") - endif() - # Rebuild the user list file - set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n") - - # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL - list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH}) - # ABSOLUTE destination files list may not exists at all - if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) - endif() - - endforeach() - - # Rebuild CPACK_RPM_INSTALL_FILES set(CPACK_RPM_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + if(IS_DIRECTORY "${WDIR}/${F}") + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n") + else() + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + endif() endforeach() -else() - set(CPACK_RPM_USER_INSTALL_FILES "") -endif() + set(CPACK_RPM_INSTALL_FILES_LIST "") -if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}") - endif() - # Remove trailing space - string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) - # Transform endline separated - string into CMake List - string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") - # Remove unecessary quotes - string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") - # Remove ABSOLUTE install file from INSTALL FILE LIST - list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}) - # Rebuild INSTALL_FILES - set(CPACK_RPM_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") - endforeach() - # Build ABSOLUTE_INSTALL_FILES - set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") - foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n") - endforeach() - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}") - message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}") - endif() -else() - # reset vars in order to avoid leakage of value(s) from one component to another - set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") -endif() + # The name of the final spec file to be used by rpmbuild + set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") -# Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir -# This is necessary to avoid duplicate files since rpmbuild do -# recursion on its own when encountering a pathname which is a directory -# which is not flagged as %dir -string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) -string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") -string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") -set(CPACK_RPM_INSTALL_FILES "") -foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - if(IS_DIRECTORY "${WDIR}/${F}") - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n") - else() - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + # Print out some debug information if we were asked for that + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") + message("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") + message("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") + message("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") + message("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") + message("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") + message("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") + message("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") + message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") endif() -endforeach() -set(CPACK_RPM_INSTALL_FILES_LIST "") - -# The name of the final spec file to be used by rpmbuild -set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") - -# Print out some debug information if we were asked for that -if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") - message("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") - message("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") - message("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") - message("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") - message("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") - message("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") - message("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") - message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") -endif() -# -# USER generated/provided spec file handling. -# + # + # USER generated/provided spec file handling. + # -# We can have a component specific spec file. -if(CPACK_RPM_PACKAGE_COMPONENT AND CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE) - set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE}) -endif() + # We can have a component specific spec file. + if(CPACK_RPM_PACKAGE_COMPONENT AND CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE) + set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE}) + endif() -# We should generate a USER spec file template: -# - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE -# - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE -if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) - file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in + # We should generate a USER spec file template: + # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE + # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE + if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) + file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# -*- rpm-spec -*- BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ @@ -1271,63 +1249,54 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %changelog \@CPACK_RPM_SPEC_CHANGELOG\@ ") - # Stop here if we were asked to only generate a template USER spec file - # The generated file may then be used as a template by user who wants - # to customize their own spec file. - if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) - message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in") + # Stop here if we were asked to only generate a template USER spec file + # The generated file may then be used as a template by user who wants + # to customize their own spec file. + if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) + message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in") + endif() endif() -endif() - -# After that we may either use a user provided spec file -# or generate one using appropriate variables value. -if(CPACK_RPM_USER_BINARY_SPECFILE) - # User may have specified SPECFILE just use it - message("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") - # The user provided file is processed for @var replacement - configure_file(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) -else() - # No User specified spec file, will use the generated spec file - message("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") - # Note the just created file is processed for @var replacement - configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) -endif() -if(RPMBUILD_EXECUTABLE) - # Now call rpmbuild using the SPECFILE - execute_process( - COMMAND "${RPMBUILD_EXECUTABLE}" -bb - --define "_topdir ${CPACK_RPM_DIRECTORY}" - --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" - --target "${_CPACK_RPM_PACKAGE_ARCHITECTURE}" - "${CPACK_RPM_BINARY_SPECFILE}" - WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" - RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT - ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" - OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") - if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT) - message("CPackRPM:Debug: You may consult rpmbuild logs in: ") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") - message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") - message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + # After that we may either use a user provided spec file + # or generate one using appropriate variables value. + if(CPACK_RPM_USER_BINARY_SPECFILE) + # User may have specified SPECFILE just use it + message("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") + # The user provided file is processed for @var replacement + configure_file(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) + else() + # No User specified spec file, will use the generated spec file + message("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") + # Note the just created file is processed for @var replacement + configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) endif() -else() - if(ALIEN_EXECUTABLE) - message(FATAL_ERROR "RPM packaging through alien not done (yet)") + + if(RPMBUILD_EXECUTABLE) + # Now call rpmbuild using the SPECFILE + execute_process( + COMMAND "${RPMBUILD_EXECUTABLE}" -bb + --define "_topdir ${CPACK_RPM_DIRECTORY}" + --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" + --target "${_CPACK_RPM_PACKAGE_ARCHITECTURE}" + "${CPACK_RPM_BINARY_SPECFILE}" + WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" + RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT + ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" + OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT) + message("CPackRPM:Debug: You may consult rpmbuild logs in: ") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") + message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + endif() + else() + if(ALIEN_EXECUTABLE) + message(FATAL_ERROR "RPM packaging through alien not done (yet)") + endif() endif() -endif() +endfunction() -# reset variables from temporary variables -if(CPACK_RPM_PACKAGE_SUMMARY_) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_PACKAGE_SUMMARY_}) -else() - unset(CPACK_RPM_PACKAGE_SUMMARY) -endif() -if(CPACK_RPM_PACKAGE_DESCRIPTION_) - set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_PACKAGE_DESCRIPTION_}) -else() - unset(CPACK_RPM_PACKAGE_DESCRIPTION) -endif() +cpack_rpm_generate_package() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ffc1b9451070d9da5860533da8c19c75583e5661 commit ffc1b9451070d9da5860533da8c19c75583e5661 Author: Domen Vrankar AuthorDate: Mon Mar 16 22:10:18 2015 +0100 Commit: Domen Vrankar CommitDate: Tue Mar 17 17:36:36 2015 +0100 CPack/RPM improved component override test Component specific attributes test passed even when attribute was able to leak to the next component as library package is the last that is generated. This patch fixes the test as header package is generated in the middle so leakage causes the test to fail. diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index e4780d3..109bb1c 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -22,12 +22,12 @@ if(CPACK_GENERATOR MATCHES "RPM") # test cross-built rpm set(CPACK_RPM_applications_PACKAGE_ARCHITECTURE "armv7hf") - # test package summary override + # test package summary override - headers rpm is generated in the middle set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary") - # test package description override - set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") + # test package description override - headers rpm is generated in the middle + set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 9261d11..6762b45 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -132,12 +132,12 @@ if(CPackGen MATCHES "RPM") endif() set(CPACK_RPM_PACKAGE_SUMMARY "default summary") - set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") - set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") + set(CPACK_RPM_headers_PACKAGE_SUMMARY "headers summary") + set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "An extremely useful application that makes use of MyLib") - set(CPACK_COMPONENT_HEADERS_DESCRIPTION - "C/C\\+\\+ header files for use with MyLib") + set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION + "Static libraries used to build programs with MyLib") # test package info if(${CPackComponentWay} STREQUAL "IgnoreGroup") @@ -172,15 +172,15 @@ if(CPackGen MATCHES "RPM") set(whitespaces "[\\t\\n\\r ]*") if(check_file_libraries_match) - set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") - set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") + set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") elseif(check_file_headers_match) - set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") - set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") + set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") set(check_file_match_expected_architecture "noarch") set(spec_regex "*headers*") ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 1273 ++++++++++---------- .../MyLibCPackConfig-IgnoreGroup.cmake.in | 8 +- .../RunCPackVerifyResult.cmake | 16 +- 3 files changed, 633 insertions(+), 664 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 14:10:33 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 14:10:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1057-g2753adc Message-ID: <20150317181033.DC867AAE81@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2753adca6f98c66733498996b2072073823114bf (commit) via f9d09626899a8196a2f46992585ddff21fd2de34 (commit) from 8a82bf6a83fa1d9c3c53cc5373cc793366d6b954 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2753adca6f98c66733498996b2072073823114bf commit 2753adca6f98c66733498996b2072073823114bf Merge: 8a82bf6 f9d0962 Author: Brad King AuthorDate: Tue Mar 17 14:10:33 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 14:10:33 2015 -0400 Merge topic 'WCDH-fix-cxx_nullptr-workaround' into next f9d09626 WCDH: Fix cxx_nullptr workaround for pre-C++11 compilers http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9d09626899a8196a2f46992585ddff21fd2de34 commit f9d09626899a8196a2f46992585ddff21fd2de34 Author: Roman W?ger AuthorDate: Fri Mar 13 09:18:19 2015 +0100 Commit: Brad King CommitDate: Tue Mar 17 13:46:43 2015 -0400 WCDH: Fix cxx_nullptr workaround for pre-C++11 compilers Use just '0' instead of 'static_cast(0)' because the latter will not automatically convert to pointers to other types. diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index d18f47c..f4dcb21 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -586,7 +586,7 @@ function(write_compiler_detection_header # if ${def_name} # define ${def_value} nullptr # else -# define ${def_value} static_cast(0) +# define ${def_value} 0 # endif \n") endif() ----------------------------------------------------------------------- Summary of changes: Modules/WriteCompilerDetectionHeader.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 14:33:03 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 14:33:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1060-g86144dc Message-ID: <20150317183303.9238FAC7C3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 86144dcd9106990de5c5329f9c8be60d7f329c89 (commit) via 6794079523de41837b43e23128643e6b2c3e9ae7 (commit) via ded79a976e2b63bbfd7a63f27ec00bd071410e27 (commit) from 2753adca6f98c66733498996b2072073823114bf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=86144dcd9106990de5c5329f9c8be60d7f329c89 commit 86144dcd9106990de5c5329f9c8be60d7f329c89 Merge: 2753adc 6794079 Author: Brad King AuthorDate: Tue Mar 17 14:33:02 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 14:33:02 2015 -0400 Merge topic 'update-kwiml' into next 67940795 Merge branch 'upstream-kwiml' into update-kwiml ded79a97 KWIML: Teach ABI.h about Xtensa architecture http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6794079523de41837b43e23128643e6b2c3e9ae7 commit 6794079523de41837b43e23128643e6b2c3e9ae7 Merge: a5cab2e ded79a9 Author: Brad King AuthorDate: Tue Mar 17 14:27:27 2015 -0400 Commit: Brad King CommitDate: Tue Mar 17 14:27:27 2015 -0400 Merge branch 'upstream-kwiml' into update-kwiml http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ded79a976e2b63bbfd7a63f27ec00bd071410e27 commit ded79a976e2b63bbfd7a63f27ec00bd071410e27 Author: Max Filippov AuthorDate: Tue Mar 17 15:51:04 2015 +0300 Commit: Brad King CommitDate: Tue Mar 17 14:26:20 2015 -0400 KWIML: Teach ABI.h about Xtensa architecture Signed-off-by: Max Filippov diff --git a/ABI.h.in b/ABI.h.in index 21c9139..6300ada 100644 --- a/ABI.h.in +++ b/ABI.h.in @@ -432,6 +432,12 @@ suppression macro @KWIML at _ABI_NO_VERIFY was defined. # define @KWIML at _ABI_ENDIAN_ID @KWIML at _ABI_ENDIAN_ID_BIG # endif +/* Xtensa */ +#elif defined(__XTENSA_EB__) +# define @KWIML at _ABI_ENDIAN_ID @KWIML at _ABI_ENDIAN_ID_BIG +#elif defined(__XTENSA_EL__) +# define @KWIML at _ABI_ENDIAN_ID @KWIML at _ABI_ENDIAN_ID_LITTLE + /* Unknown CPU */ #elif !defined(@KWIML at _ABI_NO_ERROR_ENDIAN) # error "Byte order of target CPU unknown." ----------------------------------------------------------------------- Summary of changes: Utilities/KWIML/ABI.h.in | 6 ++++++ 1 file changed, 6 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 17 14:36:06 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 17 Mar 2015 14:36:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1062-gca6f066 Message-ID: <20150317183606.507B6AC8A1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ca6f06607b0b93781483eaf77c071c1584d32867 (commit) via f94727a9c2d2a48ecca2297675a7762cdfae460f (commit) from 86144dcd9106990de5c5329f9c8be60d7f329c89 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ca6f06607b0b93781483eaf77c071c1584d32867 commit ca6f06607b0b93781483eaf77c071c1584d32867 Merge: 86144dc f94727a Author: Brad King AuthorDate: Tue Mar 17 14:36:05 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 14:36:05 2015 -0400 Merge topic 'mingw-compile-features' into next f94727a9 Record compile features for GNU on Windows (#15443) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f94727a9c2d2a48ecca2297675a7762cdfae460f commit f94727a9c2d2a48ecca2297675a7762cdfae460f Author: Brad King AuthorDate: Tue Mar 17 13:31:44 2015 -0400 Commit: Brad King CommitDate: Tue Mar 17 13:32:08 2015 -0400 Record compile features for GNU on Windows (#15443) Drop the 'UNIX' condition on GNU compiler features. Suggested-by: David Demelier diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 86a31e4..2dc02f0 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -44,10 +44,10 @@ macro(cmake_record_cxx_compile_features) endmacro() set(_result 0) - if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) _get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) endif() - if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) if (_result EQUAL 0) _get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) endif() ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/GNU-CXX.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From bill.hoffman at kitware.com Tue Mar 17 14:38:06 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Tue, 17 Mar 2015 14:38:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1065-g4dbd32d Message-ID: <20150317183806.F0DB9AC965@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4dbd32d02224616177686afd8733a4ad03d0c298 (commit) via 45063cf754673b88dfac19d1017382eedebe50dc (commit) via 0d7f16649d8eedf2c0ff0c3ae33c11d4fb00b2c6 (commit) from ca6f06607b0b93781483eaf77c071c1584d32867 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4dbd32d02224616177686afd8733a4ad03d0c298 commit 4dbd32d02224616177686afd8733a4ad03d0c298 Merge: ca6f066 45063cf Author: Bill Hoffman AuthorDate: Tue Mar 17 14:38:05 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 14:38:05 2015 -0400 Merge topic 'ctest-repeat-until-fail' into next 45063cf7 Remove standalone CTest run until fail test. 0d7f1664 Add testing for repeat until fail command line option to ctest. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45063cf754673b88dfac19d1017382eedebe50dc commit 45063cf754673b88dfac19d1017382eedebe50dc Author: Bill Hoffman AuthorDate: Tue Mar 17 14:36:43 2015 -0400 Commit: Bill Hoffman CommitDate: Tue Mar 17 14:36:43 2015 -0400 Remove standalone CTest run until fail test. The test has been moved to the RunCMake style test. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4300c7e..08765de 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2583,13 +2583,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ADD_TEST_MACRO(CTestTestSerialOrder ${CMAKE_CTEST_COMMAND} --output-on-failure -C "\${CTestTest_CONFIG}") - add_test_macro(CTestTestRunUntilFail ${CMAKE_CTEST_COMMAND} - --repeat-until-fail 4 -C "\${CTestTest_CONFIG}") - set_tests_properties(CTestTestRunUntilFail PROPERTIES - PASS_REGULAR_EXPRESSION - "1/2.*Test #1:.* initialization.*Passed.*Test #2.*test1.*Failed" - ) - if(NOT BORLAND) set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process) add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4 diff --git a/Tests/CTestTestRunUntilFail/CMakeLists.txt b/Tests/CTestTestRunUntilFail/CMakeLists.txt deleted file mode 100644 index 62f4814..0000000 --- a/Tests/CTestTestRunUntilFail/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(CTestTestRunUntilFail) -enable_testing() -set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") -add_test(NAME initialization - COMMAND ${CMAKE_COMMAND} - "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" - -P "${CMAKE_CURRENT_SOURCE_DIR}/init.cmake") -add_test(NAME test1 - COMMAND ${CMAKE_COMMAND} - "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" - -P "${CMAKE_CURRENT_SOURCE_DIR}/test1.cmake") -set_tests_properties(test1 PROPERTIES DEPENDS "initialization") diff --git a/Tests/CTestTestRunUntilFail/init.cmake b/Tests/CTestTestRunUntilFail/init.cmake deleted file mode 100644 index 560fb5e..0000000 --- a/Tests/CTestTestRunUntilFail/init.cmake +++ /dev/null @@ -1 +0,0 @@ -file(WRITE "${TEST_OUTPUT_FILE}" "0") diff --git a/Tests/CTestTestRunUntilFail/test1.cmake b/Tests/CTestTestRunUntilFail/test1.cmake deleted file mode 100644 index d7fafb8..0000000 --- a/Tests/CTestTestRunUntilFail/test1.cmake +++ /dev/null @@ -1,8 +0,0 @@ -message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}") -file(READ "${TEST_OUTPUT_FILE}" COUNT) -message("COUNT= ${COUNT}") -math(EXPR COUNT "${COUNT} + 1") -file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}") -if(${COUNT} EQUAL 2) - message(FATAL_ERROR "this test fails on the 2nd run") -endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d7f16649d8eedf2c0ff0c3ae33c11d4fb00b2c6 commit 0d7f16649d8eedf2c0ff0c3ae33c11d4fb00b2c6 Author: Bill Hoffman AuthorDate: Tue Mar 17 13:51:12 2015 -0400 Commit: Bill Hoffman CommitDate: Tue Mar 17 14:04:54 2015 -0400 Add testing for repeat until fail command line option to ctest. This adds more complete testing. It checks that the output is as expected when ctest is run on a project with several tests including one that fails on the second run only. diff --git a/Tests/RunCMake/CTestCommandLine/Build.cmake b/Tests/RunCMake/CTestCommandLine/Build.cmake new file mode 100644 index 0000000..4654416 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/Build.cmake @@ -0,0 +1,15 @@ +enable_testing() + +set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") +add_test(NAME initialization + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/init.cmake") +add_test(NAME test1 + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/test1.cmake") +set_tests_properties(test1 PROPERTIES DEPENDS "initialization") + +add_test(hello ${CMAKE_COMMAND} -E echo hello) +add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt index 2843a51..2897109 100644 --- a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt +++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt @@ -1,5 +1,3 @@ cmake_minimum_required(VERSION 3.0) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) -add_test(hello ${CMAKE_COMMAND} -E echo hello) -add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 7be07c1..916c7bc 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -6,3 +6,14 @@ run_cmake_command(repeat-until-fail-bad2 ${CMAKE_CTEST_COMMAND} --repeat-until-fail foo) run_cmake_command(repeat-until-fail-good ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2) +# Use a single build tree for a few tests without cleaning. +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build) +set(RunCMake_TEST_NO_CLEAN 1) +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + +set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1) +run_cmake(Build) +unset(RunCMake_TEST_OPTIONS) +run_cmake_command(repeat-until-fail-tests ${CMAKE_CTEST_COMMAND} + --repeat-until-fail 3 ) diff --git a/Tests/RunCMake/CTestCommandLine/init.cmake b/Tests/RunCMake/CTestCommandLine/init.cmake new file mode 100644 index 0000000..13466e1 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/init.cmake @@ -0,0 +1,3 @@ +# This is run by test initialization in Build.cmake with cmake -P +# It creates TEST_OUTPUT_FILE with a 0 in it +file(WRITE "${TEST_OUTPUT_FILE}" "0") diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stdout.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stdout.txt new file mode 100644 index 0000000..2bfb4e5 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stdout.txt @@ -0,0 +1,30 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/Build-build + Start 1: initialization + Test #1: initialization ................... Passed [0-9.]+ sec + Start 1: initialization + Test #1: initialization ................... Passed [0-9.]+ sec + Start 1: initialization +1/4 Test #1: initialization ................... Passed [0-9.]+ sec + Start 2: test1 + Test #2: test1 ............................ Passed [0-9.]+ sec + Start 2: test1 + Test #2: test1 ............................\*\*\*Failed [0-9.]+ sec + Start 3: hello + Test #3: hello ............................ Passed [0-9.]+ sec + Start 3: hello + Test #3: hello ............................ Passed [0-9.]+ sec + Start 3: hello +3/4 Test #3: hello ............................ Passed [0-9.]+ sec + Start 4: goodbye + Test #4: goodbye .......................... Passed [0-9.]+ sec + Start 4: goodbye + Test #4: goodbye .......................... Passed [0-9.]+ sec + Start 4: goodbye +4/4 Test #4: goodbye .......................... Passed [0-9.]+ sec ++ +75% tests passed, 1 tests failed out of 4 ++ +Total Test time \(real\) = [0-9.]+ sec ++ +The following tests FAILED: +[ ]+2 - test1 \(Failed\)$ diff --git a/Tests/RunCMake/CTestCommandLine/test1.cmake b/Tests/RunCMake/CTestCommandLine/test1.cmake new file mode 100644 index 0000000..d7e4538 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test1.cmake @@ -0,0 +1,13 @@ +# This is run by test test1 in Build.cmake with cmake -P +# It reads the file TEST_OUTPUT_FILE and increments the number +# found in the file by 1. When the number is 2, then the +# code sends out a cmake error causing the test to fail +# the second time it is run. +message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}") +file(READ "${TEST_OUTPUT_FILE}" COUNT) +message("COUNT= ${COUNT}") +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}") +if(${COUNT} EQUAL 2) + message(FATAL_ERROR "this test fails on the 2nd run") +endif() ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 7 ----- Tests/CTestTestRunUntilFail/init.cmake | 1 - .../CTestCommandLine/Build.cmake} | 6 ++-- Tests/RunCMake/CTestCommandLine/CMakeLists.txt | 2 -- Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 11 +++++++ Tests/RunCMake/CTestCommandLine/init.cmake | 3 ++ .../repeat-until-fail-tests-result.txt | 1 + .../repeat-until-fail-tests-stderr.txt | 1 + .../repeat-until-fail-tests-stdout.txt | 30 ++++++++++++++++++++ .../CTestCommandLine}/test1.cmake | 5 ++++ 10 files changed, 55 insertions(+), 12 deletions(-) delete mode 100644 Tests/CTestTestRunUntilFail/init.cmake rename Tests/{CTestTestRunUntilFail/CMakeLists.txt => RunCMake/CTestCommandLine/Build.cmake} (81%) create mode 100644 Tests/RunCMake/CTestCommandLine/init.cmake create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-result.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stdout.txt rename Tests/{CTestTestRunUntilFail => RunCMake/CTestCommandLine}/test1.cmake (51%) hooks/post-receive -- CMake From bill.hoffman at kitware.com Tue Mar 17 17:05:44 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Tue, 17 Mar 2015 17:05:44 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1067-g285a9ac Message-ID: <20150317210544.8E171AC1C6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 285a9ac82799578706c1ae80dafa33c8eb2c8619 (commit) via c482c4a4406028e02b90dd2e40f5291a364aa2bb (commit) from 4dbd32d02224616177686afd8733a4ad03d0c298 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=285a9ac82799578706c1ae80dafa33c8eb2c8619 commit 285a9ac82799578706c1ae80dafa33c8eb2c8619 Merge: 4dbd32d c482c4a Author: Bill Hoffman AuthorDate: Tue Mar 17 17:05:43 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 17:05:43 2015 -0400 Merge topic 'ctest-repeat-until-fail' into next c482c4a4 Pass down the ctest config option to RunCMake tests. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c482c4a4406028e02b90dd2e40f5291a364aa2bb commit c482c4a4406028e02b90dd2e40f5291a364aa2bb Author: Bill Hoffman AuthorDate: Tue Mar 17 17:04:46 2015 -0400 Commit: Bill Hoffman CommitDate: Tue Mar 17 17:04:46 2015 -0400 Pass down the ctest config option to RunCMake tests. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index ffda31f..9cd2e9a 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -20,6 +20,7 @@ macro(add_RunCMake_test test) -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} + -DRunCMake_CTestTest_CONFIG=${CTestTest_CONFIG} ${${test}_ARGS} ${TEST_ARGS} -P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake" diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 916c7bc..7176e2a 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -16,4 +16,5 @@ set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1) run_cmake(Build) unset(RunCMake_TEST_OPTIONS) run_cmake_command(repeat-until-fail-tests ${CMAKE_CTEST_COMMAND} + -C ${RunCMake_CTestTest_CONFIG} --repeat-until-fail 3 ) ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 1 + 2 files changed, 2 insertions(+) hooks/post-receive -- CMake From domen.vrankar at gmail.com Tue Mar 17 18:35:28 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Tue, 17 Mar 2015 18:35:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1069-g3eb856c Message-ID: <20150317223528.BDFDFAC43F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3eb856c1332775686b6003ba2c05c033dbd7ac47 (commit) via 16aa38f15b98089da59f7cd4cd83aeb1ac6214a2 (commit) from 285a9ac82799578706c1ae80dafa33c8eb2c8619 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3eb856c1332775686b6003ba2c05c033dbd7ac47 commit 3eb856c1332775686b6003ba2c05c033dbd7ac47 Merge: 285a9ac 16aa38f Author: Domen Vrankar AuthorDate: Tue Mar 17 18:35:27 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 17 18:35:27 2015 -0400 Merge topic 'glob_recurse_handle_cyclic_recursion' into next 16aa38f1 file GLOB list directories handling http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16aa38f15b98089da59f7cd4cd83aeb1ac6214a2 commit 16aa38f15b98089da59f7cd4cd83aeb1ac6214a2 Author: Domen Vrankar AuthorDate: Tue Mar 17 23:34:03 2015 +0100 Commit: Domen Vrankar CommitDate: Tue Mar 17 23:34:03 2015 +0100 file GLOB list directories handling GLOB lists directories by default and GLOB_RECURSE does not. LIST_DIRECTORIES enables user to control the behavior explicitly for consistently for both GLOB and GLOB_RECURSE. diff --git a/Help/command/file.rst b/Help/command/file.rst index 73d4cfa..bcecb64 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -92,8 +92,8 @@ store it in a ````. :: - file(GLOB [RELATIVE ] [...]) - file(GLOB_RECURSE [RELATIVE ] + file(GLOB [LIST_DIRECTORIES true|false] [RELATIVE ] [...]) + file(GLOB_RECURSE [LIST_DIRECTORIES true|false] [RELATIVE ] [FOLLOW_SYMLINKS] [...]) Generate a list of files that match the ```` and @@ -102,6 +102,9 @@ regular expressions, but much simpler. If ``RELATIVE`` flag is specified, the results will be returned as relative paths to the given path. +By default ``GLOB`` lists directories - directories are omited in result if +``LIST_DIRECTORIES`` is set to false. + .. note:: We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is @@ -119,6 +122,11 @@ matched directory and match the files. Subdirectories that are symlinks are only traversed if ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to ``NEW``. +By default ``GLOB_RECURSE`` omits directories from result list - setting +``LIST_DIRECTORIES`` to true adds directories to result list. +If ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to +``OLD`` then ``LIST_DIRECTORIES`` treats symlinks as directories. + Examples of recursive globbing include:: /dir/*.py - match all python files in /dir and subdirectories diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index ec22ea0..ae9099e 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -920,6 +920,35 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, bool first = true; for ( ; i != args.end(); ++i ) { + if( *i == "LIST_DIRECTORIES" ) + { + ++i; + if(i != args.end()) + { + if(cmSystemTools::IsOn(i->c_str())) + { + g.SetListDirs(true); + g.SetRecurseListDirs(true); + } + else if(cmSystemTools::IsOff(i->c_str())) + { + g.SetListDirs(false); + g.SetRecurseListDirs(false); + } + else + { + this->SetError("LIST_DIRECTORIES missing bool value."); + return false; + } + } + else + { + this->SetError("LIST_DIRECTORIES missing bool value."); + return false; + } + ++i; + } + if ( recurse && (*i == "FOLLOW_SYMLINKS") ) { explicitFollowSymlinks = true; @@ -950,6 +979,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, } } + cmsys::Glob::GlobMessages globMessages; if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) { std::string expr = this->Makefile->GetCurrentDirectory(); @@ -957,16 +987,42 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, if (!expr.empty()) { expr += "/" + *i; - g.FindFiles(expr); + g.FindFiles(expr, &globMessages); } else { - g.FindFiles(*i); + g.FindFiles(*i, &globMessages); } } else { - g.FindFiles(*i); + g.FindFiles(*i, &globMessages); + } + + if(!globMessages.empty()) + { + bool shouldExit = false; + for(cmsys::Glob::GlobMessagesIterator it=globMessages.begin(); + it != globMessages.end(); ++it) + { + if(it->type == cmsys::Glob::cyclicRecursion) + { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + "Cyclic recursion detected while globbing for '" + + *i + "':\n" + it->content); + } + else + { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "Error has occured while globbing for '" + + *i + "' - " + it->content); + shouldExit = true; + } + } + if(shouldExit) + { + return false; + } } std::vector::size_type cc; diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt new file mode 100644 index 0000000..9629cfd --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt @@ -0,0 +1 @@ +.*file LIST_DIRECTORIES missing bool value\. diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake new file mode 100644 index 0000000..a8e15f2 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST LIST_DIRECTORIES) diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt new file mode 100644 index 0000000..9629cfd --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt @@ -0,0 +1 @@ +.*file LIST_DIRECTORIES missing bool value\. diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake new file mode 100644 index 0000000..f735433 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST LIST_DIRECTORIES 13) diff --git a/Tests/RunCMake/file/GLOB-stderr.txt b/Tests/RunCMake/file/GLOB-stderr.txt new file mode 100644 index 0000000..41be050 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-stderr.txt @@ -0,0 +1,6 @@ +content: 6. +.*/test/dir 1/non_empty_dir;.*/test/dir 1/empty_dir;.*/test/dir 1/dir 1 file;.*/test/dir 2/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir +content: 6. +.*/test/dir 1/non_empty_dir;.*/test/dir 1/empty_dir;.*/test/dir 1/dir 1 file;.*/test/dir 2/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir +content: 2. +.*/test/dir 1/dir 1 file;.*/test/dir 2/dir 2 file diff --git a/Tests/RunCMake/file/GLOB.cmake b/Tests/RunCMake/file/GLOB.cmake new file mode 100644 index 0000000..c524e42 --- /dev/null +++ b/Tests/RunCMake/file/GLOB.cmake @@ -0,0 +1,25 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/dir 1 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir/dir 1 subdir file" "test file") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/dir 2 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir file" "test file") + +file(GLOB CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt new file mode 100644 index 0000000..d73c74f --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt @@ -0,0 +1,15 @@ +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 4. +.*/test/abc;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/file_symlink +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 4. +.*/test/abc;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/file_symlink +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 11. +.*/test/abc;.*/test/depth1;.*/test/depth1/depth2;.*/test/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/recursion;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1;.*/test/depth1/depth2/depth3/recursion/depth1/depth2;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/file_symlink diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake new file mode 100644 index 0000000..fb8be42 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake @@ -0,0 +1,20 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3") +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/recursion") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "message to write") +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/file_symlink") + +file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt new file mode 100644 index 0000000..dac7db6 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt @@ -0,0 +1,6 @@ +content: 4. +.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 1/dir 1 file;/home/domen/Dev/build/cmake/Tests/RunCMake/file/GLOB_RECURSE-build/test/dir 2/non_empty_dir/dir 2 subdir file;/home/domen/Dev/build/cmake/Tests/RunCMake/file/GLOB_RECURSE-build/test/dir 2/dir 2 file +content: 4. +.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 1/dir 1 file;/home/domen/Dev/build/cmake/Tests/RunCMake/file/GLOB_RECURSE-build/test/dir 2/non_empty_dir/dir 2 subdir file;/home/domen/Dev/build/cmake/Tests/RunCMake/file/GLOB_RECURSE-build/test/dir 2/dir 2 file +content: 8. +.*/test/dir 1/non_empty_dir;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 1/empty_dir;.*/test/dir 1/dir 1 file;.*/test/dir 2/non_empty_dir;.*/test/dir 2/non_empty_dir/dir 2 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir diff --git a/Tests/RunCMake/file/GLOB_RECURSE.cmake b/Tests/RunCMake/file/GLOB_RECURSE.cmake new file mode 100644 index 0000000..530930f --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE.cmake @@ -0,0 +1,25 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/dir 1 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir/dir 1 subdir file" "test file") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/dir 2 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir file" "test file") + +file(GLOB_RECURSE CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 14819e7..d3dfb1b 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -17,3 +17,13 @@ run_cmake(LOCK-error-no-result-variable) run_cmake(LOCK-error-no-timeout) run_cmake(LOCK-error-timeout) run_cmake(LOCK-error-unknown-option) +run_cmake(GLOB) +run_cmake(GLOB_RECURSE) +# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) +# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg) + +if(NOT WIN32 OR CYGWIN) + run_cmake(GLOB_RECURSE-cyclic-recursion) +endif() ----------------------------------------------------------------------- Summary of changes: Help/command/file.rst | 12 +++- Source/cmFileCommand.cxx | 62 +++++++++++++++++++- .../GLOB-error-LIST_DIRECTORIES-no-arg-result.txt} | 0 .../GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt | 1 + .../file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake | 1 + ...-error-LIST_DIRECTORIES-not-boolean-result.txt} | 0 ...B-error-LIST_DIRECTORIES-not-boolean-stderr.txt | 1 + .../GLOB-error-LIST_DIRECTORIES-not-boolean.cmake | 1 + Tests/RunCMake/file/GLOB-stderr.txt | 6 ++ Tests/RunCMake/file/GLOB.cmake | 25 ++++++++ .../file/GLOB_RECURSE-cyclic-recursion-stderr.txt | 15 +++++ .../file/GLOB_RECURSE-cyclic-recursion.cmake | 20 +++++++ Tests/RunCMake/file/GLOB_RECURSE-stderr.txt | 6 ++ Tests/RunCMake/file/GLOB_RECURSE.cmake | 25 ++++++++ Tests/RunCMake/file/RunCMakeTest.cmake | 10 ++++ 15 files changed, 180 insertions(+), 5 deletions(-) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt} (100%) create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt} (100%) create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake create mode 100644 Tests/RunCMake/file/GLOB-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB.cmake create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB_RECURSE.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 18 00:01:06 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 18 Mar 2015 00:01:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-440-g380db3d Message-ID: <20150318040106.42913ABF9B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 380db3de00bd74f01781ea93e9ba9cebdea000cc (commit) from a5cab2e7391df8d2072f1083c075a69bc746c7aa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=380db3de00bd74f01781ea93e9ba9cebdea000cc commit 380db3de00bd74f01781ea93e9ba9cebdea000cc Author: Kitware Robot AuthorDate: Wed Mar 18 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Wed Mar 18 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 35ae8b9..0d92bcf 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150317) +set(CMake_VERSION_PATCH 20150318) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 18 08:59:56 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 18 Mar 2015 08:59:56 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1072-g915508c Message-ID: <20150318125956.B2F6CAC9E4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 915508ce92ea902def48ba166021e9ca4fb228bf (commit) via 0e8325db66c3be268321aa7b274fbcd9109174b3 (commit) via bc67dbede991be9238e8a102bfb026054b48d83d (commit) from 3eb856c1332775686b6003ba2c05c033dbd7ac47 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=915508ce92ea902def48ba166021e9ca4fb228bf commit 915508ce92ea902def48ba166021e9ca4fb228bf Merge: 3eb856c 0e8325d Author: Brad King AuthorDate: Wed Mar 18 08:59:55 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 18 08:59:55 2015 -0400 Merge topic 'update-kwsys' into next 0e8325db Merge branch 'upstream-kwsys' into update-kwsys bc67dbed KWSys 2015-03-18 (9367a33b) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e8325db66c3be268321aa7b274fbcd9109174b3 commit 0e8325db66c3be268321aa7b274fbcd9109174b3 Merge: a5cab2e bc67dbe Author: Brad King AuthorDate: Wed Mar 18 08:58:11 2015 -0400 Commit: Brad King CommitDate: Wed Mar 18 08:58:11 2015 -0400 Merge branch 'upstream-kwsys' into update-kwsys http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bc67dbede991be9238e8a102bfb026054b48d83d commit bc67dbede991be9238e8a102bfb026054b48d83d Author: KWSys Robot AuthorDate: Wed Mar 18 08:55:32 2015 -0400 Commit: Brad King CommitDate: Wed Mar 18 08:58:08 2015 -0400 KWSys 2015-03-18 (9367a33b) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 9367a33b | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 4a698414..9367a33b Brad King (1): 20f50727 SystemInformation: Add missing 'break' in StacktraceSignalHandler Sean McBride (2): 093eae34 SystemInformation: Fix -Wswitch-enum warnings 9367a33b testHashSTL: Fix warnings by marking private functions static Change-Id: Ia4ba110c901698f08797412da5773abf4c4c5330 diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 9c7ceee..b0434f4 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -1234,6 +1234,7 @@ void StacktraceSignalHandler( case ILL_ILLTRP: oss << "illegal trap"; + break; case ILL_PRVOPC: oss << "privileged opcode"; @@ -1823,6 +1824,7 @@ const char * SystemInformationImplementation::GetVendorID() return "Motorola"; case HP: return "Hewlett-Packard"; + case UnknownManufacturer: default: return "Unknown Manufacturer"; } @@ -3064,6 +3066,12 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case NSC: this->ChipID.ProcessorName = "Cx486SLC \\ DLC \\ Cx486S A-Step"; break; + + case Sun: + case IBM: + case Motorola: + case HP: + case UnknownManufacturer: default: this->ChipID.ProcessorName = "Unknown family"; // We cannot identify the processor. return false; diff --git a/testHashSTL.cxx b/testHashSTL.cxx index b861a5b..ac5cf74 100644 --- a/testHashSTL.cxx +++ b/testHashSTL.cxx @@ -34,7 +34,7 @@ template class kwsys::hash_map; template class kwsys::hash_set; -bool test_hash_map() +static bool test_hash_map() { typedef kwsys::hash_map mtype; mtype m; @@ -51,7 +51,7 @@ bool test_hash_map() return sum == 3; } -bool test_hash_set() +static bool test_hash_set() { typedef kwsys::hash_set stype; stype s; ----------------------------------------------------------------------- Summary of changes: Source/kwsys/SystemInformation.cxx | 8 ++++++++ Source/kwsys/testHashSTL.cxx | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From gjasny at googlemail.com Wed Mar 18 10:18:17 2015 From: gjasny at googlemail.com (Gregor Jasny) Date: Wed, 18 Mar 2015 10:18:17 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1074-ge8d6f02 Message-ID: <20150318141817.9A911AC07D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e8d6f02cf4aa532f9a67d143c3f09d4f3f085119 (commit) via 394514135ee0c970f1f28770db8642515fd31891 (commit) from 915508ce92ea902def48ba166021e9ca4fb228bf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e8d6f02cf4aa532f9a67d143c3f09d4f3f085119 commit e8d6f02cf4aa532f9a67d143c3f09d4f3f085119 Merge: 915508c 3945141 Author: Gregor Jasny AuthorDate: Wed Mar 18 10:18:16 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 18 10:18:16 2015 -0400 Merge topic 'fix-FindPackageHandleStandardArgs-doc' into next 39451413 FPHSA: Revise documented command signature http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=394514135ee0c970f1f28770db8642515fd31891 commit 394514135ee0c970f1f28770db8642515fd31891 Author: Gregor Jasny AuthorDate: Sat Mar 14 22:10:04 2015 +0100 Commit: Gregor Jasny CommitDate: Wed Mar 18 15:15:44 2015 +0100 FPHSA: Revise documented command signature For mode 2 the first argument is not the literal NAME but the package name. Signed-off-by: Gregor Jasny diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 2de1fb3..bcbd17d 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -33,7 +33,7 @@ # # :: # -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME +# FIND_PACKAGE_HANDLE_STANDARD_ARGS( # [FOUND_VAR ] # [REQUIRED_VARS ...] # [VERSION_VAR ] ----------------------------------------------------------------------- Summary of changes: Modules/FindPackageHandleStandardArgs.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 18 10:49:58 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 18 Mar 2015 10:49:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1081-gef88ba3 Message-ID: <20150318144958.68B29AC8F8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ef88ba3fe1f16d8663109eb77b1931a3fedba443 (commit) via 3e99af4494665fae90e08cf383eda8a5722e17cd (commit) via ce5ecc52eb22a4745d46efebd00efbccf2b3507e (commit) via 36fefe29966b33505d9d4abbc4df7c41ea103e40 (commit) via 7b9453f8d22753bcd47204cdc5021de351d3d2f8 (commit) via 54a5cdbb4c35aa8847d3eb0f7f418fad72563992 (commit) via 380db3de00bd74f01781ea93e9ba9cebdea000cc (commit) from e8d6f02cf4aa532f9a67d143c3f09d4f3f085119 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ef88ba3fe1f16d8663109eb77b1931a3fedba443 commit ef88ba3fe1f16d8663109eb77b1931a3fedba443 Merge: e8d6f02 3e99af4 Author: Brad King AuthorDate: Wed Mar 18 10:49:55 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 18 10:49:55 2015 -0400 Merge topic 'xcode-xctest' into next 3e99af44 Help: Add notes for topic 'xcode-xctest' ce5ecc52 Tests: Add XCTest example to test Frameworks and Cocoa App Bundles 36fefe29 OS X: Add FindXCTest module 7b9453f8 OS X: Add handling for XCTest bundles 54a5cdbb Tests: Compute Xcode version for any generator on OS X 380db3de CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e99af4494665fae90e08cf383eda8a5722e17cd commit 3e99af4494665fae90e08cf383eda8a5722e17cd Author: Brad King AuthorDate: Fri Feb 27 09:09:25 2015 -0500 Commit: Gregor Jasny CommitDate: Wed Mar 18 15:36:07 2015 +0100 Help: Add notes for topic 'xcode-xctest' diff --git a/Help/release/dev/xcode-xctest.rst b/Help/release/dev/xcode-xctest.rst new file mode 100644 index 0000000..7a2f07b --- /dev/null +++ b/Help/release/dev/xcode-xctest.rst @@ -0,0 +1,6 @@ +xcode-xctest +------------ + +* On OS X, CMake learned to create XCTest bundles to test Frameworks + and App Bundles within Xcode. The :module:`FindXCTest` module + provides convenience functions to handle :prop_tgt:`XCTEST` bundles. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce5ecc52eb22a4745d46efebd00efbccf2b3507e commit ce5ecc52eb22a4745d46efebd00efbccf2b3507e Author: Gregor Jasny AuthorDate: Thu Feb 26 21:55:46 2015 +0100 Commit: Gregor Jasny CommitDate: Wed Mar 18 15:36:06 2015 +0100 Tests: Add XCTest example to test Frameworks and Cocoa App Bundles Signed-off-by: Gregor Jasny diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 765fc80..71cdb0f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1505,6 +1505,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5) + ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $ -V) + endif() + add_test(linkorder1 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/LinkLineOrder" diff --git a/Tests/XCTest/CMakeLists.txt b/Tests/XCTest/CMakeLists.txt new file mode 100644 index 0000000..e866623 --- /dev/null +++ b/Tests/XCTest/CMakeLists.txt @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 3.1) +project(XCTest) +enable_testing() + +find_package(XCTest REQUIRED) + +# Framework + +add_library(FrameworkExample SHARED + FrameworkExample/FrameworkExample.c + FrameworkExample/FrameworkExample.h + FrameworkExample/Info.plist) + +target_include_directories(FrameworkExample PUBLIC .) + +set_target_properties(FrameworkExample PROPERTIES + FRAMEWORK TRUE + VERSION "1.0.0" + SOVERSION "1.0.0" + FRAMEWORK_VERSION "A" + MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/FrameworkExample/Info.plist + PUBLIC_HEADER FrameworkExample/FrameworkExample.h) + +# XCTest for Framework + +xctest_add_bundle(FrameworkExampleTests FrameworkExample + FrameworkExampleTests/FrameworkExampleTests.m + FrameworkExampleTests/Info.plist) + +set_target_properties(FrameworkExampleTests PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/FrameworkExampleTests/Info.plist + ) + +xctest_add_test(XCTest.FrameworkExample FrameworkExampleTests) + +# Cocoa App Bundle + +add_executable(CocoaExample MACOSX_BUNDLE + CocoaExample/main.m + CocoaExample/AppDelegate.m + CocoaExample/AppDelegate.h + CocoaExample/MainMenu.xib +) + +target_link_libraries(CocoaExample PRIVATE "-framework Foundation") +target_link_libraries(CocoaExample PRIVATE "-framework AppKit") + +set_target_properties(CocoaExample PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/CocoaExample/Info.plist + RESOURCE "CocoaExample/MainMenu.xib") + +# XCTest for Cocoa App Bundle + +xctest_add_bundle(CocoaExampleTests CocoaExample + CocoaExampleTests/CocoaExampleTests.m) + +xctest_add_test(XCTest.CocoaExample CocoaExampleTests) diff --git a/Tests/XCTest/CocoaExample/AppDelegate.h b/Tests/XCTest/CocoaExample/AppDelegate.h new file mode 100644 index 0000000..4bf4101 --- /dev/null +++ b/Tests/XCTest/CocoaExample/AppDelegate.h @@ -0,0 +1,6 @@ +#import + + at interface AppDelegate : NSObject + + + at end diff --git a/Tests/XCTest/CocoaExample/AppDelegate.m b/Tests/XCTest/CocoaExample/AppDelegate.m new file mode 100644 index 0000000..07af62f --- /dev/null +++ b/Tests/XCTest/CocoaExample/AppDelegate.m @@ -0,0 +1,18 @@ +#import "AppDelegate.h" + + at interface AppDelegate () + + at property (assign) IBOutlet NSWindow *window; + at end + + at implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +} + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + + at end diff --git a/Tests/XCTest/CocoaExample/Info.plist b/Tests/XCTest/CocoaExample/Info.plist new file mode 100644 index 0000000..5267c63 --- /dev/null +++ b/Tests/XCTest/CocoaExample/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + CocoaExample + CFBundleIconFile + + CFBundleIdentifier + org.cmake.CocoaExample + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + CocoaExample + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/Tests/XCTest/CocoaExample/MainMenu.xib b/Tests/XCTest/CocoaExample/MainMenu.xib new file mode 100644 index 0000000..9498a0a --- /dev/null +++ b/Tests/XCTest/CocoaExample/MainMenu.xib @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/XCTest/CocoaExample/main.m b/Tests/XCTest/CocoaExample/main.m new file mode 100644 index 0000000..8a6799b --- /dev/null +++ b/Tests/XCTest/CocoaExample/main.m @@ -0,0 +1,5 @@ +#import + +int main(int argc, const char * argv[]) { + return NSApplicationMain(argc, argv); +} diff --git a/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m b/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m new file mode 100644 index 0000000..70d61d6 --- /dev/null +++ b/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m @@ -0,0 +1,13 @@ +#import + + at interface CocoaExampleTests : XCTestCase + + at end + + at implementation CocoaExampleTests + +- (void)testExample { + XCTAssert(YES, @"Pass"); +} + + at end diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.c b/Tests/XCTest/FrameworkExample/FrameworkExample.c new file mode 100644 index 0000000..2da78da --- /dev/null +++ b/Tests/XCTest/FrameworkExample/FrameworkExample.c @@ -0,0 +1,6 @@ +#include "FrameworkExample.h" + +int FourtyTwo() +{ + return 42; +} diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.h b/Tests/XCTest/FrameworkExample/FrameworkExample.h new file mode 100644 index 0000000..2e0b499 --- /dev/null +++ b/Tests/XCTest/FrameworkExample/FrameworkExample.h @@ -0,0 +1 @@ +int FourtyTwo(); diff --git a/Tests/XCTest/FrameworkExample/Info.plist b/Tests/XCTest/FrameworkExample/Info.plist new file mode 100644 index 0000000..a22acea --- /dev/null +++ b/Tests/XCTest/FrameworkExample/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + FrameworkExample + CFBundleIdentifier + org.cmake.FrameworkExample + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FrameworkExample + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + + NSHumanReadableCopyright + + NSPrincipalClass + + + diff --git a/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m b/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m new file mode 100644 index 0000000..7cba23e --- /dev/null +++ b/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m @@ -0,0 +1,16 @@ +#import + +#import "FrameworkExample/FrameworkExample.h" + + at interface FrameworkExampleTests : XCTestCase + + at end + + at implementation FrameworkExampleTests + +- (void)testFourtyTwo { + // This is an example of a functional test case. + XCTAssertEqual(42, FourtyTwo()); +} + + at end diff --git a/Tests/XCTest/FrameworkExampleTests/Info.plist b/Tests/XCTest/FrameworkExampleTests/Info.plist new file mode 100644 index 0000000..293921b --- /dev/null +++ b/Tests/XCTest/FrameworkExampleTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + FrameworkExampleTests + CFBundleIdentifier + org.cmake.FrameworkExampleTests + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FrameworkExampleTests + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36fefe29966b33505d9d4abbc4df7c41ea103e40 commit 36fefe29966b33505d9d4abbc4df7c41ea103e40 Author: Gregor Jasny AuthorDate: Thu Feb 26 21:55:45 2015 +0100 Commit: Gregor Jasny CommitDate: Wed Mar 18 15:36:06 2015 +0100 OS X: Add FindXCTest module Add a module to lookup XCTest Framework and xctest utility. It also provides APIs for creating 'xctest' targets. Signed-off-by: Gregor Jasny diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 2b26cc9..c9219d5 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -212,6 +212,7 @@ All Modules /module/FindWish /module/FindwxWidgets /module/FindwxWindows + /module/FindXCTest /module/FindXercesC /module/FindX11 /module/FindXMLRPC diff --git a/Help/module/FindXCTest.rst b/Help/module/FindXCTest.rst new file mode 100644 index 0000000..ff6273c --- /dev/null +++ b/Help/module/FindXCTest.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindXCTest.cmake diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake new file mode 100644 index 0000000..2a341ce --- /dev/null +++ b/Modules/FindXCTest.cmake @@ -0,0 +1,196 @@ +#[=======================================================================[.rst: +FindXCTest +---------- + +Functions to help creating and executing XCTest bundles. + +An XCTest bundle is a CFBundle with a special product-type +and bundle extension. For more information about XCTest visit +the Mac Developer library at: +http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ + +Module Functions +^^^^^^^^^^^^^^^^ + +.. command:: xctest_add_bundle + + The ``xctest_add_bundle`` function creates a XCTest bundle named + which will test the target . Supported target types + for testee are Frameworks and App Bundles:: + + xctest_add_bundle( + # Name of the XCTest bundle + # Target name of the testee + ) + +.. command:: xctest_add_test + + The ``xctest_add_test`` function adds an XCTest bundle to the + project to be run by :manual:`ctest(1)`. The test will be named + and tests :: + + xctest_add_test( + # Test name + # Target name of XCTest bundle + ) + +Module Variables +^^^^^^^^^^^^^^^^ + +The following variables are set by including this module: + +.. variable:: XCTest_FOUND + + True if the XCTest Framework and executable were found. + +.. variable:: XCTest_EXECUTABLE + + The ``XCTEST_EXECUTABLE`` variable contains the path to the xctest + command line tool used to execute XCTest bundles. + +.. variable:: XCTest_INCLUDE_DIRS + + The directory containing the XCTest Framework headers. + +.. variable:: XCTest_LIBRARIES + + The location of the XCTest Framework. + +#]=======================================================================] + +#============================================================================= +# Copyright 2015 Gregor Jasny +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(XCTest_INCLUDE_DIR + NAMES "XCTest/XCTest.h" + DOC "XCTest include directory") +mark_as_advanced(XCTest_INCLUDE_DIR) + +find_library(XCTest_LIBRARY + NAMES XCTest + DOC "XCTest Framework library") +mark_as_advanced(XCTest_LIBRARY) + +execute_process( + COMMAND xcrun --find xctest + OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _xcrun_err) +if(_xcrun_out) + set(XCTest_EXECUTABLE "${_xcrun_out}" CACHE FILEPATH "XCTest executable") + mark_as_advanced(XCTest_EXECUTABLE) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(XCTest + FOUND_VAR XCTest_FOUND + REQUIRED_VARS XCTest_LIBRARY XCTest_INCLUDE_DIR XCTest_EXECUTABLE) + +if(XCTest_FOUND) + set(XCTest_INCLUDE_DIRS "${XCTest_INCLUDE_DIR}") + set(XCTest_LIBRARIES "${XCTest_LIBRARY}") +endif(XCTest_FOUND) + + +function(xctest_add_bundle target testee) + if(NOT XCTest_FOUND) + message(FATAL_ERROR "XCTest is required to create a XCTest Bundle.") + endif(NOT XCTest_FOUND) + + if(NOT CMAKE_OSX_SYSROOT) + message(FATAL_ERROR "Adding XCTest bundles requires CMAKE_OSX_SYSROOT to be set.") + endif() + + add_library(${target} MODULE ${ARGN}) + + set_target_properties(${target} PROPERTIES + BUNDLE TRUE + XCTEST TRUE + XCTEST_TESTEE ${testee}) + + target_link_libraries(${target} PRIVATE "-framework Foundation") + target_link_libraries(${target} PRIVATE ${XCTest_LIBRARIES}) + target_include_directories(${target} PRIVATE ${XCTest_INCLUDE_DIRS}) + + # retrieve testee target type + if(NOT TARGET ${testee}) + message(FATAL_ERROR "${testee} is not a target.") + endif() + get_property(_testee_type TARGET ${testee} PROPERTY TYPE) + get_property(_testee_framework TARGET ${testee} PROPERTY FRAMEWORK) + get_property(_testee_macosx_bundle TARGET ${testee} PROPERTY MACOSX_BUNDLE) + + if(_testee_type STREQUAL "SHARED_LIBRARY" AND _testee_framework) + # testee is a Framework + target_link_libraries(${target} PRIVATE ${testee}) + + elseif(_testee_type STREQUAL "EXECUTABLE" AND _testee_macosx_bundle) + # testee is an App Bundle + add_dependencies(${target} ${testee}) + if(XCODE) + set_target_properties(${target} PROPERTIES + XCODE_ATTRIBUTE_BUNDLE_LOADER "$(TEST_HOST)" + XCODE_ATTRIBUTE_TEST_HOST "$") + else(XCODE) + target_link_libraries(${target} + PRIVATE -bundle_loader $) + endif(XCODE) + + else() + message(FATAL_ERROR "Testee ${testee} is of unsupported type.") + endif() +endfunction(xctest_add_bundle) + + +function(xctest_add_test name bundle) + if(NOT XCTest_EXECUTABLE) + message(FATAL_ERROR "XCTest executable is required to register a test.") + endif() + + # check that bundle is a XCTest Bundle + + if(NOT TARGET ${bundle}) + message(FATAL_ERROR "${bundle} is not a target.") + endif(NOT TARGET ${bundle}) + + get_property(_test_type TARGET ${bundle} PROPERTY TYPE) + get_property(_test_bundle TARGET ${bundle} PROPERTY BUNDLE) + get_property(_test_xctest TARGET ${bundle} PROPERTY XCTEST) + + if(NOT _test_type STREQUAL "MODULE_LIBRARY" + OR NOT _test_xctest OR NOT _test_bundle) + message(FATAL_ERROR "Test ${bundle} is not an XCTest Bundle") + endif() + + # get and check testee properties + + get_property(_testee TARGET ${bundle} PROPERTY XCTEST_TESTEE) + if(NOT TARGET ${_testee}) + message(FATAL_ERROR "${_testee} is not a target.") + endif() + + get_property(_testee_type TARGET ${_testee} PROPERTY TYPE) + get_property(_testee_framework TARGET ${_testee} PROPERTY FRAMEWORK) + + # register test + + add_test( + NAME ${name} + COMMAND ${XCTest_EXECUTABLE} $/../..) + + # point loader to testee in case rpath is disabled + + if(_testee_type STREQUAL "SHARED_LIBRARY" AND _testee_framework) + set_property(TEST ${name} APPEND PROPERTY + ENVIRONMENT DYLD_FRAMEWORK_PATH=$/..) + endif() +endfunction(xctest_add_test) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b9453f8d22753bcd47204cdc5021de351d3d2f8 commit 7b9453f8d22753bcd47204cdc5021de351d3d2f8 Author: Gregor Jasny AuthorDate: Wed Feb 25 21:07:43 2015 +0100 Commit: Gregor Jasny CommitDate: Wed Mar 18 15:23:53 2015 +0100 OS X: Add handling for XCTest bundles An XCTest bundle is a CFBundle with a special product-type and bundle extension. For more information about XCTest visit the Mac Developer library at: http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ Signed-off-by: Gregor Jasny diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 19fdf23..1dff33e 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -243,6 +243,7 @@ Properties on Targets /prop_tgt/VS_WINRT_REFERENCES /prop_tgt/WIN32_EXECUTABLE /prop_tgt/XCODE_ATTRIBUTE_an-attribute + /prop_tgt/XCTEST Properties on Tests =================== diff --git a/Help/prop_tgt/XCTEST.rst b/Help/prop_tgt/XCTEST.rst new file mode 100644 index 0000000..f3ff474 --- /dev/null +++ b/Help/prop_tgt/XCTEST.rst @@ -0,0 +1,13 @@ +XCTEST +------ + +This target is a XCTest CFBundle on the Mac. + +This property will usually get set via the ``add_xctest`` macro in +:module:`FindXCTest` module. + +If a module library target has this property set to true it will be +built as a CFBundle when built on the Mac. It will have the directory +structure required for a CFBundle. + +This property depends on :prop_tgt:`BUNDLE` to be effective. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index bd8a1f5..d340e72 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -804,6 +804,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode = "compiled.mach-o.objfile"; } + else if(ext == "xctest") + { + sourcecode = "wrapper.cfbundle"; + } else if(ext == "xib") { keepLastKnownFileType = true; @@ -2598,7 +2602,9 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget) case cmTarget::STATIC_LIBRARY: return "archive.ar"; case cmTarget::MODULE_LIBRARY: - if (cmtarget.IsCFBundleOnApple()) + if (cmtarget.IsXCTestOnApple()) + return "wrapper.cfbundle"; + else if (cmtarget.IsCFBundleOnApple()) return "wrapper.plug-in"; else return ((this->XcodeVersion >= 22)? @@ -2622,7 +2628,9 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(cmTarget& cmtarget) case cmTarget::STATIC_LIBRARY: return "com.apple.product-type.library.static"; case cmTarget::MODULE_LIBRARY: - if (cmtarget.IsCFBundleOnApple()) + if (cmtarget.IsXCTestOnApple()) + return "com.apple.product-type.bundle.unit-test"; + else if (cmtarget.IsCFBundleOnApple()) return "com.apple.product-type.bundle"; else return ((this->XcodeVersion >= 22)? diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b70f60d..b3d1155 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -616,6 +616,13 @@ bool cmTarget::IsCFBundleOnApple() const } //---------------------------------------------------------------------------- +bool cmTarget::IsXCTestOnApple() const +{ + return (this->IsCFBundleOnApple() && + this->GetPropertyAsBool("XCTEST")); +} + +//---------------------------------------------------------------------------- bool cmTarget::IsBundleOnApple() const { return this->IsFrameworkOnApple() || this->IsAppBundleOnApple() || @@ -6791,7 +6798,14 @@ std::string cmTarget::GetCFBundleDirectory(const std::string& config, const char *ext = this->GetProperty("BUNDLE_EXTENSION"); if (!ext) { - ext = "bundle"; + if (this->IsXCTestOnApple()) + { + ext = "xctest"; + } + else + { + ext = "bundle"; + } } fpath += ext; fpath += "/Contents"; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5170b31..a4ef977 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -527,6 +527,9 @@ public: /** Return whether this target is a CFBundle (plugin) on Apple. */ bool IsCFBundleOnApple() const; + /** Return whether this target is a XCTest on Apple. */ + bool IsXCTestOnApple() const; + /** Return whether this target is an executable Bundle on Apple. */ bool IsAppBundleOnApple() const; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54a5cdbb4c35aa8847d3eb0f7f418fad72563992 commit 54a5cdbb4c35aa8847d3eb0f7f418fad72563992 Author: Brad King AuthorDate: Fri Feb 27 09:35:50 2015 -0500 Commit: Gregor Jasny CommitDate: Wed Mar 18 15:23:53 2015 +0100 Tests: Compute Xcode version for any generator on OS X Store the version in CMake_TEST_XCODE_VERSION for use by tests that work with any generator on OS X but may depend on the Xcode version providing the tools. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 40bea51..765fc80 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -172,6 +172,7 @@ if(BUILD_TESTING) ON) mark_as_advanced(CTEST_TEST_CPACK) set(CTEST_TEST_OSX_ARCH 0) + set(CMake_TEST_XCODE_VERSION 0) if(APPLE) execute_process( COMMAND sw_vers -productVersion @@ -185,6 +186,17 @@ if(BUILD_TESTING) else() set(CTEST_TEST_OSX_ARCH 1) endif() + if(XCODE_VERSION) + set(CMake_TEST_XCODE_VERSION "${XCODE_VERSION}") + else() + execute_process( + COMMAND xcodebuild -version + OUTPUT_VARIABLE _version ERROR_VARIABLE _version + ) + if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)") + set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}") + endif() + endif() endif() # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value, ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-modules.7.rst | 1 + Help/manual/cmake-properties.7.rst | 1 + Help/module/FindXCTest.rst | 1 + Help/prop_tgt/XCTEST.rst | 13 + Help/release/dev/xcode-xctest.rst | 6 + Modules/FindXCTest.cmake | 196 ++++++ Source/CMakeVersion.cmake | 2 +- Source/cmGlobalXCodeGenerator.cxx | 12 +- Source/cmTarget.cxx | 16 +- Source/cmTarget.h | 3 + Tests/CMakeLists.txt | 16 + Tests/XCTest/CMakeLists.txt | 57 ++ Tests/XCTest/CocoaExample/AppDelegate.h | 6 + Tests/XCTest/CocoaExample/AppDelegate.m | 18 + .../CocoaExample/Info.plist} | 22 +- Tests/XCTest/CocoaExample/MainMenu.xib | 680 ++++++++++++++++++++ Tests/XCTest/CocoaExample/main.m | 5 + Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m | 13 + Tests/XCTest/FrameworkExample/FrameworkExample.c | 6 + Tests/XCTest/FrameworkExample/FrameworkExample.h | 1 + .../FrameworkExample/Info.plist} | 28 +- .../FrameworkExampleTests/FrameworkExampleTests.m | 16 + .../FrameworkExampleTests/Info.plist} | 24 +- 23 files changed, 1095 insertions(+), 48 deletions(-) create mode 100644 Help/module/FindXCTest.rst create mode 100644 Help/prop_tgt/XCTEST.rst create mode 100644 Help/release/dev/xcode-xctest.rst create mode 100644 Modules/FindXCTest.cmake create mode 100644 Tests/XCTest/CMakeLists.txt create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.h create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.m copy Tests/{iOSNavApp/Info.plist.in => XCTest/CocoaExample/Info.plist} (66%) create mode 100644 Tests/XCTest/CocoaExample/MainMenu.xib create mode 100644 Tests/XCTest/CocoaExample/main.m create mode 100644 Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.c create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.h copy Tests/{iOSNavApp/Info.plist.in => XCTest/FrameworkExample/Info.plist} (58%) create mode 100644 Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m copy Tests/{iOSNavApp/Info.plist.in => XCTest/FrameworkExampleTests/Info.plist} (56%) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 18 13:03:51 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 18 Mar 2015 13:03:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1083-gacfc07a Message-ID: <20150318170351.6CD81ACA39@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via acfc07a851ee91fed1e29c6e53abd9794991eb72 (commit) via 80afe28a1084d02dc3e010c7a0cabf5258237ddc (commit) from ef88ba3fe1f16d8663109eb77b1931a3fedba443 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=acfc07a851ee91fed1e29c6e53abd9794991eb72 commit acfc07a851ee91fed1e29c6e53abd9794991eb72 Merge: ef88ba3 80afe28 Author: Brad King AuthorDate: Wed Mar 18 13:03:50 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 18 13:03:50 2015 -0400 Merge topic 'ninja-no-circular-phony' into next 80afe28a Ninja: Do not generate circular phony rules (#15454) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80afe28a1084d02dc3e010c7a0cabf5258237ddc commit 80afe28a1084d02dc3e010c7a0cabf5258237ddc Author: Brad King AuthorDate: Wed Mar 18 12:51:28 2015 -0400 Commit: Brad King CommitDate: Wed Mar 18 12:55:27 2015 -0400 Ninja: Do not generate circular phony rules (#15454) The phony rules added by commit v2.8.12~248^2 (Ninja: Custom Command file depends don't need to exist before building, 2013-06-07) are circular, e.g. build side-effect: phony side-effect This is not diagnosed by Ninja as of version 1.5, but the dependency does not make sense. Simply drop it and use phony rules of the form build side-effect: phony instead. Reported-by: Daniel Dunbar diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 69b1a9d..ac7a6eb 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1069,7 +1069,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) this->WritePhonyBuild(os, "", deps, - deps); + cmNinjaDeps()); } } } ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalNinjaGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From bill.hoffman at kitware.com Wed Mar 18 13:32:36 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Wed, 18 Mar 2015 13:32:36 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1086-gf8c44b8 Message-ID: <20150318173236.85A99AC6B1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f8c44b8b438059eb936c9c59630aa8f2fc123869 (commit) via f70529359f56d799e78ceba17b0bf5375ecc4d9b (commit) via 69dfba4b319ff50c22b9265c5fe52be13dbfcdf7 (commit) from acfc07a851ee91fed1e29c6e53abd9794991eb72 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f8c44b8b438059eb936c9c59630aa8f2fc123869 commit f8c44b8b438059eb936c9c59630aa8f2fc123869 Merge: acfc07a f705293 Author: Bill Hoffman AuthorDate: Wed Mar 18 13:32:35 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 18 13:32:35 2015 -0400 Merge topic 'ctest-repeat-until-fail' into next f7052935 Pass a configuration to ctest it can be arbitrary since we don't build. 69dfba4b Revert "Pass down the ctest config option to RunCMake tests." http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f70529359f56d799e78ceba17b0bf5375ecc4d9b commit f70529359f56d799e78ceba17b0bf5375ecc4d9b Author: Bill Hoffman AuthorDate: Wed Mar 18 13:31:38 2015 -0400 Commit: Bill Hoffman CommitDate: Wed Mar 18 13:31:38 2015 -0400 Pass a configuration to ctest it can be arbitrary since we don't build. diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 916c7bc..0e7d6d0 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -16,4 +16,5 @@ set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1) run_cmake(Build) unset(RunCMake_TEST_OPTIONS) run_cmake_command(repeat-until-fail-tests ${CMAKE_CTEST_COMMAND} + -C Debug --repeat-until-fail 3 ) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69dfba4b319ff50c22b9265c5fe52be13dbfcdf7 commit 69dfba4b319ff50c22b9265c5fe52be13dbfcdf7 Author: Bill Hoffman AuthorDate: Wed Mar 18 13:27:49 2015 -0400 Commit: Bill Hoffman CommitDate: Wed Mar 18 13:27:49 2015 -0400 Revert "Pass down the ctest config option to RunCMake tests." This reverts commit c482c4a4406028e02b90dd2e40f5291a364aa2bb. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 9cd2e9a..ffda31f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -20,7 +20,6 @@ macro(add_RunCMake_test test) -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} - -DRunCMake_CTestTest_CONFIG=${CTestTest_CONFIG} ${${test}_ARGS} ${TEST_ARGS} -P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake" diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 7176e2a..916c7bc 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -16,5 +16,4 @@ set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1) run_cmake(Build) unset(RunCMake_TEST_OPTIONS) run_cmake_command(repeat-until-fail-tests ${CMAKE_CTEST_COMMAND} - -C ${RunCMake_CTestTest_CONFIG} --repeat-until-fail 3 ) ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/CMakeLists.txt | 1 - Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) hooks/post-receive -- CMake From domen.vrankar at gmail.com Wed Mar 18 15:24:04 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Wed, 18 Mar 2015 15:24:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1088-g15b62be Message-ID: <20150318192404.D75C8AC540@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 15b62be62df4829a76f8de62785e81934610c77a (commit) via 3357c4c4d4f5a4d2cd7afd58774e78bcf94c4694 (commit) from f8c44b8b438059eb936c9c59630aa8f2fc123869 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15b62be62df4829a76f8de62785e81934610c77a commit 15b62be62df4829a76f8de62785e81934610c77a Merge: f8c44b8 3357c4c Author: Domen Vrankar AuthorDate: Wed Mar 18 15:24:04 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 18 15:24:04 2015 -0400 Merge topic 'file-globbing-directory-listing' into next 3357c4c4 fixup! file GLOB list directories handling http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3357c4c4d4f5a4d2cd7afd58774e78bcf94c4694 commit 3357c4c4d4f5a4d2cd7afd58774e78bcf94c4694 Author: Domen Vrankar AuthorDate: Wed Mar 18 20:22:14 2015 +0100 Commit: Domen Vrankar CommitDate: Wed Mar 18 20:22:14 2015 +0100 fixup! file GLOB list directories handling Globbing test outputs should be sorted before printout so listing order on different platforms doesn't affect the tests. diff --git a/Tests/RunCMake/file/GLOB-stderr.txt b/Tests/RunCMake/file/GLOB-stderr.txt index 41be050..c47dc40 100644 --- a/Tests/RunCMake/file/GLOB-stderr.txt +++ b/Tests/RunCMake/file/GLOB-stderr.txt @@ -1,6 +1,6 @@ -content: 6. -.*/test/dir 1/non_empty_dir;.*/test/dir 1/empty_dir;.*/test/dir 1/dir 1 file;.*/test/dir 2/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir -content: 6. -.*/test/dir 1/non_empty_dir;.*/test/dir 1/empty_dir;.*/test/dir 1/dir 1 file;.*/test/dir 2/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir -content: 2. +content: 6[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir +content: 6[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir +content: 2[ ] .*/test/dir 1/dir 1 file;.*/test/dir 2/dir 2 file diff --git a/Tests/RunCMake/file/GLOB.cmake b/Tests/RunCMake/file/GLOB.cmake index c524e42..3d577e3 100644 --- a/Tests/RunCMake/file/GLOB.cmake +++ b/Tests/RunCMake/file/GLOB.cmake @@ -12,14 +12,17 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir fi file(GLOB CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") list(LENGTH CONTENT_LIST CONTENT_COUNT) message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) message("${CONTENT_LIST}") file(GLOB CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") list(LENGTH CONTENT_LIST CONTENT_COUNT) message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) message("${CONTENT_LIST}") file(GLOB CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") list(LENGTH CONTENT_LIST CONTENT_COUNT) message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt index d73c74f..f73aa83 100644 --- a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt @@ -1,15 +1,15 @@ .*Cyclic recursion detected while globbing for.* .*/test/depth1/depth2/depth3.* .*/test/depth1/depth2/depth3/recursion.* -content: 4. -.*/test/abc;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/file_symlink +content: 4[ ] +.*/test/abc;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink .*Cyclic recursion detected while globbing for.* .*/test/depth1/depth2/depth3.* .*/test/depth1/depth2/depth3/recursion.* -content: 4. -.*/test/abc;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/file_symlink +content: 4[ ] +.*/test/abc;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink .*Cyclic recursion detected while globbing for.* .*/test/depth1/depth2/depth3.* .*/test/depth1/depth2/depth3/recursion.* -content: 11. -.*/test/abc;.*/test/depth1;.*/test/depth1/depth2;.*/test/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/recursion;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1;.*/test/depth1/depth2/depth3/recursion/depth1/depth2;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/file_symlink +content: 11[ ] +.*/test/abc;.*/test/depth1;.*/test/depth1/depth2;.*/test/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1;.*/test/depth1/depth2/depth3/recursion/depth1/depth2;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake index fb8be42..a8c6784 100644 --- a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake @@ -7,14 +7,17 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINA file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") list(LENGTH CONTENT_LIST CONTENT_COUNT) message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) message("${CONTENT_LIST}") file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") list(LENGTH CONTENT_LIST CONTENT_COUNT) message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) message("${CONTENT_LIST}") file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") list(LENGTH CONTENT_LIST CONTENT_COUNT) message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt index dac7db6..5d48e47 100644 --- a/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt +++ b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt @@ -1,6 +1,6 @@ -content: 4. -.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 1/dir 1 file;/home/domen/Dev/build/cmake/Tests/RunCMake/file/GLOB_RECURSE-build/test/dir 2/non_empty_dir/dir 2 subdir file;/home/domen/Dev/build/cmake/Tests/RunCMake/file/GLOB_RECURSE-build/test/dir 2/dir 2 file -content: 4. -.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 1/dir 1 file;/home/domen/Dev/build/cmake/Tests/RunCMake/file/GLOB_RECURSE-build/test/dir 2/non_empty_dir/dir 2 subdir file;/home/domen/Dev/build/cmake/Tests/RunCMake/file/GLOB_RECURSE-build/test/dir 2/dir 2 file -content: 8. -.*/test/dir 1/non_empty_dir;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 1/empty_dir;.*/test/dir 1/dir 1 file;.*/test/dir 2/non_empty_dir;.*/test/dir 2/non_empty_dir/dir 2 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir +content: 4[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/non_empty_dir/dir 2 subdir file +content: 4[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/non_empty_dir/dir 2 subdir file +content: 8[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir;.*/test/dir 2/non_empty_dir/dir 2 subdir file diff --git a/Tests/RunCMake/file/GLOB_RECURSE.cmake b/Tests/RunCMake/file/GLOB_RECURSE.cmake index 530930f..6db377b 100644 --- a/Tests/RunCMake/file/GLOB_RECURSE.cmake +++ b/Tests/RunCMake/file/GLOB_RECURSE.cmake @@ -12,14 +12,17 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir fi file(GLOB_RECURSE CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") list(LENGTH CONTENT_LIST CONTENT_COUNT) message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) message("${CONTENT_LIST}") file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") list(LENGTH CONTENT_LIST CONTENT_COUNT) message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) message("${CONTENT_LIST}") file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") list(LENGTH CONTENT_LIST CONTENT_COUNT) message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) message("${CONTENT_LIST}") ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/file/GLOB-stderr.txt | 10 +++++----- Tests/RunCMake/file/GLOB.cmake | 3 +++ .../RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt | 12 ++++++------ Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake | 3 +++ Tests/RunCMake/file/GLOB_RECURSE-stderr.txt | 12 ++++++------ Tests/RunCMake/file/GLOB_RECURSE.cmake | 3 +++ 6 files changed, 26 insertions(+), 17 deletions(-) hooks/post-receive -- CMake From clinton at elemtech.com Wed Mar 18 23:05:05 2015 From: clinton at elemtech.com (Clinton Stimpson) Date: Wed, 18 Mar 2015 23:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1090-g80ca453 Message-ID: <20150319030505.7F8E4AC88D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 80ca453b3313688e40750f0908c05a77d5c4a3d4 (commit) via 2c50db263a9e23b0240f769c335fb6f2ebc1b72a (commit) from 15b62be62df4829a76f8de62785e81934610c77a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80ca453b3313688e40750f0908c05a77d5c4a3d4 commit 80ca453b3313688e40750f0908c05a77d5c4a3d4 Merge: 15b62be 2c50db2 Author: Clinton Stimpson AuthorDate: Wed Mar 18 23:05:04 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 18 23:05:04 2015 -0400 Merge topic 'cpack-bundle-codesign' into next 2c50db26 CPack: Add support to overwrite or pass additional parameter to codesign http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c50db263a9e23b0240f769c335fb6f2ebc1b72a commit 2c50db263a9e23b0240f769c335fb6f2ebc1b72a Author: Andr? Klitzing AuthorDate: Wed Mar 11 13:04:15 2015 +0100 Commit: Clinton Stimpson CommitDate: Wed Mar 18 20:53:30 2015 -0600 CPack: Add support to overwrite or pass additional parameter to codesign diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake index d26a0b3..b412216 100644 --- a/Modules/CPackBundle.cmake +++ b/Modules/CPackBundle.cmake @@ -52,6 +52,11 @@ # list the main application folder, or the main executable. You should # list any frameworks and plugins that are included in your app bundle. # +# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER +# +# Additional parameter that will passed to codesign. +# Default value: "--deep -f" +# # .. variable:: CPACK_COMMAND_CODESIGN # # Path to the codesign(1) command used to sign applications with an diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 6e7a26b..01c3f8b 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -221,6 +221,10 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) bundle_path += ".app"; // A list of additional files to sign, ie. frameworks and plugins. + const std::string sign_parameter = + this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") + ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") : "--deep -f"; + const std::string sign_files = this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") : ""; @@ -234,7 +238,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) { std::ostringstream temp_sign_file_cmd; temp_sign_file_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); - temp_sign_file_cmd << " --deep -f -s \"" << cpack_apple_cert_app; + 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 << " \""; @@ -254,7 +258,7 @@ 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 << " --deep -f -s \"" << cpack_apple_cert_app; + temp_sign_binary_cmd << " " << sign_parameter << " -s \"" << cpack_apple_cert_app; temp_sign_binary_cmd << "\" \"" << bundle_path << "\""; if(!this->RunCommand(temp_sign_binary_cmd, &output)) @@ -269,7 +273,7 @@ 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 << " --deep -f -s \"" << cpack_apple_cert_app << "\""; + temp_codesign_cmd << " " << sign_parameter << " -s \"" << cpack_apple_cert_app << "\""; if(this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS")) { temp_codesign_cmd << " --entitlements "; ----------------------------------------------------------------------- Summary of changes: Modules/CPackBundle.cmake | 5 +++++ Source/CPack/cmCPackBundleGenerator.cxx | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 19 00:01:05 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 19 Mar 2015 00:01:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-441-g486e9f4 Message-ID: <20150319040105.42F37AC374@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 486e9f4f49646cf48915781a411edfe9d9ea7618 (commit) from 380db3de00bd74f01781ea93e9ba9cebdea000cc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=486e9f4f49646cf48915781a411edfe9d9ea7618 commit 486e9f4f49646cf48915781a411edfe9d9ea7618 Author: Kitware Robot AuthorDate: Thu Mar 19 00:01:03 2015 -0400 Commit: Kitware Robot CommitDate: Thu Mar 19 00:01:03 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0d92bcf..7d81aa9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150318) +set(CMake_VERSION_PATCH 20150319) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 19 15:08:14 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 19 Mar 2015 15:08:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1092-gc52d65d Message-ID: <20150319190814.8D247ACC51@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c52d65dbee29af9141d12cfd2f5c1c5b4ac5a3a5 (commit) via e77c0b4758d3721990e67532f8081abbcb83a23f (commit) from 80ca453b3313688e40750f0908c05a77d5c4a3d4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c52d65dbee29af9141d12cfd2f5c1c5b4ac5a3a5 commit c52d65dbee29af9141d12cfd2f5c1c5b4ac5a3a5 Merge: 80ca453 e77c0b4 Author: Brad King AuthorDate: Thu Mar 19 15:08:13 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 19 15:08:13 2015 -0400 Merge topic 'xcode-xctest' into next e77c0b47 fixup! Tests: Add XCTest example to test Frameworks and Cocoa App Bundles http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e77c0b4758d3721990e67532f8081abbcb83a23f commit e77c0b4758d3721990e67532f8081abbcb83a23f Author: Brad King AuthorDate: Thu Mar 19 14:56:52 2015 -0400 Commit: Brad King CommitDate: Thu Mar 19 14:57:01 2015 -0400 fixup! Tests: Add XCTest example to test Frameworks and Cocoa App Bundles diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 71cdb0f..aa03f86 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1505,7 +1505,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5) + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5 + AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") + set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1}) ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $ -V) endif() ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 20 00:01:10 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 20 Mar 2015 00:01:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-442-ga066f73 Message-ID: <20150320040111.025E9AC454@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a066f73263c8c56f968324e51daee717291b3908 (commit) from 486e9f4f49646cf48915781a411edfe9d9ea7618 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a066f73263c8c56f968324e51daee717291b3908 commit a066f73263c8c56f968324e51daee717291b3908 Author: Kitware Robot AuthorDate: Fri Mar 20 00:01:03 2015 -0400 Commit: Kitware Robot CommitDate: Fri Mar 20 00:01:03 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7d81aa9..8127464 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150319) +set(CMake_VERSION_PATCH 20150320) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:29:13 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:29:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1094-g8c1e8b7 Message-ID: <20150320132913.1E575ACA81@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8c1e8b7cf477e0f11e374b435ff8e2e3374f0759 (commit) via 427bd1d2457593a5f250d6ed8a2f88b367dac64d (commit) from c52d65dbee29af9141d12cfd2f5c1c5b4ac5a3a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c1e8b7cf477e0f11e374b435ff8e2e3374f0759 commit 8c1e8b7cf477e0f11e374b435ff8e2e3374f0759 Merge: c52d65d 427bd1d Author: Brad King AuthorDate: Fri Mar 20 09:29:11 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:29:11 2015 -0400 Merge topic 'ctest-repeat-until-fail' into next 427bd1d2 fixup! Add testing for repeat until fail command line option to ctest. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=427bd1d2457593a5f250d6ed8a2f88b367dac64d commit 427bd1d2457593a5f250d6ed8a2f88b367dac64d Author: Brad King AuthorDate: Fri Mar 20 09:18:50 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 09:28:54 2015 -0400 fixup! Add testing for repeat until fail command line option to ctest. diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 0e7d6d0..2e5156c 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -1,20 +1,25 @@ include(RunCMake) -run_cmake_command(repeat-until-fail-bad1 ${CMAKE_CTEST_COMMAND} - --repeat-until-fail) -run_cmake_command(repeat-until-fail-bad2 ${CMAKE_CTEST_COMMAND} - --repeat-until-fail foo) -run_cmake_command(repeat-until-fail-good ${CMAKE_CTEST_COMMAND} - --repeat-until-fail 2) -# Use a single build tree for a few tests without cleaning. -set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build) -set(RunCMake_TEST_NO_CLEAN 1) -file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") -file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") +run_cmake_command(repeat-until-fail-bad1 + ${CMAKE_CTEST_COMMAND} --repeat-until-fail + ) +run_cmake_command(repeat-until-fail-bad2 + ${CMAKE_CTEST_COMMAND} --repeat-until-fail foo + ) +run_cmake_command(repeat-until-fail-good + ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 + ) -set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1) -run_cmake(Build) -unset(RunCMake_TEST_OPTIONS) -run_cmake_command(repeat-until-fail-tests ${CMAKE_CTEST_COMMAND} - -C Debug - --repeat-until-fail 3 ) +function(run_repeat_until_fail_tests) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/repeat-until-fail-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(repeat-until-fail-cmake) + run_cmake_command(repeat-until-fail-ctest + ${CMAKE_CTEST_COMMAND} -C Debug --repeat-until-fail 3 + ) +endfunction() +run_repeat_until_fail_tests() diff --git a/Tests/RunCMake/CTestCommandLine/init.cmake b/Tests/RunCMake/CTestCommandLine/init.cmake index 13466e1..a900f67 100644 --- a/Tests/RunCMake/CTestCommandLine/init.cmake +++ b/Tests/RunCMake/CTestCommandLine/init.cmake @@ -1,3 +1,3 @@ -# This is run by test initialization in Build.cmake with cmake -P -# It creates TEST_OUTPUT_FILE with a 0 in it +# This is run by test initialization in repeat-until-fail-cmake.cmake +# with cmake -P. It creates TEST_OUTPUT_FILE with a 0 in it. file(WRITE "${TEST_OUTPUT_FILE}" "0") diff --git a/Tests/RunCMake/CTestCommandLine/Build.cmake b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake similarity index 100% rename from Tests/RunCMake/CTestCommandLine/Build.cmake rename to Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt similarity index 100% rename from Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-result.txt rename to Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt new file mode 100644 index 0000000..7593783 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt @@ -0,0 +1 @@ +^Errors while running CTest$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stdout.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt similarity index 90% rename from Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stdout.txt rename to Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt index 2bfb4e5..0bc4f70 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stdout.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt @@ -1,4 +1,4 @@ -^Test project .*/Tests/RunCMake/CTestCommandLine/Build-build +^Test project .*/Tests/RunCMake/CTestCommandLine/repeat-until-fail-build Start 1: initialization Test #1: initialization ................... Passed [0-9.]+ sec Start 1: initialization @@ -24,7 +24,7 @@ + 75% tests passed, 1 tests failed out of 4 + -Total Test time \(real\) = [0-9.]+ sec +Total Test time \(real\) = +[0-9.]+ sec + The following tests FAILED: [ ]+2 - test1 \(Failed\)$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stderr.txt deleted file mode 100644 index ba4235d..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -Errors while running CTest diff --git a/Tests/RunCMake/CTestCommandLine/test1.cmake b/Tests/RunCMake/CTestCommandLine/test1.cmake index d7e4538..eeae7a2 100644 --- a/Tests/RunCMake/CTestCommandLine/test1.cmake +++ b/Tests/RunCMake/CTestCommandLine/test1.cmake @@ -1,4 +1,4 @@ -# This is run by test test1 in Build.cmake with cmake -P +# This is run by test test1 in repeat-until-fail-cmake.cmake with cmake -P. # It reads the file TEST_OUTPUT_FILE and increments the number # found in the file by 1. When the number is 2, then the # code sends out a cmake error causing the test to fail ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 39 +++++++++++--------- Tests/RunCMake/CTestCommandLine/init.cmake | 4 +- .../{Build.cmake => repeat-until-fail-cmake.cmake} | 0 ...sult.txt => repeat-until-fail-ctest-result.txt} | 0 .../repeat-until-fail-ctest-stderr.txt | 1 + ...dout.txt => repeat-until-fail-ctest-stdout.txt} | 4 +- .../repeat-until-fail-tests-stderr.txt | 1 - Tests/RunCMake/CTestCommandLine/test1.cmake | 2 +- 8 files changed, 28 insertions(+), 23 deletions(-) rename Tests/RunCMake/CTestCommandLine/{Build.cmake => repeat-until-fail-cmake.cmake} (100%) rename Tests/RunCMake/CTestCommandLine/{repeat-until-fail-tests-result.txt => repeat-until-fail-ctest-result.txt} (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt rename Tests/RunCMake/CTestCommandLine/{repeat-until-fail-tests-stdout.txt => repeat-until-fail-ctest-stdout.txt} (90%) delete mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-tests-stderr.txt hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:33:00 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:33:00 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1096-g820fa8a Message-ID: <20150320133300.B6FA5ACB7B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 820fa8a738a1d988d3cbe4aec834643448072be3 (commit) via a0075b2789d08a766732dcf287b0b7a0e7c4a8a7 (commit) from 8c1e8b7cf477e0f11e374b435ff8e2e3374f0759 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=820fa8a738a1d988d3cbe4aec834643448072be3 commit 820fa8a738a1d988d3cbe4aec834643448072be3 Merge: 8c1e8b7 a0075b2 Author: Brad King AuthorDate: Fri Mar 20 09:33:00 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:33:00 2015 -0400 Merge topic 'cpack-bundle-codesign' into next a0075b27 fixup! CPack: Add support to overwrite or pass additional parameter http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a0075b2789d08a766732dcf287b0b7a0e7c4a8a7 commit a0075b2789d08a766732dcf287b0b7a0e7c4a8a7 Author: Brad King AuthorDate: Fri Mar 20 09:32:16 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 09:32:42 2015 -0400 fixup! CPack: Add support to overwrite or pass additional parameter Wrap long lines. diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 01c3f8b..b2d7019 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -223,7 +223,8 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) // A list of additional files to sign, ie. frameworks and plugins. const std::string sign_parameter = this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") - ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") : "--deep -f"; + ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") + : "--deep -f"; const std::string sign_files = this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") @@ -238,7 +239,8 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) { 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 << " " << 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 << " \""; @@ -258,7 +260,8 @@ 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 << " " << sign_parameter << " -s \"" + << cpack_apple_cert_app; temp_sign_binary_cmd << "\" \"" << bundle_path << "\""; if(!this->RunCommand(temp_sign_binary_cmd, &output)) @@ -273,7 +276,8 @@ 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 << "\""; + temp_codesign_cmd << " " << sign_parameter << " -s \"" + << cpack_apple_cert_app << "\""; if(this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS")) { temp_codesign_cmd << " --entitlements "; ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackBundleGenerator.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:37:44 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:37:44 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1098-g3caa1a1 Message-ID: <20150320133744.1DE7BACD34@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3caa1a1c5afc83628dae8312f94b20f32c18c623 (commit) via 2aaf4f60810a86d62927a915e9286e4c2be9c53a (commit) from 820fa8a738a1d988d3cbe4aec834643448072be3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3caa1a1c5afc83628dae8312f94b20f32c18c623 commit 3caa1a1c5afc83628dae8312f94b20f32c18c623 Merge: 820fa8a 2aaf4f6 Author: Brad King AuthorDate: Fri Mar 20 09:37:43 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:37:43 2015 -0400 Merge topic 'mingw-compile-features' into next 2aaf4f60 Help: Add notes for topic 'mingw-compile-features' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2aaf4f60810a86d62927a915e9286e4c2be9c53a commit 2aaf4f60810a86d62927a915e9286e4c2be9c53a Author: Brad King AuthorDate: Fri Mar 20 09:35:59 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 09:35:59 2015 -0400 Help: Add notes for topic 'mingw-compile-features' diff --git a/Help/release/dev/mingw-compile-features.rst b/Help/release/dev/mingw-compile-features.rst new file mode 100644 index 0000000..e2ed30b --- /dev/null +++ b/Help/release/dev/mingw-compile-features.rst @@ -0,0 +1,6 @@ +mingw-compile-features +---------------------- + +* The :manual:`Compile Features ` functionality + is now aware of features supported by GNU compilers on Windows, versions + 4.4 through 5.0. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/mingw-compile-features.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/mingw-compile-features.rst hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:44:54 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:44:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1101-g5ac4b47 Message-ID: <20150320134454.CCA60ABEC8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5ac4b4738ac4eccf5546d2308268035538020a94 (commit) via 2779faff9887434dbded61bd61e70df452dd336f (commit) via 49ce1077a20cd203f1d87e32114be06bd15520d0 (commit) from 3caa1a1c5afc83628dae8312f94b20f32c18c623 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ac4b4738ac4eccf5546d2308268035538020a94 commit 5ac4b4738ac4eccf5546d2308268035538020a94 Merge: 3caa1a1 2779faf Author: Brad King AuthorDate: Fri Mar 20 09:44:53 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:44:53 2015 -0400 Merge topic 'file-globbing-directory-listing' into next 2779faff Help: Add notes for topic 'file-globbing-directory-listing' 49ce1077 fixup! file GLOB list directories handling http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2779faff9887434dbded61bd61e70df452dd336f commit 2779faff9887434dbded61bd61e70df452dd336f Author: Brad King AuthorDate: Fri Mar 20 09:43:37 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 09:44:24 2015 -0400 Help: Add notes for topic 'file-globbing-directory-listing' diff --git a/Help/release/dev/file-globbing-directory-listing.rst b/Help/release/dev/file-globbing-directory-listing.rst new file mode 100644 index 0000000..c4d7ba5 --- /dev/null +++ b/Help/release/dev/file-globbing-directory-listing.rst @@ -0,0 +1,6 @@ +file-globbing-directory-listing +------------------------------- + +* The :command:`file(GLOB)` and :command:`file(GLOB_RECURSE)` commands + learned a new ``LIST_DIRECTORIES `` option to specify whether + the glob result should include directories. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49ce1077a20cd203f1d87e32114be06bd15520d0 commit 49ce1077a20cd203f1d87e32114be06bd15520d0 Author: Brad King AuthorDate: Fri Mar 20 09:41:38 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 09:41:38 2015 -0400 fixup! file GLOB list directories handling diff --git a/Help/command/file.rst b/Help/command/file.rst index bcecb64..2fe7414 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -92,9 +92,12 @@ store it in a ````. :: - file(GLOB [LIST_DIRECTORIES true|false] [RELATIVE ] [...]) - file(GLOB_RECURSE [LIST_DIRECTORIES true|false] [RELATIVE ] - [FOLLOW_SYMLINKS] [...]) + file(GLOB + [LIST_DIRECTORIES true|false] [RELATIVE ] + [...]) + file(GLOB_RECURSE [FOLLOW_SYMLINKS] + [LIST_DIRECTORIES true|false] [RELATIVE ] + [...]) Generate a list of files that match the ```` and store it into the ````. Globbing expressions are similar to ----------------------------------------------------------------------- Summary of changes: Help/command/file.rst | 9 ++++++--- Help/release/dev/file-globbing-directory-listing.rst | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 Help/release/dev/file-globbing-directory-listing.rst hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:46:07 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:46:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1104-g95e89a6 Message-ID: <20150320134607.9734DAC0B4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 95e89a6bfa0917ed99ff58c698d8260eabb4dcc9 (commit) via 6e54b0b91032d858ae33b3cb093b5e4c9e15970e (commit) via a2c068a7ce47ab5934735b9f9168dda9760646ec (commit) from 5ac4b4738ac4eccf5546d2308268035538020a94 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95e89a6bfa0917ed99ff58c698d8260eabb4dcc9 commit 95e89a6bfa0917ed99ff58c698d8260eabb4dcc9 Merge: 5ac4b47 6e54b0b Author: Brad King AuthorDate: Fri Mar 20 09:46:06 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:46:06 2015 -0400 Merge topic 'file-globbing-directory-listing' into next 6e54b0b9 Help: Add notes for topic 'file-globbing-directory-listing' a2c068a7 file: Teach GLOB to list directories optionally http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e54b0b91032d858ae33b3cb093b5e4c9e15970e commit 6e54b0b91032d858ae33b3cb093b5e4c9e15970e Author: Brad King AuthorDate: Fri Mar 20 09:43:37 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 09:45:51 2015 -0400 Help: Add notes for topic 'file-globbing-directory-listing' diff --git a/Help/release/dev/file-globbing-directory-listing.rst b/Help/release/dev/file-globbing-directory-listing.rst new file mode 100644 index 0000000..c4d7ba5 --- /dev/null +++ b/Help/release/dev/file-globbing-directory-listing.rst @@ -0,0 +1,6 @@ +file-globbing-directory-listing +------------------------------- + +* The :command:`file(GLOB)` and :command:`file(GLOB_RECURSE)` commands + learned a new ``LIST_DIRECTORIES `` option to specify whether + the glob result should include directories. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a2c068a7ce47ab5934735b9f9168dda9760646ec commit a2c068a7ce47ab5934735b9f9168dda9760646ec Author: Domen Vrankar AuthorDate: Tue Mar 17 23:34:03 2015 +0100 Commit: Brad King CommitDate: Fri Mar 20 09:45:25 2015 -0400 file: Teach GLOB to list directories optionally GLOB lists directories by default and GLOB_RECURSE does not. LIST_DIRECTORIES enables user to control the behavior explicitly for consistently for both GLOB and GLOB_RECURSE. diff --git a/Help/command/file.rst b/Help/command/file.rst index 73d4cfa..2fe7414 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -92,9 +92,12 @@ store it in a ````. :: - file(GLOB [RELATIVE ] [...]) - file(GLOB_RECURSE [RELATIVE ] - [FOLLOW_SYMLINKS] [...]) + file(GLOB + [LIST_DIRECTORIES true|false] [RELATIVE ] + [...]) + file(GLOB_RECURSE [FOLLOW_SYMLINKS] + [LIST_DIRECTORIES true|false] [RELATIVE ] + [...]) Generate a list of files that match the ```` and store it into the ````. Globbing expressions are similar to @@ -102,6 +105,9 @@ regular expressions, but much simpler. If ``RELATIVE`` flag is specified, the results will be returned as relative paths to the given path. +By default ``GLOB`` lists directories - directories are omited in result if +``LIST_DIRECTORIES`` is set to false. + .. note:: We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is @@ -119,6 +125,11 @@ matched directory and match the files. Subdirectories that are symlinks are only traversed if ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to ``NEW``. +By default ``GLOB_RECURSE`` omits directories from result list - setting +``LIST_DIRECTORIES`` to true adds directories to result list. +If ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to +``OLD`` then ``LIST_DIRECTORIES`` treats symlinks as directories. + Examples of recursive globbing include:: /dir/*.py - match all python files in /dir and subdirectories diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index ec22ea0..ae9099e 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -920,6 +920,35 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, bool first = true; for ( ; i != args.end(); ++i ) { + if( *i == "LIST_DIRECTORIES" ) + { + ++i; + if(i != args.end()) + { + if(cmSystemTools::IsOn(i->c_str())) + { + g.SetListDirs(true); + g.SetRecurseListDirs(true); + } + else if(cmSystemTools::IsOff(i->c_str())) + { + g.SetListDirs(false); + g.SetRecurseListDirs(false); + } + else + { + this->SetError("LIST_DIRECTORIES missing bool value."); + return false; + } + } + else + { + this->SetError("LIST_DIRECTORIES missing bool value."); + return false; + } + ++i; + } + if ( recurse && (*i == "FOLLOW_SYMLINKS") ) { explicitFollowSymlinks = true; @@ -950,6 +979,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, } } + cmsys::Glob::GlobMessages globMessages; if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) { std::string expr = this->Makefile->GetCurrentDirectory(); @@ -957,16 +987,42 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, if (!expr.empty()) { expr += "/" + *i; - g.FindFiles(expr); + g.FindFiles(expr, &globMessages); } else { - g.FindFiles(*i); + g.FindFiles(*i, &globMessages); } } else { - g.FindFiles(*i); + g.FindFiles(*i, &globMessages); + } + + if(!globMessages.empty()) + { + bool shouldExit = false; + for(cmsys::Glob::GlobMessagesIterator it=globMessages.begin(); + it != globMessages.end(); ++it) + { + if(it->type == cmsys::Glob::cyclicRecursion) + { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + "Cyclic recursion detected while globbing for '" + + *i + "':\n" + it->content); + } + else + { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "Error has occured while globbing for '" + + *i + "' - " + it->content); + shouldExit = true; + } + } + if(shouldExit) + { + return false; + } } std::vector::size_type cc; diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt new file mode 100644 index 0000000..9629cfd --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt @@ -0,0 +1 @@ +.*file LIST_DIRECTORIES missing bool value\. diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake new file mode 100644 index 0000000..a8e15f2 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST LIST_DIRECTORIES) diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt new file mode 100644 index 0000000..9629cfd --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt @@ -0,0 +1 @@ +.*file LIST_DIRECTORIES missing bool value\. diff --git a/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake new file mode 100644 index 0000000..f735433 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST LIST_DIRECTORIES 13) diff --git a/Tests/RunCMake/file/GLOB-stderr.txt b/Tests/RunCMake/file/GLOB-stderr.txt new file mode 100644 index 0000000..c47dc40 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-stderr.txt @@ -0,0 +1,6 @@ +content: 6[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir +content: 6[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir +content: 2[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 2/dir 2 file diff --git a/Tests/RunCMake/file/GLOB.cmake b/Tests/RunCMake/file/GLOB.cmake new file mode 100644 index 0000000..3d577e3 --- /dev/null +++ b/Tests/RunCMake/file/GLOB.cmake @@ -0,0 +1,28 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/dir 1 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir/dir 1 subdir file" "test file") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/dir 2 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir file" "test file") + +file(GLOB CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt new file mode 100644 index 0000000..f73aa83 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt @@ -0,0 +1,15 @@ +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 4[ ] +.*/test/abc;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 4[ ] +.*/test/abc;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink +.*Cyclic recursion detected while globbing for.* +.*/test/depth1/depth2/depth3.* +.*/test/depth1/depth2/depth3/recursion.* +content: 11[ ] +.*/test/abc;.*/test/depth1;.*/test/depth1/depth2;.*/test/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/file_symlink;.*/test/depth1/depth2/depth3/recursion;.*/test/depth1/depth2/depth3/recursion/abc;.*/test/depth1/depth2/depth3/recursion/depth1;.*/test/depth1/depth2/depth3/recursion/depth1/depth2;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3;.*/test/depth1/depth2/depth3/recursion/depth1/depth2/depth3/file_symlink diff --git a/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake new file mode 100644 index 0000000..a8c6784 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake @@ -0,0 +1,23 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3") +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/recursion") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "message to write") +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/test/abc" "${CMAKE_CURRENT_BINARY_DIR}/test/depth1/depth2/depth3/file_symlink") + +file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true FOLLOW_SYMLINKS "${CMAKE_CURRENT_BINARY_DIR}/test/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt new file mode 100644 index 0000000..5d48e47 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-stderr.txt @@ -0,0 +1,6 @@ +content: 4[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/non_empty_dir/dir 2 subdir file +content: 4[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/non_empty_dir/dir 2 subdir file +content: 8[ ] +.*/test/dir 1/dir 1 file;.*/test/dir 1/empty_dir;.*/test/dir 1/non_empty_dir;.*/test/dir 1/non_empty_dir/dir 1 subdir file;.*/test/dir 2/dir 2 file;.*/test/dir 2/empty_dir;.*/test/dir 2/non_empty_dir;.*/test/dir 2/non_empty_dir/dir 2 subdir file diff --git a/Tests/RunCMake/file/GLOB_RECURSE.cmake b/Tests/RunCMake/file/GLOB_RECURSE.cmake new file mode 100644 index 0000000..6db377b --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE.cmake @@ -0,0 +1,28 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/empty_dir") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/dir 1 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 1/non_empty_dir/dir 1 subdir file" "test file") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/dir 2 file" "test file") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/dir 2/non_empty_dir/dir 2 subdir file" "test file") + +file(GLOB_RECURSE CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES false "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") + +file(GLOB_RECURSE CONTENT_LIST LIST_DIRECTORIES true "${CMAKE_CURRENT_BINARY_DIR}/test/*/*") +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +list(SORT CONTENT_LIST) +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 14819e7..d3dfb1b 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -17,3 +17,13 @@ run_cmake(LOCK-error-no-result-variable) run_cmake(LOCK-error-no-timeout) run_cmake(LOCK-error-timeout) run_cmake(LOCK-error-unknown-option) +run_cmake(GLOB) +run_cmake(GLOB_RECURSE) +# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) +# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg) + +if(NOT WIN32 OR CYGWIN) + run_cmake(GLOB_RECURSE-cyclic-recursion) +endif() ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:47:36 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:47:36 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-445-g1b1144b Message-ID: <20150320134736.A6DA0AC192@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 1b1144b91dcaae05a0caffd3d238e76268600af7 (commit) via 2aaf4f60810a86d62927a915e9286e4c2be9c53a (commit) via f94727a9c2d2a48ecca2297675a7762cdfae460f (commit) from a066f73263c8c56f968324e51daee717291b3908 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b1144b91dcaae05a0caffd3d238e76268600af7 commit 1b1144b91dcaae05a0caffd3d238e76268600af7 Merge: a066f73 2aaf4f6 Author: Brad King AuthorDate: Fri Mar 20 09:47:35 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:47:35 2015 -0400 Merge topic 'mingw-compile-features' 2aaf4f60 Help: Add notes for topic 'mingw-compile-features' f94727a9 Record compile features for GNU on Windows (#15443) ----------------------------------------------------------------------- Summary of changes: Help/release/dev/mingw-compile-features.rst | 6 ++++++ Modules/Compiler/GNU-CXX.cmake | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/mingw-compile-features.rst hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:47:38 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:47:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-447-g543b20f Message-ID: <20150320134738.9666FAC195@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 543b20f269df537f3cde6cee1dfaeab6dd31e942 (commit) via f9d09626899a8196a2f46992585ddff21fd2de34 (commit) from 1b1144b91dcaae05a0caffd3d238e76268600af7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=543b20f269df537f3cde6cee1dfaeab6dd31e942 commit 543b20f269df537f3cde6cee1dfaeab6dd31e942 Merge: 1b1144b f9d0962 Author: Brad King AuthorDate: Fri Mar 20 09:47:37 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:47:37 2015 -0400 Merge topic 'WCDH-fix-cxx_nullptr-workaround' f9d09626 WCDH: Fix cxx_nullptr workaround for pre-C++11 compilers ----------------------------------------------------------------------- Summary of changes: Modules/WriteCompilerDetectionHeader.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:47:40 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:47:40 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-450-g4faa4c6 Message-ID: <20150320134740.B14B6AC1C6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 4faa4c60ce6d66f2789255d94ef90d1a3c7bb6de (commit) via be089724e943da786c35fddceb8d9b0e7a9fb2f5 (commit) via ffc1b9451070d9da5860533da8c19c75583e5661 (commit) from 543b20f269df537f3cde6cee1dfaeab6dd31e942 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4faa4c60ce6d66f2789255d94ef90d1a3c7bb6de commit 4faa4c60ce6d66f2789255d94ef90d1a3c7bb6de Merge: 543b20f be08972 Author: Brad King AuthorDate: Fri Mar 20 09:47:39 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:47:39 2015 -0400 Merge topic 'cpack_rpm_component_fall_through' be089724 CPack/RPM prevent component attributes leakage ffc1b945 CPack/RPM improved component override test ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 1273 ++++++++++---------- .../MyLibCPackConfig-IgnoreGroup.cmake.in | 8 +- .../RunCPackVerifyResult.cmake | 16 +- 3 files changed, 633 insertions(+), 664 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:47:45 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:47:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-453-gac7d868 Message-ID: <20150320134745.51B83AC1E4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ac7d8684c56063469b3ee03cd4f5a60a4a01789e (commit) via 6794079523de41837b43e23128643e6b2c3e9ae7 (commit) via ded79a976e2b63bbfd7a63f27ec00bd071410e27 (commit) from 4faa4c60ce6d66f2789255d94ef90d1a3c7bb6de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac7d8684c56063469b3ee03cd4f5a60a4a01789e commit ac7d8684c56063469b3ee03cd4f5a60a4a01789e Merge: 4faa4c6 6794079 Author: Brad King AuthorDate: Fri Mar 20 09:47:43 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:47:43 2015 -0400 Merge topic 'update-kwiml' 67940795 Merge branch 'upstream-kwiml' into update-kwiml ded79a97 KWIML: Teach ABI.h about Xtensa architecture ----------------------------------------------------------------------- Summary of changes: Utilities/KWIML/ABI.h.in | 6 ++++++ 1 file changed, 6 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:47:47 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:47:47 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-455-gc3f4167 Message-ID: <20150320134747.7AC76AC1E4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c3f416726bee2175804b3004641eac6091df796d (commit) via 80afe28a1084d02dc3e010c7a0cabf5258237ddc (commit) from ac7d8684c56063469b3ee03cd4f5a60a4a01789e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3f416726bee2175804b3004641eac6091df796d commit c3f416726bee2175804b3004641eac6091df796d Merge: ac7d868 80afe28 Author: Brad King AuthorDate: Fri Mar 20 09:47:46 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:47:46 2015 -0400 Merge topic 'ninja-no-circular-phony' 80afe28a Ninja: Do not generate circular phony rules (#15454) ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalNinjaGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:47:49 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:47:49 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-458-gd4d56f6 Message-ID: <20150320134749.8416DAC20B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d4d56f636b653c1b5d169be8c476b2f872bc6558 (commit) via 0e8325db66c3be268321aa7b274fbcd9109174b3 (commit) via bc67dbede991be9238e8a102bfb026054b48d83d (commit) from c3f416726bee2175804b3004641eac6091df796d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4d56f636b653c1b5d169be8c476b2f872bc6558 commit d4d56f636b653c1b5d169be8c476b2f872bc6558 Merge: c3f4167 0e8325d Author: Brad King AuthorDate: Fri Mar 20 09:47:48 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:47:48 2015 -0400 Merge topic 'update-kwsys' 0e8325db Merge branch 'upstream-kwsys' into update-kwsys bc67dbed KWSys 2015-03-18 (9367a33b) ----------------------------------------------------------------------- Summary of changes: Source/kwsys/SystemInformation.cxx | 8 ++++++++ Source/kwsys/testHashSTL.cxx | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:47:51 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:47:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-460-gf447027 Message-ID: <20150320134751.63AFDAC1E4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via f447027307f32b9caa126631faaeab55b7e2133c (commit) via 394514135ee0c970f1f28770db8642515fd31891 (commit) from d4d56f636b653c1b5d169be8c476b2f872bc6558 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f447027307f32b9caa126631faaeab55b7e2133c commit f447027307f32b9caa126631faaeab55b7e2133c Merge: d4d56f6 3945141 Author: Brad King AuthorDate: Fri Mar 20 09:47:50 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:47:50 2015 -0400 Merge topic 'fix-FindPackageHandleStandardArgs-doc' 39451413 FPHSA: Revise documented command signature ----------------------------------------------------------------------- Summary of changes: Modules/FindPackageHandleStandardArgs.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:47:53 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:47:53 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-463-gc95e523 Message-ID: <20150320134753.BA004AC1E3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c95e523db87cd503c97ca2a6021614393bb33e0b (commit) via 6e54b0b91032d858ae33b3cb093b5e4c9e15970e (commit) via a2c068a7ce47ab5934735b9f9168dda9760646ec (commit) from f447027307f32b9caa126631faaeab55b7e2133c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c95e523db87cd503c97ca2a6021614393bb33e0b commit c95e523db87cd503c97ca2a6021614393bb33e0b Merge: f447027 6e54b0b Author: Brad King AuthorDate: Fri Mar 20 09:47:52 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 09:47:52 2015 -0400 Merge topic 'file-globbing-directory-listing' 6e54b0b9 Help: Add notes for topic 'file-globbing-directory-listing' a2c068a7 file: Teach GLOB to list directories optionally ----------------------------------------------------------------------- Summary of changes: Help/command/file.rst | 17 +++++- .../dev/file-globbing-directory-listing.rst | 6 ++ Source/cmFileCommand.cxx | 62 +++++++++++++++++++- .../GLOB-error-LIST_DIRECTORIES-no-arg-result.txt} | 0 .../GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt | 1 + .../file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake | 1 + ...-error-LIST_DIRECTORIES-not-boolean-result.txt} | 0 ...B-error-LIST_DIRECTORIES-not-boolean-stderr.txt | 1 + .../GLOB-error-LIST_DIRECTORIES-not-boolean.cmake | 1 + Tests/RunCMake/file/GLOB-stderr.txt | 6 ++ Tests/RunCMake/file/GLOB.cmake | 28 +++++++++ .../file/GLOB_RECURSE-cyclic-recursion-stderr.txt | 15 +++++ .../file/GLOB_RECURSE-cyclic-recursion.cmake | 23 ++++++++ Tests/RunCMake/file/GLOB_RECURSE-stderr.txt | 6 ++ Tests/RunCMake/file/GLOB_RECURSE.cmake | 28 +++++++++ Tests/RunCMake/file/RunCMakeTest.cmake | 10 ++++ 16 files changed, 199 insertions(+), 6 deletions(-) create mode 100644 Help/release/dev/file-globbing-directory-listing.rst copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => file/GLOB-error-LIST_DIRECTORIES-no-arg-result.txt} (100%) create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-no-arg.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => file/GLOB-error-LIST_DIRECTORIES-not-boolean-result.txt} (100%) create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-error-LIST_DIRECTORIES-not-boolean.cmake create mode 100644 Tests/RunCMake/file/GLOB-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB.cmake create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-cyclic-recursion.cmake create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB_RECURSE.cmake hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 09:48:37 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 09:48:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1115-gf855c4e Message-ID: <20150320134837.5C670AC216@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f855c4e9157360d4f7bd8f13dc5dc1ed1aeb74a6 (commit) via c95e523db87cd503c97ca2a6021614393bb33e0b (commit) via f447027307f32b9caa126631faaeab55b7e2133c (commit) via d4d56f636b653c1b5d169be8c476b2f872bc6558 (commit) via c3f416726bee2175804b3004641eac6091df796d (commit) via ac7d8684c56063469b3ee03cd4f5a60a4a01789e (commit) via 4faa4c60ce6d66f2789255d94ef90d1a3c7bb6de (commit) via 543b20f269df537f3cde6cee1dfaeab6dd31e942 (commit) via 1b1144b91dcaae05a0caffd3d238e76268600af7 (commit) via a066f73263c8c56f968324e51daee717291b3908 (commit) via 486e9f4f49646cf48915781a411edfe9d9ea7618 (commit) from 95e89a6bfa0917ed99ff58c698d8260eabb4dcc9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f855c4e9157360d4f7bd8f13dc5dc1ed1aeb74a6 commit f855c4e9157360d4f7bd8f13dc5dc1ed1aeb74a6 Merge: 95e89a6 c95e523 Author: Brad King AuthorDate: Fri Mar 20 09:48:30 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 09:48:30 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 10:11:13 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 10:11:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1117-g09b0ec9 Message-ID: <20150320141113.DF729AB0AD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 09b0ec9428c45f7d95bf4f2aedac27f2ccec80c6 (commit) via 6eee67b2cc2a93ceddd6adef27e9df630c81e342 (commit) from f855c4e9157360d4f7bd8f13dc5dc1ed1aeb74a6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=09b0ec9428c45f7d95bf4f2aedac27f2ccec80c6 commit 09b0ec9428c45f7d95bf4f2aedac27f2ccec80c6 Merge: f855c4e 6eee67b Author: Brad King AuthorDate: Fri Mar 20 10:11:13 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 10:11:13 2015 -0400 Merge topic 'xcode-xctest' into next 6eee67b2 fixup! Tests: Add XCTest example to test Frameworks and Cocoa App Bundles http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6eee67b2cc2a93ceddd6adef27e9df630c81e342 commit 6eee67b2cc2a93ceddd6adef27e9df630c81e342 Author: Brad King AuthorDate: Fri Mar 20 10:09:11 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 10:09:11 2015 -0400 fixup! Tests: Add XCTest example to test Frameworks and Cocoa App Bundles diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index aa03f86..9e419f8 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1505,7 +1505,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5 + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6 AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1}) ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $ -V) ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 10:26:33 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 10:26:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1119-g6d64981 Message-ID: <20150320142633.84793ACB81@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6d64981a1e9a676ea076f9d4420e536f7b108dbc (commit) via f85db2f32358e6de921aba7d1cb8ecb81da934c0 (commit) from 09b0ec9428c45f7d95bf4f2aedac27f2ccec80c6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d64981a1e9a676ea076f9d4420e536f7b108dbc commit 6d64981a1e9a676ea076f9d4420e536f7b108dbc Merge: 09b0ec9 f85db2f Author: Brad King AuthorDate: Fri Mar 20 10:26:32 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 10:26:32 2015 -0400 Merge topic 'add-extra-qbs-generator' into next f85db2f3 Qbs: Add new 'extra' generator for qbs project files http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f85db2f32358e6de921aba7d1cb8ecb81da934c0 commit f85db2f32358e6de921aba7d1cb8ecb81da934c0 Author: Stanislav Ionascu AuthorDate: Sun Feb 8 13:50:16 2015 +0100 Commit: Brad King CommitDate: Fri Mar 20 10:25:11 2015 -0400 Qbs: Add new 'extra' generator for qbs project files diff --git a/Help/generator/Qbs.rst b/Help/generator/Qbs.rst new file mode 100644 index 0000000..e569b77 --- /dev/null +++ b/Help/generator/Qbs.rst @@ -0,0 +1,25 @@ +Qbs +--- + +Generates Qbs project files. + +Project files for Qbs will be created in the top directory and +in every subdirectory which features a CMakeLists.txt file containing +a PROJECT() call. Additionally a hierarchy of makefiles is generated +into the build tree. The appropriate make program can build the +project through the default make target. A "make install" target is +also provided. + +This "extra" generator may be specified as: + +``Qbs - MinGW Makefiles`` + Generate with :generator:`MinGW Makefiles`. + +``Qbs - NMake Makefiles`` + Generate with :generator:`NMake Makefiles`. + +``Qbs - Ninja`` + Generate with :generator:`Ninja`. + +``Qbs - Unix Makefiles`` + Generate with :generator:`Unix Makefiles`. diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index bda7eef..804229b 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -85,3 +85,4 @@ The following extra generators are known to CMake. /generator/KDevelop3 /generator/Kate /generator/Sublime Text 2 + /generator/Qbs diff --git a/Help/release/dev/add-extra-qbs-generator.rst b/Help/release/dev/add-extra-qbs-generator.rst new file mode 100644 index 0000000..edb441f --- /dev/null +++ b/Help/release/dev/add-extra-qbs-generator.rst @@ -0,0 +1,6 @@ +add-extra-qbs-geneator +---------------------- + +* It is now possible to generate :generator:`Qbs` project files + for use with QtCreator IDE, matching make tool must be used + to build the project through the generated makefiles. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 482bd39..04f6a81 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -229,6 +229,8 @@ set(SRCS cmExtraKateGenerator.h cmExtraSublimeTextGenerator.cxx cmExtraSublimeTextGenerator.h + cmExtraQbsGenerator.cxx + cmExtraQbsGenerator.h cmFileLock.cxx cmFileLock.h cmFileLockPool.cxx diff --git a/Source/cmExtraQbsGenerator.cxx b/Source/cmExtraQbsGenerator.cxx new file mode 100644 index 0000000..5a1f9ef --- /dev/null +++ b/Source/cmExtraQbsGenerator.cxx @@ -0,0 +1,260 @@ +#include "cmExtraQbsGenerator.h" + +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmGeneratedFileStream.h" +#include "cmSourceFile.h" + +cmExtraQbsGenerator::cmExtraQbsGenerator() +{ +#if defined(_WIN32) + this->SupportedGlobalGenerators.push_back("MinGW Makefiles"); + this->SupportedGlobalGenerators.push_back("NMake Makefiles"); +#endif + this->SupportedGlobalGenerators.push_back("Ninja"); + this->SupportedGlobalGenerators.push_back("Unix Makefiles"); +} + +cmExtraQbsGenerator::~cmExtraQbsGenerator() {} + +void cmExtraQbsGenerator::GetDocumentation(cmDocumentationEntry &entry, + const std::string &) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Qbs project files."; +} + +void cmExtraQbsGenerator::Generate() +{ + for (std::map >::const_iterator + it = this->GlobalGenerator->GetProjectMap().begin(); + it != this->GlobalGenerator->GetProjectMap().end(); ++it) + { + // create a project file + this->CreateProjectFile(it->first, it->second); + } +} + +void cmExtraQbsGenerator::CreateProjectFile( + const std::string &name, + const std::vector &lgs) +{ + const cmMakefile *mf = lgs[0]->GetMakefile(); + std::string outputDir = mf->GetStartOutputDirectory(); + + const std::string filename = outputDir + "/" + name + ".qbs"; + + this->CreateNewProjectFile(name, lgs, filename); +} + +void cmExtraQbsGenerator::CreateNewProjectFile( + const std::string &projectName, const std::vector &lgs, + const std::string &filename) +{ + cmGeneratedFileStream fout(filename.c_str()); + if (!fout) + { + return; + } + + fout << "import qbs\n" + << "import qbs.File\n\n" + << "Project {\n" + << "\tname:\"" << projectName << "\"\n"; + std::vector::const_iterator itr = lgs.begin(); + for (; itr != lgs.end(); ++itr) + { + cmLocalGenerator *lg = (*itr); + this->AppendSubProject(fout, lg); + } + fout << "}\n"; +} + +void cmExtraQbsGenerator::AppendSubProject(cmGeneratedFileStream &fout, + cmLocalGenerator *lg) +{ + const cmMakefile *mk = lg->GetMakefile(); + if (!mk || mk->GetTargets().size() == 0) + { + return; + } + + const std::string &relativePath = cmSystemTools::RelativePath( + mk->GetHomeDirectory(), mk->GetCurrentDirectory()); + fout << "\tProject {\n" + << "\t\tname:\"" << relativePath << "\"\n"; + this->AppendProduct(fout, lg); + fout << "\t}\n"; +} + +void cmExtraQbsGenerator::AppendProduct(cmGeneratedFileStream &fout, + cmLocalGenerator *lg) +{ + const cmMakefile *mk = lg->GetMakefile(); + const cmTargets &ts = mk->GetTargets(); + std::string cfg = mk->GetSafeDefinition("CMAKE_BUILD_TYPE"); + cmTargets::const_iterator itr = ts.begin(); + for (; itr != ts.end(); ++itr) + { + const cmTarget &t = itr->second; + this->AppendTarget(fout, lg, t, cfg); + } +} + +void cmExtraQbsGenerator::AppendTarget(cmGeneratedFileStream &fout, + cmLocalGenerator *lg, const cmTarget &t, + const std::string &cfg) +{ + std::string type; + bool isBuildable = true; + switch (t.GetType()) + { + case cmTarget::EXECUTABLE: + type = "application"; + break; + case cmTarget::SHARED_LIBRARY: + type = "dynamiclibrary"; + break; + case cmTarget::STATIC_LIBRARY: + type = "staticlibrary"; + break; + default: + isBuildable = false; + break; + } + + if (type.empty()) + { + fout << "\t\tProject {\n"; + } + else + { + fout << "\t\tProduct {\n"; + fout << "\t\t\tdestinationDirectory: \"" << t.GetDirectory(cfg) << "\"\n"; + } + fout << "\t\t\tname:\"" << t.GetName() << "\"\n"; + + if (!type.empty()) + { + fout << "\t\t\ttype: \"" << type << "\"\n"; + fout << "\t\t\ttargetName: \"" << t.GetName() << "\"\n"; + } + + if (isBuildable) + { + fout << "\t\t\tDepends { name: \"cpp\" }\n"; + cmGeneratorTarget *gt = this->GlobalGenerator->GetGeneratorTarget(&t); + this->AppendSources(fout, gt, t, cfg); + + std::set langs, incPaths, defs; + t.GetLanguages(langs, cfg); + for (std::set::const_iterator lang = langs.begin(); + lang != langs.end(); + ++ lang) + { + const std::vector &paths = + gt->GetIncludeDirectories(cfg, *lang); + std::copy(paths.begin(), paths.end(), + std::inserter(incPaths, incPaths.end())); + + lg->AddCompileDefinitions(defs, &t, cfg, *lang); + } + this->AppendIncludePaths(fout, incPaths); + this->AppendCompileDefinitions(fout, defs); + } + + fout << "\t\t}\n"; +} + +void cmExtraQbsGenerator::AppendSources(cmGeneratedFileStream &fout, + cmGeneratorTarget *gt, + const cmTarget &t, + const std::string &cfg) +{ + std::vector sources; + gt->GetSourceFiles(sources, cfg); + if (sources.empty()) + { + return; + } + + std::vector genSources; + std::vector::const_iterator itr = sources.begin(); + fout << "\t\t\tfiles: [\n" + << "\t\t\t\t\"" << t.GetMakefile()->GetCurrentListFile() << "\",\n"; + for (; itr != sources.end(); ++itr) + { + if (!(*itr)->GetPropertyAsBool("GENERATED")) + { + fout << "\t\t\t\t\"" << (*itr)->GetFullPath() << "\",\n"; + } + else + { + genSources.push_back(*itr); + } + } + fout << "\t\t\t]\n"; + + if (!genSources.empty()) + { + fout << "\t\t\tGroup {\n" + << "\t\t\t\tname:\"Generated\"\n" + << "\t\t\t\tfiles: [\n"; + itr = genSources.begin(); + std::string groupCondition; + bool initialCondition = true; + for (; itr != genSources.end(); ++itr) + { + const std::string &path = (*itr)->GetFullPath(); + fout << "\t\t\t\t\t\"" << path << "\",\n"; + if (initialCondition) + { + initialCondition = false; + } + else + { + groupCondition += "\t\t\t\t\t && "; + } + groupCondition += "File.exists(\"" + path + "\")\n"; + } + fout << "\t\t\t\t]\n" + << "\t\t\t\tcondition: " << groupCondition << "\t\t\t}\n"; + } +} + +void cmExtraQbsGenerator::AppendIncludePaths( + cmGeneratedFileStream &fout, + const std::set &paths) +{ + if (paths.empty()) + { + return; + } + + std::set::const_iterator itr = paths.begin(); + fout << "\t\t\tcpp.includePaths: [\n"; + for (; itr != paths.end(); ++ itr) + { + fout << "\t\t\t\t\"" << (*itr) << "\",\n"; + } + fout << "\t\t\t]\n"; +} + +void cmExtraQbsGenerator::AppendCompileDefinitions( + cmGeneratedFileStream &fout, + const std::set &defs) +{ + if (defs.empty()) + { + return; + } + + std::set::const_iterator itr = defs.begin(); + fout << "\t\t\tcpp.defines: [\n"; + for (; itr != defs.end(); ++ itr) + { + fout << "\t\t\t\t'" << (*itr) << "',\n"; + } + fout << "\t\t\t]\n"; +} diff --git a/Source/cmExtraQbsGenerator.h b/Source/cmExtraQbsGenerator.h new file mode 100644 index 0000000..531ccc9 --- /dev/null +++ b/Source/cmExtraQbsGenerator.h @@ -0,0 +1,48 @@ +#ifndef CMEXTRAQBSGENERATOR_H +#define CMEXTRAQBSGENERATOR_H + +#include "cmExternalMakefileProjectGenerator.h" + +class cmGeneratorTarget; + +class cmExtraQbsGenerator : public cmExternalMakefileProjectGenerator +{ +public: + cmExtraQbsGenerator(); + ~cmExtraQbsGenerator(); + + virtual std::string GetName() const + { return cmExtraQbsGenerator::GetActualName(); } + static std::string GetActualName() { return "Qbs"; } + static cmExternalMakefileProjectGenerator *New() + { return new cmExtraQbsGenerator; } + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry &entry, + const std::string &fullName) const; + + virtual void Generate(); + +private: + void CreateProjectFile(const std::string &name, + const std::vector &lgs); + void CreateNewProjectFile(const std::string &projectName, + const std::vector &lgs, + const std::string &filename); + void AppendSubProject(cmGeneratedFileStream &fout, cmLocalGenerator *lg); + void AppendProduct(cmGeneratedFileStream &fout, cmLocalGenerator *lg); + void AppendTarget(cmGeneratedFileStream &fout, + cmLocalGenerator *lg, + const cmTarget &t, + const std::string &cfg); + void AppendSources(cmGeneratedFileStream &fout, + cmGeneratorTarget *gt, + const cmTarget &t, + const std::string &cfg); + void AppendIncludePaths(cmGeneratedFileStream &fout, + const std::set &paths); + void AppendCompileDefinitions(cmGeneratedFileStream &fout, + const std::set &defs); +}; + +#endif // CMEXTRAQBSGENERATOR_H diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 11196e4..51df7f2 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -86,6 +86,8 @@ # include "cmGlobalKdevelopGenerator.h" #endif +#include "cmExtraQbsGenerator.h" + #ifdef CMAKE_USE_ECLIPSE # include "cmExtraEclipseCDT4Generator.h" #endif @@ -1029,6 +1031,8 @@ void cmake::AddDefaultExtraGenerators() &cmExtraSublimeTextGenerator::New); this->AddExtraGenerator(cmExtraKateGenerator::GetActualName(), &cmExtraKateGenerator::New); + this->AddExtraGenerator(cmExtraQbsGenerator::GetActualName(), + &cmExtraQbsGenerator::New); #ifdef CMAKE_USE_ECLIPSE this->AddExtraGenerator(cmExtraEclipseCDT4Generator::GetActualName(), diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 40bea51..5fa7044 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -560,7 +560,21 @@ if(BUILD_TESTING) --test-command Simple) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator") endif () - + # check for the Qbs generator + if ("${cmakeOutput}" MATCHES Qbs) + add_test(Simple_QbsGenerator ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Simple" + "${CMake_BINARY_DIR}/Tests/Simple_QbsGenerator" + --build-two-config + --build-generator "Qbs - Unix Makefiles" + --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" + --build-project Simple + --build-options ${build_options} + --test-command Simple) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_QbsGenerator") + endif () endif() # test for correct sub-project generation ----------------------------------------------------------------------- Summary of changes: Help/generator/{CodeBlocks.rst => Qbs.rst} | 16 +- Help/manual/cmake-generators.7.rst | 1 + Help/release/dev/add-extra-qbs-generator.rst | 6 + Source/CMakeLists.txt | 2 + Source/cmExtraQbsGenerator.cxx | 260 ++++++++++++++++++++++++++ Source/cmExtraQbsGenerator.h | 48 +++++ Source/cmake.cxx | 4 + Tests/CMakeLists.txt | 16 +- 8 files changed, 344 insertions(+), 9 deletions(-) copy Help/generator/{CodeBlocks.rst => Qbs.rst} (67%) create mode 100644 Help/release/dev/add-extra-qbs-generator.rst create mode 100644 Source/cmExtraQbsGenerator.cxx create mode 100644 Source/cmExtraQbsGenerator.h hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 10:38:03 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 10:38:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1121-g0beaa35 Message-ID: <20150320143803.9F8A5ACF1A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0beaa3508ad731dc0ca1b198b0a5a28b60e682ca (commit) via 610464c12e0ef71b2bea28973b70630c4ce9a70e (commit) from 6d64981a1e9a676ea076f9d4420e536f7b108dbc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0beaa3508ad731dc0ca1b198b0a5a28b60e682ca commit 0beaa3508ad731dc0ca1b198b0a5a28b60e682ca Merge: 6d64981 610464c Author: Brad King AuthorDate: Fri Mar 20 10:38:02 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 10:38:02 2015 -0400 Merge topic 'autogen-write-access' into next 610464c1 QtAutogen: Ensure write access to AutogenInfo.cmake (#15416) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=610464c12e0ef71b2bea28973b70630c4ce9a70e commit 610464c12e0ef71b2bea28973b70630c4ce9a70e Author: Justin Borodinsky AuthorDate: Wed Mar 18 20:30:26 2015 -0500 Commit: Brad King CommitDate: Fri Mar 20 10:33:52 2015 -0400 QtAutogen: Ensure write access to AutogenInfo.cmake (#15416) ConfigureFile uses the input file permissions, but we require write access in cmQtAutoGenerators::SetupAutoGenerateTarget to append to the file. diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 42c18f7..08092c7 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -22,6 +22,8 @@ # include "cmLocalVisualStudioGenerator.h" #endif +#include + #include #include #include @@ -582,6 +584,18 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true, false); + // Ensure we have write permission in case .in was read-only. + mode_t perm = 0; +#if defined(WIN32) && !defined(__CYGWIN__) + mode_t mode_write = S_IWRITE; +#else + mode_t mode_write = S_IWUSR; +#endif + cmSystemTools::GetPermissions(outputFile, perm); + if (!(perm & mode_write)) + { + cmSystemTools::SetPermissions(outputFile, perm | mode_write); + } if (!configDefines.empty() || !configIncludes.empty() || !configUicOptions.empty()) ----------------------------------------------------------------------- Summary of changes: Source/cmQtAutoGenerators.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 10:49:33 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 10:49:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1123-ga745e32 Message-ID: <20150320144933.0684EAC47E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a745e32037c7dfd326a0776decf3592686f8200c (commit) via a21e8df0da0d43f8c678d4c07f731035d04c0e27 (commit) from 0beaa3508ad731dc0ca1b198b0a5a28b60e682ca (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a745e32037c7dfd326a0776decf3592686f8200c commit a745e32037c7dfd326a0776decf3592686f8200c Merge: 0beaa35 a21e8df Author: Brad King AuthorDate: Fri Mar 20 10:49:32 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 10:49:32 2015 -0400 Merge topic 'UseJava-fix-arg-parse' into next a21e8df0 UseJava: Fix add_jar argument parsing (#14655) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a21e8df0da0d43f8c678d4c07f731035d04c0e27 commit a21e8df0da0d43f8c678d4c07f731035d04c0e27 Author: Mark Studenka AuthorDate: Thu Mar 19 10:55:00 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 10:46:13 2015 -0400 UseJava: Fix add_jar argument parsing (#14655) Since commit v2.8.11~63^2 (UseJava.cmake: require explicit request to include jars, 2013-03-26) the argument parsing always overrides the variable settings even if the corresponding arguments are not passed. Re-order logic to fix this. diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 3a6acd8..5eb0ca8 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -340,6 +340,13 @@ set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) function(add_jar _TARGET_NAME) + cmake_parse_arguments(_add_jar + "" + "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST" + "SOURCES;INCLUDE_JARS" + ${ARGN} + ) + # In CMake < 2.8.12, add_jar used variables which were set prior to calling # add_jar for customizing the behavior of add_jar. In order to be backwards # compatible, check if any of those variables are set, and use them to @@ -347,28 +354,21 @@ function(add_jar _TARGET_NAME) # argument will override the value set here.) # # New features should use named arguments only. - if(DEFINED CMAKE_JAVA_TARGET_VERSION) + if(NOT DEFINED _add_jar_VERSION AND DEFINED CMAKE_JAVA_TARGET_VERSION) set(_add_jar_VERSION "${CMAKE_JAVA_TARGET_VERSION}") endif() - if(DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) + if(NOT DEFINED _add_jar_OUTPUT_DIR AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) set(_add_jar_OUTPUT_DIR "${CMAKE_JAVA_TARGET_OUTPUT_DIR}") endif() - if(DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME) + if(NOT DEFINED _add_jar_OUTPUT_NAME AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME) set(_add_jar_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}") # reset set(CMAKE_JAVA_TARGET_OUTPUT_NAME) endif() - if(DEFINED CMAKE_JAVA_JAR_ENTRY_POINT) + if(NOT DEFINED _add_jar_ENTRY_POINT AND DEFINED CMAKE_JAVA_JAR_ENTRY_POINT) set(_add_jar_ENTRY_POINT "${CMAKE_JAVA_JAR_ENTRY_POINT}") endif() - cmake_parse_arguments(_add_jar - "" - "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST" - "SOURCES;INCLUDE_JARS" - ${ARGN} - ) - set(_JAVA_SOURCE_FILES ${_add_jar_SOURCES} ${_add_jar_UNPARSED_ARGUMENTS}) if (NOT DEFINED _add_jar_OUTPUT_DIR) ----------------------------------------------------------------------- Summary of changes: Modules/UseJava.cmake | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) hooks/post-receive -- CMake From gjasny at googlemail.com Fri Mar 20 11:13:55 2015 From: gjasny at googlemail.com (Gregor Jasny) Date: Fri, 20 Mar 2015 11:13:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1125-g15ef2b1 Message-ID: <20150320151355.E1534ABF78@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 15ef2b1ba46c8e4fdcc91b4de6070f3b8cdfab28 (commit) via dc918ca9135d8acc7cdc607c5a799d9b905ae594 (commit) from a745e32037c7dfd326a0776decf3592686f8200c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15ef2b1ba46c8e4fdcc91b4de6070f3b8cdfab28 commit 15ef2b1ba46c8e4fdcc91b4de6070f3b8cdfab28 Merge: a745e32 dc918ca Author: Gregor Jasny AuthorDate: Fri Mar 20 11:13:55 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 11:13:55 2015 -0400 Merge topic 'xcode-xctest' into next dc918ca9 fixup! OS X: Add handling for XCTest bundles http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc918ca9135d8acc7cdc607c5a799d9b905ae594 commit dc918ca9135d8acc7cdc607c5a799d9b905ae594 Author: Gregor Jasny AuthorDate: Fri Mar 20 16:06:23 2015 +0100 Commit: Gregor Jasny CommitDate: Fri Mar 20 16:06:52 2015 +0100 fixup! OS X: Add handling for XCTest bundles Signed-off-by: Gregor Jasny diff --git a/Help/prop_tgt/XCTEST.rst b/Help/prop_tgt/XCTEST.rst index f3ff474..eb47e60 100644 --- a/Help/prop_tgt/XCTEST.rst +++ b/Help/prop_tgt/XCTEST.rst @@ -3,8 +3,8 @@ XCTEST This target is a XCTest CFBundle on the Mac. -This property will usually get set via the ``add_xctest`` macro in -:module:`FindXCTest` module. +This property will usually get set via the :command:`xctest_add_bundle` +macro in :module:`FindXCTest` module. If a module library target has this property set to true it will be built as a CFBundle when built on the Mac. It will have the directory ----------------------------------------------------------------------- Summary of changes: Help/prop_tgt/XCTEST.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From gjasny at googlemail.com Fri Mar 20 11:42:19 2015 From: gjasny at googlemail.com (Gregor Jasny) Date: Fri, 20 Mar 2015 11:42:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1128-g2c99728 Message-ID: <20150320154219.B56A4ABD70@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2c99728ad123267ffb654fd47636b6df600a7c89 (commit) via a6248fa10c53b26189a5450a41504cf486e30fba (commit) via c567c01045e8bda66c40962686a07a1a567f99a1 (commit) from 15ef2b1ba46c8e4fdcc91b4de6070f3b8cdfab28 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c99728ad123267ffb654fd47636b6df600a7c89 commit 2c99728ad123267ffb654fd47636b6df600a7c89 Merge: 15ef2b1 a6248fa Author: Gregor Jasny AuthorDate: Fri Mar 20 11:42:18 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 11:42:18 2015 -0400 Merge topic 'xcode-xctest' into next a6248fa1 fixup! OS X: Add FindXCTest module c567c010 fixup! OS X: Add FindXCTest module http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6248fa10c53b26189a5450a41504cf486e30fba commit a6248fa10c53b26189a5450a41504cf486e30fba Author: Gregor Jasny AuthorDate: Fri Mar 20 16:29:39 2015 +0100 Commit: Gregor Jasny CommitDate: Fri Mar 20 16:29:50 2015 +0100 fixup! OS X: Add FindXCTest module Signed-off-by: Gregor Jasny diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake index 82614e4..3cd9c22 100644 --- a/Modules/FindXCTest.cmake +++ b/Modules/FindXCTest.cmake @@ -5,9 +5,10 @@ FindXCTest Functions to help creating and executing XCTest bundles. An XCTest bundle is a CFBundle with a special product-type -and bundle extension. For more information about XCTest visit -the Mac Developer library at: -http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ +and bundle extension. The Mac Developer Library provides more +information in the `Testing with Xcode`_ document. + +.. _Testing with Xcode: http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ Module Functions ^^^^^^^^^^^^^^^^ http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c567c01045e8bda66c40962686a07a1a567f99a1 commit c567c01045e8bda66c40962686a07a1a567f99a1 Author: Gregor Jasny AuthorDate: Fri Mar 20 16:19:46 2015 +0100 Commit: Gregor Jasny CommitDate: Fri Mar 20 16:19:46 2015 +0100 fixup! OS X: Add FindXCTest module Signed-off-by: Gregor Jasny diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake index 2a341ce..82614e4 100644 --- a/Modules/FindXCTest.cmake +++ b/Modules/FindXCTest.cmake @@ -45,8 +45,7 @@ The following variables are set by including this module: .. variable:: XCTest_EXECUTABLE - The ``XCTEST_EXECUTABLE`` variable contains the path to the xctest - command line tool used to execute XCTest bundles. + The path to the xctest command line tool used to execute XCTest bundles. .. variable:: XCTest_INCLUDE_DIRS ----------------------------------------------------------------------- Summary of changes: Modules/FindXCTest.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 13:02:05 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 13:02:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1130-g4bf2084 Message-ID: <20150320170205.E3D45ACC0E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 4bf20848b81d98a2d138862f47aba20a19c92652 (commit) via 00842df48d8d3585562b8d64d56cd6646dc9d3ff (commit) from 2c99728ad123267ffb654fd47636b6df600a7c89 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4bf20848b81d98a2d138862f47aba20a19c92652 commit 4bf20848b81d98a2d138862f47aba20a19c92652 Merge: 2c99728 00842df Author: Brad King AuthorDate: Fri Mar 20 13:02:05 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 13:02:05 2015 -0400 Merge topic 'pgi-no-pie' into next 00842df4 PGI: Remove invalid -fPIE flag (#15460) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00842df48d8d3585562b8d64d56cd6646dc9d3ff commit 00842df48d8d3585562b8d64d56cd6646dc9d3ff Author: Brad King AuthorDate: Fri Mar 20 12:59:54 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 12:59:54 2015 -0400 PGI: Remove invalid -fPIE flag (#15460) The PGI compilers on Linux do not have the -fPIE flag. Remove the table entry added by commit v2.8.9~125^2~2 (Add platform variables for position independent code flags, 2012-05-05), which likely included it only as part of a sweeping introduction of such flags. diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake index 3cbb35c..baa2248 100644 --- a/Modules/Platform/Linux-PGI.cmake +++ b/Modules/Platform/Linux-PGI.cmake @@ -21,7 +21,7 @@ set(__LINUX_COMPILER_PGI 1) macro(__linux_compiler_pgi lang) # Shared library compile and link flags. set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") - set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") endmacro() ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Linux-PGI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 20 13:05:34 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 20 Mar 2015 13:05:34 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1132-gc583042 Message-ID: <20150320170535.40E7CACC83@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c583042c126d064d75eb6cecefc80b4e644c2abd (commit) via 3556fb1b81fccac63600a2509f92e9ef738fed69 (commit) from 4bf20848b81d98a2d138862f47aba20a19c92652 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c583042c126d064d75eb6cecefc80b4e644c2abd commit c583042c126d064d75eb6cecefc80b4e644c2abd Merge: 4bf2084 3556fb1 Author: Brad King AuthorDate: Fri Mar 20 13:05:33 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 13:05:33 2015 -0400 Merge topic 'SunPro-Fortran-KPIC' into next 3556fb1b SunPro: Add position independent code flag for Fortran compiler http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3556fb1b81fccac63600a2509f92e9ef738fed69 commit 3556fb1b81fccac63600a2509f92e9ef738fed69 Author: Steven Vancoillie AuthorDate: Fri Mar 20 09:13:00 2015 +0100 Commit: Brad King CommitDate: Fri Mar 20 13:05:05 2015 -0400 SunPro: Add position independent code flag for Fortran compiler diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index e4db1e8..196aae4 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -2,6 +2,7 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") +set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-KPIC") set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC") set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G") set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R") ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/SunPro-Fortran.cmake | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From zack.galbreath at kitware.com Fri Mar 20 15:16:33 2015 From: zack.galbreath at kitware.com (Zack Galbreath) Date: Fri, 20 Mar 2015 15:16:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1134-gac6036b Message-ID: <20150320191639.819FAABE81@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via ac6036ba4216f1059b2e9531676de6a99e79227e (commit) via e9a0668278007cde4aed343560344a99a61accbd (commit) from c583042c126d064d75eb6cecefc80b4e644c2abd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac6036ba4216f1059b2e9531676de6a99e79227e commit ac6036ba4216f1059b2e9531676de6a99e79227e Merge: c583042 e9a0668 Author: Zack Galbreath AuthorDate: Fri Mar 20 15:16:31 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 15:16:31 2015 -0400 Merge topic 'lib64_paths_crosscompiling' into next e9a06682 Ignore Debian-specific case when cross-compiling. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e9a0668278007cde4aed343560344a99a61accbd commit e9a0668278007cde4aed343560344a99a61accbd Author: Zack Galbreath AuthorDate: Fri Mar 20 15:13:33 2015 -0400 Commit: Zack Galbreath CommitDate: Fri Mar 20 15:13:33 2015 -0400 Ignore Debian-specific case when cross-compiling. diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index fe8e003..e40a74f 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -52,6 +52,6 @@ include(Platform/UnixPaths) # Debian has lib64 paths only for compatibility so they should not be # searched. -if(EXISTS "/etc/debian_version") +if(NOT CMAKE_CROSSCOMPILING AND EXISTS "/etc/debian_version") set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) endif() ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Linux.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From domen.vrankar at gmail.com Fri Mar 20 16:57:40 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Fri, 20 Mar 2015 16:57:40 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1136-gd8ddc03 Message-ID: <20150320205744.31B45AC477@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d8ddc031d5404f53afbcdb871a229d3956e99d89 (commit) via 18917d66d4997786afcb27580518e325342117d2 (commit) from ac6036ba4216f1059b2e9531676de6a99e79227e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d8ddc031d5404f53afbcdb871a229d3956e99d89 commit d8ddc031d5404f53afbcdb871a229d3956e99d89 Merge: ac6036b 18917d6 Author: Domen Vrankar AuthorDate: Fri Mar 20 16:57:39 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 20 16:57:39 2015 -0400 Merge topic 'cpack-rpm-ignore-default-prefix' into next 18917d66 CPack/RPM ignore install prefix relocation path http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18917d66d4997786afcb27580518e325342117d2 commit 18917d66d4997786afcb27580518e325342117d2 Author: Domen Vrankar AuthorDate: Fri Mar 20 21:52:49 2015 +0100 Commit: Domen Vrankar CommitDate: Fri Mar 20 21:52:49 2015 +0100 CPack/RPM ignore install prefix relocation path Patch adds possibility to remove CPACK_PACKAGING_INSTALL_PREFIX from the list of relocation paths when crating a relocatable rpm. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 539a0aa..162eba7 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -408,6 +408,16 @@ # # May be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for # relocatable RPM packages. +# +# .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION +# CPACK_RPM_NO__INSTALL_PREFIX_RELOCATION +# +# * Mandatory : NO +# * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM__PACKAGE_PREFIX +# are treated as one of relocation paths +# +# May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM__PACKAGE_PREFIX +# from relocatable RPM prefix paths. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -437,8 +447,15 @@ function(cpack_rpm_prepare_relocation_paths) # set base path prefix if(EXISTS "${WDIR}/${PATH_PREFIX}") - set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n") - list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}") + if(NOT CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION AND + NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT}_INSTALL_PREFIX_RELOCATION) + set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n") + list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}") + + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: removing '${PATH_PREFIX}' from relocation paths") + endif() + endif() endif() # set other path prefixes diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index 109bb1c..ac9b552 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -28,6 +28,10 @@ if(CPACK_GENERATOR MATCHES "RPM") # test package description override - headers rpm is generated in the middle set(CPACK_RPM_headers_PACKAGE_DESCRIPTION "headers description") + + # test package do not use CPACK_PACKAGING_INSTALL_PREFIX + # as relocation path + set(CPACK_RPM_NO_libraries_INSTALL_PREFIX_RELOCATION true) endif() if(CPACK_GENERATOR MATCHES "DEB") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 6762b45..cf4da74 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -174,10 +174,10 @@ if(CPackGen MATCHES "RPM") if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") - set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") + set(check_content_list "^/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 21 ++++++++++++++++++-- .../MyLibCPackConfig-IgnoreGroup.cmake.in | 4 ++++ .../RunCPackVerifyResult.cmake | 4 ++-- 3 files changed, 25 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 21 00:01:04 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 21 Mar 2015 00:01:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-464-g2ec1c0d Message-ID: <20150321040105.04A10AC397@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 2ec1c0d6e07305c51e0602ddff835919b4b08ed9 (commit) from c95e523db87cd503c97ca2a6021614393bb33e0b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ec1c0d6e07305c51e0602ddff835919b4b08ed9 commit 2ec1c0d6e07305c51e0602ddff835919b4b08ed9 Author: Kitware Robot AuthorDate: Sat Mar 21 00:01:03 2015 -0400 Commit: Kitware Robot CommitDate: Sat Mar 21 00:01:03 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8127464..2e10d1f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150320) +set(CMake_VERSION_PATCH 20150321) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Sat Mar 21 10:28:12 2015 From: brad.king at kitware.com (Brad King) Date: Sat, 21 Mar 2015 10:28:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1138-ga65d1e5 Message-ID: <20150321142812.5FA55AC9CC@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a65d1e56cb589d75571a0a66b3452b4d5d994cf4 (commit) via cf434b75986b168ce9d72149898fa16ddbc41735 (commit) from d8ddc031d5404f53afbcdb871a229d3956e99d89 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a65d1e56cb589d75571a0a66b3452b4d5d994cf4 commit a65d1e56cb589d75571a0a66b3452b4d5d994cf4 Merge: d8ddc03 cf434b7 Author: Brad King AuthorDate: Sat Mar 21 10:28:11 2015 -0400 Commit: CMake Topic Stage CommitDate: Sat Mar 21 10:28:11 2015 -0400 Merge topic 'ctest-repeat-until-fail' into next cf434b75 fixup! ctest: Add a new --repeat-until-fail option http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf434b75986b168ce9d72149898fa16ddbc41735 commit cf434b75986b168ce9d72149898fa16ddbc41735 Author: Brad King AuthorDate: Sat Mar 21 10:25:48 2015 -0400 Commit: Brad King CommitDate: Sat Mar 21 10:25:48 2015 -0400 fixup! ctest: Add a new --repeat-until-fail option diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 6946a20..2cbdf9c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2022,7 +2022,7 @@ bool cmCTest::HandleCommandLineArguments(size_t &i, + args[i] + "'"; return false; } - this->RepeatTests = repeat; + this->RepeatTests = static_cast(repeat); if(repeat > 1) { this->RepeatUntilFail = true; ----------------------------------------------------------------------- Summary of changes: Source/cmCTest.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Sat Mar 21 10:30:41 2015 From: brad.king at kitware.com (Brad King) Date: Sat, 21 Mar 2015 10:30:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1143-g2bb3979 Message-ID: <20150321143041.74D57ACA0F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2bb3979df7234382031bb095adff94df3f29992d (commit) via bd9c7f9b2c788f9bf69c2ce4eb93d27212a6dfaa (commit) via ed8e30b00d032594fbb67d62f8bd4319ae6e5907 (commit) via ad094f435e005b484771acae36b79895c8e36e3f (commit) via 82a37d3ce5606f578997304cefc6aded15f2535c (commit) from a65d1e56cb589d75571a0a66b3452b4d5d994cf4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bb3979df7234382031bb095adff94df3f29992d commit 2bb3979df7234382031bb095adff94df3f29992d Merge: a65d1e5 bd9c7f9 Author: Brad King AuthorDate: Sat Mar 21 10:30:39 2015 -0400 Commit: CMake Topic Stage CommitDate: Sat Mar 21 10:30:39 2015 -0400 Merge topic 'ninja-require-byproducts' into next bd9c7f9b Ninja: Add policy to require explicit custom command byproducts ed8e30b0 cmGlobalNinjaGenerator: Optimize handling of known build outputs ad094f43 cmGlobalNinjaGenerator: Fix spelling of "unknown" 82a37d3c cmGlobalNinjaGenerator: Drop unused member http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd9c7f9b2c788f9bf69c2ce4eb93d27212a6dfaa commit bd9c7f9b2c788f9bf69c2ce4eb93d27212a6dfaa Author: Brad King AuthorDate: Fri Mar 20 16:43:21 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 17:40:12 2015 -0400 Ninja: Add policy to require explicit custom command byproducts Add policy CMP0058 to avoid generating 'phony' ninja rules for unknown custom command dependencies. This requires projects to specify their custom command byproducts explicitly. With this requirement we no longer have to assume that unknown custom command dependencies are generated and can instead simply assume they are source files expected to exist when the build starts. This is particularly important in in-source builds. It is also helpful for out-of-source builds to allow Ninja to diagnose missing files before running custom command rules that depend on them. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 76ca5d4..228df14 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -115,3 +115,4 @@ All Policies /policy/CMP0055 /policy/CMP0056 /policy/CMP0057 + /policy/CMP0058 diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst new file mode 100644 index 0000000..0f20383 --- /dev/null +++ b/Help/policy/CMP0058.rst @@ -0,0 +1,108 @@ +CMP0058 +------- + +Ninja requires custom command byproducts to be explicit. + +When an intermediate file generated during the build is consumed +by an expensive operation or a large tree of dependents, one may +reduce the work needed for an incremental rebuild by updating the +file timestamp only when its content changes. With this approach +the generation rule must have a separate output file that is always +updated with a new timestamp that is newer than any dependencies of +the rule so that the build tool re-runs the rule only when the input +changes. We refer to the separate output file as a rule's *witness* +and the generated file as a rule's *byproduct*. + +Byproducts may not be listed as outputs because their timestamps are +allowed to be older than the inputs. No build tools (like ``make``) +that existed when CMake was designed have a way to express byproducts. +Therefore CMake versions prior to 3.2 had no way to specify them. +Projects typically left byproducts undeclared in the rules that +generate them. For example: + +.. code-block:: cmake + + add_custom_command( + OUTPUT witness.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/input.txt + byproduct.txt # timestamp may not change + COMMAND ${CMAKE_COMMAND} -E touch witness.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/input.txt + ) + add_custom_target(Provider DEPENDS witness.txt) + add_custom_command( + OUTPUT generated.c + COMMAND expensive-task -i byproduct.txt -o generated.c + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/byproduct.txt + ) + add_library(Consumer generated.c) + add_dependencies(Consumer Provider) + +This works well for all generators except :generator:`Ninja`. +The Ninja build tool sees a rule listing ``byproduct.txt`` +as a dependency and no rule listing it as an output. Ninja then +complains that there is no way to satisfy the dependency and +stops building even though there are order-only dependencies +that ensure ``byproduct.txt`` will exist before its consumers +need it. See discussion of this problem in `Ninja Issue 760`_ +for further details on why Ninja works this way. + +.. _`Ninja Issue 760`: https://github.com/martine/ninja/issues/760 + +Instead of leaving byproducts undeclared in the rules that generate +them, Ninja expects byproducts to be listed along with other outputs. +Such rules may be marked with a ``restat`` option that tells Ninja +to check the timestamps of outputs after the rules run. This +prevents byproducts whose timestamps do not change from causing +their dependents to re-build unnecessarily. + +Since the above approach does not tell CMake what custom command +generates ``byproduct.txt``, the Ninja generator does not have +enough information to add the byproduct as an output of any rule. +CMake 2.8.12 and above work around this problem and allow projects +using the above approach to build by generating ``phony`` build +rules to tell Ninja to tolerate such missing files. However, this +workaround prevents Ninja from diagnosing a dependency that is +really missing. It also works poorly in in-source builds where +every custom command dependency, even on source files, needs to +be treated this way because CMake does not have enough information +to know which files are generated as byproducts of custom commands. + +CMake 3.2 introduced the ``BYPRODUCTS`` option to the +:command:`add_custom_command` and :command:`add_custom_target` +commands. This option allows byproducts to be specified explicitly: + +.. code-block:: cmake + + add_custom_command( + OUTPUT witness.txt + BYPRODUCTS byproduct.txt # explicit byproduct specification + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/input.txt + byproduct.txt # timestamp may not change + ... + +The ``BYPRODUCTS`` option is used by the :generator:`Ninja` generator +to list byproducts among the outputs of the custom commands that +generate them, and is ignored by other generators. + +CMake 3.3 and above prefer to require projects to specify custom +command byproducts explicitly so that it can avoid using the +``phony`` rule workaround altogether. Policy ``CMP0058`` was +introduced to provide compatibility with existing projects that +still need the workaround. + +This policy has no effect on generators other than :generator:`Ninja`. +The ``OLD`` behavior for this policy is to generate Ninja ``phony`` +rules for unknown dependencies in the build tree. The ``NEW`` +behavior for this policy is to not generate these and instead +require projects to specify custom command ``BYPRODUCTS`` explicitly. + +This policy was introduced in CMake version 3.3. +CMake version |release| warns when it sees unknown dependencies in +out-of-source build trees if the policy is not set and then uses +``OLD`` behavior. Use the :command:`cmake_policy` command to set +the policy to ``OLD`` or ``NEW`` explicitly. The policy setting +must be in scope at the end of the top-level ``CMakeLists.txt`` +file of the project and has global effect. diff --git a/Help/release/dev/ninja-require-byproducts.rst b/Help/release/dev/ninja-require-byproducts.rst new file mode 100644 index 0000000..ccde4bc --- /dev/null +++ b/Help/release/dev/ninja-require-byproducts.rst @@ -0,0 +1,9 @@ +ninja-require-byproducts +------------------------ + +* The :generator:`Ninja` generator now requires that calls to the + :command:`add_custom_command` and :command:`add_custom_target` + commands use the ``BYPRODUCTS`` option to explicitly specify any + files generated by the custom commands that are not listed as + outputs (perhaps because their timestamps are allowed to be older + than the inputs). See policy :policy:`CMP0058`. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 6c612ab..f74f1e0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -17,6 +17,7 @@ #include "cmLocalNinjaGenerator.h" #include "cmMakefile.h" #include "cmVersion.h" +#include "cmAlgorithms.h" #include #include @@ -183,7 +184,10 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, i != outputs.end(); ++i) { build += " " + EncodeIdent(EncodePath(*i), os); - this->CombinedBuildOutputs.insert( EncodePath(*i) ); + if (this->ComputingUnknownDependencies) + { + this->CombinedBuildOutputs.insert( EncodePath(*i) ); + } } build += ":"; @@ -281,11 +285,14 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command, orderOnly, vars); - //we need to track every dependency that comes in, since we are trying - //to find dependencies that are side effects of build commands - for(cmNinjaDeps::const_iterator i = deps.begin(); i != deps.end(); ++i) + if (this->ComputingUnknownDependencies) { - this->CombinedCustomCommandExplicitDependencies.insert( EncodePath(*i) ); + //we need to track every dependency that comes in, since we are trying + //to find dependencies that are side effects of build commands + for(cmNinjaDeps::const_iterator i = deps.begin(); i != deps.end(); ++i) + { + this->CombinedCustomCommandExplicitDependencies.insert(EncodePath(*i)); + } } } @@ -477,6 +484,8 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() , CompileCommandsStream(0) , Rules() , AllDependencies() + , ComputingUnknownDependencies(false) + , PolicyCMP0058(cmPolicies::WARN) { // // Ninja is not ported to non-Unix OS yet. // this->ForceUnixPaths = true; @@ -510,6 +519,13 @@ void cmGlobalNinjaGenerator::Generate() this->OpenBuildFileStream(); this->OpenRulesFileStream(); + this->PolicyCMP0058 = + this->LocalGenerators[0]->GetMakefile() + ->GetPolicyStatus(cmPolicies::CMP0058); + this->ComputingUnknownDependencies = + (this->PolicyCMP0058 == cmPolicies::OLD || + this->PolicyCMP0058 == cmPolicies::WARN); + this->cmGlobalGenerator::Generate(); this->WriteAssumedSourceDependencies(); @@ -955,6 +971,11 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) { + if (!this->ComputingUnknownDependencies) + { + return; + } + // We need to collect the set of known build outputs. // Start with those generated by WriteBuild calls. // No other method needs this so we can take ownership @@ -1047,9 +1068,11 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) knownDependencies.end(), std::back_inserter(unknownExplicitDepends)); - std::string const rootBuildDirectory = this->GetCMakeInstance()->GetHomeOutputDirectory(); + bool const inSourceBuild = + (rootBuildDirectory == this->GetCMakeInstance()->GetHomeDirectory()); + std::vector warnExplicitDepends; for (std::vector::const_iterator i = unknownExplicitDepends.begin(); i != unknownExplicitDepends.end(); @@ -1067,8 +1090,34 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) "", deps, cmNinjaDeps()); + if (this->PolicyCMP0058 == cmPolicies::WARN && + !inSourceBuild && warnExplicitDepends.size() < 10) + { + warnExplicitDepends.push_back(*i); + } } } + + if (!warnExplicitDepends.empty()) + { + std::ostringstream w; + w << + (this->GetCMakeInstance()->GetPolicies()-> + GetPolicyWarning(cmPolicies::CMP0058)) << "\n" + "This project specifies custom command DEPENDS on files " + "in the build tree that are not specified as the OUTPUT or " + "BYPRODUCTS of any add_custom_command or add_custom_target:\n" + " " << cmJoin(warnExplicitDepends, "\n ") << + "\n" + "For compatibility with versions of CMake that did not have " + "the BYPRODUCTS option, CMake is generating phony rules for " + "such files to convince 'ninja' to build." + "\n" + "Project authors should add the missing BYPRODUCTS or OUTPUT " + "options to the custom commands that produce these files." + ; + this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } } void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os) diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 3f6af6c..6aa76f9 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -368,6 +368,11 @@ private: /// The set of custom command outputs we have seen. std::set CustomCommandOutputs; + /// Whether we are collecting known build outputs and needed + /// dependencies to determine unknown dependencies. + bool ComputingUnknownDependencies; + cmPolicies::PolicyStatus PolicyCMP0058; + /// The combined explicit dependencies of custom build commands std::set CombinedCustomCommandExplicitDependencies; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 720030b..592df8f 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -380,6 +380,11 @@ cmPolicies::cmPolicies() CMP0057, "CMP0057", "Disallow multiple MAIN_DEPENDENCY specifications for the same file.", 3,3,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0058, "CMP0058", + "Ninja requires custom command byproducts to be explicit.", + 3,3,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 854b132..b18b337 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -115,6 +115,7 @@ public: CMP0056, ///< Honor link flags in try_compile() source-file signature. CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications /// for the same file. + CMP0058, ///< Ninja requires custom command byproducts to be explicit /** \brief Always the last entry. * diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 7cbc9fe..dc63975 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -64,6 +64,9 @@ add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) add_RunCMake_test(CMP0057) +if(CMAKE_GENERATOR STREQUAL "Ninja") + add_RunCMake_test(Ninja) +endif() add_RunCMake_test(CTest) if(NOT CMake_TEST_EXTERNAL_CMAKE) diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake b/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake new file mode 100644 index 0000000..0f77930 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0058 NEW) +set(byproducts BYPRODUCTS byproduct1a byproduct1b) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt new file mode 100644 index 0000000..fa10109 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt @@ -0,0 +1 @@ +ninja: error: 'byproduct1a', needed by 'output2', missing and no known rule to make it diff --git a/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake b/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake new file mode 100644 index 0000000..582e3d5 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0058 NEW) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake b/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake new file mode 100644 index 0000000..92a3a0f --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0058 OLD) +set(byproducts BYPRODUCTS byproduct1a byproduct1b) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake b/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake new file mode 100644 index 0000000..0326e07 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0058 OLD) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake b/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake new file mode 100644 index 0000000..6128167 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake @@ -0,0 +1,2 @@ +set(byproducts BYPRODUCTS byproduct1a byproduct1b) +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt new file mode 100644 index 0000000..8646a13 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt @@ -0,0 +1,4 @@ +^[^ +]* Generating output1 +[^ +]* Generating output2$ diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt new file mode 100644 index 0000000..439a2d9 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt @@ -0,0 +1,19 @@ +^CMake Warning \(dev\): + Policy CMP0058 is not set: Ninja requires custom command byproducts to be + explicit. Run "cmake --help-policy CMP0058" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + This project specifies custom command DEPENDS on files in the build tree + that are not specified as the OUTPUT or BYPRODUCTS of any + add_custom_command or add_custom_target: + + byproduct1a + byproduct1b + + For compatibility with versions of CMake that did not have the BYPRODUCTS + option, CMake is generating phony rules for such files to convince 'ninja' + to build. + + Project authors should add the missing BYPRODUCTS or OUTPUT options to the + custom commands that produce these files. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake b/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake new file mode 100644 index 0000000..7bc66ef --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake @@ -0,0 +1 @@ +include(CMP0058-common.cmake) diff --git a/Tests/RunCMake/Ninja/CMP0058-common.cmake b/Tests/RunCMake/Ninja/CMP0058-common.cmake new file mode 100644 index 0000000..9274d58 --- /dev/null +++ b/Tests/RunCMake/Ninja/CMP0058-common.cmake @@ -0,0 +1,17 @@ +add_custom_command( + OUTPUT output1 + ${byproducts} + COMMAND ${CMAKE_COMMAND} -E touch output1 + COMMAND ${CMAKE_COMMAND} -E touch byproduct1a + COMMAND ${CMAKE_COMMAND} -E touch byproduct1b + ) +add_custom_target(Drive1 ALL DEPENDS output1) +add_custom_command( + OUTPUT output2 + COMMAND ${CMAKE_COMMAND} -E copy output1 output2 + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/output1 + ${CMAKE_CURRENT_BINARY_DIR}/byproduct1a + ${CMAKE_CURRENT_BINARY_DIR}/byproduct1b + ) +add_custom_target(Drive2 ALL DEPENDS output2) +add_dependencies(Drive2 Drive1) diff --git a/Tests/RunCMake/Ninja/CMakeLists.txt b/Tests/RunCMake/Ninja/CMakeLists.txt new file mode 100644 index 0000000..2a0591e --- /dev/null +++ b/Tests/RunCMake/Ninja/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake new file mode 100644 index 0000000..64f97bc --- /dev/null +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -0,0 +1,18 @@ +include(RunCMake) + +function(run_CMP0058 case) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0058-${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(CMP0058-${case}) + run_cmake_command(CMP0058-${case}-build ${CMAKE_COMMAND} --build .) +endfunction() + +run_CMP0058(OLD-no) +run_CMP0058(OLD-by) +run_CMP0058(WARN-no) +run_CMP0058(WARN-by) +run_CMP0058(NEW-no) +run_CMP0058(NEW-by) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed8e30b00d032594fbb67d62f8bd4319ae6e5907 commit ed8e30b00d032594fbb67d62f8bd4319ae6e5907 Author: Brad King AuthorDate: Wed Mar 18 16:24:11 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 13:33:13 2015 -0400 cmGlobalNinjaGenerator: Optimize handling of known build outputs Teach WriteUnknownExplicitDependencies to take ownership of the set of WriteBuild outputs immediately since no other methods need the data. This avoids re-inserting the whole set into another already populated set. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 1286793..6c612ab 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -955,6 +955,13 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) { + // We need to collect the set of known build outputs. + // Start with those generated by WriteBuild calls. + // No other method needs this so we can take ownership + // of the set locally and throw it out when we are done. + std::set knownDependencies; + knownDependencies.swap(this->CombinedBuildOutputs); + //now write out the unknown explicit dependencies. //union the configured files, evaluations files and the CombinedBuildOutputs, @@ -971,7 +978,6 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) cmLocalNinjaGenerator *ng = static_cast(this->LocalGenerators[0]); - std::set knownDependencies; for (std::vector::const_iterator i = this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i) { @@ -1026,15 +1032,6 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) knownDependencies.insert( ng->ConvertToNinjaPath(i->first) ); } - //insert outputs from all WirteBuild commands - //these paths have already be encoded when added to CombinedBuildOutputs - knownDependencies.insert(this->CombinedBuildOutputs.begin(), - this->CombinedBuildOutputs.end()); - - //after we have combined the data into knownDependencies we have no need - //to keep this data around - this->CombinedBuildOutputs.clear(); - //now we difference with CombinedCustomCommandExplicitDependencies to find //the list of items we know nothing about. //We have encoded all the paths in CombinedCustomCommandExplicitDependencies http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad094f435e005b484771acae36b79895c8e36e3f commit ad094f435e005b484771acae36b79895c8e36e3f Author: Brad King AuthorDate: Wed Mar 18 16:44:05 2015 -0400 Commit: Brad King CommitDate: Fri Mar 20 13:32:55 2015 -0400 cmGlobalNinjaGenerator: Fix spelling of "unknown" diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index ac7a6eb..1286793 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1041,21 +1041,21 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) //and knownDependencies so no matter if unix or windows paths they //should all match now. - std::vector unkownExplicitDepends; + std::vector unknownExplicitDepends; this->CombinedCustomCommandExplicitDependencies.erase("all"); std::set_difference(this->CombinedCustomCommandExplicitDependencies.begin(), this->CombinedCustomCommandExplicitDependencies.end(), knownDependencies.begin(), knownDependencies.end(), - std::back_inserter(unkownExplicitDepends)); + std::back_inserter(unknownExplicitDepends)); std::string const rootBuildDirectory = this->GetCMakeInstance()->GetHomeOutputDirectory(); for (std::vector::const_iterator - i = unkownExplicitDepends.begin(); - i != unkownExplicitDepends.end(); + i = unknownExplicitDepends.begin(); + i != unknownExplicitDepends.end(); ++i) { //verify the file is in the build directory http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82a37d3ce5606f578997304cefc6aded15f2535c commit 82a37d3ce5606f578997304cefc6aded15f2535c Author: Brad King AuthorDate: Wed Mar 18 16:15:01 2015 -0400 Commit: Brad King CommitDate: Wed Mar 18 16:15:01 2015 -0400 cmGlobalNinjaGenerator: Drop unused member diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index c7bb782..3f6af6c 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -381,8 +381,6 @@ private: typedef std::map TargetAliasMap; TargetAliasMap TargetAliases; - static cmLocalGenerator* LocalGenerator; - static bool UsingMinGW; }; ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0058.rst | 108 ++++++++++++++++++++ Help/release/dev/ninja-require-byproducts.rst | 9 ++ Source/cmGlobalNinjaGenerator.cxx | 86 ++++++++++++---- Source/cmGlobalNinjaGenerator.h | 7 +- Source/cmPolicies.cxx | 5 + Source/cmPolicies.h | 1 + Tests/RunCMake/CMakeLists.txt | 3 + .../RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake | 3 + .../CMP0058-NEW-no-build-result.txt} | 0 .../RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt | 1 + Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake | 2 + .../RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake | 3 + .../RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake | 2 + .../Ninja/CMP0058-WARN-by-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake | 2 + .../Ninja/CMP0058-WARN-no-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt | 19 ++++ Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake | 1 + Tests/RunCMake/Ninja/CMP0058-common.cmake | 17 +++ Tests/RunCMake/{CMP0019 => Ninja}/CMakeLists.txt | 2 +- Tests/RunCMake/Ninja/RunCMakeTest.cmake | 18 ++++ 25 files changed, 287 insertions(+), 23 deletions(-) create mode 100644 Help/policy/CMP0058.rst create mode 100644 Help/release/dev/ninja-require-byproducts.rst create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => Ninja/CMP0058-NEW-no-build-result.txt} (100%) create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-common.cmake copy Tests/RunCMake/{CMP0019 => Ninja}/CMakeLists.txt (67%) create mode 100644 Tests/RunCMake/Ninja/RunCMakeTest.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Sun Mar 22 00:01:14 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 22 Mar 2015 00:01:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-465-gaeb9fb9 Message-ID: <20150322040123.CED79AD136@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via aeb9fb977493c0865a2d6c9fab8affaf69845c85 (commit) from 2ec1c0d6e07305c51e0602ddff835919b4b08ed9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aeb9fb977493c0865a2d6c9fab8affaf69845c85 commit aeb9fb977493c0865a2d6c9fab8affaf69845c85 Author: Kitware Robot AuthorDate: Sun Mar 22 00:01:05 2015 -0400 Commit: Kitware Robot CommitDate: Sun Mar 22 00:01:05 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2e10d1f..368f23b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150321) +set(CMake_VERSION_PATCH 20150322) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 23 00:01:07 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 23 Mar 2015 00:01:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-466-gd67196d Message-ID: <20150323040107.EE988AD23C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d67196d0e8c5e9feb99d3a609d060f52ad8b9a59 (commit) from aeb9fb977493c0865a2d6c9fab8affaf69845c85 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d67196d0e8c5e9feb99d3a609d060f52ad8b9a59 commit d67196d0e8c5e9feb99d3a609d060f52ad8b9a59 Author: Kitware Robot AuthorDate: Mon Mar 23 00:01:03 2015 -0400 Commit: Kitware Robot CommitDate: Mon Mar 23 00:01:03 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 368f23b..5ef57ab 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150322) +set(CMake_VERSION_PATCH 20150323) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From tgamblin at llnl.gov Mon Mar 23 01:20:20 2015 From: tgamblin at llnl.gov (Todd Gamblin) Date: Mon, 23 Mar 2015 01:20:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1145-gfc50d18 Message-ID: <20150323052020.C6E58ACD54@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via fc50d18c7053505b1696ea6c848f7d2416f00e08 (commit) via 13807bcb414c67cf8ee3f8b203fe30b472239072 (commit) from 2bb3979df7234382031bb095adff94df3f29992d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc50d18c7053505b1696ea6c848f7d2416f00e08 commit fc50d18c7053505b1696ea6c848f7d2416f00e08 Merge: 2bb3979 13807bc Author: Todd Gamblin AuthorDate: Mon Mar 23 01:20:19 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 01:20:19 2015 -0400 Merge topic 'blugeneq-platform-files' into next 13807bcb BlueGene/Q Platform files http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13807bcb414c67cf8ee3f8b203fe30b472239072 commit 13807bcb414c67cf8ee3f8b203fe30b472239072 Author: Todd Gamblin AuthorDate: Wed Mar 18 23:40:12 2015 -0700 Commit: Todd Gamblin CommitDate: Wed Mar 18 23:40:12 2015 -0700 BlueGene/Q Platform files - based on the BlueGene/P platform files. - tested by Todd Gamblin (LLNL) and David DeMarle (Kitware) diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake new file mode 100644 index 0000000..fa8dc52 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-base.cmake @@ -0,0 +1,177 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# +# Blue Gene/Q base platform file. +# +# NOTE: Do not set your platform to "BlueGeneQ-base". This file is +# included by the real platform files. Use one of these two platforms +# instead: +# +# BlueGeneQ-dynamic For dynamically linked executables +# BlueGeneQ-static For statically linked executables +# +# The platform you choose doesn't affect whether or not you can build +# shared or static libraries -- it ONLY changs whether exeuatbles are linked +# statically or dynamically. +# +# This platform file tries its best to adhere to the behavior of the MPI +# compiler wrappers included with the latest BG/P drivers. +# + +# +# This adds directories that find commands should specifically ignore +# for cross compiles. Most of these directories are the includeand +# lib directories for the frontend on BG/P systems. Not ignoring +# these can cause things like FindX11 to find a frontend PPC version +# mistakenly. We use this on BG instead of re-rooting because backend +# libraries are typically strewn about the filesystem, and we can't +# re-root ALL backend libraries to a single place. +# +set(CMAKE_SYSTEM_IGNORE_PATH + /lib /lib64 /include + /usr/lib /usr/lib64 /usr/include + /usr/local/lib /usr/local/lib64 /usr/local/include + /usr/X11/lib /usr/X11/lib64 /usr/X11/include + /usr/lib/X11 /usr/lib64/X11 /usr/include/X11 + /usr/X11R6/lib /usr/X11R6/lib64 /usr/X11R6/include + /usr/X11R7/lib /usr/X11R7/lib64 /usr/X11R7/include +) + +# +# Indicate that this is a unix-like system +# +set(UNIX 1) + +# +# Library prefixes, suffixes, extra libs. +# +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") # lib +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") # .a + +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +set(CMAKE_EXECUTABLE_SUFFIX "") # .exe + +set(CMAKE_DL_LIBS "dl") + +# +# BG/Q supports dynamic libraries regardless of whether we're building +# static or dynamic *executables*. +# +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") + +# +# For BGQ builds, we're cross compiling, but we don't want to re-root things +# (e.g. with CMAKE_FIND_ROOT_PATH) because users may have libraries anywhere on +# the shared filesystems, and this may lie outside the root. Instead, we set the +# system directories so that the various system BG CNK library locations are +# searched first. This is not the clearest thing in the world, given IBM's driver +# layout, but this should cover all the standard ones. +# +macro(__BlueGeneQ_common_setup compiler_id lang) + # Need to use the version of the comm lib compiled with the right compiler. + set(__BlueGeneQ_commlib_dir gcc) + if (${compiler_id} STREQUAL XL) + set(__BlueGeneQ_commlib_dir xl) + endif() + + set(CMAKE_SYSTEM_LIBRARY_PATH + /bgsys/drivers/ppcfloor/comm/default/lib # default comm layer (used by mpi compiler wrappers) + /bgsys/drivers/ppcfloor/comm/${__BlueGeneQ_commlib_dir}/lib # PAMI, other lower-level comm libraries + /bgsys/drivers/ppcfloor/gnu-linux/lib # CNK python installation directory + /bgsys/drivers/ppcfloor/gnu-linux/powerpc64-bgq-linux/lib # CNK Linux image -- standard runtime libs, pthread, etc. + ) + + # Add all the system include paths. + set(CMAKE_SYSTEM_INCLUDE_PATH + /bgsys/drivers/ppcfloor/comm/sys/include + /bgsys/drivers/ppcfloor/ + /bgsys/drivers/ppcfloor/spi/include + /bgsys/drivers/ppcfloor/spi/include/kernel/cnk + /bgsys/drivers/ppcfloor/comm/${__BlueGeneQ_commlib_dir}/include + ) + + # Ensure that the system directories are included with the regular compilers, as users will expect this + # to do the same thing as the MPI compilers, which add these flags. + set(BGQ_SYSTEM_INCLUDES "") + foreach(dir ${CMAKE_SYSTEM_INCLUDE_PATH}) + set(BGQ_SYSTEM_INCLUDES "${BGQ_SYSTEM_INCLUDES} -I${dir}") + endforeach() + set(CMAKE_C_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + set(CMAKE_CXX_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + + # + # Code below does setup for shared libraries. That this is done + # regardless of whether the platform is static or dynamic -- you can make + # shared libraries even if you intend to make static executables, you just + # can't make a dynamic executable if you use the static platform file. + # + if (${compiler_id} STREQUAL XL) + # Flags for XL compilers if we explicitly detected XL + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink") + else() + # Assume flags for GNU compilers (if the ID is GNU *or* anything else). + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + endif() + + # Both toolchains use the GNU linker on BG/P, so these options are shared. + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-rpath,") + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_${lang}_FLAG "-Wl,-rpath-link,") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-soname,") + set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-dynamic") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") # : or empty + +endmacro() + +# +# This macro needs to be called for dynamic library support. Unfortunately on BG, +# We can't support both static and dynamic links in the same platform file. The +# dynamic link platform file needs to call this explicitly to set up dynamic linking. +# +macro(__BlueGeneQ_setup_dynamic compiler_id lang) + __BlueGeneQ_common_setup(${compiler_id} ${lang}) + + if (${compiler_id} STREQUAL XL) + set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc") + else() + set(BGQ_${lang}_DYNAMIC_EXE_FLAGS "-dynamic") + endif() + + # For dynamic executables, need to provide special BG/Q arguments. + set(BGQ_${lang}_DEFAULT_EXE_FLAGS + " -o ") + set(CMAKE_${lang}_LINK_EXECUTABLE + " -Wl,-relax ${BGQ_${lang}_DYNAMIC_EXE_FLAGS} ${BGQ_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() + +# +# This macro needs to be called for static builds. Right now it just adds -Wl,-relax +# to the link line. +# +macro(__BlueGeneQ_setup_static compiler_id lang) + __BlueGeneQ_common_setup(${compiler_id} ${lang}) + + # For static executables, use default link settings. + set(BGQ_${lang}_DEFAULT_EXE_FLAGS + " -o ") + set(CMAKE_${lang}_LINK_EXECUTABLE + " -Wl,-relax ${BGQ_${lang}_DEFAULT_EXE_FLAGS}") +endmacro() diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake new file mode 100644 index 0000000..102ac80 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(GNU C) diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake new file mode 100644 index 0000000..cd8ab24 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(GNU CXX) diff --git a/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake new file mode 100644 index 0000000..c029f0f --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(GNU Fortran) diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake new file mode 100644 index 0000000..0077313 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(XL C) diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake new file mode 100644 index 0000000..0f43cb2 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(XL CXX) diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake new file mode 100644 index 0000000..12e446e --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_dynamic(XL Fortran) diff --git a/Modules/Platform/BlueGeneQ-dynamic.cmake b/Modules/Platform/BlueGeneQ-dynamic.cmake new file mode 100644 index 0000000..0283900 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-dynamic.cmake @@ -0,0 +1,17 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(Platform/BlueGeneQ-base) +set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") diff --git a/Modules/Platform/BlueGeneQ-static-GNU-C.cmake b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake new file mode 100644 index 0000000..70c84ba --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-GNU-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(GNU C) diff --git a/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake new file mode 100644 index 0000000..8f991de --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-GNU-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(GNU CXX) diff --git a/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake new file mode 100644 index 0000000..24dd9e7 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-GNU-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(GNU Fortran) diff --git a/Modules/Platform/BlueGeneQ-static-XL-C.cmake b/Modules/Platform/BlueGeneQ-static-XL-C.cmake new file mode 100644 index 0000000..5555a68 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-XL-C.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(XL C) diff --git a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake new file mode 100644 index 0000000..07c3c3d --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(XL CXX) diff --git a/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake new file mode 100644 index 0000000..6f99933 --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static-XL-Fortran.cmake @@ -0,0 +1,16 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +__BlueGeneQ_setup_static(XL Fortran) diff --git a/Modules/Platform/BlueGeneQ-static.cmake b/Modules/Platform/BlueGeneQ-static.cmake new file mode 100644 index 0000000..30b530d --- /dev/null +++ b/Modules/Platform/BlueGeneQ-static.cmake @@ -0,0 +1,17 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# Copyright 2010 Todd Gamblin +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(Platform/BlueGeneQ-base) +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") ----------------------------------------------------------------------- Summary of changes: Modules/Platform/BlueGeneQ-base.cmake | 177 ++++++++++++++++++++ ...ic-XL-C.cmake => BlueGeneQ-dynamic-GNU-C.cmake} | 2 +- ...-XL-C.cmake => BlueGeneQ-dynamic-GNU-CXX.cmake} | 2 +- ...X.cmake => BlueGeneQ-dynamic-GNU-Fortran.cmake} | 2 +- ...tic-XL-C.cmake => BlueGeneQ-dynamic-XL-C.cmake} | 2 +- ...c-XL-C.cmake => BlueGeneQ-dynamic-XL-CXX.cmake} | 2 +- ...XX.cmake => BlueGeneQ-dynamic-XL-Fortran.cmake} | 2 +- ...namic-GNU-CXX.cmake => BlueGeneQ-dynamic.cmake} | 3 +- ...tic-XL-C.cmake => BlueGeneQ-static-GNU-C.cmake} | 2 +- ...c-XL-C.cmake => BlueGeneQ-static-GNU-CXX.cmake} | 2 +- ...XX.cmake => BlueGeneQ-static-GNU-Fortran.cmake} | 2 +- ...atic-XL-C.cmake => BlueGeneQ-static-XL-C.cmake} | 2 +- ...ic-XL-C.cmake => BlueGeneQ-static-XL-CXX.cmake} | 2 +- ...L-C.cmake => BlueGeneQ-static-XL-Fortran.cmake} | 2 +- ...ynamic-GNU-CXX.cmake => BlueGeneQ-static.cmake} | 3 +- 15 files changed, 193 insertions(+), 14 deletions(-) create mode 100644 Modules/Platform/BlueGeneQ-base.cmake copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-dynamic-GNU-C.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-dynamic-GNU-CXX.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-XL-CXX.cmake => BlueGeneQ-dynamic-GNU-Fortran.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-dynamic-XL-C.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-dynamic-XL-CXX.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-XL-CXX.cmake => BlueGeneQ-dynamic-XL-Fortran.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-GNU-CXX.cmake => BlueGeneQ-dynamic.cmake} (89%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-GNU-C.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-GNU-CXX.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-XL-CXX.cmake => BlueGeneQ-static-GNU-Fortran.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-XL-C.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-XL-CXX.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-XL-Fortran.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-GNU-CXX.cmake => BlueGeneQ-static.cmake} (90%) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:09:05 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:09:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1148-g3d83e8d Message-ID: <20150323130905.8BAA4A4EE6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3d83e8d0dca7a18bb38db63e006b1480f0068e6d (commit) via 6bce027662588b972602e2e74c16a1883ed853cf (commit) via fde70a1b26e130663cc4c02e0530d3aadc165a41 (commit) from fc50d18c7053505b1696ea6c848f7d2416f00e08 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3d83e8d0dca7a18bb38db63e006b1480f0068e6d commit 3d83e8d0dca7a18bb38db63e006b1480f0068e6d Merge: fc50d18 6bce027 Author: Brad King AuthorDate: Mon Mar 23 09:09:04 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:09:04 2015 -0400 Merge topic 'ctest-repeat-until-fail' into next 6bce0276 Help: Add notes for topic 'ctest-repeat-until-fail' fde70a1b ctest: Add a new --repeat-until-fail option http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6bce027662588b972602e2e74c16a1883ed853cf commit 6bce027662588b972602e2e74c16a1883ed853cf Author: Brad King AuthorDate: Tue Mar 17 11:39:43 2015 -0400 Commit: Brad King CommitDate: Mon Mar 23 09:08:22 2015 -0400 Help: Add notes for topic 'ctest-repeat-until-fail' diff --git a/Help/release/dev/ctest-repeat-until-fail.rst b/Help/release/dev/ctest-repeat-until-fail.rst new file mode 100644 index 0000000..8a679c6 --- /dev/null +++ b/Help/release/dev/ctest-repeat-until-fail.rst @@ -0,0 +1,5 @@ +ctest-repeat-until-fail +----------------------- + +* The :manual:`ctest(1)` tool learned a new ``--repeat-until-fail `` + option to help find sporadic test failures. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fde70a1b26e130663cc4c02e0530d3aadc165a41 commit fde70a1b26e130663cc4c02e0530d3aadc165a41 Author: Bill Hoffman AuthorDate: Thu Mar 5 16:51:10 2015 -0500 Commit: Brad King CommitDate: Mon Mar 23 09:08:22 2015 -0400 ctest: Add a new --repeat-until-fail option This option tells ctest to run each test N times until the test fails or the N times have run. This is useful for finding random failing tests. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index cc132c2..dd3bcfb 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -194,6 +194,11 @@ Options subsequent calls to ctest with the --rerun-failed option will run the set of tests that most recently failed (if any). +``--repeat-until-fail `` + Require each test to run ```` times without failing in order to pass. + + This is useful in finding sporadic failures in test cases. + ``--max-width `` Set the max width for a test name to output diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index eb33d8e..bd090db 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -121,6 +121,11 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) this->RunningCount += GetProcessorsUsed(test); cmCTestRunTest* testRun = new cmCTestRunTest(this->TestHandler); + if(this->CTest->GetRepeatUntilFail()) + { + testRun->SetRunUntilFailOn(); + testRun->SetNumberOfRuns(this->CTest->GetTestRepeat()); + } testRun->SetIndex(test); testRun->SetTestProperties(this->Properties[test]); @@ -289,7 +294,13 @@ bool cmCTestMultiProcessHandler::CheckOutput() cmCTestRunTest* p = *i; int test = p->GetIndex(); - if(p->EndTest(this->Completed, this->Total, true)) + bool testResult = p->EndTest(this->Completed, this->Total, true); + if(p->StartAgain()) + { + this->Completed--; // remove the completed test because run again + continue; + } + if(testResult) { this->Passed->push_back(p->GetTestProperties()->Name); } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 03131fd..6f72684 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -33,6 +33,9 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) this->CompressedOutput = ""; this->CompressionRatio = 2; this->StopTimePassed = false; + this->NumberOfRunsLeft = 1; // default to 1 run of the test + this->RunUntilFail = false; // default to run the test once + this->RunAgain = false; // default to not having to run again } cmCTestRunTest::~cmCTestRunTest() @@ -357,13 +360,50 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) this->MemCheckPostProcess(); this->ComputeWeightedCost(); } - // Always push the current TestResult onto the + // If the test does not need to rerun push the current TestResult onto the // TestHandler vector - this->TestHandler->TestResults.push_back(this->TestResult); + if(!this->NeedsToRerun()) + { + this->TestHandler->TestResults.push_back(this->TestResult); + } delete this->TestProcess; return passed; } +bool cmCTestRunTest::StartAgain() +{ + if(!this->RunAgain) + { + return false; + } + this->RunAgain = false; // reset + // change to tests directory + std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); + cmSystemTools::ChangeDirectory(this->TestProperties->Directory); + this->StartTest(this->TotalNumberOfTests); + // change back + cmSystemTools::ChangeDirectory(current_dir); + return true; +} + +bool cmCTestRunTest::NeedsToRerun() +{ + this->NumberOfRunsLeft--; + if(this->NumberOfRunsLeft == 0) + { + return false; + } + // if number of runs left is not 0, and we are running until + // we find a failed test, then return true so the test can be + // restarted + if(this->RunUntilFail + && this->TestResult.Status == cmCTestTestHandler::COMPLETED) + { + this->RunAgain = true; + return true; + } + return false; +} //---------------------------------------------------------------------- void cmCTestRunTest::ComputeWeightedCost() { @@ -400,6 +440,7 @@ void cmCTestRunTest::MemCheckPostProcess() // Starts the execution of a test. Returns once it has started bool cmCTestRunTest::StartTest(size_t total) { + this->TotalNumberOfTests = total; // save for rerun case cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8) << "Start " << std::setw(getNumWidth(this->TestHandler->GetMaxIndex())) @@ -494,10 +535,10 @@ bool cmCTestRunTest::StartTest(size_t total) //---------------------------------------------------------------------- void cmCTestRunTest::ComputeArguments() { + this->Arguments.clear(); // reset becaue this might be a rerun std::vector::const_iterator j = this->TestProperties->Args.begin(); ++j; // skip test name - // find the test executable if(this->TestHandler->MemCheck) { @@ -682,10 +723,28 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) - << completed << "/"); - cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) - << total << " "); + // if this is the last or only run of this test + // then print out completed / total + // Only issue is if a test fails and we are running until fail + // then it will never print out the completed / total, same would + // got for run until pass. Trick is when this is called we don't + // yet know if we are passing or failing. + if(this->NumberOfRunsLeft == 1) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << completed << "/"); + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << total << " "); + } + // if this is one of several runs of a test just print blank space + // to keep things neat + else + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << " " << " "); + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total)) + << " " << " "); + } if ( this->TestHandler->MemCheck ) { diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 476f3e1..3b5c831 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -27,6 +27,8 @@ public: cmCTestRunTest(cmCTestTestHandler* handler); ~cmCTestRunTest(); + void SetNumberOfRuns(int n) {this->NumberOfRunsLeft = n;} + void SetRunUntilFailOn() { this->RunUntilFail = true;} void SetTestProperties(cmCTestTestHandler::cmCTestTestProperties * prop) { this->TestProperties = prop; } @@ -58,7 +60,10 @@ public: void ComputeArguments(); void ComputeWeightedCost(); + + bool StartAgain(); private: + bool NeedsToRerun(); void DartProcessing(); void ExeNotFound(std::string exe); // Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT) @@ -92,6 +97,10 @@ private: std::string ActualCommand; std::vector Arguments; bool StopTimePassed; + bool RunUntilFail; + int NumberOfRunsLeft; + bool RunAgain; + size_t TotalNumberOfTests; }; inline int getNumWidth(size_t n) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e6d3960..2cbdf9c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -328,6 +328,8 @@ cmCTest::cmCTest() this->OutputTestOutputOnTestFailure = false; this->ComputedCompressTestOutput = false; this->ComputedCompressMemCheckOutput = false; + this->RepeatTests = 1; // default to run each test once + this->RepeatUntilFail = false; if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE")) { this->OutputTestOutputOnTestFailure = true; @@ -1983,11 +1985,11 @@ bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, //---------------------------------------------------------------------- // Processes one command line argument (and its arguments if any) // for many simple options and then returns -void cmCTest::HandleCommandLineArguments(size_t &i, - std::vector &args) +bool cmCTest::HandleCommandLineArguments(size_t &i, + std::vector &args, + std::string& errormsg) { std::string arg = args[i]; - if(this->CheckArgument(arg, "-F")) { this->Failover = true; @@ -2005,6 +2007,27 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->SetParallelLevel(plevel); this->ParallelLevelSetInCli = true; } + if(this->CheckArgument(arg, "--repeat-until-fail")) + { + if( i >= args.size() - 1) + { + errormsg = "'--repeat-until-fail' requires an argument"; + return false; + } + i++; + long repeat = 1; + if(!cmSystemTools::StringToLong(args[i].c_str(), &repeat)) + { + errormsg = "'--repeat-until-fail' given non-integer value '" + + args[i] + "'"; + return false; + } + this->RepeatTests = static_cast(repeat); + if(repeat > 1) + { + this->RepeatUntilFail = true; + } + } if(this->CheckArgument(arg, "--no-compress-output")) { @@ -2190,6 +2213,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->GetHandler("test")->SetPersistentOption("RerunFailed", "true"); this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true"); } + return true; } //---------------------------------------------------------------------- @@ -2272,7 +2296,12 @@ int cmCTest::Run(std::vector &args, std::string* output) for(size_t i=1; i < args.size(); ++i) { // handle the simple commandline arguments - this->HandleCommandLineArguments(i,args); + std::string errormsg; + if(!this->HandleCommandLineArguments(i,args, errormsg)) + { + cmSystemTools::Error(errormsg.c_str()); + return 1; + } // handle the script arguments -S -SR -SP this->HandleScriptArguments(i,args,SRArgumentSpecified); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 88191c4..3f033d9 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -429,8 +429,13 @@ public: { return this->Definitions; } - + // return the number of times a test should be run + int GetTestRepeat() { return this->RepeatTests;} + // return true if test should run until fail + bool GetRepeatUntilFail() { return this->RepeatUntilFail;} private: + int RepeatTests; + bool RepeatUntilFail; std::string ConfigType; std::string ScheduleType; std::string StopTime; @@ -535,8 +540,9 @@ private: bool AddVariableDefinition(const std::string &arg); //! parse and process most common command line arguments - void HandleCommandLineArguments(size_t &i, - std::vector &args); + bool HandleCommandLineArguments(size_t &i, + std::vector &args, + std::string& errormsg); //! hande the -S -SP and -SR arguments void HandleScriptArguments(size_t &i, diff --git a/Source/ctest.cxx b/Source/ctest.cxx index c0eb8ac..0fc47b7 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -75,6 +75,8 @@ static const char * cmDocumentationOptions[][2] = "Run a specific number of tests by number."}, {"-U, --union", "Take the Union of -I and -R"}, {"--rerun-failed", "Run only the tests that failed previously"}, + {"--repeat-until-fail ", "Require each test to run " + "times without failing in order to pass"}, {"--max-width ", "Set the max width for a test name to output"}, {"--interactive-debug-mode [0|1]", "Set the interactive mode to 0 or 1."}, {"--no-label-summary", "Disable timing summary information for labels."}, diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index eb42057..ffda31f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -198,6 +198,7 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) +add_RunCMake_test(CTestCommandLine) set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake new file mode 100644 index 0000000..2e5156c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -0,0 +1,25 @@ +include(RunCMake) + +run_cmake_command(repeat-until-fail-bad1 + ${CMAKE_CTEST_COMMAND} --repeat-until-fail + ) +run_cmake_command(repeat-until-fail-bad2 + ${CMAKE_CTEST_COMMAND} --repeat-until-fail foo + ) +run_cmake_command(repeat-until-fail-good + ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 + ) + +function(run_repeat_until_fail_tests) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/repeat-until-fail-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(repeat-until-fail-cmake) + run_cmake_command(repeat-until-fail-ctest + ${CMAKE_CTEST_COMMAND} -C Debug --repeat-until-fail 3 + ) +endfunction() +run_repeat_until_fail_tests() diff --git a/Tests/RunCMake/CTestCommandLine/init.cmake b/Tests/RunCMake/CTestCommandLine/init.cmake new file mode 100644 index 0000000..a900f67 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/init.cmake @@ -0,0 +1,3 @@ +# This is run by test initialization in repeat-until-fail-cmake.cmake +# with cmake -P. It creates TEST_OUTPUT_FILE with a 0 in it. +file(WRITE "${TEST_OUTPUT_FILE}" "0") diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt new file mode 100644 index 0000000..5ea8816 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-until-fail' requires an argument$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt new file mode 100644 index 0000000..a79faae --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat-until-fail' given non-integer value 'foo'$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake new file mode 100644 index 0000000..4654416 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake @@ -0,0 +1,15 @@ +enable_testing() + +set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt") +add_test(NAME initialization + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/init.cmake") +add_test(NAME test1 + COMMAND ${CMAKE_COMMAND} + "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/test1.cmake") +set_tests_properties(test1 PROPERTIES DEPENDS "initialization") + +add_test(hello ${CMAKE_COMMAND} -E echo hello) +add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt new file mode 100644 index 0000000..7593783 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt @@ -0,0 +1 @@ +^Errors while running CTest$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt new file mode 100644 index 0000000..0bc4f70 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt @@ -0,0 +1,30 @@ +^Test project .*/Tests/RunCMake/CTestCommandLine/repeat-until-fail-build + Start 1: initialization + Test #1: initialization ................... Passed [0-9.]+ sec + Start 1: initialization + Test #1: initialization ................... Passed [0-9.]+ sec + Start 1: initialization +1/4 Test #1: initialization ................... Passed [0-9.]+ sec + Start 2: test1 + Test #2: test1 ............................ Passed [0-9.]+ sec + Start 2: test1 + Test #2: test1 ............................\*\*\*Failed [0-9.]+ sec + Start 3: hello + Test #3: hello ............................ Passed [0-9.]+ sec + Start 3: hello + Test #3: hello ............................ Passed [0-9.]+ sec + Start 3: hello +3/4 Test #3: hello ............................ Passed [0-9.]+ sec + Start 4: goodbye + Test #4: goodbye .......................... Passed [0-9.]+ sec + Start 4: goodbye + Test #4: goodbye .......................... Passed [0-9.]+ sec + Start 4: goodbye +4/4 Test #4: goodbye .......................... Passed [0-9.]+ sec ++ +75% tests passed, 1 tests failed out of 4 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +[ ]+2 - test1 \(Failed\)$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CTestCommandLine/test1.cmake b/Tests/RunCMake/CTestCommandLine/test1.cmake new file mode 100644 index 0000000..eeae7a2 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test1.cmake @@ -0,0 +1,13 @@ +# This is run by test test1 in repeat-until-fail-cmake.cmake with cmake -P. +# It reads the file TEST_OUTPUT_FILE and increments the number +# found in the file by 1. When the number is 2, then the +# code sends out a cmake error causing the test to fail +# the second time it is run. +message("TEST_OUTPUT_FILE = ${TEST_OUTPUT_FILE}") +file(READ "${TEST_OUTPUT_FILE}" COUNT) +message("COUNT= ${COUNT}") +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${TEST_OUTPUT_FILE}" "${COUNT}") +if(${COUNT} EQUAL 2) + message(FATAL_ERROR "this test fails on the 2nd run") +endif() ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:13:36 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:13:36 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1153-gcb2eb13 Message-ID: <20150323131336.E7CB6ACC6B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via cb2eb1395022579149e562d9226f545e2fa608da (commit) via 4178cd88fc01bd38fde2f3ee7a1702cfb4808f93 (commit) via 87a4b8580cad34fefa5c5e1833b0963a6bcf3e7d (commit) via ba14510b4ebdbbfe115e29111615a4b775fb7198 (commit) via 3714955b9cded21b13064886b30a412211ce217e (commit) from 3d83e8d0dca7a18bb38db63e006b1480f0068e6d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb2eb1395022579149e562d9226f545e2fa608da commit cb2eb1395022579149e562d9226f545e2fa608da Merge: 3d83e8d 4178cd8 Author: Brad King AuthorDate: Mon Mar 23 09:13:35 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:13:35 2015 -0400 Merge topic 'xcode-xctest' into next 4178cd88 Help: Add notes for topic 'xcode-xctest' 87a4b858 Tests: Add XCTest example to test Frameworks and Cocoa App Bundles ba14510b OS X: Add FindXCTest module 3714955b OS X: Add handling for XCTest bundles http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4178cd88fc01bd38fde2f3ee7a1702cfb4808f93 commit 4178cd88fc01bd38fde2f3ee7a1702cfb4808f93 Author: Brad King AuthorDate: Fri Feb 27 09:09:25 2015 -0500 Commit: Brad King CommitDate: Mon Mar 23 09:12:20 2015 -0400 Help: Add notes for topic 'xcode-xctest' diff --git a/Help/release/dev/xcode-xctest.rst b/Help/release/dev/xcode-xctest.rst new file mode 100644 index 0000000..7a2f07b --- /dev/null +++ b/Help/release/dev/xcode-xctest.rst @@ -0,0 +1,6 @@ +xcode-xctest +------------ + +* On OS X, CMake learned to create XCTest bundles to test Frameworks + and App Bundles within Xcode. The :module:`FindXCTest` module + provides convenience functions to handle :prop_tgt:`XCTEST` bundles. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87a4b8580cad34fefa5c5e1833b0963a6bcf3e7d commit 87a4b8580cad34fefa5c5e1833b0963a6bcf3e7d Author: Gregor Jasny AuthorDate: Thu Feb 26 21:55:46 2015 +0100 Commit: Brad King CommitDate: Mon Mar 23 09:12:20 2015 -0400 Tests: Add XCTest example to test Frameworks and Cocoa App Bundles Signed-off-by: Gregor Jasny diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 765fc80..9e419f8 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1505,6 +1505,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6 + AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") + set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1}) + ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $ -V) + endif() + add_test(linkorder1 ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/LinkLineOrder" diff --git a/Tests/XCTest/CMakeLists.txt b/Tests/XCTest/CMakeLists.txt new file mode 100644 index 0000000..e866623 --- /dev/null +++ b/Tests/XCTest/CMakeLists.txt @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 3.1) +project(XCTest) +enable_testing() + +find_package(XCTest REQUIRED) + +# Framework + +add_library(FrameworkExample SHARED + FrameworkExample/FrameworkExample.c + FrameworkExample/FrameworkExample.h + FrameworkExample/Info.plist) + +target_include_directories(FrameworkExample PUBLIC .) + +set_target_properties(FrameworkExample PROPERTIES + FRAMEWORK TRUE + VERSION "1.0.0" + SOVERSION "1.0.0" + FRAMEWORK_VERSION "A" + MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/FrameworkExample/Info.plist + PUBLIC_HEADER FrameworkExample/FrameworkExample.h) + +# XCTest for Framework + +xctest_add_bundle(FrameworkExampleTests FrameworkExample + FrameworkExampleTests/FrameworkExampleTests.m + FrameworkExampleTests/Info.plist) + +set_target_properties(FrameworkExampleTests PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/FrameworkExampleTests/Info.plist + ) + +xctest_add_test(XCTest.FrameworkExample FrameworkExampleTests) + +# Cocoa App Bundle + +add_executable(CocoaExample MACOSX_BUNDLE + CocoaExample/main.m + CocoaExample/AppDelegate.m + CocoaExample/AppDelegate.h + CocoaExample/MainMenu.xib +) + +target_link_libraries(CocoaExample PRIVATE "-framework Foundation") +target_link_libraries(CocoaExample PRIVATE "-framework AppKit") + +set_target_properties(CocoaExample PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/CocoaExample/Info.plist + RESOURCE "CocoaExample/MainMenu.xib") + +# XCTest for Cocoa App Bundle + +xctest_add_bundle(CocoaExampleTests CocoaExample + CocoaExampleTests/CocoaExampleTests.m) + +xctest_add_test(XCTest.CocoaExample CocoaExampleTests) diff --git a/Tests/XCTest/CocoaExample/AppDelegate.h b/Tests/XCTest/CocoaExample/AppDelegate.h new file mode 100644 index 0000000..4bf4101 --- /dev/null +++ b/Tests/XCTest/CocoaExample/AppDelegate.h @@ -0,0 +1,6 @@ +#import + + at interface AppDelegate : NSObject + + + at end diff --git a/Tests/XCTest/CocoaExample/AppDelegate.m b/Tests/XCTest/CocoaExample/AppDelegate.m new file mode 100644 index 0000000..07af62f --- /dev/null +++ b/Tests/XCTest/CocoaExample/AppDelegate.m @@ -0,0 +1,18 @@ +#import "AppDelegate.h" + + at interface AppDelegate () + + at property (assign) IBOutlet NSWindow *window; + at end + + at implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +} + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + + at end diff --git a/Tests/XCTest/CocoaExample/Info.plist b/Tests/XCTest/CocoaExample/Info.plist new file mode 100644 index 0000000..5267c63 --- /dev/null +++ b/Tests/XCTest/CocoaExample/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + CocoaExample + CFBundleIconFile + + CFBundleIdentifier + org.cmake.CocoaExample + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + CocoaExample + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/Tests/XCTest/CocoaExample/MainMenu.xib b/Tests/XCTest/CocoaExample/MainMenu.xib new file mode 100644 index 0000000..9498a0a --- /dev/null +++ b/Tests/XCTest/CocoaExample/MainMenu.xib @@ -0,0 +1,680 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/XCTest/CocoaExample/main.m b/Tests/XCTest/CocoaExample/main.m new file mode 100644 index 0000000..8a6799b --- /dev/null +++ b/Tests/XCTest/CocoaExample/main.m @@ -0,0 +1,5 @@ +#import + +int main(int argc, const char * argv[]) { + return NSApplicationMain(argc, argv); +} diff --git a/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m b/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m new file mode 100644 index 0000000..70d61d6 --- /dev/null +++ b/Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m @@ -0,0 +1,13 @@ +#import + + at interface CocoaExampleTests : XCTestCase + + at end + + at implementation CocoaExampleTests + +- (void)testExample { + XCTAssert(YES, @"Pass"); +} + + at end diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.c b/Tests/XCTest/FrameworkExample/FrameworkExample.c new file mode 100644 index 0000000..2da78da --- /dev/null +++ b/Tests/XCTest/FrameworkExample/FrameworkExample.c @@ -0,0 +1,6 @@ +#include "FrameworkExample.h" + +int FourtyTwo() +{ + return 42; +} diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.h b/Tests/XCTest/FrameworkExample/FrameworkExample.h new file mode 100644 index 0000000..2e0b499 --- /dev/null +++ b/Tests/XCTest/FrameworkExample/FrameworkExample.h @@ -0,0 +1 @@ +int FourtyTwo(); diff --git a/Tests/XCTest/FrameworkExample/Info.plist b/Tests/XCTest/FrameworkExample/Info.plist new file mode 100644 index 0000000..a22acea --- /dev/null +++ b/Tests/XCTest/FrameworkExample/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + FrameworkExample + CFBundleIdentifier + org.cmake.FrameworkExample + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FrameworkExample + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + + NSHumanReadableCopyright + + NSPrincipalClass + + + diff --git a/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m b/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m new file mode 100644 index 0000000..7cba23e --- /dev/null +++ b/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m @@ -0,0 +1,16 @@ +#import + +#import "FrameworkExample/FrameworkExample.h" + + at interface FrameworkExampleTests : XCTestCase + + at end + + at implementation FrameworkExampleTests + +- (void)testFourtyTwo { + // This is an example of a functional test case. + XCTAssertEqual(42, FourtyTwo()); +} + + at end diff --git a/Tests/XCTest/FrameworkExampleTests/Info.plist b/Tests/XCTest/FrameworkExampleTests/Info.plist new file mode 100644 index 0000000..293921b --- /dev/null +++ b/Tests/XCTest/FrameworkExampleTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + FrameworkExampleTests + CFBundleIdentifier + org.cmake.FrameworkExampleTests + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FrameworkExampleTests + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba14510b4ebdbbfe115e29111615a4b775fb7198 commit ba14510b4ebdbbfe115e29111615a4b775fb7198 Author: Gregor Jasny AuthorDate: Thu Feb 26 21:55:45 2015 +0100 Commit: Brad King CommitDate: Mon Mar 23 09:12:19 2015 -0400 OS X: Add FindXCTest module Add a module to lookup XCTest Framework and xctest utility. It also provides APIs for creating 'xctest' targets. Signed-off-by: Gregor Jasny diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 2b26cc9..c9219d5 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -212,6 +212,7 @@ All Modules /module/FindWish /module/FindwxWidgets /module/FindwxWindows + /module/FindXCTest /module/FindXercesC /module/FindX11 /module/FindXMLRPC diff --git a/Help/module/FindXCTest.rst b/Help/module/FindXCTest.rst new file mode 100644 index 0000000..ff6273c --- /dev/null +++ b/Help/module/FindXCTest.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindXCTest.cmake diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake new file mode 100644 index 0000000..3cd9c22 --- /dev/null +++ b/Modules/FindXCTest.cmake @@ -0,0 +1,196 @@ +#[=======================================================================[.rst: +FindXCTest +---------- + +Functions to help creating and executing XCTest bundles. + +An XCTest bundle is a CFBundle with a special product-type +and bundle extension. The Mac Developer Library provides more +information in the `Testing with Xcode`_ document. + +.. _Testing with Xcode: http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ + +Module Functions +^^^^^^^^^^^^^^^^ + +.. command:: xctest_add_bundle + + The ``xctest_add_bundle`` function creates a XCTest bundle named + which will test the target . Supported target types + for testee are Frameworks and App Bundles:: + + xctest_add_bundle( + # Name of the XCTest bundle + # Target name of the testee + ) + +.. command:: xctest_add_test + + The ``xctest_add_test`` function adds an XCTest bundle to the + project to be run by :manual:`ctest(1)`. The test will be named + and tests :: + + xctest_add_test( + # Test name + # Target name of XCTest bundle + ) + +Module Variables +^^^^^^^^^^^^^^^^ + +The following variables are set by including this module: + +.. variable:: XCTest_FOUND + + True if the XCTest Framework and executable were found. + +.. variable:: XCTest_EXECUTABLE + + The path to the xctest command line tool used to execute XCTest bundles. + +.. variable:: XCTest_INCLUDE_DIRS + + The directory containing the XCTest Framework headers. + +.. variable:: XCTest_LIBRARIES + + The location of the XCTest Framework. + +#]=======================================================================] + +#============================================================================= +# Copyright 2015 Gregor Jasny +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(XCTest_INCLUDE_DIR + NAMES "XCTest/XCTest.h" + DOC "XCTest include directory") +mark_as_advanced(XCTest_INCLUDE_DIR) + +find_library(XCTest_LIBRARY + NAMES XCTest + DOC "XCTest Framework library") +mark_as_advanced(XCTest_LIBRARY) + +execute_process( + COMMAND xcrun --find xctest + OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _xcrun_err) +if(_xcrun_out) + set(XCTest_EXECUTABLE "${_xcrun_out}" CACHE FILEPATH "XCTest executable") + mark_as_advanced(XCTest_EXECUTABLE) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(XCTest + FOUND_VAR XCTest_FOUND + REQUIRED_VARS XCTest_LIBRARY XCTest_INCLUDE_DIR XCTest_EXECUTABLE) + +if(XCTest_FOUND) + set(XCTest_INCLUDE_DIRS "${XCTest_INCLUDE_DIR}") + set(XCTest_LIBRARIES "${XCTest_LIBRARY}") +endif(XCTest_FOUND) + + +function(xctest_add_bundle target testee) + if(NOT XCTest_FOUND) + message(FATAL_ERROR "XCTest is required to create a XCTest Bundle.") + endif(NOT XCTest_FOUND) + + if(NOT CMAKE_OSX_SYSROOT) + message(FATAL_ERROR "Adding XCTest bundles requires CMAKE_OSX_SYSROOT to be set.") + endif() + + add_library(${target} MODULE ${ARGN}) + + set_target_properties(${target} PROPERTIES + BUNDLE TRUE + XCTEST TRUE + XCTEST_TESTEE ${testee}) + + target_link_libraries(${target} PRIVATE "-framework Foundation") + target_link_libraries(${target} PRIVATE ${XCTest_LIBRARIES}) + target_include_directories(${target} PRIVATE ${XCTest_INCLUDE_DIRS}) + + # retrieve testee target type + if(NOT TARGET ${testee}) + message(FATAL_ERROR "${testee} is not a target.") + endif() + get_property(_testee_type TARGET ${testee} PROPERTY TYPE) + get_property(_testee_framework TARGET ${testee} PROPERTY FRAMEWORK) + get_property(_testee_macosx_bundle TARGET ${testee} PROPERTY MACOSX_BUNDLE) + + if(_testee_type STREQUAL "SHARED_LIBRARY" AND _testee_framework) + # testee is a Framework + target_link_libraries(${target} PRIVATE ${testee}) + + elseif(_testee_type STREQUAL "EXECUTABLE" AND _testee_macosx_bundle) + # testee is an App Bundle + add_dependencies(${target} ${testee}) + if(XCODE) + set_target_properties(${target} PROPERTIES + XCODE_ATTRIBUTE_BUNDLE_LOADER "$(TEST_HOST)" + XCODE_ATTRIBUTE_TEST_HOST "$") + else(XCODE) + target_link_libraries(${target} + PRIVATE -bundle_loader $) + endif(XCODE) + + else() + message(FATAL_ERROR "Testee ${testee} is of unsupported type.") + endif() +endfunction(xctest_add_bundle) + + +function(xctest_add_test name bundle) + if(NOT XCTest_EXECUTABLE) + message(FATAL_ERROR "XCTest executable is required to register a test.") + endif() + + # check that bundle is a XCTest Bundle + + if(NOT TARGET ${bundle}) + message(FATAL_ERROR "${bundle} is not a target.") + endif(NOT TARGET ${bundle}) + + get_property(_test_type TARGET ${bundle} PROPERTY TYPE) + get_property(_test_bundle TARGET ${bundle} PROPERTY BUNDLE) + get_property(_test_xctest TARGET ${bundle} PROPERTY XCTEST) + + if(NOT _test_type STREQUAL "MODULE_LIBRARY" + OR NOT _test_xctest OR NOT _test_bundle) + message(FATAL_ERROR "Test ${bundle} is not an XCTest Bundle") + endif() + + # get and check testee properties + + get_property(_testee TARGET ${bundle} PROPERTY XCTEST_TESTEE) + if(NOT TARGET ${_testee}) + message(FATAL_ERROR "${_testee} is not a target.") + endif() + + get_property(_testee_type TARGET ${_testee} PROPERTY TYPE) + get_property(_testee_framework TARGET ${_testee} PROPERTY FRAMEWORK) + + # register test + + add_test( + NAME ${name} + COMMAND ${XCTest_EXECUTABLE} $/../..) + + # point loader to testee in case rpath is disabled + + if(_testee_type STREQUAL "SHARED_LIBRARY" AND _testee_framework) + set_property(TEST ${name} APPEND PROPERTY + ENVIRONMENT DYLD_FRAMEWORK_PATH=$/..) + endif() +endfunction(xctest_add_test) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3714955b9cded21b13064886b30a412211ce217e commit 3714955b9cded21b13064886b30a412211ce217e Author: Gregor Jasny AuthorDate: Wed Feb 25 21:07:43 2015 +0100 Commit: Brad King CommitDate: Mon Mar 23 09:12:18 2015 -0400 OS X: Add handling for XCTest bundles An XCTest bundle is a CFBundle with a special product-type and bundle extension. For more information about XCTest visit the Mac Developer library at: http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ Signed-off-by: Gregor Jasny diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 19fdf23..1dff33e 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -243,6 +243,7 @@ Properties on Targets /prop_tgt/VS_WINRT_REFERENCES /prop_tgt/WIN32_EXECUTABLE /prop_tgt/XCODE_ATTRIBUTE_an-attribute + /prop_tgt/XCTEST Properties on Tests =================== diff --git a/Help/prop_tgt/XCTEST.rst b/Help/prop_tgt/XCTEST.rst new file mode 100644 index 0000000..eb47e60 --- /dev/null +++ b/Help/prop_tgt/XCTEST.rst @@ -0,0 +1,13 @@ +XCTEST +------ + +This target is a XCTest CFBundle on the Mac. + +This property will usually get set via the :command:`xctest_add_bundle` +macro in :module:`FindXCTest` module. + +If a module library target has this property set to true it will be +built as a CFBundle when built on the Mac. It will have the directory +structure required for a CFBundle. + +This property depends on :prop_tgt:`BUNDLE` to be effective. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index bd8a1f5..d340e72 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -804,6 +804,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode = "compiled.mach-o.objfile"; } + else if(ext == "xctest") + { + sourcecode = "wrapper.cfbundle"; + } else if(ext == "xib") { keepLastKnownFileType = true; @@ -2598,7 +2602,9 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget) case cmTarget::STATIC_LIBRARY: return "archive.ar"; case cmTarget::MODULE_LIBRARY: - if (cmtarget.IsCFBundleOnApple()) + if (cmtarget.IsXCTestOnApple()) + return "wrapper.cfbundle"; + else if (cmtarget.IsCFBundleOnApple()) return "wrapper.plug-in"; else return ((this->XcodeVersion >= 22)? @@ -2622,7 +2628,9 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(cmTarget& cmtarget) case cmTarget::STATIC_LIBRARY: return "com.apple.product-type.library.static"; case cmTarget::MODULE_LIBRARY: - if (cmtarget.IsCFBundleOnApple()) + if (cmtarget.IsXCTestOnApple()) + return "com.apple.product-type.bundle.unit-test"; + else if (cmtarget.IsCFBundleOnApple()) return "com.apple.product-type.bundle"; else return ((this->XcodeVersion >= 22)? diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b70f60d..b3d1155 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -616,6 +616,13 @@ bool cmTarget::IsCFBundleOnApple() const } //---------------------------------------------------------------------------- +bool cmTarget::IsXCTestOnApple() const +{ + return (this->IsCFBundleOnApple() && + this->GetPropertyAsBool("XCTEST")); +} + +//---------------------------------------------------------------------------- bool cmTarget::IsBundleOnApple() const { return this->IsFrameworkOnApple() || this->IsAppBundleOnApple() || @@ -6791,7 +6798,14 @@ std::string cmTarget::GetCFBundleDirectory(const std::string& config, const char *ext = this->GetProperty("BUNDLE_EXTENSION"); if (!ext) { - ext = "bundle"; + if (this->IsXCTestOnApple()) + { + ext = "xctest"; + } + else + { + ext = "bundle"; + } } fpath += ext; fpath += "/Contents"; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5170b31..a4ef977 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -527,6 +527,9 @@ public: /** Return whether this target is a CFBundle (plugin) on Apple. */ bool IsCFBundleOnApple() const; + /** Return whether this target is a XCTest on Apple. */ + bool IsXCTestOnApple() const; + /** Return whether this target is an executable Bundle on Apple. */ bool IsAppBundleOnApple() const; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:16:19 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:16:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1155-g740e223 Message-ID: <20150323131619.C6874AD3BE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 740e22350a8e336a29ecf4b47362ed1da72a3d34 (commit) via fb3e4de8e81f5f14edd2123f53ae1eaed7c37172 (commit) from cb2eb1395022579149e562d9226f545e2fa608da (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=740e22350a8e336a29ecf4b47362ed1da72a3d34 commit 740e22350a8e336a29ecf4b47362ed1da72a3d34 Merge: cb2eb13 fb3e4de Author: Brad King AuthorDate: Mon Mar 23 09:16:19 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:16:19 2015 -0400 Merge topic 'cpack-bundle-codesign' into next fb3e4de8 CPack: Add support to overwrite or pass additional parameter to codesign http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb3e4de8e81f5f14edd2123f53ae1eaed7c37172 commit fb3e4de8e81f5f14edd2123f53ae1eaed7c37172 Author: Andr? Klitzing AuthorDate: Wed Mar 11 13:04:15 2015 +0100 Commit: Brad King CommitDate: Mon Mar 23 09:15:43 2015 -0400 CPack: Add support to overwrite or pass additional parameter to codesign diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake index d26a0b3..b412216 100644 --- a/Modules/CPackBundle.cmake +++ b/Modules/CPackBundle.cmake @@ -52,6 +52,11 @@ # list the main application folder, or the main executable. You should # list any frameworks and plugins that are included in your app bundle. # +# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER +# +# Additional parameter that will passed to codesign. +# Default value: "--deep -f" +# # .. variable:: CPACK_COMMAND_CODESIGN # # Path to the codesign(1) command used to sign applications with an diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 6e7a26b..b2d7019 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -221,6 +221,11 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) bundle_path += ".app"; // A list of additional files to sign, ie. frameworks and plugins. + const std::string sign_parameter = + this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") + ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") + : "--deep -f"; + const std::string sign_files = this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") : ""; @@ -234,7 +239,8 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) { std::ostringstream temp_sign_file_cmd; temp_sign_file_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); - temp_sign_file_cmd << " --deep -f -s \"" << cpack_apple_cert_app; + 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 << " \""; @@ -254,7 +260,8 @@ 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 << " --deep -f -s \"" << cpack_apple_cert_app; + temp_sign_binary_cmd << " " << sign_parameter << " -s \"" + << cpack_apple_cert_app; temp_sign_binary_cmd << "\" \"" << bundle_path << "\""; if(!this->RunCommand(temp_sign_binary_cmd, &output)) @@ -269,7 +276,8 @@ 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 << " --deep -f -s \"" << cpack_apple_cert_app << "\""; + temp_codesign_cmd << " " << sign_parameter << " -s \"" + << cpack_apple_cert_app << "\""; if(this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS")) { temp_codesign_cmd << " --entitlements "; ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:18:28 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:18:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-469-gcc8b8cd Message-ID: <20150323131828.8DD59AD425@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via cc8b8cdc751ff2dfa6e77a69da542d6aef066346 (commit) via 6bce027662588b972602e2e74c16a1883ed853cf (commit) via fde70a1b26e130663cc4c02e0530d3aadc165a41 (commit) from d67196d0e8c5e9feb99d3a609d060f52ad8b9a59 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc8b8cdc751ff2dfa6e77a69da542d6aef066346 commit cc8b8cdc751ff2dfa6e77a69da542d6aef066346 Merge: d67196d 6bce027 Author: Brad King AuthorDate: Mon Mar 23 09:18:26 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:18:26 2015 -0400 Merge topic 'ctest-repeat-until-fail' 6bce0276 Help: Add notes for topic 'ctest-repeat-until-fail' fde70a1b ctest: Add a new --repeat-until-fail option ----------------------------------------------------------------------- Summary of changes: Help/manual/ctest.1.rst | 5 ++ Help/release/dev/ctest-repeat-until-fail.rst | 5 ++ Source/CTest/cmCTestMultiProcessHandler.cxx | 13 +++- Source/CTest/cmCTestRunTest.cxx | 73 ++++++++++++++++++-- Source/CTest/cmCTestRunTest.h | 9 +++ Source/cmCTest.cxx | 37 ++++++++-- Source/cmCTest.h | 12 +++- Source/ctest.cxx | 2 + Tests/RunCMake/CMakeLists.txt | 1 + .../{CMP0054 => CTestCommandLine}/CMakeLists.txt | 0 Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 25 +++++++ Tests/RunCMake/CTestCommandLine/init.cmake | 3 + .../repeat-until-fail-bad1-result.txt} | 0 .../repeat-until-fail-bad1-stderr.txt | 1 + .../repeat-until-fail-bad2-result.txt} | 0 .../repeat-until-fail-bad2-stderr.txt | 1 + .../CTestCommandLine/repeat-until-fail-cmake.cmake | 15 ++++ .../repeat-until-fail-ctest-result.txt | 1 + .../repeat-until-fail-ctest-stderr.txt | 1 + .../repeat-until-fail-ctest-stdout.txt | 30 ++++++++ .../repeat-until-fail-good-stderr.txt | 1 + Tests/RunCMake/CTestCommandLine/test1.cmake | 13 ++++ 22 files changed, 233 insertions(+), 15 deletions(-) create mode 100644 Help/release/dev/ctest-repeat-until-fail.rst copy Tests/RunCMake/{CMP0054 => CTestCommandLine}/CMakeLists.txt (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CTestCommandLine/init.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CTestCommandLine/repeat-until-fail-bad1-result.txt} (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad1-stderr.txt copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CTestCommandLine/repeat-until-fail-bad2-result.txt} (100%) create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-bad2-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-result.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt create mode 100644 Tests/RunCMake/CTestCommandLine/repeat-until-fail-good-stderr.txt create mode 100644 Tests/RunCMake/CTestCommandLine/test1.cmake hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:18:31 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:18:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-475-ga37937f Message-ID: <20150323131831.889F4AD425@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a37937f7c0a37626298ccc80cffe5ec9fd26aa75 (commit) via 4178cd88fc01bd38fde2f3ee7a1702cfb4808f93 (commit) via 87a4b8580cad34fefa5c5e1833b0963a6bcf3e7d (commit) via ba14510b4ebdbbfe115e29111615a4b775fb7198 (commit) via 3714955b9cded21b13064886b30a412211ce217e (commit) via 54a5cdbb4c35aa8847d3eb0f7f418fad72563992 (commit) from cc8b8cdc751ff2dfa6e77a69da542d6aef066346 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a37937f7c0a37626298ccc80cffe5ec9fd26aa75 commit a37937f7c0a37626298ccc80cffe5ec9fd26aa75 Merge: cc8b8cd 4178cd8 Author: Brad King AuthorDate: Mon Mar 23 09:18:29 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:18:29 2015 -0400 Merge topic 'xcode-xctest' 4178cd88 Help: Add notes for topic 'xcode-xctest' 87a4b858 Tests: Add XCTest example to test Frameworks and Cocoa App Bundles ba14510b OS X: Add FindXCTest module 3714955b OS X: Add handling for XCTest bundles 54a5cdbb Tests: Compute Xcode version for any generator on OS X ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-modules.7.rst | 1 + Help/manual/cmake-properties.7.rst | 1 + Help/module/FindXCTest.rst | 1 + Help/prop_tgt/XCTEST.rst | 13 + Help/release/dev/xcode-xctest.rst | 6 + Modules/FindXCTest.cmake | 196 ++++++ Source/cmGlobalXCodeGenerator.cxx | 12 +- Source/cmTarget.cxx | 16 +- Source/cmTarget.h | 3 + Tests/CMakeLists.txt | 18 + Tests/XCTest/CMakeLists.txt | 57 ++ Tests/XCTest/CocoaExample/AppDelegate.h | 6 + Tests/XCTest/CocoaExample/AppDelegate.m | 18 + .../CocoaExample/Info.plist} | 22 +- Tests/XCTest/CocoaExample/MainMenu.xib | 680 ++++++++++++++++++++ Tests/XCTest/CocoaExample/main.m | 5 + Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m | 13 + Tests/XCTest/FrameworkExample/FrameworkExample.c | 6 + Tests/XCTest/FrameworkExample/FrameworkExample.h | 1 + .../FrameworkExample/Info.plist} | 28 +- .../FrameworkExampleTests/FrameworkExampleTests.m | 16 + .../FrameworkExampleTests/Info.plist} | 24 +- 22 files changed, 1096 insertions(+), 47 deletions(-) create mode 100644 Help/module/FindXCTest.rst create mode 100644 Help/prop_tgt/XCTEST.rst create mode 100644 Help/release/dev/xcode-xctest.rst create mode 100644 Modules/FindXCTest.cmake create mode 100644 Tests/XCTest/CMakeLists.txt create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.h create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.m copy Tests/{iOSNavApp/Info.plist.in => XCTest/CocoaExample/Info.plist} (66%) create mode 100644 Tests/XCTest/CocoaExample/MainMenu.xib create mode 100644 Tests/XCTest/CocoaExample/main.m create mode 100644 Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.c create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.h copy Tests/{iOSNavApp/Info.plist.in => XCTest/FrameworkExample/Info.plist} (58%) create mode 100644 Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m copy Tests/{iOSNavApp/Info.plist.in => XCTest/FrameworkExampleTests/Info.plist} (56%) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:18:33 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:18:33 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-477-g88abc78 Message-ID: <20150323131833.7283DAD434@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 88abc78723bc955d44d83998e70d3b09d5dd4806 (commit) via 00842df48d8d3585562b8d64d56cd6646dc9d3ff (commit) from a37937f7c0a37626298ccc80cffe5ec9fd26aa75 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=88abc78723bc955d44d83998e70d3b09d5dd4806 commit 88abc78723bc955d44d83998e70d3b09d5dd4806 Merge: a37937f 00842df Author: Brad King AuthorDate: Mon Mar 23 09:18:32 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:18:32 2015 -0400 Merge topic 'pgi-no-pie' 00842df4 PGI: Remove invalid -fPIE flag (#15460) ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Linux-PGI.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:18:35 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:18:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-479-gd0af020 Message-ID: <20150323131835.5FE18AD437@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d0af0207131b8436a2cf670265f815db511f441d (commit) via 3556fb1b81fccac63600a2509f92e9ef738fed69 (commit) from 88abc78723bc955d44d83998e70d3b09d5dd4806 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0af0207131b8436a2cf670265f815db511f441d commit d0af0207131b8436a2cf670265f815db511f441d Merge: 88abc78 3556fb1 Author: Brad King AuthorDate: Mon Mar 23 09:18:34 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:18:34 2015 -0400 Merge topic 'SunPro-Fortran-KPIC' 3556fb1b SunPro: Add position independent code flag for Fortran compiler ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/SunPro-Fortran.cmake | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:18:37 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:18:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-481-g45583e5 Message-ID: <20150323131837.924C8AD431@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 45583e52728584385f67e68aac0998368042f23f (commit) via 18917d66d4997786afcb27580518e325342117d2 (commit) from d0af0207131b8436a2cf670265f815db511f441d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45583e52728584385f67e68aac0998368042f23f commit 45583e52728584385f67e68aac0998368042f23f Merge: d0af020 18917d6 Author: Brad King AuthorDate: Mon Mar 23 09:18:36 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:18:36 2015 -0400 Merge topic 'cpack-rpm-ignore-default-prefix' 18917d66 CPack/RPM ignore install prefix relocation path ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 21 ++++++++++++++++++-- .../MyLibCPackConfig-IgnoreGroup.cmake.in | 4 ++++ .../RunCPackVerifyResult.cmake | 4 ++-- 3 files changed, 25 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:18:39 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:18:39 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-483-g114ddb0 Message-ID: <20150323131839.638C0AD435@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 114ddb072ce309df64806800550823f656845e77 (commit) via 610464c12e0ef71b2bea28973b70630c4ce9a70e (commit) from 45583e52728584385f67e68aac0998368042f23f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=114ddb072ce309df64806800550823f656845e77 commit 114ddb072ce309df64806800550823f656845e77 Merge: 45583e5 610464c Author: Brad King AuthorDate: Mon Mar 23 09:18:38 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:18:38 2015 -0400 Merge topic 'autogen-write-access' 610464c1 QtAutogen: Ensure write access to AutogenInfo.cmake (#15416) ----------------------------------------------------------------------- Summary of changes: Source/cmQtAutoGenerators.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:18:41 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:18:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-485-ged99514 Message-ID: <20150323131841.39AA5AD439@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ed99514fc1f77ac48dfffbf4fec4a08bff56976f (commit) via fb3e4de8e81f5f14edd2123f53ae1eaed7c37172 (commit) from 114ddb072ce309df64806800550823f656845e77 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed99514fc1f77ac48dfffbf4fec4a08bff56976f commit ed99514fc1f77ac48dfffbf4fec4a08bff56976f Merge: 114ddb0 fb3e4de Author: Brad King AuthorDate: Mon Mar 23 09:18:40 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:18:40 2015 -0400 Merge topic 'cpack-bundle-codesign' fb3e4de8 CPack: Add support to overwrite or pass additional parameter to codesign ----------------------------------------------------------------------- Summary of changes: Modules/CPackBundle.cmake | 5 +++++ Source/CPack/cmCPackBundleGenerator.cxx | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:18:43 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:18:43 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-487-g4f12961 Message-ID: <20150323131843.22946AD43F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 4f129615b3ec6d4f136ea77768745ef9649d11dc (commit) via a21e8df0da0d43f8c678d4c07f731035d04c0e27 (commit) from ed99514fc1f77ac48dfffbf4fec4a08bff56976f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4f129615b3ec6d4f136ea77768745ef9649d11dc commit 4f129615b3ec6d4f136ea77768745ef9649d11dc Merge: ed99514 a21e8df Author: Brad King AuthorDate: Mon Mar 23 09:18:41 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:18:41 2015 -0400 Merge topic 'UseJava-fix-arg-parse' a21e8df0 UseJava: Fix add_jar argument parsing (#14655) ----------------------------------------------------------------------- Summary of changes: Modules/UseJava.cmake | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:18:45 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:18:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-489-ge85eb2e Message-ID: <20150323131845.BC895AD3CF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e85eb2e3368f2cc26149ef801c1a35979ffa1bad (commit) via f85db2f32358e6de921aba7d1cb8ecb81da934c0 (commit) from 4f129615b3ec6d4f136ea77768745ef9649d11dc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e85eb2e3368f2cc26149ef801c1a35979ffa1bad commit e85eb2e3368f2cc26149ef801c1a35979ffa1bad Merge: 4f12961 f85db2f Author: Brad King AuthorDate: Mon Mar 23 09:18:43 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:18:43 2015 -0400 Merge topic 'add-extra-qbs-generator' f85db2f3 Qbs: Add new 'extra' generator for qbs project files ----------------------------------------------------------------------- Summary of changes: Help/generator/{CodeBlocks.rst => Qbs.rst} | 16 +- Help/manual/cmake-generators.7.rst | 1 + Help/release/dev/add-extra-qbs-generator.rst | 6 + Source/CMakeLists.txt | 2 + Source/cmExtraQbsGenerator.cxx | 260 ++++++++++++++++++++++++++ Source/cmExtraQbsGenerator.h | 48 +++++ Source/cmake.cxx | 4 + Tests/CMakeLists.txt | 16 +- 8 files changed, 344 insertions(+), 9 deletions(-) copy Help/generator/{CodeBlocks.rst => Qbs.rst} (67%) create mode 100644 Help/release/dev/add-extra-qbs-generator.rst create mode 100644 Source/cmExtraQbsGenerator.cxx create mode 100644 Source/cmExtraQbsGenerator.h hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:19:16 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:19:16 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1168-g551dfb5 Message-ID: <20150323131916.4E228AD43F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 551dfb5692986403408793e051507b37a8b292a5 (commit) via e85eb2e3368f2cc26149ef801c1a35979ffa1bad (commit) via 4f129615b3ec6d4f136ea77768745ef9649d11dc (commit) via ed99514fc1f77ac48dfffbf4fec4a08bff56976f (commit) via 114ddb072ce309df64806800550823f656845e77 (commit) via 45583e52728584385f67e68aac0998368042f23f (commit) via d0af0207131b8436a2cf670265f815db511f441d (commit) via 88abc78723bc955d44d83998e70d3b09d5dd4806 (commit) via a37937f7c0a37626298ccc80cffe5ec9fd26aa75 (commit) via cc8b8cdc751ff2dfa6e77a69da542d6aef066346 (commit) via d67196d0e8c5e9feb99d3a609d060f52ad8b9a59 (commit) via aeb9fb977493c0865a2d6c9fab8affaf69845c85 (commit) via 2ec1c0d6e07305c51e0602ddff835919b4b08ed9 (commit) from 740e22350a8e336a29ecf4b47362ed1da72a3d34 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=551dfb5692986403408793e051507b37a8b292a5 commit 551dfb5692986403408793e051507b37a8b292a5 Merge: 740e223 e85eb2e Author: Brad King AuthorDate: Mon Mar 23 09:19:05 2015 -0400 Commit: Brad King CommitDate: Mon Mar 23 09:19:05 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:22:02 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:22:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1170-ga5c530b Message-ID: <20150323132202.073D1AD4A9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a5c530b709838a32b3ee786774843b506dd0321b (commit) via 81bfebfe8c1cd568c945250ac26ac18d92fcd251 (commit) from 551dfb5692986403408793e051507b37a8b292a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5c530b709838a32b3ee786774843b506dd0321b commit a5c530b709838a32b3ee786774843b506dd0321b Merge: 551dfb5 81bfebf Author: Brad King AuthorDate: Mon Mar 23 09:22:01 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:22:01 2015 -0400 Merge topic 'lib64_paths_crosscompiling' into next 81bfebfe Linux: Ignore Debian-specific case when cross-compiling http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81bfebfe8c1cd568c945250ac26ac18d92fcd251 commit 81bfebfe8c1cd568c945250ac26ac18d92fcd251 Author: Zack Galbreath AuthorDate: Fri Mar 20 15:13:33 2015 -0400 Commit: Brad King CommitDate: Mon Mar 23 09:19:54 2015 -0400 Linux: Ignore Debian-specific case when cross-compiling When constructing settings for the target environment during cross compiling we should not check for /etc/debian_version on the host. diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index fe8e003..e40a74f 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -52,6 +52,6 @@ include(Platform/UnixPaths) # Debian has lib64 paths only for compatibility so they should not be # searched. -if(EXISTS "/etc/debian_version") +if(NOT CMAKE_CROSSCOMPILING AND EXISTS "/etc/debian_version") set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) endif() ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:22:07 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:22:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-491-g7ef5f24 Message-ID: <20150323132207.27A5CAD4B1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 7ef5f240c80bae10701eda5a1592d0516668a85e (commit) via 81bfebfe8c1cd568c945250ac26ac18d92fcd251 (commit) from e85eb2e3368f2cc26149ef801c1a35979ffa1bad (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ef5f240c80bae10701eda5a1592d0516668a85e commit 7ef5f240c80bae10701eda5a1592d0516668a85e Merge: e85eb2e 81bfebf Author: Brad King AuthorDate: Mon Mar 23 09:22:06 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:22:06 2015 -0400 Merge topic 'lib64_paths_crosscompiling' 81bfebfe Linux: Ignore Debian-specific case when cross-compiling ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Linux.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:22:23 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:22:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1172-g462318e Message-ID: <20150323132223.2AD13AD4A8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 462318ee7e8ca369f899f580b9bde5fa9b4f23b1 (commit) via 7ef5f240c80bae10701eda5a1592d0516668a85e (commit) from a5c530b709838a32b3ee786774843b506dd0321b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=462318ee7e8ca369f899f580b9bde5fa9b4f23b1 commit 462318ee7e8ca369f899f580b9bde5fa9b4f23b1 Merge: a5c530b 7ef5f24 Author: Brad King AuthorDate: Mon Mar 23 09:22:17 2015 -0400 Commit: Brad King CommitDate: Mon Mar 23 09:22:17 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:48:09 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:48:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-496-g64e97ed Message-ID: <20150323134809.DA5BBACEFB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 64e97edad7c8d4b8a2585067db206ad9a57d68f6 (commit) via bd9c7f9b2c788f9bf69c2ce4eb93d27212a6dfaa (commit) via ed8e30b00d032594fbb67d62f8bd4319ae6e5907 (commit) via ad094f435e005b484771acae36b79895c8e36e3f (commit) via 82a37d3ce5606f578997304cefc6aded15f2535c (commit) from 7ef5f240c80bae10701eda5a1592d0516668a85e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=64e97edad7c8d4b8a2585067db206ad9a57d68f6 commit 64e97edad7c8d4b8a2585067db206ad9a57d68f6 Merge: 7ef5f24 bd9c7f9 Author: Brad King AuthorDate: Mon Mar 23 09:48:07 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 09:48:07 2015 -0400 Merge topic 'ninja-require-byproducts' bd9c7f9b Ninja: Add policy to require explicit custom command byproducts ed8e30b0 cmGlobalNinjaGenerator: Optimize handling of known build outputs ad094f43 cmGlobalNinjaGenerator: Fix spelling of "unknown" 82a37d3c cmGlobalNinjaGenerator: Drop unused member ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0058.rst | 108 ++++++++++++++++++++ Help/release/dev/ninja-require-byproducts.rst | 9 ++ Source/cmGlobalNinjaGenerator.cxx | 86 ++++++++++++---- Source/cmGlobalNinjaGenerator.h | 7 +- Source/cmPolicies.cxx | 5 + Source/cmPolicies.h | 1 + Tests/RunCMake/CMakeLists.txt | 3 + .../RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake | 3 + .../CMP0058-NEW-no-build-result.txt} | 0 .../RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt | 1 + Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake | 2 + .../RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake | 3 + .../RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake | 2 + .../Ninja/CMP0058-WARN-by-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake | 2 + .../Ninja/CMP0058-WARN-no-build-stdout.txt | 4 + Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt | 19 ++++ Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake | 1 + Tests/RunCMake/Ninja/CMP0058-common.cmake | 17 +++ Tests/RunCMake/{CMP0019 => Ninja}/CMakeLists.txt | 2 +- Tests/RunCMake/Ninja/RunCMakeTest.cmake | 18 ++++ 25 files changed, 287 insertions(+), 23 deletions(-) create mode 100644 Help/policy/CMP0058.rst create mode 100644 Help/release/dev/ninja-require-byproducts.rst create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-by-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-by.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => Ninja/CMP0058-NEW-no-build-result.txt} (100%) create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-no-build-stderr.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-NEW-no.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-by-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-by.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-no-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-OLD-no.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-by-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-by.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-no-build-stdout.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-no-stderr.txt create mode 100644 Tests/RunCMake/Ninja/CMP0058-WARN-no.cmake create mode 100644 Tests/RunCMake/Ninja/CMP0058-common.cmake copy Tests/RunCMake/{CMP0019 => Ninja}/CMakeLists.txt (67%) create mode 100644 Tests/RunCMake/Ninja/RunCMakeTest.cmake hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 09:48:24 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 09:48:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1174-g3506478 Message-ID: <20150323134824.887B0ACEFD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 350647855b53e0b0b7a80170a413d73868559d54 (commit) via 64e97edad7c8d4b8a2585067db206ad9a57d68f6 (commit) from 462318ee7e8ca369f899f580b9bde5fa9b4f23b1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=350647855b53e0b0b7a80170a413d73868559d54 commit 350647855b53e0b0b7a80170a413d73868559d54 Merge: 462318e 64e97ed Author: Brad King AuthorDate: Mon Mar 23 09:48:16 2015 -0400 Commit: Brad King CommitDate: Mon Mar 23 09:48:16 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 10:29:00 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 10:29:00 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1176-g3a18de5 Message-ID: <20150323142900.6F50CAD55A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3a18de5bd9d27acd50c4a117bf8e654a37c56a9c (commit) via 209c142f68a8902db802ca6c73c22c395a7aea06 (commit) from 350647855b53e0b0b7a80170a413d73868559d54 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a18de5bd9d27acd50c4a117bf8e654a37c56a9c commit 3a18de5bd9d27acd50c4a117bf8e654a37c56a9c Merge: 3506478 209c142 Author: Brad King AuthorDate: Mon Mar 23 10:28:59 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 10:28:59 2015 -0400 Merge topic 'SunPro-no-KPIE' into next 209c142f SunPro: Drop non-existent -KPIE flag http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=209c142f68a8902db802ca6c73c22c395a7aea06 commit 209c142f68a8902db802ca6c73c22c395a7aea06 Author: Steven Vancoillie AuthorDate: Mon Mar 23 09:22:14 2015 +0100 Commit: Brad King CommitDate: Mon Mar 23 10:24:18 2015 -0400 SunPro: Drop non-existent -KPIE flag diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index c5b5203..92252cb 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -1,7 +1,6 @@ set(CMAKE_C_VERBOSE_FLAG "-#") set(CMAKE_C_COMPILE_OPTIONS_PIC -KPIC) -set(CMAKE_C_COMPILE_OPTIONS_PIE -KPIE) set(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC") set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G") set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index c7bc734..022b4d4 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -1,7 +1,6 @@ set(CMAKE_CXX_VERBOSE_FLAG "-v") set(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC) -set(CMAKE_CXX_COMPILE_OPTIONS_PIE -KPIE) set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC") set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G") set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R") ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/SunPro-C.cmake | 1 - Modules/Compiler/SunPro-CXX.cmake | 1 - 2 files changed, 2 deletions(-) hooks/post-receive -- CMake From gjasny at googlemail.com Mon Mar 23 12:56:07 2015 From: gjasny at googlemail.com (Gregor Jasny) Date: Mon, 23 Mar 2015 12:56:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1178-g67f80c3 Message-ID: <20150323165607.76FD1AD16F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 67f80c3e1ba9987369297a37f26fda680b9f9d6c (commit) via 840f5b89a456b6f68a9b75c7a0a0bfc3fa37e643 (commit) from 3a18de5bd9d27acd50c4a117bf8e654a37c56a9c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67f80c3e1ba9987369297a37f26fda680b9f9d6c commit 67f80c3e1ba9987369297a37f26fda680b9f9d6c Merge: 3a18de5 840f5b8 Author: Gregor Jasny AuthorDate: Mon Mar 23 12:56:03 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 12:56:03 2015 -0400 Merge topic 'install-sphinx-object-mapping' into next 840f5b89 Help: Install Sphinx HTML object mapping file http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=840f5b89a456b6f68a9b75c7a0a0bfc3fa37e643 commit 840f5b89a456b6f68a9b75c7a0a0bfc3fa37e643 Author: Gregor Jasny AuthorDate: Sun Mar 22 11:50:53 2015 +0100 Commit: Gregor Jasny CommitDate: Sun Mar 22 11:50:53 2015 +0100 Help: Install Sphinx HTML object mapping file To link CMake documentation from other documentation sets like KDE extra-cmake-modules the intersphinx extension depends on the objects.inv mapping file. The size overhead of 14k seems to be neglectable. Signed-off-by: Gregor Jasny diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index a58604e..da81752 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -159,7 +159,6 @@ if(SPHINX_HTML) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${CMAKE_DOC_DIR} PATTERN .buildinfo EXCLUDE - PATTERN objects.inv EXCLUDE ) endif() @@ -167,7 +166,6 @@ if(SPHINX_SINGLEHTML) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/singlehtml DESTINATION ${CMAKE_DOC_DIR} PATTERN .buildinfo EXCLUDE - PATTERN objects.inv EXCLUDE ) endif() ----------------------------------------------------------------------- Summary of changes: Utilities/Sphinx/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) hooks/post-receive -- CMake From gjasny at googlemail.com Mon Mar 23 13:12:25 2015 From: gjasny at googlemail.com (Gregor Jasny) Date: Mon, 23 Mar 2015 13:12:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1181-g9df562a Message-ID: <20150323171225.EBA15ACA2A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9df562aee9d17d00549722070d06da6967f7a154 (commit) via 008480bad1251fb9aa726d497d25148a238e7db9 (commit) via 5621c2fa857be13ee1f13b4a0178584a8cb783fe (commit) from 67f80c3e1ba9987369297a37f26fda680b9f9d6c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9df562aee9d17d00549722070d06da6967f7a154 commit 9df562aee9d17d00549722070d06da6967f7a154 Merge: 67f80c3 008480b Author: Gregor Jasny AuthorDate: Mon Mar 23 13:12:25 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 13:12:25 2015 -0400 Merge topic 'xcode5-xctest' into next 008480ba Tests: Enable XCTest tests for Xcode 5 5621c2fa Look for Xcode 5 platform specific Frameworks http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=008480bad1251fb9aa726d497d25148a238e7db9 commit 008480bad1251fb9aa726d497d25148a238e7db9 Author: Gregor Jasny AuthorDate: Mon Mar 23 18:06:46 2015 +0100 Commit: Gregor Jasny CommitDate: Mon Mar 23 18:09:52 2015 +0100 Tests: Enable XCTest tests for Xcode 5 Signed-off-by: Gregor Jasny diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 49fd02b..41032f8 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1519,7 +1519,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6 + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5 AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1}) ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $ -V) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5621c2fa857be13ee1f13b4a0178584a8cb783fe commit 5621c2fa857be13ee1f13b4a0178584a8cb783fe Author: Gregor Jasny AuthorDate: Fri Mar 20 23:48:22 2015 +0100 Commit: Gregor Jasny CommitDate: Mon Mar 23 18:09:24 2015 +0100 Look for Xcode 5 platform specific Frameworks The Xcode 5 platform specific framework locations differ from the Xcode 6 ones. Look first for the Xcode 6 ones, then for iOS Xcode 5 ones and last for the Xcode 5 OSX ones. For the record: Xcode511.app/Contents/Developer/Library/Frameworks/XCTest.framework Xcode511.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/Developer/Library/Frameworks/XCTest.framework Xcode511.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/Developer/Library/Frameworks/XCTest.framework Xcode601.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework Xcode601.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework Xcode601.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework Signed-off-by: Gregor Jasny diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index b912d98..2cbfce1 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -167,12 +167,21 @@ if(_CMAKE_OSX_SYSROOT_PATH) ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks ) # add platform developer framework path if exists - get_filename_component(_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH - ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks ABSOLUTE) - if(IS_DIRECTORY ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH}) - list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH - ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH}) - endif() + foreach(_path + # Xcode 6 + ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks + # Xcode 5 iOS + ${_CMAKE_OSX_SYSROOT_PATH}/Developer/Library/Frameworks + # Xcode 5 OSX + ${_CMAKE_OSX_SYSROOT_PATH}/../../../../../Library/Frameworks + ) + get_filename_component(_abolute_path "${_path}" ABSOLUTE) + if(EXISTS "${_abolute_path}") + list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH "${_abolute_path}") + message(STATUS "Found") + break() + endif() + endforeach() endif() list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH /Library/Frameworks ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Darwin.cmake | 21 +++++++++++++++------ Tests/CMakeLists.txt | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 23 14:23:02 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 23 Mar 2015 14:23:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1183-gb534f57 Message-ID: <20150323182302.38DF0AD3EC@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b534f579622d0af154689dc14b4952834318741b (commit) via c5f0185e73611458946faea75bd3347c40ea4d90 (commit) from 9df562aee9d17d00549722070d06da6967f7a154 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b534f579622d0af154689dc14b4952834318741b commit b534f579622d0af154689dc14b4952834318741b Merge: 9df562a c5f0185 Author: Brad King AuthorDate: Mon Mar 23 14:23:01 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 14:23:01 2015 -0400 Merge topic 'xcode5-xctest' into next c5f0185e fixup! Look for Xcode 5 platform specific Frameworks http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c5f0185e73611458946faea75bd3347c40ea4d90 commit c5f0185e73611458946faea75bd3347c40ea4d90 Author: Brad King AuthorDate: Mon Mar 23 14:22:50 2015 -0400 Commit: Brad King CommitDate: Mon Mar 23 14:22:50 2015 -0400 fixup! Look for Xcode 5 platform specific Frameworks diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 2cbfce1..4e4810a 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -178,7 +178,6 @@ if(_CMAKE_OSX_SYSROOT_PATH) get_filename_component(_abolute_path "${_path}" ABSOLUTE) if(EXISTS "${_abolute_path}") list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH "${_abolute_path}") - message(STATUS "Found") break() endif() endforeach() ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Darwin.cmake | 1 - 1 file changed, 1 deletion(-) hooks/post-receive -- CMake From betsy.mcphail at kitware.com Mon Mar 23 16:37:14 2015 From: betsy.mcphail at kitware.com (Betsy McPhail) Date: Mon, 23 Mar 2015 16:37:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1185-ga9282d8 Message-ID: <20150323203714.5A62CAD550@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a9282d84b211041bb8552d34c9e3e7c633873526 (commit) via 1a8d86ad8ba9a87848eed498fe66e715bb7d9ba1 (commit) from b534f579622d0af154689dc14b4952834318741b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9282d84b211041bb8552d34c9e3e7c633873526 commit a9282d84b211041bb8552d34c9e3e7c633873526 Merge: b534f57 1a8d86a Author: Betsy McPhail AuthorDate: Mon Mar 23 16:37:13 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 23 16:37:13 2015 -0400 Merge topic 'FileLockUnix-close-file' into next 1a8d86ad When a File Lock was released on Unix, the file handle was not closed http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1a8d86ad8ba9a87848eed498fe66e715bb7d9ba1 commit 1a8d86ad8ba9a87848eed498fe66e715bb7d9ba1 Author: Betsy McPhail AuthorDate: Mon Mar 23 16:32:12 2015 -0400 Commit: Betsy McPhail CommitDate: Mon Mar 23 16:32:12 2015 -0400 When a File Lock was released on Unix, the file handle was not closed Eventually, it was possible to run out of file handles and locks could not longer be acquired. The file lock functionality was added in commit e6db4c5. diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx index fc18a64..36a2d72 100644 --- a/Source/cmFileLockUnix.cxx +++ b/Source/cmFileLockUnix.cxx @@ -15,6 +15,7 @@ #include // errno #include // SEEK_SET #include +#include #include "cmSystemTools.h" cmFileLock::cmFileLock(): File(-1) @@ -31,6 +32,9 @@ cmFileLockResult cmFileLock::Release() this->Filename = ""; + ::close(this->File); + this->File = -1; + if (lockResult == 0) { return cmFileLockResult::MakeOk(); ----------------------------------------------------------------------- Summary of changes: Source/cmFileLockUnix.cxx | 4 ++++ 1 file changed, 4 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 24 00:01:06 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 24 Mar 2015 00:01:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-497-gbcdda24 Message-ID: <20150324040106.1D192AD1FD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via bcdda24851c83c86c19ec9cd96c90e7cdec688ef (commit) from 64e97edad7c8d4b8a2585067db206ad9a57d68f6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcdda24851c83c86c19ec9cd96c90e7cdec688ef commit bcdda24851c83c86c19ec9cd96c90e7cdec688ef Author: Kitware Robot AuthorDate: Tue Mar 24 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Tue Mar 24 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5ef57ab..b9a4a9c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150323) +set(CMake_VERSION_PATCH 20150324) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 11:13:41 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 11:13:41 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1187-gd4e11ba Message-ID: <20150324151341.E2F8BACE2A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d4e11ba12596763942888e1c7b6b46949e687c73 (commit) via 2ad054ff6719728244aac1ec0f9e5f872d56b2e9 (commit) from a9282d84b211041bb8552d34c9e3e7c633873526 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4e11ba12596763942888e1c7b6b46949e687c73 commit d4e11ba12596763942888e1c7b6b46949e687c73 Merge: a9282d8 2ad054f Author: Brad King AuthorDate: Tue Mar 24 11:13:41 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 11:13:41 2015 -0400 Merge topic 'FileLockUnix-close-file' into next 2ad054ff cmFileLockUnix: Close file descriptor when releasing a lock http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ad054ff6719728244aac1ec0f9e5f872d56b2e9 commit 2ad054ff6719728244aac1ec0f9e5f872d56b2e9 Author: Betsy McPhail AuthorDate: Mon Mar 23 16:32:12 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 11:10:34 2015 -0400 cmFileLockUnix: Close file descriptor when releasing a lock The file lock functionality added in commit v3.2.0-rc1~297^2~1 (file: Add LOCK subcommand to do file and directory locking, 2014-11-26) forgot to close the lock file descriptors on UNIX. Eventually it was possible to run out of file descriptors and locks could not longer be acquired. Fix this by closing the file descriptor when we are done with it. diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx index fc18a64..36a2d72 100644 --- a/Source/cmFileLockUnix.cxx +++ b/Source/cmFileLockUnix.cxx @@ -15,6 +15,7 @@ #include // errno #include // SEEK_SET #include +#include #include "cmSystemTools.h" cmFileLock::cmFileLock(): File(-1) @@ -31,6 +32,9 @@ cmFileLockResult cmFileLock::Release() this->Filename = ""; + ::close(this->File); + this->File = -1; + if (lockResult == 0) { return cmFileLockResult::MakeOk(); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 11:25:29 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 11:25:29 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1190-g08f38a3 Message-ID: <20150324152529.6712BAD691@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 08f38a325700aaef5d64f1664d0d63573206836c (commit) via 6ab1413499284dc8e1d7a8ac1f1940798a79e674 (commit) via 52642b466ec47f61195b4112407845e62b381596 (commit) from d4e11ba12596763942888e1c7b6b46949e687c73 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08f38a325700aaef5d64f1664d0d63573206836c commit 08f38a325700aaef5d64f1664d0d63573206836c Merge: d4e11ba 6ab1413 Author: Brad King AuthorDate: Tue Mar 24 11:25:28 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 11:25:28 2015 -0400 Merge topic 'xcode5-xctest' into next 6ab14134 Tests: Enable XCTest tests for Xcode 5 52642b46 OS X: Look for Xcode 5 platform-specific Frameworks http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ab1413499284dc8e1d7a8ac1f1940798a79e674 commit 6ab1413499284dc8e1d7a8ac1f1940798a79e674 Author: Gregor Jasny AuthorDate: Mon Mar 23 18:06:46 2015 +0100 Commit: Brad King CommitDate: Tue Mar 24 11:24:56 2015 -0400 Tests: Enable XCTest tests for Xcode 5 Signed-off-by: Gregor Jasny diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 49fd02b..41032f8 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1519,7 +1519,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6 + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5 AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1}) ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $ -V) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52642b466ec47f61195b4112407845e62b381596 commit 52642b466ec47f61195b4112407845e62b381596 Author: Gregor Jasny AuthorDate: Fri Mar 20 23:48:22 2015 +0100 Commit: Brad King CommitDate: Tue Mar 24 11:23:40 2015 -0400 OS X: Look for Xcode 5 platform-specific Frameworks The Xcode 5 platform specific framework locations differ from the Xcode 6 ones. Look first for the Xcode 6 ones, then for iOS Xcode 5 ones and last for the Xcode 5 OS X ones. For reference, the XCTest.framework is located as follows: Xcode511.app/Contents/Developer/Library/Frameworks/XCTest.framework Xcode511.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/Developer/Library/Frameworks/XCTest.framework Xcode511.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/Developer/Library/Frameworks/XCTest.framework Xcode601.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework Xcode601.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework Xcode601.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/XCTest.framework Signed-off-by: Gregor Jasny diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index b912d98..4e4810a 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -167,12 +167,20 @@ if(_CMAKE_OSX_SYSROOT_PATH) ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks ) # add platform developer framework path if exists - get_filename_component(_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH - ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks ABSOLUTE) - if(IS_DIRECTORY ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH}) - list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH - ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH}) - endif() + foreach(_path + # Xcode 6 + ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks + # Xcode 5 iOS + ${_CMAKE_OSX_SYSROOT_PATH}/Developer/Library/Frameworks + # Xcode 5 OSX + ${_CMAKE_OSX_SYSROOT_PATH}/../../../../../Library/Frameworks + ) + get_filename_component(_abolute_path "${_path}" ABSOLUTE) + if(EXISTS "${_abolute_path}") + list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH "${_abolute_path}") + break() + endif() + endforeach() endif() list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH /Library/Frameworks ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 11:26:22 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 11:26:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-500-ged777f1 Message-ID: <20150324152622.25116AD6A2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ed777f18375b79694016550b1221b2ed63c997a5 (commit) via 6ab1413499284dc8e1d7a8ac1f1940798a79e674 (commit) via 52642b466ec47f61195b4112407845e62b381596 (commit) from bcdda24851c83c86c19ec9cd96c90e7cdec688ef (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed777f18375b79694016550b1221b2ed63c997a5 commit ed777f18375b79694016550b1221b2ed63c997a5 Merge: bcdda24 6ab1413 Author: Brad King AuthorDate: Tue Mar 24 11:26:21 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 11:26:21 2015 -0400 Merge topic 'xcode5-xctest' 6ab14134 Tests: Enable XCTest tests for Xcode 5 52642b46 OS X: Look for Xcode 5 platform-specific Frameworks ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Darwin.cmake | 20 ++++++++++++++------ Tests/CMakeLists.txt | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 11:26:24 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 11:26:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-502-g048a8fb Message-ID: <20150324152624.16ABEAD6A6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 048a8fb837360dcba23d0f0ea6d29fbfd94fc9dd (commit) via 840f5b89a456b6f68a9b75c7a0a0bfc3fa37e643 (commit) from ed777f18375b79694016550b1221b2ed63c997a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=048a8fb837360dcba23d0f0ea6d29fbfd94fc9dd commit 048a8fb837360dcba23d0f0ea6d29fbfd94fc9dd Merge: ed777f1 840f5b8 Author: Brad King AuthorDate: Tue Mar 24 11:26:22 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 11:26:22 2015 -0400 Merge topic 'install-sphinx-object-mapping' 840f5b89 Help: Install Sphinx HTML object mapping file ----------------------------------------------------------------------- Summary of changes: Utilities/Sphinx/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 11:26:26 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 11:26:26 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-504-g81db650 Message-ID: <20150324152626.6C08BAD6AB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 81db6506a9d7367da4c7fb5455c95dd40a13554e (commit) via 13807bcb414c67cf8ee3f8b203fe30b472239072 (commit) from 048a8fb837360dcba23d0f0ea6d29fbfd94fc9dd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81db6506a9d7367da4c7fb5455c95dd40a13554e commit 81db6506a9d7367da4c7fb5455c95dd40a13554e Merge: 048a8fb 13807bc Author: Brad King AuthorDate: Tue Mar 24 11:26:24 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 11:26:24 2015 -0400 Merge topic 'blugeneq-platform-files' 13807bcb BlueGene/Q Platform files ----------------------------------------------------------------------- Summary of changes: Modules/Platform/BlueGeneQ-base.cmake | 177 ++++++++++++++++++++ ...ic-XL-C.cmake => BlueGeneQ-dynamic-GNU-C.cmake} | 2 +- ...-XL-C.cmake => BlueGeneQ-dynamic-GNU-CXX.cmake} | 2 +- ...X.cmake => BlueGeneQ-dynamic-GNU-Fortran.cmake} | 2 +- ...tic-XL-C.cmake => BlueGeneQ-dynamic-XL-C.cmake} | 2 +- ...c-XL-C.cmake => BlueGeneQ-dynamic-XL-CXX.cmake} | 2 +- ...XX.cmake => BlueGeneQ-dynamic-XL-Fortran.cmake} | 2 +- ...namic-GNU-CXX.cmake => BlueGeneQ-dynamic.cmake} | 3 +- ...tic-XL-C.cmake => BlueGeneQ-static-GNU-C.cmake} | 2 +- ...c-XL-C.cmake => BlueGeneQ-static-GNU-CXX.cmake} | 2 +- ...XX.cmake => BlueGeneQ-static-GNU-Fortran.cmake} | 2 +- ...atic-XL-C.cmake => BlueGeneQ-static-XL-C.cmake} | 2 +- ...ic-XL-C.cmake => BlueGeneQ-static-XL-CXX.cmake} | 2 +- ...L-C.cmake => BlueGeneQ-static-XL-Fortran.cmake} | 2 +- ...ynamic-GNU-CXX.cmake => BlueGeneQ-static.cmake} | 3 +- 15 files changed, 193 insertions(+), 14 deletions(-) create mode 100644 Modules/Platform/BlueGeneQ-base.cmake copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-dynamic-GNU-C.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-dynamic-GNU-CXX.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-XL-CXX.cmake => BlueGeneQ-dynamic-GNU-Fortran.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-dynamic-XL-C.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-dynamic-XL-CXX.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-XL-CXX.cmake => BlueGeneQ-dynamic-XL-Fortran.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-GNU-CXX.cmake => BlueGeneQ-dynamic.cmake} (89%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-GNU-C.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-GNU-CXX.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-XL-CXX.cmake => BlueGeneQ-static-GNU-Fortran.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-XL-C.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-XL-CXX.cmake} (94%) copy Modules/Platform/{BlueGeneP-static-XL-C.cmake => BlueGeneQ-static-XL-Fortran.cmake} (94%) copy Modules/Platform/{BlueGeneP-dynamic-GNU-CXX.cmake => BlueGeneQ-static.cmake} (90%) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 11:26:32 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 11:26:32 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-506-g51b4321 Message-ID: <20150324152632.4BEB2AD6A5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 51b4321e5fdf9f7cbc54881037a45a474883ef47 (commit) via 209c142f68a8902db802ca6c73c22c395a7aea06 (commit) from 81db6506a9d7367da4c7fb5455c95dd40a13554e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51b4321e5fdf9f7cbc54881037a45a474883ef47 commit 51b4321e5fdf9f7cbc54881037a45a474883ef47 Merge: 81db650 209c142 Author: Brad King AuthorDate: Tue Mar 24 11:26:30 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 11:26:30 2015 -0400 Merge topic 'SunPro-no-KPIE' 209c142f SunPro: Drop non-existent -KPIE flag ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/SunPro-C.cmake | 1 - Modules/Compiler/SunPro-CXX.cmake | 1 - 2 files changed, 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 11:29:24 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 11:29:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1196-gfebdd93 Message-ID: <20150324152924.3D28AAD712@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via febdd93da4e12087157861cbf74f929a714e0b46 (commit) via 51b4321e5fdf9f7cbc54881037a45a474883ef47 (commit) via 81db6506a9d7367da4c7fb5455c95dd40a13554e (commit) via 048a8fb837360dcba23d0f0ea6d29fbfd94fc9dd (commit) via ed777f18375b79694016550b1221b2ed63c997a5 (commit) via bcdda24851c83c86c19ec9cd96c90e7cdec688ef (commit) from 08f38a325700aaef5d64f1664d0d63573206836c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=febdd93da4e12087157861cbf74f929a714e0b46 commit febdd93da4e12087157861cbf74f929a714e0b46 Merge: 08f38a3 51b4321 Author: Brad King AuthorDate: Tue Mar 24 11:29:16 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 11:29:16 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 11:49:48 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 11:49:48 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1203-g0437c47 Message-ID: <20150324154948.E2183AD0C5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0437c473420f10b06488bf3d786c4c48b312d0f3 (commit) via ed1ee3d43992ef0b1512dcca2beb5add480580c5 (commit) via 52a7d6a8b1923ce08472a4f6ad9c7640fe4554a9 (commit) via 3fbaa3720dd024e653b654cd0d081f76da95f4f7 (commit) via ad69c815edf7f6b70b2e8a872d0968ec99aad988 (commit) via 590e0eb516f716a7e9beea17203fa462de6dfe5a (commit) via 1128a5f75d39fcf7c629d9367595e1812f7a1e75 (commit) from febdd93da4e12087157861cbf74f929a714e0b46 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0437c473420f10b06488bf3d786c4c48b312d0f3 commit 0437c473420f10b06488bf3d786c4c48b312d0f3 Merge: febdd93 ed1ee3d Author: Brad King AuthorDate: Tue Mar 24 11:49:47 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 11:49:47 2015 -0400 Merge topic 'add-GreenHills-MULTI-generator' into next ed1ee3d4 GHS: Drop unused method argument 52a7d6a8 GHS: Cleanup file streams as soon as we are done with them 3fbaa372 GHS: Fix global generator constructor ad69c815 GHS: Wrap long lines in source 590e0eb5 Help: Revise CMAKE_MAKE_PROGRAM documentation for GHS 1128a5f7 Add a 'Green Hills MULTI' generator http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed1ee3d43992ef0b1512dcca2beb5add480580c5 commit ed1ee3d43992ef0b1512dcca2beb5add480580c5 Author: Brad King AuthorDate: Tue Mar 24 11:28:25 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 11:31:38 2015 -0400 GHS: Drop unused method argument diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index d8cbb69..042339a 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -174,8 +174,7 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream( *filestream << "#!gbuild" << std::endl; } -void cmGlobalGhsMultiGenerator::OpenBuildFileStream( - cmMakefile *const makefile) { +void cmGlobalGhsMultiGenerator::OpenBuildFileStream() { // Compute GHS MULTI's build file path. std::string buildFilePath = this->GetCMakeInstance()->GetHomeOutputDirectory(); @@ -238,8 +237,7 @@ void cmGlobalGhsMultiGenerator::Generate() { this->cmGlobalGenerator::Generate(); if (this->LocalGenerators.size() > 0) { - cmLocalGenerator *sampLG = this->LocalGenerators[0]; - this->OpenBuildFileStream(sampLG->GetMakefile()); + this->OpenBuildFileStream(); // Build all the folder build files for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 9aff8e7..78a7736 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -93,7 +93,7 @@ private: std::string GetCompRoot(); std::vector GetCompRootHardPaths(); std::vector GetCompRootRegistry(); - void OpenBuildFileStream(cmMakefile *makefile); + void OpenBuildFileStream(); void WriteMacros(); void WriteHighLevelDirectives(); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52a7d6a8b1923ce08472a4f6ad9c7640fe4554a9 commit 52a7d6a8b1923ce08472a4f6ad9c7640fe4554a9 Author: Brad King AuthorDate: Tue Mar 24 10:54:50 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 10:57:00 2015 -0400 GHS: Cleanup file streams as soon as we are done with them diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 85b3aaf..d8cbb69 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -249,6 +249,9 @@ void cmGlobalGhsMultiGenerator::Generate() { UpdateBuildFiles(tgts); } } + + cmDeleteAll(TargetFolderBuildStreams); + this->TargetFolderBuildStreams.clear(); } void cmGlobalGhsMultiGenerator::GenerateBuildCommand( http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3fbaa3720dd024e653b654cd0d081f76da95f4f7 commit 3fbaa3720dd024e653b654cd0d081f76da95f4f7 Author: Brad King AuthorDate: Tue Mar 24 10:51:12 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 10:56:59 2015 -0400 GHS: Fix global generator constructor We have no module to find the make program. Add missing member initializer. diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 2410d76..85b3aaf 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -21,7 +21,7 @@ const char *cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator() : OSDirRelative(false) { - this->FindMakeProgramFile = "CMakeGreenHillsFindMake.cmake"; + this->GhsBuildCommandInitialized = false; } cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad69c815edf7f6b70b2e8a872d0968ec99aad988 commit ad69c815edf7f6b70b2e8a872d0968ec99aad988 Author: Brad King AuthorDate: Tue Mar 24 10:50:51 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 10:56:59 2015 -0400 GHS: Wrap long lines in source diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index e242cc0..648751f 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -354,7 +354,8 @@ void cmGhsMultiTargetGenerator::WriteObjectDir( } std::string -cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const { +cmGhsMultiTargetGenerator +::GetOutputDirectory(const std::string &config) const { std::string outputDir(AbsBuildFilePath); const char *runtimeOutputProp = diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 7822fab..0e61193 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -38,7 +38,7 @@ public: const char *GetAbsBuildFilePath() const { return AbsBuildFilePath.c_str(); } const char *GetRelBuildFileName() const { return RelBuildFileName.c_str(); } const char *GetAbsBuildFileName() const { return AbsBuildFileName.c_str(); } - const char *GetAbsOutputFileName() const { return AbsOutputFileName.c_str(); } + const char *GetAbsOutputFileName() const {return AbsOutputFileName.c_str();} private: cmGlobalGhsMultiGenerator *GetGlobalGenerator() const; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index d66d0d7..2410d76 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -78,7 +78,8 @@ void cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile *mf) { // directly instead of needing a helper module to do it, so we // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) { - mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetGhsBuildCommand().c_str()); + mf->AddDefinition("CMAKE_MAKE_PROGRAM", + this->GetGhsBuildCommand().c_str()); } } @@ -101,7 +102,8 @@ std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() { std::string cmGlobalGhsMultiGenerator::GetCompRoot() { std::string output; - const std::vector potentialDirsHardPaths(GetCompRootHardPaths()); + const std::vector + potentialDirsHardPaths(GetCompRootHardPaths()); const std::vector potentialDirsRegistry(GetCompRootRegistry()); std::vector potentialDirsComplete; @@ -143,14 +145,14 @@ std::vector cmGlobalGhsMultiGenerator::GetCompRootRegistry() { std::vector output(2); cmsys::SystemTools::ReadRegistryValue( "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Unin" - "stall\\" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" + "Windows\\CurrentVersion\\Uninstall\\" "GreenHillsSoftwared771f1b4;InstallLocation", output[0]); cmsys::SystemTools::ReadRegistryValue( "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Unin" - "stall\\" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" + "Windows\\CurrentVersion\\Uninstall\\" "GreenHillsSoftware9881cef6;InstallLocation", output[1]); return output; @@ -257,7 +259,8 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( std::vector const &makeOptions) { makeCommand.push_back(this->SelectMakeProgram(makeProgram)); - makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); + makeCommand.insert(makeCommand.end(), + makeOptions.begin(), makeOptions.end()); if (!targetName.empty()) { if (targetName == "clean") { makeCommand.push_back("-clean"); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index c7b5196..9aff8e7 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -82,9 +82,10 @@ protected: virtual void GenerateBuildCommand( std::vector &makeCommand, const std::string &makeProgram, const std::string &projectName, const std::string &projectDir, - const std::string &targetName, const std::string &config, bool fast, - bool verbose, - std::vector const &makeOptions = std::vector()); + const std::string &targetName, const std::string &config, + bool fast, bool verbose, + std::vector const &makeOptions = + std::vector()); private: std::string const &GetGhsBuildCommand(); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=590e0eb516f716a7e9beea17203fa462de6dfe5a commit 590e0eb516f716a7e9beea17203fa462de6dfe5a Author: Brad King AuthorDate: Tue Mar 24 10:50:16 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 10:56:59 2015 -0400 Help: Revise CMAKE_MAKE_PROGRAM documentation for GHS diff --git a/Help/variable/CMAKE_MAKE_PROGRAM.rst b/Help/variable/CMAKE_MAKE_PROGRAM.rst index 1cc22b5..85b098b 100644 --- a/Help/variable/CMAKE_MAKE_PROGRAM.rst +++ b/Help/variable/CMAKE_MAKE_PROGRAM.rst @@ -8,8 +8,6 @@ name if it is expected to be in the ``PATH``. The tool selected depends on the :variable:`CMAKE_GENERATOR` used to configure the project: -* The Green Hills MULTI generator sets this to ``GHS-MULTI`` - * The Makefile generators set this to ``make``, ``gmake``, or a generator-specific tool (e.g. ``nmake`` for "NMake Makefiles"). @@ -58,6 +56,10 @@ to configure the project: the CMake cache then CMake will use the specified value if possible. +* The :generator:`Green Hills MULTI` generator sets this to ``gbuild``. + If a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to + the CMake cache then CMake will use the specified value. + The ``CMAKE_MAKE_PROGRAM`` variable is set for use by project code. The value is also used by the :manual:`cmake(1)` ``--build`` and :manual:`ctest(1)` ``--build-and-test`` tools to launch the native http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1128a5f75d39fcf7c629d9367595e1812f7a1e75 commit 1128a5f75d39fcf7c629d9367595e1812f7a1e75 Author: Geoff Viola AuthorDate: Mon Mar 23 23:12:55 2015 -0600 Commit: Brad King CommitDate: Tue Mar 24 10:56:59 2015 -0400 Add a 'Green Hills MULTI' generator diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst new file mode 100644 index 0000000..79695f1 --- /dev/null +++ b/Help/generator/Green Hills MULTI.rst @@ -0,0 +1,11 @@ +Green Hills MULTI +----------------- + +Generates Green Hills MULTI project files. + +Customizations are available through the following cache variables: + +* ``GHS_BSP_NAME`` +* ``GHS_CUSTOMIZATION`` +* ``GHS_GPJ_MACROS`` +* ``GHS_OS_DIR`` diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 804229b..ce9f5c8 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -56,6 +56,7 @@ one may launch CMake from any environment. .. toctree:: :maxdepth: 1 + /generator/Green Hills MULTI /generator/Visual Studio 6 /generator/Visual Studio 7 /generator/Visual Studio 7 .NET 2003 diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index c342dbe..5282872 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -181,6 +181,7 @@ Variables that Describe the System /variable/CMAKE_SYSTEM_VERSION /variable/CYGWIN /variable/ENV + /variable/GHS-MULTI /variable/MINGW /variable/MSVC10 /variable/MSVC11 diff --git a/Help/variable/CMAKE_MAKE_PROGRAM.rst b/Help/variable/CMAKE_MAKE_PROGRAM.rst index f1d88a5..1cc22b5 100644 --- a/Help/variable/CMAKE_MAKE_PROGRAM.rst +++ b/Help/variable/CMAKE_MAKE_PROGRAM.rst @@ -8,6 +8,8 @@ name if it is expected to be in the ``PATH``. The tool selected depends on the :variable:`CMAKE_GENERATOR` used to configure the project: +* The Green Hills MULTI generator sets this to ``GHS-MULTI`` + * The Makefile generators set this to ``make``, ``gmake``, or a generator-specific tool (e.g. ``nmake`` for "NMake Makefiles"). diff --git a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst index 8ad89f1..2f5313b 100644 --- a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst +++ b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst @@ -6,3 +6,5 @@ The name of the CPU CMake is building for. This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if you build for the host system instead of the target system when cross compiling. + +* The Green Hills MULTI generator sets this to ``ARM`` by default diff --git a/Help/variable/GHS-MULTI.rst b/Help/variable/GHS-MULTI.rst new file mode 100644 index 0000000..0f91be8 --- /dev/null +++ b/Help/variable/GHS-MULTI.rst @@ -0,0 +1,4 @@ +GHS-MULTI +--------- + +True when using Green Hills MULTI diff --git a/Modules/Compiler/GHS-DetermineCompiler.cmake b/Modules/Compiler/GHS-DetermineCompiler.cmake new file mode 100644 index 0000000..56d24e2 --- /dev/null +++ b/Modules/Compiler/GHS-DetermineCompiler.cmake @@ -0,0 +1,6 @@ +set(_compiler_id_pp_test "defined(__INTEGRITY)") + +set(_compiler_id_version_compute " +# define @PREFIX at COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEGRITY_MAJOR_VERSION) +# define @PREFIX at COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEGRITY_MINOR_VERSION) +# define @PREFIX at COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEGRITY_PATCH_VERSION)") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 466090b..c844aed 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -405,6 +405,8 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) else() set (_boost_COMPILER "-il") endif() + elseif (GHSMULTI) + set(_boost_COMPILER "-ghs") elseif (MSVC14) set(_boost_COMPILER "-vc140") elseif (MSVC12) @@ -777,7 +779,8 @@ endif() # ------------------------------------------------------------------------ set(Boost_LIB_PREFIX "") -if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) +if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR + (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) ) set(Boost_LIB_PREFIX "lib") endif() diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake new file mode 100644 index 0000000..342ad21 --- /dev/null +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -0,0 +1,29 @@ + +#============================================================================= +# Copyright 2015 Geoffrey Viola +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +#Setup Greenhills MULTI specific compilation information +find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122 + "C:/ghs/int1122" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104 + "C:/ghs/int1104" + DOC "Path to integrity directory" + ) +set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory") +set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation") +set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") +set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") +mark_as_advanced(GHS_CUSTOMIZATION) +set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons") +mark_as_advanced(GHS_GPJ_MACROS) diff --git a/Modules/Platform/GHS-MULTI.cmake b/Modules/Platform/GHS-MULTI.cmake new file mode 100644 index 0000000..211cf3e --- /dev/null +++ b/Modules/Platform/GHS-MULTI.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2015 Geoffrey Viola +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. + +if(__GHSMULTI) + return() +endif() +set(__GHSMULTI 1) + +set(GHSMULTI 1) + +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + +include(Platform/WindowsPaths) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 04f6a81..064b827 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -472,6 +472,14 @@ if (WIN32) cmVisualStudioSlnParser.cxx cmVisualStudioWCEPlatformParser.h cmVisualStudioWCEPlatformParser.cxx + cmGlobalGhsMultiGenerator.cxx + cmGlobalGhsMultiGenerator.h + cmLocalGhsMultiGenerator.cxx + cmLocalGhsMultiGenerator.h + cmGhsMultiTargetGenerator.cxx + cmGhsMultiTargetGenerator.h + cmGhsMultiGpj.cxx + cmGhsMultiGpj.h ) endif() endif () @@ -499,6 +507,7 @@ set(SRCS ${SRCS} cmNinjaUtilityTargetGenerator.cxx cmNinjaUtilityTargetGenerator.h ) + if(WIN32 AND NOT CYGWIN) set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501) add_executable(cmcldeps cmcldeps.cxx) diff --git a/Source/cmGhsMultiGpj.cxx b/Source/cmGhsMultiGpj.cxx new file mode 100644 index 0000000..d630faa --- /dev/null +++ b/Source/cmGhsMultiGpj.cxx @@ -0,0 +1,39 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGhsMultiGpj.h" + +#include "cmGeneratedFileStream.h" + +void GhsMultiGpj::WriteGpjTag(Types const gpjType, + cmGeneratedFileStream *const filestream) { + char const *tag; + switch (gpjType) { + case INTERGRITY_APPLICATION: + tag = "INTEGRITY Application"; + break; + case PROJECT: + tag = "Project"; + break; + case PROGRAM: + tag = "Program"; + break; + case REFERENCE: + tag = "Reference"; + break; + case SUBPROJECT: + tag = "Subproject"; + break; + default: + tag = ""; + } + *filestream << "[" << tag << "]" << std::endl; +} diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h new file mode 100644 index 0000000..225ec47 --- /dev/null +++ b/Source/cmGhsMultiGpj.h @@ -0,0 +1,31 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGhsMultiGpj_h +#define cmGhsMultiGpj_h + +class cmGeneratedFileStream; + +class GhsMultiGpj { +public: + enum Types { + INTERGRITY_APPLICATION, + PROJECT, + PROGRAM, + REFERENCE, + SUBPROJECT + }; + + static void WriteGpjTag(Types const gpjType, + cmGeneratedFileStream *filestream); +}; + +#endif // ! cmGhsMultiGpjType_h diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx new file mode 100644 index 0000000..e242cc0 --- /dev/null +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -0,0 +1,435 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGhsMultiTargetGenerator.h" +#include "cmGlobalGhsMultiGenerator.h" +#include "cmLocalGhsMultiGenerator.h" +#include "cmMakefile.h" +#include "cmTarget.h" +#include "cmGeneratedFileStream.h" +#include "cmSourceFile.h" +#include +#include + +std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic"); + +cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget const *target) + : Target(target), LocalGenerator(static_cast( + target->GetMakefile()->GetLocalGenerator())), + Makefile(target->GetMakefile()), TargetGroup(DetermineIfTargetGroup()), + DynamicDownload(false) { + std::string BuildFileName; + BuildFileName = this->Target->GetName(); + BuildFileName += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + + char const *folderProp = this->Target->GetProperty("FOLDER"); + RelBuildFilePath = NULL == folderProp ? "" : folderProp; + if (RelBuildFilePath.size() > 0 && '/' != RelBuildFilePath.back()) { + RelBuildFilePath += "/"; + } + RelBuildFilePath += Target->GetName() + "/"; + + RelOutputFileName = RelBuildFilePath + Target->GetName() + ".a"; + + RelBuildFileName = RelBuildFilePath; + if (RelBuildFileName.size() > 0 && '/' != RelBuildFileName.back()) { + RelBuildFileName += "/"; + } + RelBuildFileName += BuildFileName; + + std::string absPathToRoot(this->Makefile->GetHomeOutputDirectory()); + if (absPathToRoot.size() > 0 && '/' != absPathToRoot.back()) { + absPathToRoot += "/"; + } + AbsBuildFilePath = absPathToRoot + RelBuildFilePath; + AbsBuildFileName = absPathToRoot + RelBuildFileName; + AbsOutputFileName = absPathToRoot + RelOutputFileName; +} + +cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() +{ + cmDeleteAll(FolderBuildStreams); +} + +void cmGhsMultiTargetGenerator::Generate() { + std::vector objectSources = GetSources(); + if (objectSources.size() > 0 && IncludeThisTarget()) { + if (!cmSystemTools::FileExists(AbsBuildFilePath.c_str())) { + cmSystemTools::MakeDirectory(AbsBuildFilePath.c_str()); + } + cmGlobalGhsMultiGenerator::Open(std::string(""), this->AbsBuildFileName, + &FolderBuildStreams); + cmGlobalGhsMultiGenerator::OpenBuildFileStream(GetFolderBuildStreams()); + std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + if (0 == config.length()) { + config = "RELEASE"; + } + const std::string language(this->Target->GetLinkerLanguage(config)); + config = cmSystemTools::UpperCase(config); + DynamicDownload = DetermineIfDynamicDownload(config, language); + if (DynamicDownload) { + *this->GetFolderBuildStreams() << "#component integrity_dynamic_download" + << std::endl; + } + GhsMultiGpj::WriteGpjTag(GetGpjTag(), this->GetFolderBuildStreams()); + cmGlobalGhsMultiGenerator::WriteDisclaimer(GetFolderBuildStreams()); + + bool const notKernel = IsNotKernel(config, language); + WriteTypeSpecifics(config, notKernel); + WriteDebugOptions(config, notKernel); + WriteCompilerOptions(config, language); + WriteCompilerFlags(); + WriteCompilerDefinitions(config, language); + WriteIncludes(config, language); + WriteTargetLinkLibraries(); + WriteCustomCommands(); + if (DynamicDownload) { + *this->GetFolderBuildStreams() << " " << DDOption << std::endl; + } + + WriteSources(objectSources); + } +} + +bool cmGhsMultiTargetGenerator::IncludeThisTarget() { + bool output = true; + char const *excludeFromAll = this->Target->GetProperty("EXCLUDE_FROM_ALL"); + if (NULL != excludeFromAll && '1' == excludeFromAll[0] && + '\0' == excludeFromAll[1]) { + output = false; + } + return output; +} + +std::vector cmGhsMultiTargetGenerator::GetSources() const { + std::vector output; + std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->Target->GetSourceFiles(output, config); + return output; +} + +GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const { + GhsMultiGpj::Types output; + if (IsTargetGroup()) { + output = GhsMultiGpj::Types::INTERGRITY_APPLICATION; + } else { + output = GhsMultiGpj::Types::PROGRAM; + } + return output; +} + +cmGlobalGhsMultiGenerator * +cmGhsMultiTargetGenerator::GetGlobalGenerator() const { + return static_cast( + LocalGenerator->GetGlobalGenerator()); +} + +void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string &config, + bool const notKernel) { + std::string outputDir(GetOutputDirectory(config)); + std::string outputFilename(GetOutputFilename(config)); + + if (Target->GetType() == cmTarget::TargetType::STATIC_LIBRARY) { + *GetFolderBuildStreams() << " -relobj" << std::endl; + *GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" + << outputDir << outputFilename << ".a\"" + << std::endl; + } else if (Target->GetType() == cmTarget::TargetType::EXECUTABLE) { + if (notKernel && !IsTargetGroup()) { + *GetFolderBuildStreams() << " -relprog" << std::endl; + } + if (IsTargetGroup()) { + *GetFolderBuildStreams() << " -non_shared" << std::endl; + *GetFolderBuildStreams() << " -o \"" << outputDir << outputFilename + << ".elf\"" << std::endl; + } else { + *GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" + << outputDir << outputFilename << ".as\"" + << std::endl; + } + } +} + +void cmGhsMultiTargetGenerator::WriteDebugOptions(std::string const &config, + bool const notKernel) { + if ("DEBUG" == config) { + if (notKernel) { + *GetFolderBuildStreams() << " -G" << std::endl; + *GetFolderBuildStreams() << " -Onone" << std::endl; + } else { + *GetFolderBuildStreams() << " -ldebug" << std::endl; + } + } else if (notKernel) { + *GetFolderBuildStreams() << " -O" << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteCompilerOptions( + std::string const &config, const std::string &language) { + std::vector options; + Target->GetCompileOptions(options, config, language); + bool hasStartfileDirProp = false; + std::string const startFilePropName("-startfile_dir="); + for (std::vector::const_iterator options_i = options.begin(); + options_i != options.end(); ++options_i) { + std::string option = *options_i; + if (DDOption != option) { + if (option.length() >= startFilePropName.length() && + startFilePropName == option.substr(0, startFilePropName.length())) { + hasStartfileDirProp = true; + } + cmSystemTools::ConvertToUnixSlashes(option); + *this->GetFolderBuildStreams() << " " << option << std::endl; + } + } + + // If this property is relative, make it relative to the root lists file + if (!hasStartfileDirProp && GetGlobalGenerator()->IsOSDirRelative()) { + *this->GetFolderBuildStreams() << " " << startFilePropName << "\"" + << this->Makefile->GetHomeOutputDirectory() + << "/$(__LIBS_DIR_BASE)/$(__BSP_NAME)\"" + << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteCompilerFlags() { + char const *const compileFlags = Target->GetProperty("COMPILE_FLAGS"); + if (NULL != compileFlags) { + *this->GetFolderBuildStreams() << " " << compileFlags << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteCompilerDefinitions( + const std::string &config, const std::string &language) { + std::vector compileDefinitions; + this->Target->GetCompileDefinitions(compileDefinitions, config, language); + for (std::vector::const_iterator cdI = + compileDefinitions.begin(); + cdI != compileDefinitions.end(); ++cdI) { + *this->GetFolderBuildStreams() << " -D" << (*cdI) << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config, + const std::string &language) { + std::vector includes = + Target->GetIncludeDirectories(config, language); + for (std::vector::const_iterator includes_i = includes.begin(); + includes_i != includes.end(); ++includes_i) { + *this->GetFolderBuildStreams() << " -I\"" << *includes_i << "\"" + << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() { + // library directories + cmTargetDependSet tds = + GetGlobalGenerator()->GetTargetDirectDepends(*this->Target); + for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end(); + ++tdsI) { + cmTarget const *tg(*tdsI); + cmGhsMultiTargetGenerator gmtg(tg); + *this->GetFolderBuildStreams() << " -L\"" << gmtg.GetAbsBuildFilePath() + << "\"" << std::endl; + } + // library targets + cmTarget::LinkLibraryVectorType llv = + this->Target->GetOriginalLinkLibraries(); + for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin(); + llvI != llv.end(); ++llvI) { + std::string libName = llvI->first; + // if it is a user defined target get the full path to the lib + cmTarget *tg(GetGlobalGenerator()->FindTarget(libName)); + if (NULL != tg) { + cmGhsMultiTargetGenerator gmtg(tg); + libName = tg->GetName() + ".a"; + } + *this->GetFolderBuildStreams() << " -l\"" << libName << "\"" + << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteCustomCommands() { + WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(), + cmTarget::CustomCommandType::PRE_BUILD); + WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(), + cmTarget::CustomCommandType::POST_BUILD); +} + +void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( + std::vector const &commandsSet, + cmTarget::CustomCommandType const commandType) { + for (std::vector::const_iterator commandsSetI = + commandsSet.begin(); + commandsSetI != commandsSet.end(); ++commandsSetI) { + cmCustomCommandLines const &commands = commandsSetI->GetCommandLines(); + for (cmCustomCommandLines::const_iterator commandI = commands.begin(); + commandI != commands.end(); ++commandI) { + switch (commandType) { + case cmTarget::CustomCommandType::PRE_BUILD: + *GetFolderBuildStreams() << " :preexecShellSafe="; + break; + case cmTarget::CustomCommandType::POST_BUILD: + *GetFolderBuildStreams() << " :postexecShellSafe="; + break; + default: + assert("Only pre and post are supported"); + } + cmCustomCommandLine const &command = *commandI; + for (cmCustomCommandLine::const_iterator commandLineI = command.begin(); + commandLineI != command.end(); ++commandLineI) { + if (command.size() > 0) { + *GetFolderBuildStreams() + << (command.begin() == commandLineI ? "'" : " "); + } + *GetFolderBuildStreams() << *commandLineI; + } + if (command.size() > 0) { + *GetFolderBuildStreams() << "'" << std::endl; + } + } + } +} + +void cmGhsMultiTargetGenerator::WriteSources( + std::vector const &objectSources) { + for (std::vector::const_iterator si = objectSources.begin(); + si != objectSources.end(); ++si) { + std::vector sourceGroups(this->Makefile->GetSourceGroups()); + char const *sourceFullPath = (*si)->GetFullPath().c_str(); + cmSourceGroup *sourceGroup = + this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups); + std::string sgPath(sourceGroup->GetFullName()); + cmSystemTools::ConvertToUnixSlashes(sgPath); + cmGlobalGhsMultiGenerator::AddFilesUpToPath( + GetFolderBuildStreams(), &FolderBuildStreams, + this->Makefile->GetHomeOutputDirectory(), sgPath, + GhsMultiGpj::Types::SUBPROJECT, RelBuildFilePath); + + if ((*si)->GetExtension() == ".int") { + *this->FolderBuildStreams[sgPath] << "\"" << (*si)->GetFullPath() << "\"" + << std::endl; + } else { + *this->FolderBuildStreams[sgPath] << (*si)->GetFullPath() << std::endl; + } + + if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() && + "bsp" != (*si)->GetExtension()) { + WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si)); + + WriteObjectDir(this->FolderBuildStreams[sgPath], + AbsBuildFilePath + sgPath); + } + } +} + +void cmGhsMultiTargetGenerator::WriteObjectLangOverride( + cmGeneratedFileStream *fileStream, cmSourceFile *sourceFile) { + const char *rawLangProp = sourceFile->GetProperty("LANGUAGE"); + if (NULL != rawLangProp) { + std::string sourceLangProp(rawLangProp); + std::string extension(sourceFile->GetExtension()); + if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) { + *fileStream << " -dotciscxx" << std::endl; + } + } +} + +void cmGhsMultiTargetGenerator::WriteObjectDir( + cmGeneratedFileStream *fileStream, std::string const &dir) { + std::string workingDir(dir); + if (workingDir.size() > 0 && '/' != workingDir.back()) { + workingDir += "/"; + } + workingDir += "Objs"; + *fileStream << " -object_dir=\"" << workingDir << "\"" << std::endl; +} + +std::string +cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const { + std::string outputDir(AbsBuildFilePath); + + const char *runtimeOutputProp = + Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY"); + if (NULL != runtimeOutputProp) { + outputDir = runtimeOutputProp; + } + + std::string configCapped(cmSystemTools::UpperCase(config)); + const char *runtimeOutputSProp = + Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped); + if (NULL != runtimeOutputSProp) { + outputDir = runtimeOutputSProp; + } + cmSystemTools::ConvertToUnixSlashes(outputDir); + + if (outputDir.length() > 0 && ('/' != (*outputDir.rbegin()))) { + outputDir += "/"; + } + + return outputDir; +} + +std::string +cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const { + std::string outputFilename(Target->GetName()); + + const char *outputNameProp = Target->GetProperty("OUTPUT_NAME"); + if (NULL != outputNameProp) { + outputFilename = outputNameProp; + } + + std::string configCapped(cmSystemTools::UpperCase(config)); + const char *outputNameSProp = + Target->GetProperty(configCapped + "_OUTPUT_NAME"); + if (NULL != outputNameSProp) { + outputFilename = outputNameSProp; + } + + return outputFilename; +} + +bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config, + const std::string &language) { + bool output; + std::vector options; + Target->GetCompileOptions(options, config, language); + output = + options.end() == std::find(options.begin(), options.end(), "-kernel"); + return output; +} + +bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup() { + bool output = false; + std::vector sources = GetSources(); + for (std::vector::const_iterator sources_i = sources.begin(); + sources.end() != sources_i; ++sources_i) { + if ("int" == (*sources_i)->GetExtension()) { + output = true; + } + } + return output; +} + +bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload( + std::string const &config, const std::string &language) { + std::vector options; + bool output = false; + Target->GetCompileOptions(options, config, language); + for (std::vector::const_iterator options_i = options.begin(); + options_i != options.end(); ++options_i) { + std::string option = *options_i; + if (DDOption == option) { + output = true; + } + } + return output; +} diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h new file mode 100644 index 0000000..7822fab --- /dev/null +++ b/Source/cmGhsMultiTargetGenerator.h @@ -0,0 +1,92 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGhsMultiTargetGenerator_h +#define cmGhsMultiTargetGenerator_h + +#include "cmStandardIncludes.h" +#include "cmTarget.h" +#include "cmGhsMultiGpj.h" + +class cmGeneratedFileStream; +class cmGlobalGhsMultiGenerator; +class cmLocalGhsMultiGenerator; +class cmMakefile; +class cmSourceFile; +class cmGeneratedFileStream; +class cmCustomCommand; + +class cmGhsMultiTargetGenerator { +public: + cmGhsMultiTargetGenerator(cmTarget const *target); + + virtual ~cmGhsMultiTargetGenerator(); + + virtual void Generate(); + + bool IncludeThisTarget(); + std::vector GetSources() const; + GhsMultiGpj::Types GetGpjTag() const; + const char *GetAbsBuildFilePath() const { return AbsBuildFilePath.c_str(); } + const char *GetRelBuildFileName() const { return RelBuildFileName.c_str(); } + const char *GetAbsBuildFileName() const { return AbsBuildFileName.c_str(); } + const char *GetAbsOutputFileName() const { return AbsOutputFileName.c_str(); } + +private: + cmGlobalGhsMultiGenerator *GetGlobalGenerator() const; + cmGeneratedFileStream *GetFolderBuildStreams() { + return FolderBuildStreams[""]; + }; + bool IsTargetGroup() const { return TargetGroup; } + + void WriteTypeSpecifics(const std::string &config, bool notKernel); + void WriteDebugOptions(std::string const &config, bool notKernel); + void WriteCompilerOptions(const std::string &config, + const std::string &language); + void WriteCompilerFlags(); + void WriteCompilerDefinitions(const std::string &config, + const std::string &language); + void WriteIncludes(const std::string &config, const std::string &language); + void WriteTargetLinkLibraries(); + void WriteCustomCommands(); + void + WriteCustomCommandsHelper(std::vector const &commandsSet, + cmTarget::CustomCommandType commandType); + void WriteSources(std::vector const &objectSources); + static void WriteObjectLangOverride(cmGeneratedFileStream *fileStream, + cmSourceFile *sourceFile); + static void WriteObjectDir(cmGeneratedFileStream *fileStream, + std::string const &dir); + std::string GetOutputDirectory(const std::string &config) const; + std::string GetOutputFilename(const std::string &config) const; + + bool IsNotKernel(std::string const &config, const std::string &language); + bool DetermineIfTargetGroup(); + bool DetermineIfDynamicDownload(std::string const &config, + const std::string &language); + + cmTarget const *Target; + cmLocalGhsMultiGenerator *LocalGenerator; + cmMakefile *Makefile; + std::string AbsBuildFilePath; + std::string RelBuildFilePath; + std::string AbsBuildFileName; + std::string RelBuildFileName; + std::string RelOutputFileName; + std::string AbsOutputFileName; + std::map + FolderBuildStreams; + bool TargetGroup; + bool DynamicDownload; + static std::string const DDOption; +}; + +#endif // ! cmGhsMultiTargetGenerator_h diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx new file mode 100644 index 0000000..d66d0d7 --- /dev/null +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -0,0 +1,448 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalGhsMultiGenerator.h" +#include "cmLocalGhsMultiGenerator.h" +#include "cmMakefile.h" +#include "cmVersion.h" +#include "cmGeneratedFileStream.h" +#include "cmGhsMultiTargetGenerator.h" +#include +#include + +const char *cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; + +cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator() : OSDirRelative(false) { + this->FindMakeProgramFile = "CMakeGreenHillsFindMake.cmake"; +} + +cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() { + cmDeleteAll(TargetFolderBuildStreams); +} + +cmLocalGenerator *cmGlobalGhsMultiGenerator::CreateLocalGenerator() { + cmLocalGenerator *lg = new cmLocalGhsMultiGenerator; + lg->SetGlobalGenerator(this); + this->SetCurrentLocalGenerator(lg); + return lg; +} + +void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry) { + entry.Name = GetActualName(); + entry.Brief = "Generates Green Hills MULTI files (experimental)."; +} + +void cmGlobalGhsMultiGenerator::EnableLanguage( + std::vector const &l, cmMakefile *mf, bool optional) { + mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); + mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM"); + + const std::string ghsCompRoot(GetCompRoot()); + mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str()); + std::string ghsCompRootStart = + 0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/"; + mf->AddDefinition("CMAKE_C_COMPILER", + std::string(ghsCompRootStart + "ccarm.exe").c_str()); + mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); + mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHSC"); + mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE"); + + mf->AddDefinition("CMAKE_CXX_COMPILER", + std::string(ghsCompRootStart + "cxarm.exe").c_str()); + mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE"); + mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHSCXX"); + mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); + + if (ghsCompRoot.length() > 0) { + static const char *compPreFix = "comp_"; + std::string compFilename = + cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix); + cmsys::SystemTools::ReplaceString(compFilename, compPreFix, ""); + mf->AddDefinition("CMAKE_SYSTEM_VERSION", compFilename.c_str()); + } + + mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files + this->cmGlobalGenerator::EnableLanguage(l, mf, optional); +} + +void cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile *mf) { + // The GHS generator knows how to lookup its build tool + // directly instead of needing a helper module to do it, so we + // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. + if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) { + mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetGhsBuildCommand().c_str()); + } +} + +std::string const &cmGlobalGhsMultiGenerator::GetGhsBuildCommand() { + if (!this->GhsBuildCommandInitialized) { + this->GhsBuildCommandInitialized = true; + this->GhsBuildCommand = this->FindGhsBuildCommand(); + } + return this->GhsBuildCommand; +} + +std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() { + std::string makeProgram = cmSystemTools::FindProgram("gbuild"); + if (makeProgram.empty()) { + makeProgram = "gbuild"; + } + return makeProgram; +} + +std::string cmGlobalGhsMultiGenerator::GetCompRoot() { + std::string output; + + const std::vector potentialDirsHardPaths(GetCompRootHardPaths()); + const std::vector potentialDirsRegistry(GetCompRootRegistry()); + + std::vector potentialDirsComplete; + potentialDirsComplete.insert(potentialDirsComplete.end(), + potentialDirsHardPaths.begin(), + potentialDirsHardPaths.end()); + potentialDirsComplete.insert(potentialDirsComplete.end(), + potentialDirsRegistry.begin(), + potentialDirsRegistry.end()); + + // Use latest version + std::string outputDirName; + for (std::vector::const_iterator potentialDirsCompleteIt = + potentialDirsComplete.begin(); + potentialDirsCompleteIt != potentialDirsComplete.end(); + ++potentialDirsCompleteIt) { + const std::string dirName( + cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt)); + if (dirName.compare(outputDirName) > 0) { + output = *potentialDirsCompleteIt; + outputDirName = dirName; + } + } + + return output; +} + +std::vector cmGlobalGhsMultiGenerator::GetCompRootHardPaths() { + std::vector output; + cmSystemTools::Glob("C:/ghs", "comp_[^;]+", output); + for (std::vector::iterator outputIt = output.begin(); + outputIt != output.end(); ++outputIt) { + *outputIt = "C:/ghs/" + *outputIt; + } + return output; +} + +std::vector cmGlobalGhsMultiGenerator::GetCompRootRegistry() { + std::vector output(2); + cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Unin" + "stall\\" + "GreenHillsSoftwared771f1b4;InstallLocation", + output[0]); + cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Unin" + "stall\\" + "GreenHillsSoftware9881cef6;InstallLocation", + output[1]); + return output; +} + +void cmGlobalGhsMultiGenerator::OpenBuildFileStream( + std::string const &filepath, cmGeneratedFileStream **filestream) { + // Get a stream where to generate things. + if (NULL == *filestream) { + *filestream = new cmGeneratedFileStream(filepath.c_str()); + if (NULL != *filestream) { + OpenBuildFileStream(*filestream); + } + } +} + +void cmGlobalGhsMultiGenerator::OpenBuildFileStream( + cmGeneratedFileStream *filestream) { + *filestream << "#!gbuild" << std::endl; +} + +void cmGlobalGhsMultiGenerator::OpenBuildFileStream( + cmMakefile *const makefile) { + // Compute GHS MULTI's build file path. + std::string buildFilePath = + this->GetCMakeInstance()->GetHomeOutputDirectory(); + buildFilePath += "/"; + buildFilePath += "default"; + buildFilePath += FILE_EXTENSION; + + Open(std::string(""), buildFilePath, &TargetFolderBuildStreams); + OpenBuildFileStream(GetBuildFileStream()); + + char const *osDir = + this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR"); + if (NULL == osDir) { + osDir = ""; + cmSystemTools::Error("GHS_OS_DIR cache variable must be set"); + } else { + this->GetCMakeInstance()->MarkCliAsUsed("GHS_OS_DIR"); + } + std::string fOSDir(trimQuotes(osDir)); + cmSystemTools::ReplaceString(fOSDir, "\\", "/"); + if (fOSDir.length() > 0 && ('c' == fOSDir[0] || 'C' == fOSDir[0])) { + OSDirRelative = false; + } else { + OSDirRelative = true; + } + + char const *bspName = + this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); + if (NULL == bspName) { + bspName = ""; + cmSystemTools::Error("GHS_BSP_NAME cache variable must be set"); + } else { + this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); + } + std::string fBspName(trimQuotes(bspName)); + cmSystemTools::ReplaceString(fBspName, "\\", "/"); + WriteMacros(); + WriteHighLevelDirectives(); + + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::Types::PROJECT, GetBuildFileStream()); + WriteDisclaimer(GetBuildFileStream()); + *GetBuildFileStream() << "# Top Level Project File" << std::endl; + if (fBspName.length() > 0) { + *GetBuildFileStream() << " -bsp " << fBspName << std::endl; + } + WriteCompilerOptions(fOSDir); +} + +void cmGlobalGhsMultiGenerator::CloseBuildFileStream( + cmGeneratedFileStream **filestream) { + if (filestream) { + delete *filestream; + *filestream = NULL; + } else { + cmSystemTools::Error("Build file stream was not open."); + } +} + +void cmGlobalGhsMultiGenerator::Generate() { + this->cmGlobalGenerator::Generate(); + + if (this->LocalGenerators.size() > 0) { + cmLocalGenerator *sampLG = this->LocalGenerators[0]; + this->OpenBuildFileStream(sampLG->GetMakefile()); + + // Build all the folder build files + for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { + cmLocalGhsMultiGenerator *lg = + static_cast(this->LocalGenerators[i]); + cmGeneratorTargetsType tgts = lg->GetMakefile()->GetGeneratorTargets(); + UpdateBuildFiles(tgts); + } + } +} + +void cmGlobalGhsMultiGenerator::GenerateBuildCommand( + std::vector &makeCommand, const std::string &makeProgram, + const std::string & /*projectName*/, const std::string & /*projectDir*/, + const std::string &targetName, const std::string & /*config*/, + bool /*fast*/, bool /*verbose*/, + std::vector const &makeOptions) { + makeCommand.push_back(this->SelectMakeProgram(makeProgram)); + + makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); + if (!targetName.empty()) { + if (targetName == "clean") { + makeCommand.push_back("-clean"); + } else { + makeCommand.push_back(targetName); + } + } +} + +void cmGlobalGhsMultiGenerator::WriteMacros() { + char const *ghsGpjMacros = + this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS"); + if (NULL != ghsGpjMacros) { + std::vector expandedList; + cmSystemTools::ExpandListArgument(std::string(ghsGpjMacros), expandedList); + for (std::vector::const_iterator expandedListI = + expandedList.begin(); + expandedListI != expandedList.end(); ++expandedListI) { + *GetBuildFileStream() << "macro " << *expandedListI << std::endl; + } + } +} + +void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() { + *GetBuildFileStream() << "primaryTarget=arm_integrity.tgt" << std::endl; + char const *const customization = + this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); + if (NULL != customization && strlen(customization) > 0) { + *GetBuildFileStream() << "customization=" << trimQuotes(customization) + << std::endl; + this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION"); + } +} + +void cmGlobalGhsMultiGenerator::WriteCompilerOptions( + std::string const &fOSDir) { + *GetBuildFileStream() << " -os_dir=\"" << fOSDir << "\"" << std::endl; + *GetBuildFileStream() << " --link_once_templates" << std::endl; +} + +void cmGlobalGhsMultiGenerator::WriteDisclaimer(std::ostream *os) { + (*os) << "#" << std::endl + << "# CMAKE generated file: DO NOT EDIT!" << std::endl + << "# Generated by \"" << GetActualName() << "\"" + << " Generator, CMake Version " << cmVersion::GetMajorVersion() << "." + << cmVersion::GetMinorVersion() << std::endl + << "#" << std::endl; +} + +void cmGlobalGhsMultiGenerator::AddFilesUpToPath( + cmGeneratedFileStream *mainBuildFile, + std::map * + targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &path, + GhsMultiGpj::Types projType, std::string const &relPath) { + std::string workingPath(path); + cmSystemTools::ConvertToUnixSlashes(workingPath); + std::vector splitPath = + cmSystemTools::SplitString(workingPath); + std::string workingRelPath(relPath); + if (relPath.size() > 0 && '/' != relPath.back()) { + workingRelPath += "/"; + } + std::string pathUpTo; + for (std::vector::const_iterator splitPathI = + splitPath.begin(); + splitPath.end() != splitPathI; ++splitPathI) { + pathUpTo += *splitPathI; + if (targetFolderBuildStreams->end() == + targetFolderBuildStreams->find(pathUpTo)) { + AddFilesUpToPathNewBuildFile( + mainBuildFile, targetFolderBuildStreams, homeOutputDirectory, + pathUpTo, splitPath.begin() == splitPathI, workingRelPath, projType); + } + AddFilesUpToPathAppendNextFile(targetFolderBuildStreams, pathUpTo, + splitPathI, splitPath.end(), projType); + pathUpTo += "/"; + } +} + +void cmGlobalGhsMultiGenerator::Open( + std::string const &mapKeyName, std::string const &fileName, + std::map *fileMap) { + if (fileMap->end() == fileMap->find(fileName)) { + cmGeneratedFileStream* temp(new cmGeneratedFileStream); + temp->open(fileName.c_str()); + (*fileMap)[mapKeyName] = temp; + } +} + +void cmGlobalGhsMultiGenerator::AddFilesUpToPathNewBuildFile( + cmGeneratedFileStream *mainBuildFile, + std::map * + targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &pathUpTo, + bool const isFirst, std::string const &relPath, + GhsMultiGpj::Types const projType) { + // create folders up to file path + std::string absPath = std::string(homeOutputDirectory) + "/" + relPath; + std::string newPath = absPath + pathUpTo; + if (!cmSystemTools::FileExists(newPath.c_str())) { + cmSystemTools::MakeDirectory(newPath.c_str()); + } + + // Write out to filename for first time + std::string relFilename(GetFileNameFromPath(pathUpTo)); + std::string absFilename = absPath + relFilename; + Open(pathUpTo, absFilename, targetFolderBuildStreams); + OpenBuildFileStream((*targetFolderBuildStreams)[pathUpTo]); + GhsMultiGpj::WriteGpjTag(projType, + (*targetFolderBuildStreams)[pathUpTo]); + WriteDisclaimer((*targetFolderBuildStreams)[pathUpTo]); + + // Add to main build file + if (isFirst) { + *mainBuildFile << relFilename << " "; + GhsMultiGpj::WriteGpjTag(projType, mainBuildFile); + } +} + +void cmGlobalGhsMultiGenerator::AddFilesUpToPathAppendNextFile( + std::map * + targetFolderBuildStreams, + std::string const &pathUpTo, + std::vector::const_iterator splitPathI, + std::vector::const_iterator end, + GhsMultiGpj::Types const projType) { + std::vector::const_iterator splitPathNextI = splitPathI + 1; + if (end != splitPathNextI && + targetFolderBuildStreams->end() == + targetFolderBuildStreams->find(pathUpTo + "/" + *splitPathNextI)) { + std::string nextFilename(*splitPathNextI); + nextFilename = GetFileNameFromPath(nextFilename); + *(*targetFolderBuildStreams)[pathUpTo] << nextFilename << " "; + GhsMultiGpj::WriteGpjTag(projType, + (*targetFolderBuildStreams)[pathUpTo]); + } +} + +std::string +cmGlobalGhsMultiGenerator::GetFileNameFromPath(std::string const &path) { + std::string output(path); + if (path.length() > 0) { + cmSystemTools::ConvertToUnixSlashes(output); + std::vector splitPath = cmSystemTools::SplitString(output); + output += "/" + splitPath.back() + FILE_EXTENSION; + } + return output; +} + +void cmGlobalGhsMultiGenerator::UpdateBuildFiles( + cmGeneratorTargetsType const &tgts) { + for (cmGeneratorTargetsType::const_iterator tgtsI = tgts.begin(); + tgtsI != tgts.end(); ++tgtsI) { + cmGhsMultiTargetGenerator gmtg(tgtsI->first); + if (gmtg.GetSources().size() > 0 && gmtg.IncludeThisTarget()) { + char const *rawFolderName = tgtsI->first->GetProperty("FOLDER"); + if (NULL == rawFolderName) { + rawFolderName = ""; + } + std::string folderName(rawFolderName); + if (TargetFolderBuildStreams.end() == + TargetFolderBuildStreams.find(folderName)) { + AddFilesUpToPath(GetBuildFileStream(), &TargetFolderBuildStreams, + this->GetCMakeInstance()->GetHomeOutputDirectory(), + folderName, GhsMultiGpj::Types::PROJECT); + } + std::vector splitPath = + cmSystemTools::SplitString(gmtg.GetRelBuildFileName()); + std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" + + splitPath.back()); + *TargetFolderBuildStreams[folderName] << foldNameRelBuildFile << " "; + GhsMultiGpj::WriteGpjTag(gmtg.GetGpjTag(), + TargetFolderBuildStreams[folderName]); + } + } +} + +std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const &str) { + std::string result; + result.reserve(str.size()); + for (const char *ch = str.c_str(); *ch != '\0'; ++ch) { + if (*ch != '"') { + result += *ch; + } + } + return result; +} diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h new file mode 100644 index 0000000..c7b5196 --- /dev/null +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -0,0 +1,128 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGhsMultiGenerator_h +#define cmGhsMultiGenerator_h + +#include "cmGlobalGeneratorFactory.h" +#include "cmGlobalGenerator.h" +#include "cmGhsMultiGpj.h" + +class cmGeneratedFileStream; + +class cmGlobalGhsMultiGenerator : public cmGlobalGenerator { +public: + /// The default name of GHS MULTI's build file. Typically: monolith.gpj. + static const char *FILE_EXTENSION; + + cmGlobalGhsMultiGenerator(); + ~cmGlobalGhsMultiGenerator(); + + static cmGlobalGeneratorFactory *NewFactory() { + return new cmGlobalGeneratorSimpleFactory(); + } + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /// @return the name of this generator. + static std::string GetActualName() { return "Green Hills MULTI"; } + ///! Get the name for this generator + virtual std::string GetName() const { return GetActualName(); } + + /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() + static void GetDocumentation(cmDocumentationEntry &entry); + + /** + * Try to determine system information such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector const &languages, + cmMakefile *, bool optional); + /* + * Determine what program to use for building the project. + */ + virtual void FindMakeProgram(cmMakefile *); + + cmGeneratedFileStream *GetBuildFileStream() { + return TargetFolderBuildStreams[""]; + } + + static void OpenBuildFileStream(std::string const &filepath, + cmGeneratedFileStream **filestream); + static void OpenBuildFileStream(cmGeneratedFileStream *filestream); + static void CloseBuildFileStream(cmGeneratedFileStream **filestream); + /// Write the common disclaimer text at the top of each build file. + static void WriteDisclaimer(std::ostream *os); + std::vector GetLibDirs() { return LibDirs; } + + static void AddFilesUpToPath( + cmGeneratedFileStream *mainBuildFile, + std::map * + targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &path, + GhsMultiGpj::Types projType, std::string const &relPath = ""); + static void + Open(std::string const &mapKeyName, std::string const &fileName, + std::map *fileMap); + + static std::string trimQuotes(std::string const &str); + inline bool IsOSDirRelative() { return OSDirRelative; } + +protected: + virtual void Generate(); + virtual void GenerateBuildCommand( + std::vector &makeCommand, const std::string &makeProgram, + const std::string &projectName, const std::string &projectDir, + const std::string &targetName, const std::string &config, bool fast, + bool verbose, + std::vector const &makeOptions = std::vector()); + +private: + std::string const &GetGhsBuildCommand(); + std::string FindGhsBuildCommand(); + std::string GetCompRoot(); + std::vector GetCompRootHardPaths(); + std::vector GetCompRootRegistry(); + void OpenBuildFileStream(cmMakefile *makefile); + + void WriteMacros(); + void WriteHighLevelDirectives(); + void WriteCompilerOptions(std::string const &fOSDir); + + static void AddFilesUpToPathNewBuildFile( + cmGeneratedFileStream *mainBuildFile, + std::map * + targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &pathUpTo, + bool isFirst, std::string const &relPath, GhsMultiGpj::Types projType); + static void AddFilesUpToPathAppendNextFile( + std::map * + targetFolderBuildStreams, + std::string const &pathUpTo, + std::vector::const_iterator splitPathI, + std::vector::const_iterator end, + GhsMultiGpj::Types projType); + static std::string GetFileNameFromPath(std::string const &path); + void UpdateBuildFiles(cmGeneratorTargetsType const &tgts); + + std::vector TargetSubProjects; + std::map + TargetFolderBuildStreams; + + std::vector LibDirs; + + bool OSDirRelative; + bool GhsBuildCommandInitialized; + std::string GhsBuildCommand; +}; + +#endif diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index f74f1e0..2ade825 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -576,6 +576,7 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false; // Implemented by: // cmGlobalUnixMakefileGenerator3 +// cmGlobalGhsMultiGenerator // cmGlobalVisualStudio10Generator // cmGlobalVisualStudio6Generator // cmGlobalVisualStudio7Generator diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx new file mode 100644 index 0000000..b700143 --- /dev/null +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -0,0 +1,48 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmLocalGhsMultiGenerator.h" +#include "cmGlobalGhsMultiGenerator.h" +#include "cmGeneratorTarget.h" +#include "cmMakefile.h" +#include "cmGhsMultiTargetGenerator.h" +#include "cmGeneratedFileStream.h" + +cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator() {} + +cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() {} + +void cmLocalGhsMultiGenerator::Generate() { + cmGeneratorTargetsType tgts = this->GetMakefile()->GetGeneratorTargets(); + if (tgts.size() > 0) { + for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); + ++l) { + cmGhsMultiTargetGenerator tg(l->second->Target); + tg.Generate(); + } + } +} + +// Implemented in: +// cmLocalGenerator. +// Used in: +// Source/cmMakefile.cxx +// Source/cmGlobalGenerator.cxx +void cmLocalGhsMultiGenerator::Configure() { + // Compute the path to use when referencing the current output + // directory from the top output directory. + this->HomeRelativeOutputPath = + this->Convert(this->Makefile->GetStartOutputDirectory(), HOME_OUTPUT); + if (this->HomeRelativeOutputPath == ".") { + this->HomeRelativeOutputPath = ""; + } + this->cmLocalGenerator::Configure(); +} diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h new file mode 100644 index 0000000..c97b03f --- /dev/null +++ b/Source/cmLocalGhsMultiGenerator.h @@ -0,0 +1,54 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmLocalGhsMultiGenerator_h +#define cmLocalGhsMultiGenerator_h + +#include "cmLocalGenerator.h" + +class cmGeneratedFileStream; + +/** \class cmLocalGhsMultiGenerator + * \brief Write Green Hills MULTI project files. + * + * cmLocalGhsMultiGenerator produces a set of .gpj + * file for each target in its mirrored directory. + */ +class cmLocalGhsMultiGenerator : public cmLocalGenerator { +public: + cmLocalGhsMultiGenerator(); + + virtual ~cmLocalGhsMultiGenerator(); + + /// @returns the relative path between the HomeOutputDirectory and this + /// local generators StartOutputDirectory. + std::string GetHomeRelativeOutputPath() const { + return this->HomeRelativeOutputPath; + } + + /** + * Generate the makefile for this directory. + */ + virtual void Generate(); + + /// Overloaded methods. @see cmLocalGenerator::Configure() + virtual void Configure(); + const char *GetBuildFileName() { return BuildFileName.c_str(); } + +protected: + virtual bool CustomCommandUseLocal() const { return true; } + +private: + std::string BuildFileName; + std::string HomeRelativeOutputPath; +}; + +#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 51df7f2..631397b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -63,6 +63,7 @@ # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" +# include "cmGlobalGhsMultiGenerator.h" # define CMAKE_HAVE_VS_GENERATORS # endif # include "cmGlobalMSYSMakefileGenerator.h" @@ -1841,6 +1842,8 @@ void cmake::AddDefaultGenerators() cmGlobalNMakeMakefileGenerator::NewFactory()); this->Generators.push_back( cmGlobalJOMMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalGhsMultiGenerator::NewFactory()); # endif this->Generators.push_back( cmGlobalMSYSMakefileGenerator::NewFactory()); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 49fd02b..87727c7 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1938,6 +1938,23 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if (CMake_TEST_GreenHillsMULTI) + macro(add_test_GhsMulti name primaryTarget bspName) + add_test(NAME GhsMulti.${name} COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/GhsMulti" + "${CMake_BINARY_DIR}/Tests/GhsMulti/${name}" + --build-generator "Green Hills MULTI" + --build-project ReturnNum + --build-config $ + --build-options -DGHS_PRIMARY_TARGET=${primaryTarget} + -DGHS_BSP_NAME=${bspName} + ) + endmacro () + add_test_GhsMulti("arm_integrity_simarm" "arm_integrity.tgt" "simarm") + add_test_GhsMulti("arm64_integrity_simarm" "arm64_integrity.tgt" "simarm") + endif () + if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") macro(add_test_VSNsightTegra name generator) add_test(NAME VSNsightTegra.${name} COMMAND ${CMAKE_CTEST_COMMAND} diff --git a/Tests/GhsMulti/CMakeLists.txt b/Tests/GhsMulti/CMakeLists.txt new file mode 100644 index 0000000..6e15ba9 --- /dev/null +++ b/Tests/GhsMulti/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(ReturnNum) + +add_subdirectory(ReturnNum) diff --git a/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt new file mode 100644 index 0000000..2adbd4e --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt @@ -0,0 +1,4 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Lib) +add_executable(App Main.c) +target_link_libraries(App Lib) +target_compile_options(App PUBLIC "-non_shared") diff --git a/Tests/GhsMulti/ReturnNum/App/Main.c b/Tests/GhsMulti/ReturnNum/App/Main.c new file mode 100644 index 0000000..1133834 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/App/Main.c @@ -0,0 +1,8 @@ +#include "HelperFun.h" + +int main(int argc, const char* argv[]) +{ + int out; + out = giveNum(); + return out; +} diff --git a/Tests/GhsMulti/ReturnNum/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/CMakeLists.txt new file mode 100644 index 0000000..7bcc5f9 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(App) +add_subdirectory(Int) +add_subdirectory(Lib) diff --git a/Tests/GhsMulti/ReturnNum/Int/AppDD.int b/Tests/GhsMulti/ReturnNum/Int/AppDD.int new file mode 100644 index 0000000..9e22b5e --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Int/AppDD.int @@ -0,0 +1,12 @@ +# Input File for the Integrate utility for use with the INTEGRITY real-time +# operating system by Green Hills Software. +# Before editing this file, refer to the Integrate Reference Manual. + +Kernel + Filename DynamicDownload +EndKernel + +AddressSpace App + Filename "App/App.as" + Language C +EndAddressSpace diff --git a/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt new file mode 100644 index 0000000..44c5de1 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(AppDD AppDD.int Default.bsp) diff --git a/Tests/GhsMulti/ReturnNum/Int/Default.bsp b/Tests/GhsMulti/ReturnNum/Int/Default.bsp new file mode 100644 index 0000000..224ec29 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Int/Default.bsp @@ -0,0 +1,35 @@ +# Target description File for the Integrate utility for use with the +# INTEGRITY real-time operating system by Green Hills Software. +# Before editing this file, refer to your Integrate documentation. +# default.bsp is appropriate for INTEGRITY applications which are +# fully linked with the kernel (for RAM or ROM) or dynamically downloaded. +# +# MinimumAddress must match the value of .ramend in the linker directives +# file used for the KernelSpace program - see default.ld for more info. +# The MaximumAddress used here allows memory mappings to be specified +# for up to the 16 MB mark in RAM. Intex will not permit programs +# that require more memory for its mappings. If the board has less +# memory, this number can be reduced by the user. + +Target + MinimumAddress .ramend + MaximumAddress .ramlimit + Clock StandardTick + EndClock + Clock HighResTimer + EndClock + IODevice "SerialDev0" + InitialKernelObjects 200 + DefaultStartIt false + DefaultMaxPriority 255 + DefaultPriority 127 + DefaultWeight 1 + DefaultMaxWeight 255 + DefaultHeapSize 0x10000 + LastVirtualAddress 0x3fffffff + PageSize 0x1000 + ArchitectedPageSize 0x1000 + ArchitectedPageSize 0x10000 + ArchitectedPageSize 0x100000 + DefaultMemoryRegionSize 0x20000 +EndTarget diff --git a/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt new file mode 100644 index 0000000..9c822da --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt @@ -0,0 +1 @@ +add_library(Lib HelperFun.c HelperFun.h) \ No newline at end of file diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c new file mode 100644 index 0000000..d7515d7 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c @@ -0,0 +1,4 @@ +int giveNum(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h new file mode 100644 index 0000000..00971b0 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h @@ -0,0 +1 @@ +int giveNum(void); ----------------------------------------------------------------------- Summary of changes: Help/generator/Green Hills MULTI.rst | 11 + Help/manual/cmake-generators.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/variable/CMAKE_MAKE_PROGRAM.rst | 4 + Help/variable/CMAKE_SYSTEM_PROCESSOR.rst | 2 + Help/variable/GHS-MULTI.rst | 4 + Modules/Compiler/GHS-DetermineCompiler.cmake | 6 + Modules/FindBoost.cmake | 5 +- Modules/Platform/GHS-MULTI-Initialize.cmake | 29 ++ Modules/Platform/GHS-MULTI.cmake | 27 ++ Source/CMakeLists.txt | 9 + Source/cmGhsMultiGpj.cxx | 39 +++ Source/cmGhsMultiGpj.h | 31 ++ Source/cmGhsMultiTargetGenerator.cxx | 436 +++++++++++++++++++++++++ Source/cmGhsMultiTargetGenerator.h | 92 ++++++ Source/cmGlobalGhsMultiGenerator.cxx | 452 ++++++++++++++++++++++++++ Source/cmGlobalGhsMultiGenerator.h | 129 ++++++++ Source/cmGlobalNinjaGenerator.cxx | 1 + Source/cmLocalGhsMultiGenerator.cxx | 48 +++ Source/cmLocalGhsMultiGenerator.h | 54 +++ Source/cmake.cxx | 3 + Tests/CMakeLists.txt | 17 + Tests/GhsMulti/CMakeLists.txt | 4 + Tests/GhsMulti/ReturnNum/App/CMakeLists.txt | 4 + Tests/GhsMulti/ReturnNum/App/Main.c | 8 + Tests/GhsMulti/ReturnNum/CMakeLists.txt | 3 + Tests/GhsMulti/ReturnNum/Int/AppDD.int | 12 + Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt | 1 + Tests/GhsMulti/ReturnNum/Int/Default.bsp | 35 ++ Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt | 1 + Tests/GhsMulti/ReturnNum/Lib/HelperFun.c | 4 + Tests/GhsMulti/ReturnNum/Lib/HelperFun.h | 1 + 32 files changed, 1473 insertions(+), 1 deletion(-) create mode 100644 Help/generator/Green Hills MULTI.rst create mode 100644 Help/variable/GHS-MULTI.rst create mode 100644 Modules/Compiler/GHS-DetermineCompiler.cmake create mode 100644 Modules/Platform/GHS-MULTI-Initialize.cmake create mode 100644 Modules/Platform/GHS-MULTI.cmake create mode 100644 Source/cmGhsMultiGpj.cxx create mode 100644 Source/cmGhsMultiGpj.h create mode 100644 Source/cmGhsMultiTargetGenerator.cxx create mode 100644 Source/cmGhsMultiTargetGenerator.h create mode 100644 Source/cmGlobalGhsMultiGenerator.cxx create mode 100644 Source/cmGlobalGhsMultiGenerator.h create mode 100644 Source/cmLocalGhsMultiGenerator.cxx create mode 100644 Source/cmLocalGhsMultiGenerator.h create mode 100644 Tests/GhsMulti/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/App/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/App/Main.c create mode 100644 Tests/GhsMulti/ReturnNum/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/Int/AppDD.int create mode 100644 Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/Int/Default.bsp create mode 100644 Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt create mode 100644 Tests/GhsMulti/ReturnNum/Lib/HelperFun.c create mode 100644 Tests/GhsMulti/ReturnNum/Lib/HelperFun.h hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 13:56:53 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 13:56:53 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1207-gd59d361 Message-ID: <20150324175654.14544ACFAD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d59d361480e18cb70e9ca64faa57833bae023806 (commit) via dbc9f8c6ad7d1d9e5e2a2715efceddbb87e2ce95 (commit) via 54828b82c6c757794439533dda781cd12d0de1f2 (commit) via a4427fa9d03ba251b3f0168a471d6f818ae69a95 (commit) from 0437c473420f10b06488bf3d786c4c48b312d0f3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d59d361480e18cb70e9ca64faa57833bae023806 commit d59d361480e18cb70e9ca64faa57833bae023806 Merge: 0437c47 dbc9f8c Author: Brad King AuthorDate: Tue Mar 24 13:56:51 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 13:56:51 2015 -0400 Merge topic 'add-GreenHills-MULTI-generator' into next dbc9f8c6 GHS: Do not use string::back() that is missing on VS 7.1 54828b82 GHS: Use !foo.empty() instead of foo.size() > 0 a4427fa9 GHS: Do not use C++11 enum name scope http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dbc9f8c6ad7d1d9e5e2a2715efceddbb87e2ce95 commit dbc9f8c6ad7d1d9e5e2a2715efceddbb87e2ce95 Author: Brad King AuthorDate: Tue Mar 24 13:56:02 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 13:56:02 2015 -0400 GHS: Do not use string::back() that is missing on VS 7.1 Use cmHasLiteralSuffix instead. diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 70cfd8d..282eb53 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -32,7 +32,7 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget const *target) char const *folderProp = this->Target->GetProperty("FOLDER"); RelBuildFilePath = NULL == folderProp ? "" : folderProp; - if (!RelBuildFilePath.empty() && '/' != RelBuildFilePath.back()) { + if (!cmHasLiteralSuffix(RelBuildFilePath, "/")) { RelBuildFilePath += "/"; } RelBuildFilePath += Target->GetName() + "/"; @@ -40,13 +40,13 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget const *target) RelOutputFileName = RelBuildFilePath + Target->GetName() + ".a"; RelBuildFileName = RelBuildFilePath; - if (!RelBuildFileName.empty() && '/' != RelBuildFileName.back()) { + if (!cmHasLiteralSuffix(RelBuildFileName, "/")) { RelBuildFileName += "/"; } RelBuildFileName += BuildFileName; std::string absPathToRoot(this->Makefile->GetHomeOutputDirectory()); - if (!absPathToRoot.empty() && '/' != absPathToRoot.back()) { + if (!cmHasLiteralSuffix(absPathToRoot, "/")) { absPathToRoot += "/"; } AbsBuildFilePath = absPathToRoot + RelBuildFilePath; @@ -346,7 +346,7 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( void cmGhsMultiTargetGenerator::WriteObjectDir( cmGeneratedFileStream *fileStream, std::string const &dir) { std::string workingDir(dir); - if (!workingDir.empty() && '/' != workingDir.back()) { + if (!cmHasLiteralSuffix(workingDir, "/")) { workingDir += "/"; } workingDir += "Objs"; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index b955cac..cec0f8d 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -322,7 +322,7 @@ void cmGlobalGhsMultiGenerator::AddFilesUpToPath( std::vector splitPath = cmSystemTools::SplitString(workingPath); std::string workingRelPath(relPath); - if (!relPath.empty() && '/' != relPath.back()) { + if (!cmHasLiteralSuffix(relPath, "/")) { workingRelPath += "/"; } std::string pathUpTo; http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54828b82c6c757794439533dda781cd12d0de1f2 commit 54828b82c6c757794439533dda781cd12d0de1f2 Author: Brad King AuthorDate: Tue Mar 24 13:51:48 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 13:51:48 2015 -0400 GHS: Use !foo.empty() instead of foo.size() > 0 diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index a352a0d..70cfd8d 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -32,7 +32,7 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget const *target) char const *folderProp = this->Target->GetProperty("FOLDER"); RelBuildFilePath = NULL == folderProp ? "" : folderProp; - if (RelBuildFilePath.size() > 0 && '/' != RelBuildFilePath.back()) { + if (!RelBuildFilePath.empty() && '/' != RelBuildFilePath.back()) { RelBuildFilePath += "/"; } RelBuildFilePath += Target->GetName() + "/"; @@ -40,13 +40,13 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget const *target) RelOutputFileName = RelBuildFilePath + Target->GetName() + ".a"; RelBuildFileName = RelBuildFilePath; - if (RelBuildFileName.size() > 0 && '/' != RelBuildFileName.back()) { + if (!RelBuildFileName.empty() && '/' != RelBuildFileName.back()) { RelBuildFileName += "/"; } RelBuildFileName += BuildFileName; std::string absPathToRoot(this->Makefile->GetHomeOutputDirectory()); - if (absPathToRoot.size() > 0 && '/' != absPathToRoot.back()) { + if (!absPathToRoot.empty() && '/' != absPathToRoot.back()) { absPathToRoot += "/"; } AbsBuildFilePath = absPathToRoot + RelBuildFilePath; @@ -61,7 +61,7 @@ cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() void cmGhsMultiTargetGenerator::Generate() { std::vector objectSources = GetSources(); - if (objectSources.size() > 0 && IncludeThisTarget()) { + if (!objectSources.empty() && IncludeThisTarget()) { if (!cmSystemTools::FileExists(AbsBuildFilePath.c_str())) { cmSystemTools::MakeDirectory(AbsBuildFilePath.c_str()); } @@ -286,13 +286,13 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( cmCustomCommandLine const &command = *commandI; for (cmCustomCommandLine::const_iterator commandLineI = command.begin(); commandLineI != command.end(); ++commandLineI) { - if (command.size() > 0) { + if (!command.empty()) { *GetFolderBuildStreams() << (command.begin() == commandLineI ? "'" : " "); } *GetFolderBuildStreams() << *commandLineI; } - if (command.size() > 0) { + if (!command.empty()) { *GetFolderBuildStreams() << "'" << std::endl; } } @@ -346,7 +346,7 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( void cmGhsMultiTargetGenerator::WriteObjectDir( cmGeneratedFileStream *fileStream, std::string const &dir) { std::string workingDir(dir); - if (workingDir.size() > 0 && '/' != workingDir.back()) { + if (!workingDir.empty() && '/' != workingDir.back()) { workingDir += "/"; } workingDir += "Objs"; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 3be33db..b955cac 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -236,7 +236,7 @@ void cmGlobalGhsMultiGenerator::CloseBuildFileStream( void cmGlobalGhsMultiGenerator::Generate() { this->cmGlobalGenerator::Generate(); - if (this->LocalGenerators.size() > 0) { + if (!this->LocalGenerators.empty()) { this->OpenBuildFileStream(); // Build all the folder build files @@ -322,7 +322,7 @@ void cmGlobalGhsMultiGenerator::AddFilesUpToPath( std::vector splitPath = cmSystemTools::SplitString(workingPath); std::string workingRelPath(relPath); - if (relPath.size() > 0 && '/' != relPath.back()) { + if (!relPath.empty() && '/' != relPath.back()) { workingRelPath += "/"; } std::string pathUpTo; @@ -417,7 +417,7 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles( for (cmGeneratorTargetsType::const_iterator tgtsI = tgts.begin(); tgtsI != tgts.end(); ++tgtsI) { cmGhsMultiTargetGenerator gmtg(tgtsI->first); - if (gmtg.GetSources().size() > 0 && gmtg.IncludeThisTarget()) { + if (!gmtg.GetSources().empty() && gmtg.IncludeThisTarget()) { char const *rawFolderName = tgtsI->first->GetProperty("FOLDER"); if (NULL == rawFolderName) { rawFolderName = ""; diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index b700143..b60463f 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -22,7 +22,7 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() {} void cmLocalGhsMultiGenerator::Generate() { cmGeneratorTargetsType tgts = this->GetMakefile()->GetGeneratorTargets(); - if (tgts.size() > 0) { + if (!tgts.empty()) { for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); ++l) { cmGhsMultiTargetGenerator tg(l->second->Target); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4427fa9d03ba251b3f0168a471d6f818ae69a95 commit a4427fa9d03ba251b3f0168a471d6f818ae69a95 Author: Brad King AuthorDate: Tue Mar 24 13:47:52 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 13:47:52 2015 -0400 GHS: Do not use C++11 enum name scope diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 648751f..a352a0d 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -119,9 +119,9 @@ std::vector cmGhsMultiTargetGenerator::GetSources() const { GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const { GhsMultiGpj::Types output; if (IsTargetGroup()) { - output = GhsMultiGpj::Types::INTERGRITY_APPLICATION; + output = GhsMultiGpj::INTERGRITY_APPLICATION; } else { - output = GhsMultiGpj::Types::PROGRAM; + output = GhsMultiGpj::PROGRAM; } return output; } @@ -137,12 +137,12 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string &config, std::string outputDir(GetOutputDirectory(config)); std::string outputFilename(GetOutputFilename(config)); - if (Target->GetType() == cmTarget::TargetType::STATIC_LIBRARY) { + if (Target->GetType() == cmTarget::STATIC_LIBRARY) { *GetFolderBuildStreams() << " -relobj" << std::endl; *GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" << outputDir << outputFilename << ".a\"" << std::endl; - } else if (Target->GetType() == cmTarget::TargetType::EXECUTABLE) { + } else if (Target->GetType() == cmTarget::EXECUTABLE) { if (notKernel && !IsTargetGroup()) { *GetFolderBuildStreams() << " -relprog" << std::endl; } @@ -259,9 +259,9 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() { void cmGhsMultiTargetGenerator::WriteCustomCommands() { WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(), - cmTarget::CustomCommandType::PRE_BUILD); + cmTarget::PRE_BUILD); WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(), - cmTarget::CustomCommandType::POST_BUILD); + cmTarget::POST_BUILD); } void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( @@ -274,10 +274,10 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( for (cmCustomCommandLines::const_iterator commandI = commands.begin(); commandI != commands.end(); ++commandI) { switch (commandType) { - case cmTarget::CustomCommandType::PRE_BUILD: + case cmTarget::PRE_BUILD: *GetFolderBuildStreams() << " :preexecShellSafe="; break; - case cmTarget::CustomCommandType::POST_BUILD: + case cmTarget::POST_BUILD: *GetFolderBuildStreams() << " :postexecShellSafe="; break; default: @@ -312,7 +312,7 @@ void cmGhsMultiTargetGenerator::WriteSources( cmGlobalGhsMultiGenerator::AddFilesUpToPath( GetFolderBuildStreams(), &FolderBuildStreams, this->Makefile->GetHomeOutputDirectory(), sgPath, - GhsMultiGpj::Types::SUBPROJECT, RelBuildFilePath); + GhsMultiGpj::SUBPROJECT, RelBuildFilePath); if ((*si)->GetExtension() == ".int") { *this->FolderBuildStreams[sgPath] << "\"" << (*si)->GetFullPath() << "\"" diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 042339a..3be33db 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -214,7 +214,7 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() { WriteMacros(); WriteHighLevelDirectives(); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::Types::PROJECT, GetBuildFileStream()); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, GetBuildFileStream()); WriteDisclaimer(GetBuildFileStream()); *GetBuildFileStream() << "# Top Level Project File" << std::endl; if (fBspName.length() > 0) { @@ -427,7 +427,7 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles( TargetFolderBuildStreams.find(folderName)) { AddFilesUpToPath(GetBuildFileStream(), &TargetFolderBuildStreams, this->GetCMakeInstance()->GetHomeOutputDirectory(), - folderName, GhsMultiGpj::Types::PROJECT); + folderName, GhsMultiGpj::PROJECT); } std::vector splitPath = cmSystemTools::SplitString(gmtg.GetRelBuildFileName()); ----------------------------------------------------------------------- Summary of changes: Source/cmGhsMultiTargetGenerator.cxx | 32 ++++++++++++++++---------------- Source/cmGlobalGhsMultiGenerator.cxx | 10 +++++----- Source/cmLocalGhsMultiGenerator.cxx | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 14:44:25 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 14:44:25 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1209-g0cf0944 Message-ID: <20150324184425.1F458ACB4A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0cf09443232868edeb25143987f17c39745e71da (commit) via 209bf58a6c5938411d2c53f5dbe2f86403a50ecc (commit) from d59d361480e18cb70e9ca64faa57833bae023806 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0cf09443232868edeb25143987f17c39745e71da commit 0cf09443232868edeb25143987f17c39745e71da Merge: d59d361 209bf58 Author: Brad King AuthorDate: Tue Mar 24 14:44:24 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 14:44:24 2015 -0400 Merge topic 'file-LOCK-close' into next 209bf58a fixup! cmFileLockUnix: Close file descriptor when releasing a lock http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=209bf58a6c5938411d2c53f5dbe2f86403a50ecc commit 209bf58a6c5938411d2c53f5dbe2f86403a50ecc Author: Brad King AuthorDate: Tue Mar 24 14:42:31 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 14:42:31 2015 -0400 fixup! cmFileLockUnix: Close file descriptor when releasing a lock diff --git a/Source/cmFileLockWin32.cxx b/Source/cmFileLockWin32.cxx index 4691689..dc65948 100644 --- a/Source/cmFileLockWin32.cxx +++ b/Source/cmFileLockWin32.cxx @@ -38,6 +38,9 @@ cmFileLockResult cmFileLock::Release() this->Filename = ""; + CloseHandle(this->File); + this->File = INVALID_HANDLE_VALUE; + if (unlockResult) { return cmFileLockResult::MakeOk(); ----------------------------------------------------------------------- Summary of changes: Source/cmFileLockWin32.cxx | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 24 14:52:03 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 24 Mar 2015 14:52:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1211-g7ae7789 Message-ID: <20150324185203.928E0AD15B@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 7ae7789e06051a8b8db16c5e3d2e7ef43ce44c6d (commit) via 437be8dbb6eede6df0693c6b00370368bc832018 (commit) from 0cf09443232868edeb25143987f17c39745e71da (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ae7789e06051a8b8db16c5e3d2e7ef43ce44c6d commit 7ae7789e06051a8b8db16c5e3d2e7ef43ce44c6d Merge: 0cf0944 437be8d Author: Brad King AuthorDate: Tue Mar 24 14:52:02 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 14:52:02 2015 -0400 Merge topic 'file-LOCK-close' into next 437be8db file(LOCK): Close file descriptor/handle when releasing a lock http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=437be8dbb6eede6df0693c6b00370368bc832018 commit 437be8dbb6eede6df0693c6b00370368bc832018 Author: Betsy McPhail AuthorDate: Mon Mar 23 16:32:12 2015 -0400 Commit: Brad King CommitDate: Tue Mar 24 14:49:49 2015 -0400 file(LOCK): Close file descriptor/handle when releasing a lock The file lock functionality added in commit v3.2.0-rc1~297^2~1 (file: Add LOCK subcommand to do file and directory locking, 2014-11-26) forgot to close the lock file descriptors. Eventually it was possible to run out of file descriptors and locks could not longer be acquired. Fix this by closing the file descriptor or handle when we are done with it. Also set the member back to the initial value from the constructor to leave everything in a consistent state (useful for debugging). Co-Author: Ruslan Baratov diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx index fc18a64..36a2d72 100644 --- a/Source/cmFileLockUnix.cxx +++ b/Source/cmFileLockUnix.cxx @@ -15,6 +15,7 @@ #include // errno #include // SEEK_SET #include +#include #include "cmSystemTools.h" cmFileLock::cmFileLock(): File(-1) @@ -31,6 +32,9 @@ cmFileLockResult cmFileLock::Release() this->Filename = ""; + ::close(this->File); + this->File = -1; + if (lockResult == 0) { return cmFileLockResult::MakeOk(); diff --git a/Source/cmFileLockWin32.cxx b/Source/cmFileLockWin32.cxx index 4691689..dc65948 100644 --- a/Source/cmFileLockWin32.cxx +++ b/Source/cmFileLockWin32.cxx @@ -38,6 +38,9 @@ cmFileLockResult cmFileLock::Release() this->Filename = ""; + CloseHandle(this->File); + this->File = INVALID_HANDLE_VALUE; + if (unlockResult) { return cmFileLockResult::MakeOk(); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From clinton at elemtech.com Tue Mar 24 22:57:55 2015 From: clinton at elemtech.com (Clinton Stimpson) Date: Tue, 24 Mar 2015 22:57:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1213-g5fa4e63 Message-ID: <20150325025755.3CD08AD36E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5fa4e63ef5ec17d068a75700d5e40127ec82d2db (commit) via 9c76ff015a393a2a5107a9db7f8ba91eb12c4ffa (commit) from 7ae7789e06051a8b8db16c5e3d2e7ef43ce44c6d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5fa4e63ef5ec17d068a75700d5e40127ec82d2db commit 5fa4e63ef5ec17d068a75700d5e40127ec82d2db Merge: 7ae7789 9c76ff0 Author: Clinton Stimpson AuthorDate: Tue Mar 24 22:57:53 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 24 22:57:53 2015 -0400 Merge topic 'qtdialog-cpack-qt5-osx' into next 9c76ff01 QtDialog: Fix CMake packaging with CPack on OS X with Qt5. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9c76ff015a393a2a5107a9db7f8ba91eb12c4ffa commit 9c76ff015a393a2a5107a9db7f8ba91eb12c4ffa Author: Clinton Stimpson AuthorDate: Tue Mar 24 20:55:59 2015 -0600 Commit: Clinton Stimpson CommitDate: Tue Mar 24 20:56:38 2015 -0600 QtDialog: Fix CMake packaging with CPack on OS X with Qt5. diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index b59af94..9cc993a 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -45,11 +45,11 @@ if (Qt5Widgets_FOUND) get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME) get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH) get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME) - set(_qt_plugin_dest "${CMAKE_INSTALL_PREFIX}/PlugIns/${_qt_plugin_type}") + set(_qt_plugin_dest "PlugIns/${_qt_plugin_type}") install(FILES "${_qt_plugin_path}" DESTINATION "${_qt_plugin_dest}") set(${_qt_plugins_var} - "${${_qt_plugins_var}};${_qt_plugin_dest}/${_qt_plugin_file}") + "${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}") else() message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found") endif() ----------------------------------------------------------------------- Summary of changes: Source/QtDialog/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 25 00:01:06 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 25 Mar 2015 00:01:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-507-g26c4300 Message-ID: <20150325040106.7C8F3AD4A1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 26c43005847394ab110ebbdb29f1a1f37eaa7b7a (commit) from 51b4321e5fdf9f7cbc54881037a45a474883ef47 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26c43005847394ab110ebbdb29f1a1f37eaa7b7a commit 26c43005847394ab110ebbdb29f1a1f37eaa7b7a Author: Kitware Robot AuthorDate: Wed Mar 25 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Wed Mar 25 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b9a4a9c..8f0e54c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150324) +set(CMake_VERSION_PATCH 20150325) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 25 09:01:15 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 25 Mar 2015 09:01:15 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1215-gc87cc9f Message-ID: <20150325130115.6A18EAD526@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c87cc9f9530ec3339f7ebe7f0752e962dad51661 (commit) via 1f289095f908fddd64152c5686bec25eecbc66d6 (commit) from 5fa4e63ef5ec17d068a75700d5e40127ec82d2db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c87cc9f9530ec3339f7ebe7f0752e962dad51661 commit c87cc9f9530ec3339f7ebe7f0752e962dad51661 Merge: 5fa4e63 1f28909 Author: Brad King AuthorDate: Wed Mar 25 09:01:14 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 25 09:01:14 2015 -0400 Merge topic 'file-LOCK-close' into next 1f289095 file(LOCK): Close file descriptor/handle when releasing a lock http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f289095f908fddd64152c5686bec25eecbc66d6 commit 1f289095f908fddd64152c5686bec25eecbc66d6 Author: Betsy McPhail AuthorDate: Mon Mar 23 16:32:12 2015 -0400 Commit: Brad King CommitDate: Wed Mar 25 09:00:51 2015 -0400 file(LOCK): Close file descriptor/handle when releasing a lock The file lock functionality added in commit v3.2.0-rc1~297^2~1 (file: Add LOCK subcommand to do file and directory locking, 2014-11-26) forgot to close the lock file descriptors. Eventually it was possible to run out of file descriptors and locks could not longer be acquired. Fix this by closing the file descriptor or handle when we are done with it. Also set the member back to the initial value from the constructor to leave everything in a consistent state (useful for debugging). Co-Author: Ruslan Baratov diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx index fc18a64..36a2d72 100644 --- a/Source/cmFileLockUnix.cxx +++ b/Source/cmFileLockUnix.cxx @@ -15,6 +15,7 @@ #include // errno #include // SEEK_SET #include +#include #include "cmSystemTools.h" cmFileLock::cmFileLock(): File(-1) @@ -31,6 +32,9 @@ cmFileLockResult cmFileLock::Release() this->Filename = ""; + ::close(this->File); + this->File = -1; + if (lockResult == 0) { return cmFileLockResult::MakeOk(); diff --git a/Source/cmFileLockWin32.cxx b/Source/cmFileLockWin32.cxx index 4691689..dc65948 100644 --- a/Source/cmFileLockWin32.cxx +++ b/Source/cmFileLockWin32.cxx @@ -38,6 +38,9 @@ cmFileLockResult cmFileLock::Release() this->Filename = ""; + CloseHandle(this->File); + this->File = INVALID_HANDLE_VALUE; + if (unlockResult) { return cmFileLockResult::MakeOk(); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 25 09:01:20 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 25 Mar 2015 09:01:20 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-509-g166e29e Message-ID: <20150325130120.CD975AD546@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 166e29e453e6a48e191b02835b08cf5bd3d0f988 (commit) via 1f289095f908fddd64152c5686bec25eecbc66d6 (commit) from 26c43005847394ab110ebbdb29f1a1f37eaa7b7a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=166e29e453e6a48e191b02835b08cf5bd3d0f988 commit 166e29e453e6a48e191b02835b08cf5bd3d0f988 Merge: 26c4300 1f28909 Author: Brad King AuthorDate: Wed Mar 25 09:01:18 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 25 09:01:18 2015 -0400 Merge topic 'file-LOCK-close' 1f289095 file(LOCK): Close file descriptor/handle when releasing a lock ----------------------------------------------------------------------- Summary of changes: Source/cmFileLockUnix.cxx | 4 ++++ Source/cmFileLockWin32.cxx | 3 +++ 2 files changed, 7 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 25 09:01:55 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 25 Mar 2015 09:01:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1218-g27941d1 Message-ID: <20150325130155.F19FBAD548@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 27941d1e43a1ade47c33f97935fee53eeaf8dd51 (commit) via 166e29e453e6a48e191b02835b08cf5bd3d0f988 (commit) via 26c43005847394ab110ebbdb29f1a1f37eaa7b7a (commit) from c87cc9f9530ec3339f7ebe7f0752e962dad51661 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=27941d1e43a1ade47c33f97935fee53eeaf8dd51 commit 27941d1e43a1ade47c33f97935fee53eeaf8dd51 Merge: c87cc9f 166e29e Author: Brad King AuthorDate: Wed Mar 25 09:01:46 2015 -0400 Commit: Brad King CommitDate: Wed Mar 25 09:01:46 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 25 09:04:54 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 25 Mar 2015 09:04:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1220-g631b189 Message-ID: <20150325130454.693B1AD73A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 631b189e9f5b905b72c5605ae8cb5db8658a196e (commit) via 128cad7e7a34702b9b38b9eaa42a4600de4d183c (commit) from 27941d1e43a1ade47c33f97935fee53eeaf8dd51 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=631b189e9f5b905b72c5605ae8cb5db8658a196e commit 631b189e9f5b905b72c5605ae8cb5db8658a196e Merge: 27941d1 128cad7 Author: Brad King AuthorDate: Wed Mar 25 09:04:53 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 25 09:04:53 2015 -0400 Merge topic 'add-GreenHills-MULTI-generator' into next 128cad7e GHS: Fix selection of make program 'gbuild' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=128cad7e7a34702b9b38b9eaa42a4600de4d183c commit 128cad7e7a34702b9b38b9eaa42a4600de4d183c Author: Brad King AuthorDate: Wed Mar 25 08:56:36 2015 -0400 Commit: Brad King CommitDate: Wed Mar 25 08:56:36 2015 -0400 GHS: Fix selection of make program 'gbuild' diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index cec0f8d..b99462b 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -258,7 +258,9 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( const std::string &targetName, const std::string & /*config*/, bool /*fast*/, bool /*verbose*/, std::vector const &makeOptions) { - makeCommand.push_back(this->SelectMakeProgram(makeProgram)); + makeCommand.push_back( + this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand()) + ); makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalGhsMultiGenerator.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 25 10:44:00 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 25 Mar 2015 10:44:00 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1222-g82dfb1b Message-ID: <20150325144400.3B912ACF27@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 82dfb1b65285e19e01e05ced44c307d26548e5ce (commit) via 89bcd1a093d9d3a976f5a26e0231d0c361647fcf (commit) from 631b189e9f5b905b72c5605ae8cb5db8658a196e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82dfb1b65285e19e01e05ced44c307d26548e5ce commit 82dfb1b65285e19e01e05ced44c307d26548e5ce Merge: 631b189 89bcd1a Author: Brad King AuthorDate: Wed Mar 25 10:43:59 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 25 10:43:59 2015 -0400 Merge topic 'add-GreenHills-MULTI-generator' into next 89bcd1a0 GHS: Further revisions http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89bcd1a093d9d3a976f5a26e0231d0c361647fcf commit 89bcd1a093d9d3a976f5a26e0231d0c361647fcf Author: Geoff Viola AuthorDate: Tue Mar 24 21:50:50 2015 -0600 Commit: Brad King CommitDate: Wed Mar 25 10:43:07 2015 -0400 GHS: Further revisions * broke lines after curly brace in GHS CPP files * added this to member accesses in GHS CPP files * cleaned up trailing slash logic diff --git a/Source/cmGhsMultiGpj.cxx b/Source/cmGhsMultiGpj.cxx index d630faa..e47d583 100644 --- a/Source/cmGhsMultiGpj.cxx +++ b/Source/cmGhsMultiGpj.cxx @@ -14,26 +14,28 @@ #include "cmGeneratedFileStream.h" void GhsMultiGpj::WriteGpjTag(Types const gpjType, - cmGeneratedFileStream *const filestream) { + cmGeneratedFileStream *const filestream) +{ char const *tag; - switch (gpjType) { - case INTERGRITY_APPLICATION: - tag = "INTEGRITY Application"; - break; - case PROJECT: - tag = "Project"; - break; - case PROGRAM: - tag = "Program"; - break; - case REFERENCE: - tag = "Reference"; - break; - case SUBPROJECT: - tag = "Subproject"; - break; - default: - tag = ""; - } + switch (gpjType) + { + case INTERGRITY_APPLICATION: + tag = "INTEGRITY Application"; + break; + case PROJECT: + tag = "Project"; + break; + case PROGRAM: + tag = "Program"; + break; + case REFERENCE: + tag = "Reference"; + break; + case SUBPROJECT: + tag = "Subproject"; + break; + default: + tag = ""; + } *filestream << "[" << tag << "]" << std::endl; } diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h index 225ec47..7e5b942 100644 --- a/Source/cmGhsMultiGpj.h +++ b/Source/cmGhsMultiGpj.h @@ -14,9 +14,11 @@ class cmGeneratedFileStream; -class GhsMultiGpj { +class GhsMultiGpj +{ public: - enum Types { + enum Types + { INTERGRITY_APPLICATION, PROJECT, PROGRAM, diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 282eb53..0c3595b 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -22,242 +22,292 @@ std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic"); cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget const *target) - : Target(target), LocalGenerator(static_cast( - target->GetMakefile()->GetLocalGenerator())), - Makefile(target->GetMakefile()), TargetGroup(DetermineIfTargetGroup()), - DynamicDownload(false) { - std::string BuildFileName; - BuildFileName = this->Target->GetName(); - BuildFileName += cmGlobalGhsMultiGenerator::FILE_EXTENSION; - + : Target(target) + , LocalGenerator(static_cast( + target->GetMakefile()->GetLocalGenerator())) + , Makefile(target->GetMakefile()) + , TargetGroup(DetermineIfTargetGroup()) + , DynamicDownload(false) +{ char const *folderProp = this->Target->GetProperty("FOLDER"); - RelBuildFilePath = NULL == folderProp ? "" : folderProp; - if (!cmHasLiteralSuffix(RelBuildFilePath, "/")) { - RelBuildFilePath += "/"; - } - RelBuildFilePath += Target->GetName() + "/"; + this->RelBuildFilePath = NULL == folderProp ? "" : folderProp; + cmSystemTools::ConvertToUnixSlashes(this->RelBuildFilePath); + if (!this->RelBuildFilePath.empty()) + { + this->RelBuildFilePath += "/"; + } + this->RelBuildFilePath += this->Target->GetName() + "/"; - RelOutputFileName = RelBuildFilePath + Target->GetName() + ".a"; + this->RelOutputFileName = + this->RelBuildFilePath + this->Target->GetName() + ".a"; - RelBuildFileName = RelBuildFilePath; - if (!cmHasLiteralSuffix(RelBuildFileName, "/")) { - RelBuildFileName += "/"; - } - RelBuildFileName += BuildFileName; + this->RelBuildFileName = this->RelBuildFilePath; + std::string BuildFileName; + BuildFileName = this->Target->GetName(); + BuildFileName += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + this->RelBuildFileName += BuildFileName; std::string absPathToRoot(this->Makefile->GetHomeOutputDirectory()); - if (!cmHasLiteralSuffix(absPathToRoot, "/")) { + if (!cmHasLiteralSuffix(absPathToRoot, "/")) + { absPathToRoot += "/"; - } - AbsBuildFilePath = absPathToRoot + RelBuildFilePath; - AbsBuildFileName = absPathToRoot + RelBuildFileName; - AbsOutputFileName = absPathToRoot + RelOutputFileName; + } + this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath; + this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName; + this->AbsOutputFileName = absPathToRoot + this->RelOutputFileName; } cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() { - cmDeleteAll(FolderBuildStreams); + cmDeleteAll(this->FolderBuildStreams); } -void cmGhsMultiTargetGenerator::Generate() { - std::vector objectSources = GetSources(); - if (!objectSources.empty() && IncludeThisTarget()) { - if (!cmSystemTools::FileExists(AbsBuildFilePath.c_str())) { - cmSystemTools::MakeDirectory(AbsBuildFilePath.c_str()); - } +void cmGhsMultiTargetGenerator::Generate() +{ + const std::vector objectSources = this->GetSources(); + if (!objectSources.empty() && this->IncludeThisTarget()) + { + if (!cmSystemTools::FileExists(this->AbsBuildFilePath.c_str())) + { + cmSystemTools::MakeDirectory(this->AbsBuildFilePath.c_str()); + } cmGlobalGhsMultiGenerator::Open(std::string(""), this->AbsBuildFileName, - &FolderBuildStreams); - cmGlobalGhsMultiGenerator::OpenBuildFileStream(GetFolderBuildStreams()); + &this->FolderBuildStreams); + cmGlobalGhsMultiGenerator::OpenBuildFileStream( + this->GetFolderBuildStreams()); std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - if (0 == config.length()) { + if (0 == config.length()) + { config = "RELEASE"; - } + } const std::string language(this->Target->GetLinkerLanguage(config)); config = cmSystemTools::UpperCase(config); - DynamicDownload = DetermineIfDynamicDownload(config, language); - if (DynamicDownload) { + this->DynamicDownload = this->DetermineIfDynamicDownload(config, language); + if (this->DynamicDownload) + { *this->GetFolderBuildStreams() << "#component integrity_dynamic_download" << std::endl; - } - GhsMultiGpj::WriteGpjTag(GetGpjTag(), this->GetFolderBuildStreams()); - cmGlobalGhsMultiGenerator::WriteDisclaimer(GetFolderBuildStreams()); - - bool const notKernel = IsNotKernel(config, language); - WriteTypeSpecifics(config, notKernel); - WriteDebugOptions(config, notKernel); - WriteCompilerOptions(config, language); - WriteCompilerFlags(); - WriteCompilerDefinitions(config, language); - WriteIncludes(config, language); - WriteTargetLinkLibraries(); - WriteCustomCommands(); - if (DynamicDownload) { - *this->GetFolderBuildStreams() << " " << DDOption << std::endl; - } + } + GhsMultiGpj::WriteGpjTag(this->GetGpjTag(), this->GetFolderBuildStreams()); + cmGlobalGhsMultiGenerator::WriteDisclaimer(this->GetFolderBuildStreams()); + + bool const notKernel = this->IsNotKernel(config, language); + this->WriteTypeSpecifics(config, notKernel); + this->WriteDebugOptions(config, notKernel); + this->WriteCompilerOptions(config, language); + this->WriteCompilerFlags(); + this->WriteCompilerDefinitions(config, language); + this->WriteIncludes(config, language); + this->WriteTargetLinkLibraries(); + this->WriteCustomCommands(); + if (this->DynamicDownload) + { + *this->GetFolderBuildStreams() << " " << this->DDOption << std::endl; + } - WriteSources(objectSources); - } + this->WriteSources(objectSources); + } } -bool cmGhsMultiTargetGenerator::IncludeThisTarget() { +bool cmGhsMultiTargetGenerator::IncludeThisTarget() +{ bool output = true; char const *excludeFromAll = this->Target->GetProperty("EXCLUDE_FROM_ALL"); if (NULL != excludeFromAll && '1' == excludeFromAll[0] && - '\0' == excludeFromAll[1]) { + '\0' == excludeFromAll[1]) + { output = false; - } + } return output; } -std::vector cmGhsMultiTargetGenerator::GetSources() const { +std::vector cmGhsMultiTargetGenerator::GetSources() const +{ std::vector output; std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->Target->GetSourceFiles(output, config); return output; } -GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const { +GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const +{ GhsMultiGpj::Types output; - if (IsTargetGroup()) { + if (this->IsTargetGroup()) + { output = GhsMultiGpj::INTERGRITY_APPLICATION; - } else { + } + else + { output = GhsMultiGpj::PROGRAM; - } + } return output; } -cmGlobalGhsMultiGenerator * -cmGhsMultiTargetGenerator::GetGlobalGenerator() const { +cmGlobalGhsMultiGenerator* +cmGhsMultiTargetGenerator::GetGlobalGenerator() const +{ return static_cast( - LocalGenerator->GetGlobalGenerator()); + this->LocalGenerator->GetGlobalGenerator()); } void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string &config, - bool const notKernel) { - std::string outputDir(GetOutputDirectory(config)); - std::string outputFilename(GetOutputFilename(config)); - - if (Target->GetType() == cmTarget::STATIC_LIBRARY) { - *GetFolderBuildStreams() << " -relobj" << std::endl; - *GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" - << outputDir << outputFilename << ".a\"" - << std::endl; - } else if (Target->GetType() == cmTarget::EXECUTABLE) { - if (notKernel && !IsTargetGroup()) { - *GetFolderBuildStreams() << " -relprog" << std::endl; + bool const notKernel) +{ + std::string outputDir(this->GetOutputDirectory(config)); + std::string outputFilename(this->GetOutputFilename(config)); + + if (this->Target->GetType() == cmTarget::STATIC_LIBRARY) + { + *this->GetFolderBuildStreams() << " -relobj" << std::endl; + *this->GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" + << outputDir << outputFilename << ".a\"" + << std::endl; } - if (IsTargetGroup()) { - *GetFolderBuildStreams() << " -non_shared" << std::endl; - *GetFolderBuildStreams() << " -o \"" << outputDir << outputFilename - << ".elf\"" << std::endl; - } else { - *GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" - << outputDir << outputFilename << ".as\"" - << std::endl; + else if (this->Target->GetType() == cmTarget::EXECUTABLE) + { + if (notKernel && !this->IsTargetGroup()) + { + *this->GetFolderBuildStreams() << " -relprog" << std::endl; + } + if (this->IsTargetGroup()) + { + *this->GetFolderBuildStreams() << " -non_shared" << std::endl; + *this->GetFolderBuildStreams() << " -o \"" << outputDir + << outputFilename << ".elf\"" + << std::endl; + } + else + { + *this->GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" + << outputDir << outputFilename << ".as\"" + << std::endl; + } } - } } void cmGhsMultiTargetGenerator::WriteDebugOptions(std::string const &config, - bool const notKernel) { - if ("DEBUG" == config) { - if (notKernel) { - *GetFolderBuildStreams() << " -G" << std::endl; - *GetFolderBuildStreams() << " -Onone" << std::endl; - } else { - *GetFolderBuildStreams() << " -ldebug" << std::endl; + bool const notKernel) +{ + if ("DEBUG" == config) + { + if (notKernel) + { + *this->GetFolderBuildStreams() << " -G" << std::endl; + *this->GetFolderBuildStreams() << " -Onone" << std::endl; + } + else + { + *this->GetFolderBuildStreams() << " -ldebug" << std::endl; + } + } + else if (notKernel) + { + *this->GetFolderBuildStreams() << " -O" << std::endl; } - } else if (notKernel) { - *GetFolderBuildStreams() << " -O" << std::endl; - } } void cmGhsMultiTargetGenerator::WriteCompilerOptions( - std::string const &config, const std::string &language) { + std::string const &config, const std::string &language) +{ std::vector options; - Target->GetCompileOptions(options, config, language); + this->Target->GetCompileOptions(options, config, language); bool hasStartfileDirProp = false; std::string const startFilePropName("-startfile_dir="); for (std::vector::const_iterator options_i = options.begin(); - options_i != options.end(); ++options_i) { + options_i != options.end(); ++options_i) + { std::string option = *options_i; - if (DDOption != option) { + if (this->DDOption != option) + { if (option.length() >= startFilePropName.length() && - startFilePropName == option.substr(0, startFilePropName.length())) { + startFilePropName == option.substr(0, startFilePropName.length())) + { hasStartfileDirProp = true; - } + } cmSystemTools::ConvertToUnixSlashes(option); *this->GetFolderBuildStreams() << " " << option << std::endl; + } } - } // If this property is relative, make it relative to the root lists file - if (!hasStartfileDirProp && GetGlobalGenerator()->IsOSDirRelative()) { + if (!hasStartfileDirProp && this->GetGlobalGenerator()->IsOSDirRelative()) + { *this->GetFolderBuildStreams() << " " << startFilePropName << "\"" << this->Makefile->GetHomeOutputDirectory() << "/$(__LIBS_DIR_BASE)/$(__BSP_NAME)\"" << std::endl; - } + } } -void cmGhsMultiTargetGenerator::WriteCompilerFlags() { - char const *const compileFlags = Target->GetProperty("COMPILE_FLAGS"); - if (NULL != compileFlags) { +void cmGhsMultiTargetGenerator::WriteCompilerFlags() +{ + char const *const compileFlags = this->Target->GetProperty("COMPILE_FLAGS"); + if (NULL != compileFlags) + { *this->GetFolderBuildStreams() << " " << compileFlags << std::endl; - } + } } void cmGhsMultiTargetGenerator::WriteCompilerDefinitions( - const std::string &config, const std::string &language) { + const std::string &config, const std::string &language) +{ std::vector compileDefinitions; this->Target->GetCompileDefinitions(compileDefinitions, config, language); for (std::vector::const_iterator cdI = - compileDefinitions.begin(); - cdI != compileDefinitions.end(); ++cdI) { + compileDefinitions.begin(); + cdI != compileDefinitions.end(); ++cdI) + { *this->GetFolderBuildStreams() << " -D" << (*cdI) << std::endl; - } + } } void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config, - const std::string &language) { + const std::string &language) +{ std::vector includes = - Target->GetIncludeDirectories(config, language); + this->Target->GetIncludeDirectories(config, language); for (std::vector::const_iterator includes_i = includes.begin(); - includes_i != includes.end(); ++includes_i) { + includes_i != includes.end(); ++includes_i) + { *this->GetFolderBuildStreams() << " -I\"" << *includes_i << "\"" << std::endl; - } + } } -void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() { +void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() +{ // library directories cmTargetDependSet tds = - GetGlobalGenerator()->GetTargetDirectDepends(*this->Target); + this->GetGlobalGenerator()->GetTargetDirectDepends(*this->Target); for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end(); - ++tdsI) { + ++tdsI) + { cmTarget const *tg(*tdsI); cmGhsMultiTargetGenerator gmtg(tg); *this->GetFolderBuildStreams() << " -L\"" << gmtg.GetAbsBuildFilePath() << "\"" << std::endl; - } + } // library targets cmTarget::LinkLibraryVectorType llv = - this->Target->GetOriginalLinkLibraries(); + this->Target->GetOriginalLinkLibraries(); for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin(); - llvI != llv.end(); ++llvI) { + llvI != llv.end(); ++llvI) + { std::string libName = llvI->first; // if it is a user defined target get the full path to the lib cmTarget *tg(GetGlobalGenerator()->FindTarget(libName)); - if (NULL != tg) { + if (NULL != tg) + { cmGhsMultiTargetGenerator gmtg(tg); libName = tg->GetName() + ".a"; - } + } *this->GetFolderBuildStreams() << " -l\"" << libName << "\"" << std::endl; - } + } } -void cmGhsMultiTargetGenerator::WriteCustomCommands() { +void cmGhsMultiTargetGenerator::WriteCustomCommands() +{ WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(), cmTarget::PRE_BUILD); WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(), @@ -265,172 +315,204 @@ void cmGhsMultiTargetGenerator::WriteCustomCommands() { } void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( - std::vector const &commandsSet, - cmTarget::CustomCommandType const commandType) { + std::vector const &commandsSet, + cmTarget::CustomCommandType const commandType) +{ for (std::vector::const_iterator commandsSetI = - commandsSet.begin(); - commandsSetI != commandsSet.end(); ++commandsSetI) { + commandsSet.begin(); + commandsSetI != commandsSet.end(); ++commandsSetI) + { cmCustomCommandLines const &commands = commandsSetI->GetCommandLines(); for (cmCustomCommandLines::const_iterator commandI = commands.begin(); - commandI != commands.end(); ++commandI) { - switch (commandType) { - case cmTarget::PRE_BUILD: - *GetFolderBuildStreams() << " :preexecShellSafe="; - break; - case cmTarget::POST_BUILD: - *GetFolderBuildStreams() << " :postexecShellSafe="; - break; - default: - assert("Only pre and post are supported"); - } + commandI != commands.end(); ++commandI) + { + switch (commandType) + { + case cmTarget::PRE_BUILD: + *this->GetFolderBuildStreams() << " :preexecShellSafe="; + break; + case cmTarget::POST_BUILD: + *this->GetFolderBuildStreams() << " :postexecShellSafe="; + break; + default: + assert("Only pre and post are supported"); + } cmCustomCommandLine const &command = *commandI; for (cmCustomCommandLine::const_iterator commandLineI = command.begin(); - commandLineI != command.end(); ++commandLineI) { - if (!command.empty()) { - *GetFolderBuildStreams() - << (command.begin() == commandLineI ? "'" : " "); + commandLineI != command.end(); ++commandLineI) + { + if (!command.empty()) + { + *this->GetFolderBuildStreams() + << (command.begin() == commandLineI ? "'" : " "); + } + *this->GetFolderBuildStreams() << *commandLineI; + } + if (!command.empty()) + { + *this->GetFolderBuildStreams() << "'" << std::endl; } - *GetFolderBuildStreams() << *commandLineI; - } - if (!command.empty()) { - *GetFolderBuildStreams() << "'" << std::endl; } } - } } void cmGhsMultiTargetGenerator::WriteSources( - std::vector const &objectSources) { + std::vector const &objectSources) +{ for (std::vector::const_iterator si = objectSources.begin(); - si != objectSources.end(); ++si) { + si != objectSources.end(); ++si) + { std::vector sourceGroups(this->Makefile->GetSourceGroups()); char const *sourceFullPath = (*si)->GetFullPath().c_str(); cmSourceGroup *sourceGroup = - this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups); + this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups); std::string sgPath(sourceGroup->GetFullName()); cmSystemTools::ConvertToUnixSlashes(sgPath); cmGlobalGhsMultiGenerator::AddFilesUpToPath( - GetFolderBuildStreams(), &FolderBuildStreams, - this->Makefile->GetHomeOutputDirectory(), sgPath, - GhsMultiGpj::SUBPROJECT, RelBuildFilePath); + this->GetFolderBuildStreams(), &this->FolderBuildStreams, + this->Makefile->GetHomeOutputDirectory(), sgPath, + GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath); - if ((*si)->GetExtension() == ".int") { + if ((*si)->GetExtension() == ".int") + { *this->FolderBuildStreams[sgPath] << "\"" << (*si)->GetFullPath() << "\"" << std::endl; - } else { + } + else + { *this->FolderBuildStreams[sgPath] << (*si)->GetFullPath() << std::endl; - } + } if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() && - "bsp" != (*si)->GetExtension()) { - WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si)); + "bsp" != (*si)->GetExtension()) + { + this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si)); - WriteObjectDir(this->FolderBuildStreams[sgPath], - AbsBuildFilePath + sgPath); + this->WriteObjectDir(this->FolderBuildStreams[sgPath], + this->AbsBuildFilePath + sgPath); + } } - } } void cmGhsMultiTargetGenerator::WriteObjectLangOverride( - cmGeneratedFileStream *fileStream, cmSourceFile *sourceFile) { + cmGeneratedFileStream *fileStream, cmSourceFile *sourceFile) +{ const char *rawLangProp = sourceFile->GetProperty("LANGUAGE"); - if (NULL != rawLangProp) { + if (NULL != rawLangProp) + { std::string sourceLangProp(rawLangProp); std::string extension(sourceFile->GetExtension()); - if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) { + if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) + { *fileStream << " -dotciscxx" << std::endl; + } } - } } void cmGhsMultiTargetGenerator::WriteObjectDir( - cmGeneratedFileStream *fileStream, std::string const &dir) { + cmGeneratedFileStream *fileStream, std::string const &dir) +{ std::string workingDir(dir); - if (!cmHasLiteralSuffix(workingDir, "/")) { + cmSystemTools::ConvertToUnixSlashes(workingDir); + if (!workingDir.empty()) + { workingDir += "/"; - } + } workingDir += "Objs"; *fileStream << " -object_dir=\"" << workingDir << "\"" << std::endl; } std::string -cmGhsMultiTargetGenerator -::GetOutputDirectory(const std::string &config) const { +cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const +{ std::string outputDir(AbsBuildFilePath); const char *runtimeOutputProp = - Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY"); - if (NULL != runtimeOutputProp) { + this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY"); + if (NULL != runtimeOutputProp) + { outputDir = runtimeOutputProp; - } + } std::string configCapped(cmSystemTools::UpperCase(config)); const char *runtimeOutputSProp = - Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped); - if (NULL != runtimeOutputSProp) { + this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped); + if (NULL != runtimeOutputSProp) + { outputDir = runtimeOutputSProp; - } + } cmSystemTools::ConvertToUnixSlashes(outputDir); - if (outputDir.length() > 0 && ('/' != (*outputDir.rbegin()))) { + if (!outputDir.empty()) + { outputDir += "/"; - } + } return outputDir; } std::string -cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const { - std::string outputFilename(Target->GetName()); +cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const +{ + std::string outputFilename(this->Target->GetName()); - const char *outputNameProp = Target->GetProperty("OUTPUT_NAME"); - if (NULL != outputNameProp) { + const char *outputNameProp = this->Target->GetProperty("OUTPUT_NAME"); + if (NULL != outputNameProp) + { outputFilename = outputNameProp; - } + } std::string configCapped(cmSystemTools::UpperCase(config)); const char *outputNameSProp = - Target->GetProperty(configCapped + "_OUTPUT_NAME"); - if (NULL != outputNameSProp) { + this->Target->GetProperty(configCapped + "_OUTPUT_NAME"); + if (NULL != outputNameSProp) + { outputFilename = outputNameSProp; - } + } return outputFilename; } bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config, - const std::string &language) { + const std::string &language) +{ bool output; std::vector options; - Target->GetCompileOptions(options, config, language); + this->Target->GetCompileOptions(options, config, language); output = - options.end() == std::find(options.begin(), options.end(), "-kernel"); + options.end() == std::find(options.begin(), options.end(), "-kernel"); return output; } -bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup() { +bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup() +{ bool output = false; - std::vector sources = GetSources(); + std::vector sources = this->GetSources(); for (std::vector::const_iterator sources_i = sources.begin(); - sources.end() != sources_i; ++sources_i) { - if ("int" == (*sources_i)->GetExtension()) { + sources.end() != sources_i; ++sources_i) + { + if ("int" == (*sources_i)->GetExtension()) + { output = true; + } } - } return output; } bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload( - std::string const &config, const std::string &language) { + std::string const &config, const std::string &language) +{ std::vector options; bool output = false; - Target->GetCompileOptions(options, config, language); + this->Target->GetCompileOptions(options, config, language); for (std::vector::const_iterator options_i = options.begin(); - options_i != options.end(); ++options_i) { + options_i != options.end(); ++options_i) + { std::string option = *options_i; - if (DDOption == option) { + if (this->DDOption == option) + { output = true; + } } - } return output; } diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 0e61193..3eecc60 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -24,7 +24,8 @@ class cmSourceFile; class cmGeneratedFileStream; class cmCustomCommand; -class cmGhsMultiTargetGenerator { +class cmGhsMultiTargetGenerator +{ public: cmGhsMultiTargetGenerator(cmTarget const *target); @@ -35,17 +36,30 @@ public: bool IncludeThisTarget(); std::vector GetSources() const; GhsMultiGpj::Types GetGpjTag() const; - const char *GetAbsBuildFilePath() const { return AbsBuildFilePath.c_str(); } - const char *GetRelBuildFileName() const { return RelBuildFileName.c_str(); } - const char *GetAbsBuildFileName() const { return AbsBuildFileName.c_str(); } - const char *GetAbsOutputFileName() const {return AbsOutputFileName.c_str();} + const char *GetAbsBuildFilePath() const + { + return this->AbsBuildFilePath.c_str(); + } + const char *GetRelBuildFileName() const + { + return this->RelBuildFileName.c_str(); + } + const char *GetAbsBuildFileName() const + { + return this->AbsBuildFileName.c_str(); + } + const char *GetAbsOutputFileName() const + { + return this->AbsOutputFileName.c_str(); + } private: cmGlobalGhsMultiGenerator *GetGlobalGenerator() const; - cmGeneratedFileStream *GetFolderBuildStreams() { - return FolderBuildStreams[""]; + cmGeneratedFileStream *GetFolderBuildStreams() + { + return this->FolderBuildStreams[""]; }; - bool IsTargetGroup() const { return TargetGroup; } + bool IsTargetGroup() const { return this->TargetGroup; } void WriteTypeSpecifics(const std::string &config, bool notKernel); void WriteDebugOptions(std::string const &config, bool notKernel); @@ -82,8 +96,7 @@ private: std::string RelBuildFileName; std::string RelOutputFileName; std::string AbsOutputFileName; - std::map - FolderBuildStreams; + std::map FolderBuildStreams; bool TargetGroup; bool DynamicDownload; static std::string const DDOption; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index b99462b..afd05ae 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -20,35 +20,41 @@ const char *cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; -cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator() : OSDirRelative(false) { +cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator() + : OSDirRelative(false) +{ this->GhsBuildCommandInitialized = false; } -cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() { +cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() +{ cmDeleteAll(TargetFolderBuildStreams); } -cmLocalGenerator *cmGlobalGhsMultiGenerator::CreateLocalGenerator() { +cmLocalGenerator *cmGlobalGhsMultiGenerator::CreateLocalGenerator() +{ cmLocalGenerator *lg = new cmLocalGhsMultiGenerator; lg->SetGlobalGenerator(this); this->SetCurrentLocalGenerator(lg); return lg; } -void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry) { +void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry) +{ entry.Name = GetActualName(); entry.Brief = "Generates Green Hills MULTI files (experimental)."; } void cmGlobalGhsMultiGenerator::EnableLanguage( - std::vector const &l, cmMakefile *mf, bool optional) { + std::vector const &l, cmMakefile *mf, bool optional) +{ mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM"); const std::string ghsCompRoot(GetCompRoot()); mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str()); std::string ghsCompRootStart = - 0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/"; + 0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/"; mf->AddDefinition("CMAKE_C_COMPILER", std::string(ghsCompRootStart + "ccarm.exe").c_str()); mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); @@ -61,45 +67,53 @@ void cmGlobalGhsMultiGenerator::EnableLanguage( mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHSCXX"); mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); - if (ghsCompRoot.length() > 0) { + if (!ghsCompRoot.empty()) + { static const char *compPreFix = "comp_"; std::string compFilename = - cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix); + cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix); cmsys::SystemTools::ReplaceString(compFilename, compPreFix, ""); mf->AddDefinition("CMAKE_SYSTEM_VERSION", compFilename.c_str()); - } + } mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files this->cmGlobalGenerator::EnableLanguage(l, mf, optional); } -void cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile *mf) { +void cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile *mf) +{ // The GHS generator knows how to lookup its build tool // directly instead of needing a helper module to do it, so we // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. - if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) { + if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) + { mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetGhsBuildCommand().c_str()); - } + } } -std::string const &cmGlobalGhsMultiGenerator::GetGhsBuildCommand() { - if (!this->GhsBuildCommandInitialized) { +std::string const &cmGlobalGhsMultiGenerator::GetGhsBuildCommand() +{ + if (!this->GhsBuildCommandInitialized) + { this->GhsBuildCommandInitialized = true; this->GhsBuildCommand = this->FindGhsBuildCommand(); - } + } return this->GhsBuildCommand; } -std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() { +std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() +{ std::string makeProgram = cmSystemTools::FindProgram("gbuild"); - if (makeProgram.empty()) { + if (makeProgram.empty()) + { makeProgram = "gbuild"; - } + } return makeProgram; } -std::string cmGlobalGhsMultiGenerator::GetCompRoot() { +std::string cmGlobalGhsMultiGenerator::GetCompRoot() +{ std::string output; const std::vector @@ -117,194 +131,235 @@ std::string cmGlobalGhsMultiGenerator::GetCompRoot() { // Use latest version std::string outputDirName; for (std::vector::const_iterator potentialDirsCompleteIt = - potentialDirsComplete.begin(); + potentialDirsComplete.begin(); potentialDirsCompleteIt != potentialDirsComplete.end(); - ++potentialDirsCompleteIt) { + ++potentialDirsCompleteIt) + { const std::string dirName( - cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt)); - if (dirName.compare(outputDirName) > 0) { + cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt)); + if (dirName.compare(outputDirName) > 0) + { output = *potentialDirsCompleteIt; outputDirName = dirName; + } } - } return output; } -std::vector cmGlobalGhsMultiGenerator::GetCompRootHardPaths() { +std::vector cmGlobalGhsMultiGenerator::GetCompRootHardPaths() +{ std::vector output; cmSystemTools::Glob("C:/ghs", "comp_[^;]+", output); for (std::vector::iterator outputIt = output.begin(); - outputIt != output.end(); ++outputIt) { + outputIt != output.end(); ++outputIt) + { *outputIt = "C:/ghs/" + *outputIt; - } + } return output; } -std::vector cmGlobalGhsMultiGenerator::GetCompRootRegistry() { +std::vector cmGlobalGhsMultiGenerator::GetCompRootRegistry() +{ std::vector output(2); cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" - "Windows\\CurrentVersion\\Uninstall\\" - "GreenHillsSoftwared771f1b4;InstallLocation", - output[0]); + "HKEY_LOCAL_" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" + "Windows\\CurrentVersion\\Uninstall\\" + "GreenHillsSoftwared771f1b4;InstallLocation", + output[0]); cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" - "Windows\\CurrentVersion\\Uninstall\\" - "GreenHillsSoftware9881cef6;InstallLocation", - output[1]); + "HKEY_LOCAL_" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" + "Windows\\CurrentVersion\\Uninstall\\" + "GreenHillsSoftware9881cef6;InstallLocation", + output[1]); return output; } void cmGlobalGhsMultiGenerator::OpenBuildFileStream( - std::string const &filepath, cmGeneratedFileStream **filestream) { + std::string const &filepath, cmGeneratedFileStream **filestream) +{ // Get a stream where to generate things. - if (NULL == *filestream) { + if (NULL == *filestream) + { *filestream = new cmGeneratedFileStream(filepath.c_str()); - if (NULL != *filestream) { + if (NULL != *filestream) + { OpenBuildFileStream(*filestream); + } } - } } void cmGlobalGhsMultiGenerator::OpenBuildFileStream( - cmGeneratedFileStream *filestream) { + cmGeneratedFileStream *filestream) +{ *filestream << "#!gbuild" << std::endl; } -void cmGlobalGhsMultiGenerator::OpenBuildFileStream() { +void cmGlobalGhsMultiGenerator::OpenBuildFileStream() +{ // Compute GHS MULTI's build file path. std::string buildFilePath = - this->GetCMakeInstance()->GetHomeOutputDirectory(); + this->GetCMakeInstance()->GetHomeOutputDirectory(); buildFilePath += "/"; buildFilePath += "default"; buildFilePath += FILE_EXTENSION; - Open(std::string(""), buildFilePath, &TargetFolderBuildStreams); + this->Open(std::string(""), buildFilePath, &this->TargetFolderBuildStreams); OpenBuildFileStream(GetBuildFileStream()); char const *osDir = - this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR"); - if (NULL == osDir) { + this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR"); + if (NULL == osDir) + { osDir = ""; cmSystemTools::Error("GHS_OS_DIR cache variable must be set"); - } else { + } + else + { this->GetCMakeInstance()->MarkCliAsUsed("GHS_OS_DIR"); - } - std::string fOSDir(trimQuotes(osDir)); + } + std::string fOSDir(this->trimQuotes(osDir)); cmSystemTools::ReplaceString(fOSDir, "\\", "/"); - if (fOSDir.length() > 0 && ('c' == fOSDir[0] || 'C' == fOSDir[0])) { - OSDirRelative = false; - } else { - OSDirRelative = true; - } + if (!fOSDir.empty() && ('c' == fOSDir[0] || 'C' == fOSDir[0])) + { + this->OSDirRelative = false; + } + else + { + this->OSDirRelative = true; + } char const *bspName = - this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); - if (NULL == bspName) { + this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); + if (NULL == bspName) + { bspName = ""; cmSystemTools::Error("GHS_BSP_NAME cache variable must be set"); - } else { + } + else + { this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); - } - std::string fBspName(trimQuotes(bspName)); + } + std::string fBspName(this->trimQuotes(bspName)); cmSystemTools::ReplaceString(fBspName, "\\", "/"); - WriteMacros(); - WriteHighLevelDirectives(); - - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, GetBuildFileStream()); - WriteDisclaimer(GetBuildFileStream()); - *GetBuildFileStream() << "# Top Level Project File" << std::endl; - if (fBspName.length() > 0) { - *GetBuildFileStream() << " -bsp " << fBspName << std::endl; - } - WriteCompilerOptions(fOSDir); + this->WriteMacros(); + this->WriteHighLevelDirectives(); + + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); + this->WriteDisclaimer(this->GetBuildFileStream()); + *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; + if (!fBspName.empty()) + { + *this->GetBuildFileStream() << " -bsp " << fBspName << std::endl; + } + this->WriteCompilerOptions(fOSDir); } void cmGlobalGhsMultiGenerator::CloseBuildFileStream( - cmGeneratedFileStream **filestream) { - if (filestream) { + cmGeneratedFileStream **filestream) +{ + if (filestream) + { delete *filestream; *filestream = NULL; - } else { + } + else + { cmSystemTools::Error("Build file stream was not open."); - } + } } -void cmGlobalGhsMultiGenerator::Generate() { +void cmGlobalGhsMultiGenerator::Generate() +{ this->cmGlobalGenerator::Generate(); - if (!this->LocalGenerators.empty()) { + if (!this->LocalGenerators.empty()) + { this->OpenBuildFileStream(); // Build all the folder build files - for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { + for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) + { cmLocalGhsMultiGenerator *lg = - static_cast(this->LocalGenerators[i]); + static_cast(this->LocalGenerators[i]); cmGeneratorTargetsType tgts = lg->GetMakefile()->GetGeneratorTargets(); - UpdateBuildFiles(tgts); + this->UpdateBuildFiles(tgts); + } } - } cmDeleteAll(TargetFolderBuildStreams); this->TargetFolderBuildStreams.clear(); } void cmGlobalGhsMultiGenerator::GenerateBuildCommand( - std::vector &makeCommand, const std::string &makeProgram, - const std::string & /*projectName*/, const std::string & /*projectDir*/, - const std::string &targetName, const std::string & /*config*/, - bool /*fast*/, bool /*verbose*/, - std::vector const &makeOptions) { + std::vector &makeCommand, const std::string &makeProgram, + const std::string & /*projectName*/, const std::string & /*projectDir*/, + const std::string &targetName, const std::string & /*config*/, + bool /*fast*/, bool /*verbose*/, + std::vector const &makeOptions) +{ makeCommand.push_back( this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand()) ); makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); - if (!targetName.empty()) { - if (targetName == "clean") { + if (!targetName.empty()) + { + if (targetName == "clean") + { makeCommand.push_back("-clean"); - } else { + } + else + { makeCommand.push_back(targetName); + } } - } } -void cmGlobalGhsMultiGenerator::WriteMacros() { +void cmGlobalGhsMultiGenerator::WriteMacros() +{ char const *ghsGpjMacros = - this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS"); - if (NULL != ghsGpjMacros) { + this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS"); + if (NULL != ghsGpjMacros) + { std::vector expandedList; cmSystemTools::ExpandListArgument(std::string(ghsGpjMacros), expandedList); for (std::vector::const_iterator expandedListI = - expandedList.begin(); - expandedListI != expandedList.end(); ++expandedListI) { - *GetBuildFileStream() << "macro " << *expandedListI << std::endl; + expandedList.begin(); + expandedListI != expandedList.end(); ++expandedListI) + { + *this->GetBuildFileStream() << "macro " << *expandedListI << std::endl; + } } - } } -void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() { - *GetBuildFileStream() << "primaryTarget=arm_integrity.tgt" << std::endl; +void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() +{ + *this->GetBuildFileStream() << "primaryTarget=arm_integrity.tgt" + << std::endl; char const *const customization = - this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); - if (NULL != customization && strlen(customization) > 0) { - *GetBuildFileStream() << "customization=" << trimQuotes(customization) - << std::endl; + this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); + if (NULL != customization && strlen(customization) > 0) + { + *this->GetBuildFileStream() << "customization=" + << trimQuotes(customization) + << std::endl; this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION"); - } + } } -void cmGlobalGhsMultiGenerator::WriteCompilerOptions( - std::string const &fOSDir) { - *GetBuildFileStream() << " -os_dir=\"" << fOSDir << "\"" << std::endl; - *GetBuildFileStream() << " --link_once_templates" << std::endl; +void cmGlobalGhsMultiGenerator::WriteCompilerOptions(std::string const &fOSDir) +{ + *this->GetBuildFileStream() << " -os_dir=\"" << fOSDir << "\"" + << std::endl; + *this->GetBuildFileStream() << " --link_once_templates" << std::endl; } -void cmGlobalGhsMultiGenerator::WriteDisclaimer(std::ostream *os) { +void cmGlobalGhsMultiGenerator::WriteDisclaimer(std::ostream *os) +{ (*os) << "#" << std::endl << "# CMAKE generated file: DO NOT EDIT!" << std::endl << "# Generated by \"" << GetActualName() << "\"" @@ -314,141 +369,160 @@ void cmGlobalGhsMultiGenerator::WriteDisclaimer(std::ostream *os) { } void cmGlobalGhsMultiGenerator::AddFilesUpToPath( - cmGeneratedFileStream *mainBuildFile, - std::map * - targetFolderBuildStreams, - char const *homeOutputDirectory, std::string const &path, - GhsMultiGpj::Types projType, std::string const &relPath) { + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &path, + GhsMultiGpj::Types projType, std::string const &relPath) +{ std::string workingPath(path); cmSystemTools::ConvertToUnixSlashes(workingPath); std::vector splitPath = - cmSystemTools::SplitString(workingPath); + cmSystemTools::SplitString(workingPath); std::string workingRelPath(relPath); - if (!cmHasLiteralSuffix(relPath, "/")) { + cmSystemTools::ConvertToUnixSlashes(workingRelPath); + if (!workingRelPath.empty()) + { workingRelPath += "/"; - } + } std::string pathUpTo; for (std::vector::const_iterator splitPathI = - splitPath.begin(); - splitPath.end() != splitPathI; ++splitPathI) { + splitPath.begin(); + splitPath.end() != splitPathI; ++splitPathI) + { pathUpTo += *splitPathI; if (targetFolderBuildStreams->end() == - targetFolderBuildStreams->find(pathUpTo)) { + targetFolderBuildStreams->find(pathUpTo)) + { AddFilesUpToPathNewBuildFile( - mainBuildFile, targetFolderBuildStreams, homeOutputDirectory, - pathUpTo, splitPath.begin() == splitPathI, workingRelPath, projType); - } + mainBuildFile, targetFolderBuildStreams, homeOutputDirectory, + pathUpTo, splitPath.begin() == splitPathI, workingRelPath, projType); + } AddFilesUpToPathAppendNextFile(targetFolderBuildStreams, pathUpTo, splitPathI, splitPath.end(), projType); pathUpTo += "/"; - } + } } void cmGlobalGhsMultiGenerator::Open( - std::string const &mapKeyName, std::string const &fileName, - std::map *fileMap) { - if (fileMap->end() == fileMap->find(fileName)) { - cmGeneratedFileStream* temp(new cmGeneratedFileStream); + std::string const &mapKeyName, std::string const &fileName, + std::map *fileMap) +{ + if (fileMap->end() == fileMap->find(fileName)) + { + cmGeneratedFileStream *temp(new cmGeneratedFileStream); temp->open(fileName.c_str()); (*fileMap)[mapKeyName] = temp; - } + } } void cmGlobalGhsMultiGenerator::AddFilesUpToPathNewBuildFile( - cmGeneratedFileStream *mainBuildFile, - std::map * - targetFolderBuildStreams, - char const *homeOutputDirectory, std::string const &pathUpTo, - bool const isFirst, std::string const &relPath, - GhsMultiGpj::Types const projType) { + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &pathUpTo, + bool const isFirst, std::string const &relPath, + GhsMultiGpj::Types const projType) +{ // create folders up to file path std::string absPath = std::string(homeOutputDirectory) + "/" + relPath; std::string newPath = absPath + pathUpTo; - if (!cmSystemTools::FileExists(newPath.c_str())) { + if (!cmSystemTools::FileExists(newPath.c_str())) + { cmSystemTools::MakeDirectory(newPath.c_str()); - } + } // Write out to filename for first time std::string relFilename(GetFileNameFromPath(pathUpTo)); std::string absFilename = absPath + relFilename; Open(pathUpTo, absFilename, targetFolderBuildStreams); OpenBuildFileStream((*targetFolderBuildStreams)[pathUpTo]); - GhsMultiGpj::WriteGpjTag(projType, - (*targetFolderBuildStreams)[pathUpTo]); + GhsMultiGpj::WriteGpjTag(projType, (*targetFolderBuildStreams)[pathUpTo]); WriteDisclaimer((*targetFolderBuildStreams)[pathUpTo]); // Add to main build file - if (isFirst) { + if (isFirst) + { *mainBuildFile << relFilename << " "; GhsMultiGpj::WriteGpjTag(projType, mainBuildFile); - } + } } void cmGlobalGhsMultiGenerator::AddFilesUpToPathAppendNextFile( - std::map * - targetFolderBuildStreams, - std::string const &pathUpTo, - std::vector::const_iterator splitPathI, - std::vector::const_iterator end, - GhsMultiGpj::Types const projType) { + std::map *targetFolderBuildStreams, + std::string const &pathUpTo, + std::vector::const_iterator splitPathI, + std::vector::const_iterator end, + GhsMultiGpj::Types const projType) +{ std::vector::const_iterator splitPathNextI = splitPathI + 1; if (end != splitPathNextI && targetFolderBuildStreams->end() == - targetFolderBuildStreams->find(pathUpTo + "/" + *splitPathNextI)) { + targetFolderBuildStreams->find(pathUpTo + "/" + *splitPathNextI)) + { std::string nextFilename(*splitPathNextI); nextFilename = GetFileNameFromPath(nextFilename); *(*targetFolderBuildStreams)[pathUpTo] << nextFilename << " "; - GhsMultiGpj::WriteGpjTag(projType, - (*targetFolderBuildStreams)[pathUpTo]); - } + GhsMultiGpj::WriteGpjTag(projType, (*targetFolderBuildStreams)[pathUpTo]); + } } std::string -cmGlobalGhsMultiGenerator::GetFileNameFromPath(std::string const &path) { +cmGlobalGhsMultiGenerator::GetFileNameFromPath(std::string const &path) +{ std::string output(path); - if (path.length() > 0) { + if (!path.empty()) + { cmSystemTools::ConvertToUnixSlashes(output); std::vector splitPath = cmSystemTools::SplitString(output); output += "/" + splitPath.back() + FILE_EXTENSION; - } + } return output; } void cmGlobalGhsMultiGenerator::UpdateBuildFiles( - cmGeneratorTargetsType const &tgts) { + cmGeneratorTargetsType const &tgts) +{ for (cmGeneratorTargetsType::const_iterator tgtsI = tgts.begin(); - tgtsI != tgts.end(); ++tgtsI) { + tgtsI != tgts.end(); ++tgtsI) + { cmGhsMultiTargetGenerator gmtg(tgtsI->first); - if (!gmtg.GetSources().empty() && gmtg.IncludeThisTarget()) { + if (!gmtg.GetSources().empty() && gmtg.IncludeThisTarget()) + { char const *rawFolderName = tgtsI->first->GetProperty("FOLDER"); - if (NULL == rawFolderName) { + if (NULL == rawFolderName) + { rawFolderName = ""; - } + } std::string folderName(rawFolderName); - if (TargetFolderBuildStreams.end() == - TargetFolderBuildStreams.find(folderName)) { - AddFilesUpToPath(GetBuildFileStream(), &TargetFolderBuildStreams, - this->GetCMakeInstance()->GetHomeOutputDirectory(), - folderName, GhsMultiGpj::PROJECT); - } + if (this->TargetFolderBuildStreams.end() == + this->TargetFolderBuildStreams.find(folderName)) + { + this->AddFilesUpToPath( + GetBuildFileStream(), &this->TargetFolderBuildStreams, + this->GetCMakeInstance()->GetHomeOutputDirectory(), folderName, + GhsMultiGpj::PROJECT); + } std::vector splitPath = - cmSystemTools::SplitString(gmtg.GetRelBuildFileName()); + cmSystemTools::SplitString(gmtg.GetRelBuildFileName()); std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" + splitPath.back()); - *TargetFolderBuildStreams[folderName] << foldNameRelBuildFile << " "; + *this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile + << " "; GhsMultiGpj::WriteGpjTag(gmtg.GetGpjTag(), - TargetFolderBuildStreams[folderName]); + this->TargetFolderBuildStreams[folderName]); + } } - } } -std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const &str) { +std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const &str) +{ std::string result; result.reserve(str.size()); - for (const char *ch = str.c_str(); *ch != '\0'; ++ch) { - if (*ch != '"') { + for (const char *ch = str.c_str(); *ch != '\0'; ++ch) + { + if (*ch != '"') + { result += *ch; + } } - } return result; } diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 78a7736..d5948da 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -18,7 +18,8 @@ class cmGeneratedFileStream; -class cmGlobalGhsMultiGenerator : public cmGlobalGenerator { +class cmGlobalGhsMultiGenerator : public cmGlobalGenerator +{ public: /// The default name of GHS MULTI's build file. Typically: monolith.gpj. static const char *FILE_EXTENSION; @@ -26,9 +27,8 @@ public: cmGlobalGhsMultiGenerator(); ~cmGlobalGhsMultiGenerator(); - static cmGlobalGeneratorFactory *NewFactory() { - return new cmGlobalGeneratorSimpleFactory(); - } + static cmGlobalGeneratorFactory *NewFactory() + { return new cmGlobalGeneratorSimpleFactory(); } ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -36,7 +36,7 @@ public: /// @return the name of this generator. static std::string GetActualName() { return "Green Hills MULTI"; } ///! Get the name for this generator - virtual std::string GetName() const { return GetActualName(); } + virtual std::string GetName() const { return this->GetActualName(); } /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() static void GetDocumentation(cmDocumentationEntry &entry); @@ -52,8 +52,9 @@ public: */ virtual void FindMakeProgram(cmMakefile *); - cmGeneratedFileStream *GetBuildFileStream() { - return TargetFolderBuildStreams[""]; + cmGeneratedFileStream *GetBuildFileStream() + { + return this->TargetFolderBuildStreams[""]; } static void OpenBuildFileStream(std::string const &filepath, @@ -62,30 +63,28 @@ public: static void CloseBuildFileStream(cmGeneratedFileStream **filestream); /// Write the common disclaimer text at the top of each build file. static void WriteDisclaimer(std::ostream *os); - std::vector GetLibDirs() { return LibDirs; } + std::vector GetLibDirs() { return this->LibDirs; } static void AddFilesUpToPath( cmGeneratedFileStream *mainBuildFile, - std::map * - targetFolderBuildStreams, + std::map *targetFolderBuildStreams, char const *homeOutputDirectory, std::string const &path, GhsMultiGpj::Types projType, std::string const &relPath = ""); - static void - Open(std::string const &mapKeyName, std::string const &fileName, - std::map *fileMap); + static void Open(std::string const &mapKeyName, std::string const &fileName, + std::map *fileMap); static std::string trimQuotes(std::string const &str); - inline bool IsOSDirRelative() { return OSDirRelative; } + inline bool IsOSDirRelative() { return this->OSDirRelative; } protected: virtual void Generate(); virtual void GenerateBuildCommand( std::vector &makeCommand, const std::string &makeProgram, const std::string &projectName, const std::string &projectDir, - const std::string &targetName, const std::string &config, - bool fast, bool verbose, - std::vector const &makeOptions = - std::vector()); + const std::string &targetName, const std::string &config, bool fast, + bool verbose, + std::vector const& makeOptions = std::vector() + ); private: std::string const &GetGhsBuildCommand(); @@ -101,13 +100,11 @@ private: static void AddFilesUpToPathNewBuildFile( cmGeneratedFileStream *mainBuildFile, - std::map * - targetFolderBuildStreams, + std::map *targetFolderBuildStreams, char const *homeOutputDirectory, std::string const &pathUpTo, bool isFirst, std::string const &relPath, GhsMultiGpj::Types projType); static void AddFilesUpToPathAppendNextFile( - std::map * - targetFolderBuildStreams, + std::map *targetFolderBuildStreams, std::string const &pathUpTo, std::vector::const_iterator splitPathI, std::vector::const_iterator end, @@ -116,8 +113,7 @@ private: void UpdateBuildFiles(cmGeneratorTargetsType const &tgts); std::vector TargetSubProjects; - std::map - TargetFolderBuildStreams; + std::map TargetFolderBuildStreams; std::vector LibDirs; diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index b60463f..8773715 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -20,15 +20,18 @@ cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator() {} cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() {} -void cmLocalGhsMultiGenerator::Generate() { +void cmLocalGhsMultiGenerator::Generate() +{ cmGeneratorTargetsType tgts = this->GetMakefile()->GetGeneratorTargets(); - if (!tgts.empty()) { + if (!tgts.empty()) + { for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); - ++l) { + ++l) + { cmGhsMultiTargetGenerator tg(l->second->Target); tg.Generate(); + } } - } } // Implemented in: @@ -36,13 +39,15 @@ void cmLocalGhsMultiGenerator::Generate() { // Used in: // Source/cmMakefile.cxx // Source/cmGlobalGenerator.cxx -void cmLocalGhsMultiGenerator::Configure() { +void cmLocalGhsMultiGenerator::Configure() +{ // Compute the path to use when referencing the current output // directory from the top output directory. this->HomeRelativeOutputPath = - this->Convert(this->Makefile->GetStartOutputDirectory(), HOME_OUTPUT); - if (this->HomeRelativeOutputPath == ".") { + this->Convert(this->Makefile->GetStartOutputDirectory(), HOME_OUTPUT); + if (this->HomeRelativeOutputPath == ".") + { this->HomeRelativeOutputPath = ""; - } + } this->cmLocalGenerator::Configure(); } diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index c97b03f..a8df3e7 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -22,7 +22,8 @@ class cmGeneratedFileStream; * cmLocalGhsMultiGenerator produces a set of .gpj * file for each target in its mirrored directory. */ -class cmLocalGhsMultiGenerator : public cmLocalGenerator { +class cmLocalGhsMultiGenerator : public cmLocalGenerator +{ public: cmLocalGhsMultiGenerator(); @@ -30,7 +31,8 @@ public: /// @returns the relative path between the HomeOutputDirectory and this /// local generators StartOutputDirectory. - std::string GetHomeRelativeOutputPath() const { + std::string GetHomeRelativeOutputPath() const + { return this->HomeRelativeOutputPath; } @@ -41,7 +43,7 @@ public: /// Overloaded methods. @see cmLocalGenerator::Configure() virtual void Configure(); - const char *GetBuildFileName() { return BuildFileName.c_str(); } + const char *GetBuildFileName() { return this->BuildFileName.c_str(); } protected: virtual bool CustomCommandUseLocal() const { return true; } ----------------------------------------------------------------------- Summary of changes: Source/cmGhsMultiGpj.cxx | 42 +-- Source/cmGhsMultiGpj.h | 6 +- Source/cmGhsMultiTargetGenerator.cxx | 490 ++++++++++++++++++++-------------- Source/cmGhsMultiTargetGenerator.h | 33 ++- Source/cmGlobalGhsMultiGenerator.cxx | 420 +++++++++++++++++------------ Source/cmGlobalGhsMultiGenerator.h | 44 ++- Source/cmLocalGhsMultiGenerator.cxx | 21 +- Source/cmLocalGhsMultiGenerator.h | 8 +- 8 files changed, 620 insertions(+), 444 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Wed Mar 25 11:34:28 2015 From: brad.king at kitware.com (Brad King) Date: Wed, 25 Mar 2015 11:34:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1224-g3aefbb3 Message-ID: <20150325153428.AEFC1AD8C9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3aefbb3c78f90c552e4e3c2039302aca3437e959 (commit) via 8f547be5d75621e8b54321e22198954c58a77624 (commit) from 82dfb1b65285e19e01e05ced44c307d26548e5ce (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3aefbb3c78f90c552e4e3c2039302aca3437e959 commit 3aefbb3c78f90c552e4e3c2039302aca3437e959 Merge: 82dfb1b 8f547be Author: Brad King AuthorDate: Wed Mar 25 11:34:27 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 25 11:34:27 2015 -0400 Merge topic 'add-GreenHills-MULTI-generator' into next 8f547be5 Add a 'Green Hills MULTI' generator on Windows http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f547be5d75621e8b54321e22198954c58a77624 commit 8f547be5d75621e8b54321e22198954c58a77624 Author: Geoff Viola AuthorDate: Mon Mar 23 23:12:55 2015 -0600 Commit: Brad King CommitDate: Wed Mar 25 11:32:41 2015 -0400 Add a 'Green Hills MULTI' generator on Windows Green Hills MULTI is an IDE for embedded real-time systems. The IDE's product page can be found here: http://www.ghs.com/products/MULTI_IDE.html It supports cross compiling on ARM, Intel x86, and other architectures with various operating systems. The IDE exists on Linux and Windows host systems, but CMake will currently only generate the project files on Windows host systems. diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst new file mode 100644 index 0000000..79695f1 --- /dev/null +++ b/Help/generator/Green Hills MULTI.rst @@ -0,0 +1,11 @@ +Green Hills MULTI +----------------- + +Generates Green Hills MULTI project files. + +Customizations are available through the following cache variables: + +* ``GHS_BSP_NAME`` +* ``GHS_CUSTOMIZATION`` +* ``GHS_GPJ_MACROS`` +* ``GHS_OS_DIR`` diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 804229b..ce9f5c8 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -56,6 +56,7 @@ one may launch CMake from any environment. .. toctree:: :maxdepth: 1 + /generator/Green Hills MULTI /generator/Visual Studio 6 /generator/Visual Studio 7 /generator/Visual Studio 7 .NET 2003 diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index c342dbe..5282872 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -181,6 +181,7 @@ Variables that Describe the System /variable/CMAKE_SYSTEM_VERSION /variable/CYGWIN /variable/ENV + /variable/GHS-MULTI /variable/MINGW /variable/MSVC10 /variable/MSVC11 diff --git a/Help/variable/CMAKE_MAKE_PROGRAM.rst b/Help/variable/CMAKE_MAKE_PROGRAM.rst index f1d88a5..85b098b 100644 --- a/Help/variable/CMAKE_MAKE_PROGRAM.rst +++ b/Help/variable/CMAKE_MAKE_PROGRAM.rst @@ -56,6 +56,10 @@ to configure the project: the CMake cache then CMake will use the specified value if possible. +* The :generator:`Green Hills MULTI` generator sets this to ``gbuild``. + If a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to + the CMake cache then CMake will use the specified value. + The ``CMAKE_MAKE_PROGRAM`` variable is set for use by project code. The value is also used by the :manual:`cmake(1)` ``--build`` and :manual:`ctest(1)` ``--build-and-test`` tools to launch the native diff --git a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst index 8ad89f1..2f5313b 100644 --- a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst +++ b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst @@ -6,3 +6,5 @@ The name of the CPU CMake is building for. This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if you build for the host system instead of the target system when cross compiling. + +* The Green Hills MULTI generator sets this to ``ARM`` by default diff --git a/Help/variable/GHS-MULTI.rst b/Help/variable/GHS-MULTI.rst new file mode 100644 index 0000000..0f91be8 --- /dev/null +++ b/Help/variable/GHS-MULTI.rst @@ -0,0 +1,4 @@ +GHS-MULTI +--------- + +True when using Green Hills MULTI diff --git a/Modules/Compiler/GHS-DetermineCompiler.cmake b/Modules/Compiler/GHS-DetermineCompiler.cmake new file mode 100644 index 0000000..56d24e2 --- /dev/null +++ b/Modules/Compiler/GHS-DetermineCompiler.cmake @@ -0,0 +1,6 @@ +set(_compiler_id_pp_test "defined(__INTEGRITY)") + +set(_compiler_id_version_compute " +# define @PREFIX at COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEGRITY_MAJOR_VERSION) +# define @PREFIX at COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEGRITY_MINOR_VERSION) +# define @PREFIX at COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEGRITY_PATCH_VERSION)") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 466090b..c844aed 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -405,6 +405,8 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) else() set (_boost_COMPILER "-il") endif() + elseif (GHSMULTI) + set(_boost_COMPILER "-ghs") elseif (MSVC14) set(_boost_COMPILER "-vc140") elseif (MSVC12) @@ -777,7 +779,8 @@ endif() # ------------------------------------------------------------------------ set(Boost_LIB_PREFIX "") -if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) +if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR + (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) ) set(Boost_LIB_PREFIX "lib") endif() diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake new file mode 100644 index 0000000..342ad21 --- /dev/null +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -0,0 +1,29 @@ + +#============================================================================= +# Copyright 2015 Geoffrey Viola +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +#Setup Greenhills MULTI specific compilation information +find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122 + "C:/ghs/int1122" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104 + "C:/ghs/int1104" + DOC "Path to integrity directory" + ) +set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory") +set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation") +set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") +set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") +mark_as_advanced(GHS_CUSTOMIZATION) +set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons") +mark_as_advanced(GHS_GPJ_MACROS) diff --git a/Modules/Platform/GHS-MULTI.cmake b/Modules/Platform/GHS-MULTI.cmake new file mode 100644 index 0000000..211cf3e --- /dev/null +++ b/Modules/Platform/GHS-MULTI.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2015 Geoffrey Viola +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. + +if(__GHSMULTI) + return() +endif() +set(__GHSMULTI 1) + +set(GHSMULTI 1) + +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + +include(Platform/WindowsPaths) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 04f6a81..064b827 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -472,6 +472,14 @@ if (WIN32) cmVisualStudioSlnParser.cxx cmVisualStudioWCEPlatformParser.h cmVisualStudioWCEPlatformParser.cxx + cmGlobalGhsMultiGenerator.cxx + cmGlobalGhsMultiGenerator.h + cmLocalGhsMultiGenerator.cxx + cmLocalGhsMultiGenerator.h + cmGhsMultiTargetGenerator.cxx + cmGhsMultiTargetGenerator.h + cmGhsMultiGpj.cxx + cmGhsMultiGpj.h ) endif() endif () @@ -499,6 +507,7 @@ set(SRCS ${SRCS} cmNinjaUtilityTargetGenerator.cxx cmNinjaUtilityTargetGenerator.h ) + if(WIN32 AND NOT CYGWIN) set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501) add_executable(cmcldeps cmcldeps.cxx) diff --git a/Source/cmGhsMultiGpj.cxx b/Source/cmGhsMultiGpj.cxx new file mode 100644 index 0000000..e47d583 --- /dev/null +++ b/Source/cmGhsMultiGpj.cxx @@ -0,0 +1,41 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGhsMultiGpj.h" + +#include "cmGeneratedFileStream.h" + +void GhsMultiGpj::WriteGpjTag(Types const gpjType, + cmGeneratedFileStream *const filestream) +{ + char const *tag; + switch (gpjType) + { + case INTERGRITY_APPLICATION: + tag = "INTEGRITY Application"; + break; + case PROJECT: + tag = "Project"; + break; + case PROGRAM: + tag = "Program"; + break; + case REFERENCE: + tag = "Reference"; + break; + case SUBPROJECT: + tag = "Subproject"; + break; + default: + tag = ""; + } + *filestream << "[" << tag << "]" << std::endl; +} diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h new file mode 100644 index 0000000..7e5b942 --- /dev/null +++ b/Source/cmGhsMultiGpj.h @@ -0,0 +1,33 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGhsMultiGpj_h +#define cmGhsMultiGpj_h + +class cmGeneratedFileStream; + +class GhsMultiGpj +{ +public: + enum Types + { + INTERGRITY_APPLICATION, + PROJECT, + PROGRAM, + REFERENCE, + SUBPROJECT + }; + + static void WriteGpjTag(Types const gpjType, + cmGeneratedFileStream *filestream); +}; + +#endif // ! cmGhsMultiGpjType_h diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx new file mode 100644 index 0000000..0c3595b --- /dev/null +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -0,0 +1,518 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGhsMultiTargetGenerator.h" +#include "cmGlobalGhsMultiGenerator.h" +#include "cmLocalGhsMultiGenerator.h" +#include "cmMakefile.h" +#include "cmTarget.h" +#include "cmGeneratedFileStream.h" +#include "cmSourceFile.h" +#include +#include + +std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic"); + +cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget const *target) + : Target(target) + , LocalGenerator(static_cast( + target->GetMakefile()->GetLocalGenerator())) + , Makefile(target->GetMakefile()) + , TargetGroup(DetermineIfTargetGroup()) + , DynamicDownload(false) +{ + char const *folderProp = this->Target->GetProperty("FOLDER"); + this->RelBuildFilePath = NULL == folderProp ? "" : folderProp; + cmSystemTools::ConvertToUnixSlashes(this->RelBuildFilePath); + if (!this->RelBuildFilePath.empty()) + { + this->RelBuildFilePath += "/"; + } + this->RelBuildFilePath += this->Target->GetName() + "/"; + + this->RelOutputFileName = + this->RelBuildFilePath + this->Target->GetName() + ".a"; + + this->RelBuildFileName = this->RelBuildFilePath; + std::string BuildFileName; + BuildFileName = this->Target->GetName(); + BuildFileName += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + this->RelBuildFileName += BuildFileName; + + std::string absPathToRoot(this->Makefile->GetHomeOutputDirectory()); + if (!cmHasLiteralSuffix(absPathToRoot, "/")) + { + absPathToRoot += "/"; + } + this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath; + this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName; + this->AbsOutputFileName = absPathToRoot + this->RelOutputFileName; +} + +cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() +{ + cmDeleteAll(this->FolderBuildStreams); +} + +void cmGhsMultiTargetGenerator::Generate() +{ + const std::vector objectSources = this->GetSources(); + if (!objectSources.empty() && this->IncludeThisTarget()) + { + if (!cmSystemTools::FileExists(this->AbsBuildFilePath.c_str())) + { + cmSystemTools::MakeDirectory(this->AbsBuildFilePath.c_str()); + } + cmGlobalGhsMultiGenerator::Open(std::string(""), this->AbsBuildFileName, + &this->FolderBuildStreams); + cmGlobalGhsMultiGenerator::OpenBuildFileStream( + this->GetFolderBuildStreams()); + std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + if (0 == config.length()) + { + config = "RELEASE"; + } + const std::string language(this->Target->GetLinkerLanguage(config)); + config = cmSystemTools::UpperCase(config); + this->DynamicDownload = this->DetermineIfDynamicDownload(config, language); + if (this->DynamicDownload) + { + *this->GetFolderBuildStreams() << "#component integrity_dynamic_download" + << std::endl; + } + GhsMultiGpj::WriteGpjTag(this->GetGpjTag(), this->GetFolderBuildStreams()); + cmGlobalGhsMultiGenerator::WriteDisclaimer(this->GetFolderBuildStreams()); + + bool const notKernel = this->IsNotKernel(config, language); + this->WriteTypeSpecifics(config, notKernel); + this->WriteDebugOptions(config, notKernel); + this->WriteCompilerOptions(config, language); + this->WriteCompilerFlags(); + this->WriteCompilerDefinitions(config, language); + this->WriteIncludes(config, language); + this->WriteTargetLinkLibraries(); + this->WriteCustomCommands(); + if (this->DynamicDownload) + { + *this->GetFolderBuildStreams() << " " << this->DDOption << std::endl; + } + + this->WriteSources(objectSources); + } +} + +bool cmGhsMultiTargetGenerator::IncludeThisTarget() +{ + bool output = true; + char const *excludeFromAll = this->Target->GetProperty("EXCLUDE_FROM_ALL"); + if (NULL != excludeFromAll && '1' == excludeFromAll[0] && + '\0' == excludeFromAll[1]) + { + output = false; + } + return output; +} + +std::vector cmGhsMultiTargetGenerator::GetSources() const +{ + std::vector output; + std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + this->Target->GetSourceFiles(output, config); + return output; +} + +GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const +{ + GhsMultiGpj::Types output; + if (this->IsTargetGroup()) + { + output = GhsMultiGpj::INTERGRITY_APPLICATION; + } + else + { + output = GhsMultiGpj::PROGRAM; + } + return output; +} + +cmGlobalGhsMultiGenerator* +cmGhsMultiTargetGenerator::GetGlobalGenerator() const +{ + return static_cast( + this->LocalGenerator->GetGlobalGenerator()); +} + +void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string &config, + bool const notKernel) +{ + std::string outputDir(this->GetOutputDirectory(config)); + std::string outputFilename(this->GetOutputFilename(config)); + + if (this->Target->GetType() == cmTarget::STATIC_LIBRARY) + { + *this->GetFolderBuildStreams() << " -relobj" << std::endl; + *this->GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" + << outputDir << outputFilename << ".a\"" + << std::endl; + } + else if (this->Target->GetType() == cmTarget::EXECUTABLE) + { + if (notKernel && !this->IsTargetGroup()) + { + *this->GetFolderBuildStreams() << " -relprog" << std::endl; + } + if (this->IsTargetGroup()) + { + *this->GetFolderBuildStreams() << " -non_shared" << std::endl; + *this->GetFolderBuildStreams() << " -o \"" << outputDir + << outputFilename << ".elf\"" + << std::endl; + } + else + { + *this->GetFolderBuildStreams() << " {optgroup=GhsCommonOptions} -o \"" + << outputDir << outputFilename << ".as\"" + << std::endl; + } + } +} + +void cmGhsMultiTargetGenerator::WriteDebugOptions(std::string const &config, + bool const notKernel) +{ + if ("DEBUG" == config) + { + if (notKernel) + { + *this->GetFolderBuildStreams() << " -G" << std::endl; + *this->GetFolderBuildStreams() << " -Onone" << std::endl; + } + else + { + *this->GetFolderBuildStreams() << " -ldebug" << std::endl; + } + } + else if (notKernel) + { + *this->GetFolderBuildStreams() << " -O" << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteCompilerOptions( + std::string const &config, const std::string &language) +{ + std::vector options; + this->Target->GetCompileOptions(options, config, language); + bool hasStartfileDirProp = false; + std::string const startFilePropName("-startfile_dir="); + for (std::vector::const_iterator options_i = options.begin(); + options_i != options.end(); ++options_i) + { + std::string option = *options_i; + if (this->DDOption != option) + { + if (option.length() >= startFilePropName.length() && + startFilePropName == option.substr(0, startFilePropName.length())) + { + hasStartfileDirProp = true; + } + cmSystemTools::ConvertToUnixSlashes(option); + *this->GetFolderBuildStreams() << " " << option << std::endl; + } + } + + // If this property is relative, make it relative to the root lists file + if (!hasStartfileDirProp && this->GetGlobalGenerator()->IsOSDirRelative()) + { + *this->GetFolderBuildStreams() << " " << startFilePropName << "\"" + << this->Makefile->GetHomeOutputDirectory() + << "/$(__LIBS_DIR_BASE)/$(__BSP_NAME)\"" + << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteCompilerFlags() +{ + char const *const compileFlags = this->Target->GetProperty("COMPILE_FLAGS"); + if (NULL != compileFlags) + { + *this->GetFolderBuildStreams() << " " << compileFlags << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteCompilerDefinitions( + const std::string &config, const std::string &language) +{ + std::vector compileDefinitions; + this->Target->GetCompileDefinitions(compileDefinitions, config, language); + for (std::vector::const_iterator cdI = + compileDefinitions.begin(); + cdI != compileDefinitions.end(); ++cdI) + { + *this->GetFolderBuildStreams() << " -D" << (*cdI) << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config, + const std::string &language) +{ + std::vector includes = + this->Target->GetIncludeDirectories(config, language); + for (std::vector::const_iterator includes_i = includes.begin(); + includes_i != includes.end(); ++includes_i) + { + *this->GetFolderBuildStreams() << " -I\"" << *includes_i << "\"" + << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries() +{ + // library directories + cmTargetDependSet tds = + this->GetGlobalGenerator()->GetTargetDirectDepends(*this->Target); + for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end(); + ++tdsI) + { + cmTarget const *tg(*tdsI); + cmGhsMultiTargetGenerator gmtg(tg); + *this->GetFolderBuildStreams() << " -L\"" << gmtg.GetAbsBuildFilePath() + << "\"" << std::endl; + } + // library targets + cmTarget::LinkLibraryVectorType llv = + this->Target->GetOriginalLinkLibraries(); + for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin(); + llvI != llv.end(); ++llvI) + { + std::string libName = llvI->first; + // if it is a user defined target get the full path to the lib + cmTarget *tg(GetGlobalGenerator()->FindTarget(libName)); + if (NULL != tg) + { + cmGhsMultiTargetGenerator gmtg(tg); + libName = tg->GetName() + ".a"; + } + *this->GetFolderBuildStreams() << " -l\"" << libName << "\"" + << std::endl; + } +} + +void cmGhsMultiTargetGenerator::WriteCustomCommands() +{ + WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(), + cmTarget::PRE_BUILD); + WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(), + cmTarget::POST_BUILD); +} + +void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( + std::vector const &commandsSet, + cmTarget::CustomCommandType const commandType) +{ + for (std::vector::const_iterator commandsSetI = + commandsSet.begin(); + commandsSetI != commandsSet.end(); ++commandsSetI) + { + cmCustomCommandLines const &commands = commandsSetI->GetCommandLines(); + for (cmCustomCommandLines::const_iterator commandI = commands.begin(); + commandI != commands.end(); ++commandI) + { + switch (commandType) + { + case cmTarget::PRE_BUILD: + *this->GetFolderBuildStreams() << " :preexecShellSafe="; + break; + case cmTarget::POST_BUILD: + *this->GetFolderBuildStreams() << " :postexecShellSafe="; + break; + default: + assert("Only pre and post are supported"); + } + cmCustomCommandLine const &command = *commandI; + for (cmCustomCommandLine::const_iterator commandLineI = command.begin(); + commandLineI != command.end(); ++commandLineI) + { + if (!command.empty()) + { + *this->GetFolderBuildStreams() + << (command.begin() == commandLineI ? "'" : " "); + } + *this->GetFolderBuildStreams() << *commandLineI; + } + if (!command.empty()) + { + *this->GetFolderBuildStreams() << "'" << std::endl; + } + } + } +} + +void cmGhsMultiTargetGenerator::WriteSources( + std::vector const &objectSources) +{ + for (std::vector::const_iterator si = objectSources.begin(); + si != objectSources.end(); ++si) + { + std::vector sourceGroups(this->Makefile->GetSourceGroups()); + char const *sourceFullPath = (*si)->GetFullPath().c_str(); + cmSourceGroup *sourceGroup = + this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups); + std::string sgPath(sourceGroup->GetFullName()); + cmSystemTools::ConvertToUnixSlashes(sgPath); + cmGlobalGhsMultiGenerator::AddFilesUpToPath( + this->GetFolderBuildStreams(), &this->FolderBuildStreams, + this->Makefile->GetHomeOutputDirectory(), sgPath, + GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath); + + if ((*si)->GetExtension() == ".int") + { + *this->FolderBuildStreams[sgPath] << "\"" << (*si)->GetFullPath() << "\"" + << std::endl; + } + else + { + *this->FolderBuildStreams[sgPath] << (*si)->GetFullPath() << std::endl; + } + + if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() && + "bsp" != (*si)->GetExtension()) + { + this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si)); + + this->WriteObjectDir(this->FolderBuildStreams[sgPath], + this->AbsBuildFilePath + sgPath); + } + } +} + +void cmGhsMultiTargetGenerator::WriteObjectLangOverride( + cmGeneratedFileStream *fileStream, cmSourceFile *sourceFile) +{ + const char *rawLangProp = sourceFile->GetProperty("LANGUAGE"); + if (NULL != rawLangProp) + { + std::string sourceLangProp(rawLangProp); + std::string extension(sourceFile->GetExtension()); + if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) + { + *fileStream << " -dotciscxx" << std::endl; + } + } +} + +void cmGhsMultiTargetGenerator::WriteObjectDir( + cmGeneratedFileStream *fileStream, std::string const &dir) +{ + std::string workingDir(dir); + cmSystemTools::ConvertToUnixSlashes(workingDir); + if (!workingDir.empty()) + { + workingDir += "/"; + } + workingDir += "Objs"; + *fileStream << " -object_dir=\"" << workingDir << "\"" << std::endl; +} + +std::string +cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const +{ + std::string outputDir(AbsBuildFilePath); + + const char *runtimeOutputProp = + this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY"); + if (NULL != runtimeOutputProp) + { + outputDir = runtimeOutputProp; + } + + std::string configCapped(cmSystemTools::UpperCase(config)); + const char *runtimeOutputSProp = + this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped); + if (NULL != runtimeOutputSProp) + { + outputDir = runtimeOutputSProp; + } + cmSystemTools::ConvertToUnixSlashes(outputDir); + + if (!outputDir.empty()) + { + outputDir += "/"; + } + + return outputDir; +} + +std::string +cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const +{ + std::string outputFilename(this->Target->GetName()); + + const char *outputNameProp = this->Target->GetProperty("OUTPUT_NAME"); + if (NULL != outputNameProp) + { + outputFilename = outputNameProp; + } + + std::string configCapped(cmSystemTools::UpperCase(config)); + const char *outputNameSProp = + this->Target->GetProperty(configCapped + "_OUTPUT_NAME"); + if (NULL != outputNameSProp) + { + outputFilename = outputNameSProp; + } + + return outputFilename; +} + +bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config, + const std::string &language) +{ + bool output; + std::vector options; + this->Target->GetCompileOptions(options, config, language); + output = + options.end() == std::find(options.begin(), options.end(), "-kernel"); + return output; +} + +bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup() +{ + bool output = false; + std::vector sources = this->GetSources(); + for (std::vector::const_iterator sources_i = sources.begin(); + sources.end() != sources_i; ++sources_i) + { + if ("int" == (*sources_i)->GetExtension()) + { + output = true; + } + } + return output; +} + +bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload( + std::string const &config, const std::string &language) +{ + std::vector options; + bool output = false; + this->Target->GetCompileOptions(options, config, language); + for (std::vector::const_iterator options_i = options.begin(); + options_i != options.end(); ++options_i) + { + std::string option = *options_i; + if (this->DDOption == option) + { + output = true; + } + } + return output; +} diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h new file mode 100644 index 0000000..3eecc60 --- /dev/null +++ b/Source/cmGhsMultiTargetGenerator.h @@ -0,0 +1,105 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGhsMultiTargetGenerator_h +#define cmGhsMultiTargetGenerator_h + +#include "cmStandardIncludes.h" +#include "cmTarget.h" +#include "cmGhsMultiGpj.h" + +class cmGeneratedFileStream; +class cmGlobalGhsMultiGenerator; +class cmLocalGhsMultiGenerator; +class cmMakefile; +class cmSourceFile; +class cmGeneratedFileStream; +class cmCustomCommand; + +class cmGhsMultiTargetGenerator +{ +public: + cmGhsMultiTargetGenerator(cmTarget const *target); + + virtual ~cmGhsMultiTargetGenerator(); + + virtual void Generate(); + + bool IncludeThisTarget(); + std::vector GetSources() const; + GhsMultiGpj::Types GetGpjTag() const; + const char *GetAbsBuildFilePath() const + { + return this->AbsBuildFilePath.c_str(); + } + const char *GetRelBuildFileName() const + { + return this->RelBuildFileName.c_str(); + } + const char *GetAbsBuildFileName() const + { + return this->AbsBuildFileName.c_str(); + } + const char *GetAbsOutputFileName() const + { + return this->AbsOutputFileName.c_str(); + } + +private: + cmGlobalGhsMultiGenerator *GetGlobalGenerator() const; + cmGeneratedFileStream *GetFolderBuildStreams() + { + return this->FolderBuildStreams[""]; + }; + bool IsTargetGroup() const { return this->TargetGroup; } + + void WriteTypeSpecifics(const std::string &config, bool notKernel); + void WriteDebugOptions(std::string const &config, bool notKernel); + void WriteCompilerOptions(const std::string &config, + const std::string &language); + void WriteCompilerFlags(); + void WriteCompilerDefinitions(const std::string &config, + const std::string &language); + void WriteIncludes(const std::string &config, const std::string &language); + void WriteTargetLinkLibraries(); + void WriteCustomCommands(); + void + WriteCustomCommandsHelper(std::vector const &commandsSet, + cmTarget::CustomCommandType commandType); + void WriteSources(std::vector const &objectSources); + static void WriteObjectLangOverride(cmGeneratedFileStream *fileStream, + cmSourceFile *sourceFile); + static void WriteObjectDir(cmGeneratedFileStream *fileStream, + std::string const &dir); + std::string GetOutputDirectory(const std::string &config) const; + std::string GetOutputFilename(const std::string &config) const; + + bool IsNotKernel(std::string const &config, const std::string &language); + bool DetermineIfTargetGroup(); + bool DetermineIfDynamicDownload(std::string const &config, + const std::string &language); + + cmTarget const *Target; + cmLocalGhsMultiGenerator *LocalGenerator; + cmMakefile *Makefile; + std::string AbsBuildFilePath; + std::string RelBuildFilePath; + std::string AbsBuildFileName; + std::string RelBuildFileName; + std::string RelOutputFileName; + std::string AbsOutputFileName; + std::map FolderBuildStreams; + bool TargetGroup; + bool DynamicDownload; + static std::string const DDOption; +}; + +#endif // ! cmGhsMultiTargetGenerator_h diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx new file mode 100644 index 0000000..afd05ae --- /dev/null +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -0,0 +1,528 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalGhsMultiGenerator.h" +#include "cmLocalGhsMultiGenerator.h" +#include "cmMakefile.h" +#include "cmVersion.h" +#include "cmGeneratedFileStream.h" +#include "cmGhsMultiTargetGenerator.h" +#include +#include + +const char *cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; + +cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator() + : OSDirRelative(false) +{ + this->GhsBuildCommandInitialized = false; +} + +cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() +{ + cmDeleteAll(TargetFolderBuildStreams); +} + +cmLocalGenerator *cmGlobalGhsMultiGenerator::CreateLocalGenerator() +{ + cmLocalGenerator *lg = new cmLocalGhsMultiGenerator; + lg->SetGlobalGenerator(this); + this->SetCurrentLocalGenerator(lg); + return lg; +} + +void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry) +{ + entry.Name = GetActualName(); + entry.Brief = "Generates Green Hills MULTI files (experimental)."; +} + +void cmGlobalGhsMultiGenerator::EnableLanguage( + std::vector const &l, cmMakefile *mf, bool optional) +{ + mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); + mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM"); + + const std::string ghsCompRoot(GetCompRoot()); + mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str()); + std::string ghsCompRootStart = + 0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/"; + mf->AddDefinition("CMAKE_C_COMPILER", + std::string(ghsCompRootStart + "ccarm.exe").c_str()); + mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); + mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHSC"); + mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE"); + + mf->AddDefinition("CMAKE_CXX_COMPILER", + std::string(ghsCompRootStart + "cxarm.exe").c_str()); + mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE"); + mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHSCXX"); + mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); + + if (!ghsCompRoot.empty()) + { + static const char *compPreFix = "comp_"; + std::string compFilename = + cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix); + cmsys::SystemTools::ReplaceString(compFilename, compPreFix, ""); + mf->AddDefinition("CMAKE_SYSTEM_VERSION", compFilename.c_str()); + } + + mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files + this->cmGlobalGenerator::EnableLanguage(l, mf, optional); +} + +void cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile *mf) +{ + // The GHS generator knows how to lookup its build tool + // directly instead of needing a helper module to do it, so we + // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. + if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) + { + mf->AddDefinition("CMAKE_MAKE_PROGRAM", + this->GetGhsBuildCommand().c_str()); + } +} + +std::string const &cmGlobalGhsMultiGenerator::GetGhsBuildCommand() +{ + if (!this->GhsBuildCommandInitialized) + { + this->GhsBuildCommandInitialized = true; + this->GhsBuildCommand = this->FindGhsBuildCommand(); + } + return this->GhsBuildCommand; +} + +std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() +{ + std::string makeProgram = cmSystemTools::FindProgram("gbuild"); + if (makeProgram.empty()) + { + makeProgram = "gbuild"; + } + return makeProgram; +} + +std::string cmGlobalGhsMultiGenerator::GetCompRoot() +{ + std::string output; + + const std::vector + potentialDirsHardPaths(GetCompRootHardPaths()); + const std::vector potentialDirsRegistry(GetCompRootRegistry()); + + std::vector potentialDirsComplete; + potentialDirsComplete.insert(potentialDirsComplete.end(), + potentialDirsHardPaths.begin(), + potentialDirsHardPaths.end()); + potentialDirsComplete.insert(potentialDirsComplete.end(), + potentialDirsRegistry.begin(), + potentialDirsRegistry.end()); + + // Use latest version + std::string outputDirName; + for (std::vector::const_iterator potentialDirsCompleteIt = + potentialDirsComplete.begin(); + potentialDirsCompleteIt != potentialDirsComplete.end(); + ++potentialDirsCompleteIt) + { + const std::string dirName( + cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt)); + if (dirName.compare(outputDirName) > 0) + { + output = *potentialDirsCompleteIt; + outputDirName = dirName; + } + } + + return output; +} + +std::vector cmGlobalGhsMultiGenerator::GetCompRootHardPaths() +{ + std::vector output; + cmSystemTools::Glob("C:/ghs", "comp_[^;]+", output); + for (std::vector::iterator outputIt = output.begin(); + outputIt != output.end(); ++outputIt) + { + *outputIt = "C:/ghs/" + *outputIt; + } + return output; +} + +std::vector cmGlobalGhsMultiGenerator::GetCompRootRegistry() +{ + std::vector output(2); + cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" + "Windows\\CurrentVersion\\Uninstall\\" + "GreenHillsSoftwared771f1b4;InstallLocation", + output[0]); + cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_" + "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" + "Windows\\CurrentVersion\\Uninstall\\" + "GreenHillsSoftware9881cef6;InstallLocation", + output[1]); + return output; +} + +void cmGlobalGhsMultiGenerator::OpenBuildFileStream( + std::string const &filepath, cmGeneratedFileStream **filestream) +{ + // Get a stream where to generate things. + if (NULL == *filestream) + { + *filestream = new cmGeneratedFileStream(filepath.c_str()); + if (NULL != *filestream) + { + OpenBuildFileStream(*filestream); + } + } +} + +void cmGlobalGhsMultiGenerator::OpenBuildFileStream( + cmGeneratedFileStream *filestream) +{ + *filestream << "#!gbuild" << std::endl; +} + +void cmGlobalGhsMultiGenerator::OpenBuildFileStream() +{ + // Compute GHS MULTI's build file path. + std::string buildFilePath = + this->GetCMakeInstance()->GetHomeOutputDirectory(); + buildFilePath += "/"; + buildFilePath += "default"; + buildFilePath += FILE_EXTENSION; + + this->Open(std::string(""), buildFilePath, &this->TargetFolderBuildStreams); + OpenBuildFileStream(GetBuildFileStream()); + + char const *osDir = + this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR"); + if (NULL == osDir) + { + osDir = ""; + cmSystemTools::Error("GHS_OS_DIR cache variable must be set"); + } + else + { + this->GetCMakeInstance()->MarkCliAsUsed("GHS_OS_DIR"); + } + std::string fOSDir(this->trimQuotes(osDir)); + cmSystemTools::ReplaceString(fOSDir, "\\", "/"); + if (!fOSDir.empty() && ('c' == fOSDir[0] || 'C' == fOSDir[0])) + { + this->OSDirRelative = false; + } + else + { + this->OSDirRelative = true; + } + + char const *bspName = + this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); + if (NULL == bspName) + { + bspName = ""; + cmSystemTools::Error("GHS_BSP_NAME cache variable must be set"); + } + else + { + this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); + } + std::string fBspName(this->trimQuotes(bspName)); + cmSystemTools::ReplaceString(fBspName, "\\", "/"); + this->WriteMacros(); + this->WriteHighLevelDirectives(); + + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); + this->WriteDisclaimer(this->GetBuildFileStream()); + *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; + if (!fBspName.empty()) + { + *this->GetBuildFileStream() << " -bsp " << fBspName << std::endl; + } + this->WriteCompilerOptions(fOSDir); +} + +void cmGlobalGhsMultiGenerator::CloseBuildFileStream( + cmGeneratedFileStream **filestream) +{ + if (filestream) + { + delete *filestream; + *filestream = NULL; + } + else + { + cmSystemTools::Error("Build file stream was not open."); + } +} + +void cmGlobalGhsMultiGenerator::Generate() +{ + this->cmGlobalGenerator::Generate(); + + if (!this->LocalGenerators.empty()) + { + this->OpenBuildFileStream(); + + // Build all the folder build files + for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) + { + cmLocalGhsMultiGenerator *lg = + static_cast(this->LocalGenerators[i]); + cmGeneratorTargetsType tgts = lg->GetMakefile()->GetGeneratorTargets(); + this->UpdateBuildFiles(tgts); + } + } + + cmDeleteAll(TargetFolderBuildStreams); + this->TargetFolderBuildStreams.clear(); +} + +void cmGlobalGhsMultiGenerator::GenerateBuildCommand( + std::vector &makeCommand, const std::string &makeProgram, + const std::string & /*projectName*/, const std::string & /*projectDir*/, + const std::string &targetName, const std::string & /*config*/, + bool /*fast*/, bool /*verbose*/, + std::vector const &makeOptions) +{ + makeCommand.push_back( + this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand()) + ); + + makeCommand.insert(makeCommand.end(), + makeOptions.begin(), makeOptions.end()); + if (!targetName.empty()) + { + if (targetName == "clean") + { + makeCommand.push_back("-clean"); + } + else + { + makeCommand.push_back(targetName); + } + } +} + +void cmGlobalGhsMultiGenerator::WriteMacros() +{ + char const *ghsGpjMacros = + this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS"); + if (NULL != ghsGpjMacros) + { + std::vector expandedList; + cmSystemTools::ExpandListArgument(std::string(ghsGpjMacros), expandedList); + for (std::vector::const_iterator expandedListI = + expandedList.begin(); + expandedListI != expandedList.end(); ++expandedListI) + { + *this->GetBuildFileStream() << "macro " << *expandedListI << std::endl; + } + } +} + +void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() +{ + *this->GetBuildFileStream() << "primaryTarget=arm_integrity.tgt" + << std::endl; + char const *const customization = + this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); + if (NULL != customization && strlen(customization) > 0) + { + *this->GetBuildFileStream() << "customization=" + << trimQuotes(customization) + << std::endl; + this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION"); + } +} + +void cmGlobalGhsMultiGenerator::WriteCompilerOptions(std::string const &fOSDir) +{ + *this->GetBuildFileStream() << " -os_dir=\"" << fOSDir << "\"" + << std::endl; + *this->GetBuildFileStream() << " --link_once_templates" << std::endl; +} + +void cmGlobalGhsMultiGenerator::WriteDisclaimer(std::ostream *os) +{ + (*os) << "#" << std::endl + << "# CMAKE generated file: DO NOT EDIT!" << std::endl + << "# Generated by \"" << GetActualName() << "\"" + << " Generator, CMake Version " << cmVersion::GetMajorVersion() << "." + << cmVersion::GetMinorVersion() << std::endl + << "#" << std::endl; +} + +void cmGlobalGhsMultiGenerator::AddFilesUpToPath( + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &path, + GhsMultiGpj::Types projType, std::string const &relPath) +{ + std::string workingPath(path); + cmSystemTools::ConvertToUnixSlashes(workingPath); + std::vector splitPath = + cmSystemTools::SplitString(workingPath); + std::string workingRelPath(relPath); + cmSystemTools::ConvertToUnixSlashes(workingRelPath); + if (!workingRelPath.empty()) + { + workingRelPath += "/"; + } + std::string pathUpTo; + for (std::vector::const_iterator splitPathI = + splitPath.begin(); + splitPath.end() != splitPathI; ++splitPathI) + { + pathUpTo += *splitPathI; + if (targetFolderBuildStreams->end() == + targetFolderBuildStreams->find(pathUpTo)) + { + AddFilesUpToPathNewBuildFile( + mainBuildFile, targetFolderBuildStreams, homeOutputDirectory, + pathUpTo, splitPath.begin() == splitPathI, workingRelPath, projType); + } + AddFilesUpToPathAppendNextFile(targetFolderBuildStreams, pathUpTo, + splitPathI, splitPath.end(), projType); + pathUpTo += "/"; + } +} + +void cmGlobalGhsMultiGenerator::Open( + std::string const &mapKeyName, std::string const &fileName, + std::map *fileMap) +{ + if (fileMap->end() == fileMap->find(fileName)) + { + cmGeneratedFileStream *temp(new cmGeneratedFileStream); + temp->open(fileName.c_str()); + (*fileMap)[mapKeyName] = temp; + } +} + +void cmGlobalGhsMultiGenerator::AddFilesUpToPathNewBuildFile( + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &pathUpTo, + bool const isFirst, std::string const &relPath, + GhsMultiGpj::Types const projType) +{ + // create folders up to file path + std::string absPath = std::string(homeOutputDirectory) + "/" + relPath; + std::string newPath = absPath + pathUpTo; + if (!cmSystemTools::FileExists(newPath.c_str())) + { + cmSystemTools::MakeDirectory(newPath.c_str()); + } + + // Write out to filename for first time + std::string relFilename(GetFileNameFromPath(pathUpTo)); + std::string absFilename = absPath + relFilename; + Open(pathUpTo, absFilename, targetFolderBuildStreams); + OpenBuildFileStream((*targetFolderBuildStreams)[pathUpTo]); + GhsMultiGpj::WriteGpjTag(projType, (*targetFolderBuildStreams)[pathUpTo]); + WriteDisclaimer((*targetFolderBuildStreams)[pathUpTo]); + + // Add to main build file + if (isFirst) + { + *mainBuildFile << relFilename << " "; + GhsMultiGpj::WriteGpjTag(projType, mainBuildFile); + } +} + +void cmGlobalGhsMultiGenerator::AddFilesUpToPathAppendNextFile( + std::map *targetFolderBuildStreams, + std::string const &pathUpTo, + std::vector::const_iterator splitPathI, + std::vector::const_iterator end, + GhsMultiGpj::Types const projType) +{ + std::vector::const_iterator splitPathNextI = splitPathI + 1; + if (end != splitPathNextI && + targetFolderBuildStreams->end() == + targetFolderBuildStreams->find(pathUpTo + "/" + *splitPathNextI)) + { + std::string nextFilename(*splitPathNextI); + nextFilename = GetFileNameFromPath(nextFilename); + *(*targetFolderBuildStreams)[pathUpTo] << nextFilename << " "; + GhsMultiGpj::WriteGpjTag(projType, (*targetFolderBuildStreams)[pathUpTo]); + } +} + +std::string +cmGlobalGhsMultiGenerator::GetFileNameFromPath(std::string const &path) +{ + std::string output(path); + if (!path.empty()) + { + cmSystemTools::ConvertToUnixSlashes(output); + std::vector splitPath = cmSystemTools::SplitString(output); + output += "/" + splitPath.back() + FILE_EXTENSION; + } + return output; +} + +void cmGlobalGhsMultiGenerator::UpdateBuildFiles( + cmGeneratorTargetsType const &tgts) +{ + for (cmGeneratorTargetsType::const_iterator tgtsI = tgts.begin(); + tgtsI != tgts.end(); ++tgtsI) + { + cmGhsMultiTargetGenerator gmtg(tgtsI->first); + if (!gmtg.GetSources().empty() && gmtg.IncludeThisTarget()) + { + char const *rawFolderName = tgtsI->first->GetProperty("FOLDER"); + if (NULL == rawFolderName) + { + rawFolderName = ""; + } + std::string folderName(rawFolderName); + if (this->TargetFolderBuildStreams.end() == + this->TargetFolderBuildStreams.find(folderName)) + { + this->AddFilesUpToPath( + GetBuildFileStream(), &this->TargetFolderBuildStreams, + this->GetCMakeInstance()->GetHomeOutputDirectory(), folderName, + GhsMultiGpj::PROJECT); + } + std::vector splitPath = + cmSystemTools::SplitString(gmtg.GetRelBuildFileName()); + std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" + + splitPath.back()); + *this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile + << " "; + GhsMultiGpj::WriteGpjTag(gmtg.GetGpjTag(), + this->TargetFolderBuildStreams[folderName]); + } + } +} + +std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const &str) +{ + std::string result; + result.reserve(str.size()); + for (const char *ch = str.c_str(); *ch != '\0'; ++ch) + { + if (*ch != '"') + { + result += *ch; + } + } + return result; +} diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h new file mode 100644 index 0000000..d5948da --- /dev/null +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -0,0 +1,125 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGhsMultiGenerator_h +#define cmGhsMultiGenerator_h + +#include "cmGlobalGeneratorFactory.h" +#include "cmGlobalGenerator.h" +#include "cmGhsMultiGpj.h" + +class cmGeneratedFileStream; + +class cmGlobalGhsMultiGenerator : public cmGlobalGenerator +{ +public: + /// The default name of GHS MULTI's build file. Typically: monolith.gpj. + static const char *FILE_EXTENSION; + + cmGlobalGhsMultiGenerator(); + ~cmGlobalGhsMultiGenerator(); + + static cmGlobalGeneratorFactory *NewFactory() + { return new cmGlobalGeneratorSimpleFactory(); } + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /// @return the name of this generator. + static std::string GetActualName() { return "Green Hills MULTI"; } + ///! Get the name for this generator + virtual std::string GetName() const { return this->GetActualName(); } + + /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() + static void GetDocumentation(cmDocumentationEntry &entry); + + /** + * Try to determine system information such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector const &languages, + cmMakefile *, bool optional); + /* + * Determine what program to use for building the project. + */ + virtual void FindMakeProgram(cmMakefile *); + + cmGeneratedFileStream *GetBuildFileStream() + { + return this->TargetFolderBuildStreams[""]; + } + + static void OpenBuildFileStream(std::string const &filepath, + cmGeneratedFileStream **filestream); + static void OpenBuildFileStream(cmGeneratedFileStream *filestream); + static void CloseBuildFileStream(cmGeneratedFileStream **filestream); + /// Write the common disclaimer text at the top of each build file. + static void WriteDisclaimer(std::ostream *os); + std::vector GetLibDirs() { return this->LibDirs; } + + static void AddFilesUpToPath( + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &path, + GhsMultiGpj::Types projType, std::string const &relPath = ""); + static void Open(std::string const &mapKeyName, std::string const &fileName, + std::map *fileMap); + + static std::string trimQuotes(std::string const &str); + inline bool IsOSDirRelative() { return this->OSDirRelative; } + +protected: + virtual void Generate(); + virtual void GenerateBuildCommand( + std::vector &makeCommand, const std::string &makeProgram, + const std::string &projectName, const std::string &projectDir, + const std::string &targetName, const std::string &config, bool fast, + bool verbose, + std::vector const& makeOptions = std::vector() + ); + +private: + std::string const &GetGhsBuildCommand(); + std::string FindGhsBuildCommand(); + std::string GetCompRoot(); + std::vector GetCompRootHardPaths(); + std::vector GetCompRootRegistry(); + void OpenBuildFileStream(); + + void WriteMacros(); + void WriteHighLevelDirectives(); + void WriteCompilerOptions(std::string const &fOSDir); + + static void AddFilesUpToPathNewBuildFile( + cmGeneratedFileStream *mainBuildFile, + std::map *targetFolderBuildStreams, + char const *homeOutputDirectory, std::string const &pathUpTo, + bool isFirst, std::string const &relPath, GhsMultiGpj::Types projType); + static void AddFilesUpToPathAppendNextFile( + std::map *targetFolderBuildStreams, + std::string const &pathUpTo, + std::vector::const_iterator splitPathI, + std::vector::const_iterator end, + GhsMultiGpj::Types projType); + static std::string GetFileNameFromPath(std::string const &path); + void UpdateBuildFiles(cmGeneratorTargetsType const &tgts); + + std::vector TargetSubProjects; + std::map TargetFolderBuildStreams; + + std::vector LibDirs; + + bool OSDirRelative; + bool GhsBuildCommandInitialized; + std::string GhsBuildCommand; +}; + +#endif diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index f74f1e0..2ade825 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -576,6 +576,7 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false; // Implemented by: // cmGlobalUnixMakefileGenerator3 +// cmGlobalGhsMultiGenerator // cmGlobalVisualStudio10Generator // cmGlobalVisualStudio6Generator // cmGlobalVisualStudio7Generator diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx new file mode 100644 index 0000000..8773715 --- /dev/null +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -0,0 +1,53 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmLocalGhsMultiGenerator.h" +#include "cmGlobalGhsMultiGenerator.h" +#include "cmGeneratorTarget.h" +#include "cmMakefile.h" +#include "cmGhsMultiTargetGenerator.h" +#include "cmGeneratedFileStream.h" + +cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator() {} + +cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() {} + +void cmLocalGhsMultiGenerator::Generate() +{ + cmGeneratorTargetsType tgts = this->GetMakefile()->GetGeneratorTargets(); + if (!tgts.empty()) + { + for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); + ++l) + { + cmGhsMultiTargetGenerator tg(l->second->Target); + tg.Generate(); + } + } +} + +// Implemented in: +// cmLocalGenerator. +// Used in: +// Source/cmMakefile.cxx +// Source/cmGlobalGenerator.cxx +void cmLocalGhsMultiGenerator::Configure() +{ + // Compute the path to use when referencing the current output + // directory from the top output directory. + this->HomeRelativeOutputPath = + this->Convert(this->Makefile->GetStartOutputDirectory(), HOME_OUTPUT); + if (this->HomeRelativeOutputPath == ".") + { + this->HomeRelativeOutputPath = ""; + } + this->cmLocalGenerator::Configure(); +} diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h new file mode 100644 index 0000000..a8df3e7 --- /dev/null +++ b/Source/cmLocalGhsMultiGenerator.h @@ -0,0 +1,56 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Geoffrey Viola + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmLocalGhsMultiGenerator_h +#define cmLocalGhsMultiGenerator_h + +#include "cmLocalGenerator.h" + +class cmGeneratedFileStream; + +/** \class cmLocalGhsMultiGenerator + * \brief Write Green Hills MULTI project files. + * + * cmLocalGhsMultiGenerator produces a set of .gpj + * file for each target in its mirrored directory. + */ +class cmLocalGhsMultiGenerator : public cmLocalGenerator +{ +public: + cmLocalGhsMultiGenerator(); + + virtual ~cmLocalGhsMultiGenerator(); + + /// @returns the relative path between the HomeOutputDirectory and this + /// local generators StartOutputDirectory. + std::string GetHomeRelativeOutputPath() const + { + return this->HomeRelativeOutputPath; + } + + /** + * Generate the makefile for this directory. + */ + virtual void Generate(); + + /// Overloaded methods. @see cmLocalGenerator::Configure() + virtual void Configure(); + const char *GetBuildFileName() { return this->BuildFileName.c_str(); } + +protected: + virtual bool CustomCommandUseLocal() const { return true; } + +private: + std::string BuildFileName; + std::string HomeRelativeOutputPath; +}; + +#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 51df7f2..631397b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -63,6 +63,7 @@ # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" +# include "cmGlobalGhsMultiGenerator.h" # define CMAKE_HAVE_VS_GENERATORS # endif # include "cmGlobalMSYSMakefileGenerator.h" @@ -1841,6 +1842,8 @@ void cmake::AddDefaultGenerators() cmGlobalNMakeMakefileGenerator::NewFactory()); this->Generators.push_back( cmGlobalJOMMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalGhsMultiGenerator::NewFactory()); # endif this->Generators.push_back( cmGlobalMSYSMakefileGenerator::NewFactory()); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 49fd02b..87727c7 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1938,6 +1938,23 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if (CMake_TEST_GreenHillsMULTI) + macro(add_test_GhsMulti name primaryTarget bspName) + add_test(NAME GhsMulti.${name} COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/GhsMulti" + "${CMake_BINARY_DIR}/Tests/GhsMulti/${name}" + --build-generator "Green Hills MULTI" + --build-project ReturnNum + --build-config $ + --build-options -DGHS_PRIMARY_TARGET=${primaryTarget} + -DGHS_BSP_NAME=${bspName} + ) + endmacro () + add_test_GhsMulti("arm_integrity_simarm" "arm_integrity.tgt" "simarm") + add_test_GhsMulti("arm64_integrity_simarm" "arm64_integrity.tgt" "simarm") + endif () + if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") macro(add_test_VSNsightTegra name generator) add_test(NAME VSNsightTegra.${name} COMMAND ${CMAKE_CTEST_COMMAND} diff --git a/Tests/GhsMulti/CMakeLists.txt b/Tests/GhsMulti/CMakeLists.txt new file mode 100644 index 0000000..6e15ba9 --- /dev/null +++ b/Tests/GhsMulti/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(ReturnNum) + +add_subdirectory(ReturnNum) diff --git a/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt new file mode 100644 index 0000000..2adbd4e --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/App/CMakeLists.txt @@ -0,0 +1,4 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Lib) +add_executable(App Main.c) +target_link_libraries(App Lib) +target_compile_options(App PUBLIC "-non_shared") diff --git a/Tests/GhsMulti/ReturnNum/App/Main.c b/Tests/GhsMulti/ReturnNum/App/Main.c new file mode 100644 index 0000000..1133834 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/App/Main.c @@ -0,0 +1,8 @@ +#include "HelperFun.h" + +int main(int argc, const char* argv[]) +{ + int out; + out = giveNum(); + return out; +} diff --git a/Tests/GhsMulti/ReturnNum/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/CMakeLists.txt new file mode 100644 index 0000000..7bcc5f9 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(App) +add_subdirectory(Int) +add_subdirectory(Lib) diff --git a/Tests/GhsMulti/ReturnNum/Int/AppDD.int b/Tests/GhsMulti/ReturnNum/Int/AppDD.int new file mode 100644 index 0000000..9e22b5e --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Int/AppDD.int @@ -0,0 +1,12 @@ +# Input File for the Integrate utility for use with the INTEGRITY real-time +# operating system by Green Hills Software. +# Before editing this file, refer to the Integrate Reference Manual. + +Kernel + Filename DynamicDownload +EndKernel + +AddressSpace App + Filename "App/App.as" + Language C +EndAddressSpace diff --git a/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt new file mode 100644 index 0000000..44c5de1 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Int/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(AppDD AppDD.int Default.bsp) diff --git a/Tests/GhsMulti/ReturnNum/Int/Default.bsp b/Tests/GhsMulti/ReturnNum/Int/Default.bsp new file mode 100644 index 0000000..224ec29 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Int/Default.bsp @@ -0,0 +1,35 @@ +# Target description File for the Integrate utility for use with the +# INTEGRITY real-time operating system by Green Hills Software. +# Before editing this file, refer to your Integrate documentation. +# default.bsp is appropriate for INTEGRITY applications which are +# fully linked with the kernel (for RAM or ROM) or dynamically downloaded. +# +# MinimumAddress must match the value of .ramend in the linker directives +# file used for the KernelSpace program - see default.ld for more info. +# The MaximumAddress used here allows memory mappings to be specified +# for up to the 16 MB mark in RAM. Intex will not permit programs +# that require more memory for its mappings. If the board has less +# memory, this number can be reduced by the user. + +Target + MinimumAddress .ramend + MaximumAddress .ramlimit + Clock StandardTick + EndClock + Clock HighResTimer + EndClock + IODevice "SerialDev0" + InitialKernelObjects 200 + DefaultStartIt false + DefaultMaxPriority 255 + DefaultPriority 127 + DefaultWeight 1 + DefaultMaxWeight 255 + DefaultHeapSize 0x10000 + LastVirtualAddress 0x3fffffff + PageSize 0x1000 + ArchitectedPageSize 0x1000 + ArchitectedPageSize 0x10000 + ArchitectedPageSize 0x100000 + DefaultMemoryRegionSize 0x20000 +EndTarget diff --git a/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt b/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt new file mode 100644 index 0000000..9c822da --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Lib/CMakeLists.txt @@ -0,0 +1 @@ +add_library(Lib HelperFun.c HelperFun.h) \ No newline at end of file diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c new file mode 100644 index 0000000..d7515d7 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.c @@ -0,0 +1,4 @@ +int giveNum(void) +{ + return 1; +} diff --git a/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h new file mode 100644 index 0000000..00971b0 --- /dev/null +++ b/Tests/GhsMulti/ReturnNum/Lib/HelperFun.h @@ -0,0 +1 @@ +int giveNum(void); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From bill.hoffman at kitware.com Wed Mar 25 12:39:51 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Wed, 25 Mar 2015 12:39:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1226-g8e5b1aa Message-ID: <20150325163951.B40A4ABE69@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8e5b1aa579c1ec68fd428ef29eecd9723812c3ed (commit) via a4a1b729c63ec81037af06ac1009d12cc1dc3188 (commit) from 3aefbb3c78f90c552e4e3c2039302aca3437e959 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e5b1aa579c1ec68fd428ef29eecd9723812c3ed commit 8e5b1aa579c1ec68fd428ef29eecd9723812c3ed Merge: 3aefbb3 a4a1b72 Author: Bill Hoffman AuthorDate: Wed Mar 25 12:39:48 2015 -0400 Commit: CMake Topic Stage CommitDate: Wed Mar 25 12:39:48 2015 -0400 Merge topic 'clean-scanbuild-warnings' into next a4a1b729 Fix warnings from clang scanbuild. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a4a1b729c63ec81037af06ac1009d12cc1dc3188 commit a4a1b729c63ec81037af06ac1009d12cc1dc3188 Author: Bill Hoffman AuthorDate: Wed Mar 25 12:38:37 2015 -0400 Commit: Bill Hoffman CommitDate: Wed Mar 25 12:38:37 2015 -0400 Fix warnings from clang scanbuild. diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 0a64bd5..87764e1 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -507,6 +507,11 @@ int cmCPackDebGenerator::createDeb() //int retVal = -1; res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &retval, toplevel.c_str(), this->GeneratorVerbose, 0); + if ( !res || retval ) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running cmake -E md5sum " + << cmd << std::endl); + } // debian md5sums entries are like this: // 014f3604694729f3bf19263bac599765 usr/bin/ccmake // thus strip the full path (with the trailing slash) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 0026fd7..df61fe6 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1343,16 +1343,21 @@ int cmCTest::RunTest(std::vector argv, } *retVal = inst.Run(args, output); - *output += oss.str(); - if ( log ) + if(output) + { + *output += oss.str(); + } + if ( log && output) { *log << *output; } cmSystemTools::ChangeDirectory(oldpath); - - cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, - "Internal cmCTest object used to run test." << std::endl - << *output << std::endl); + if(output) + { + cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, + "Internal cmCTest object used to run test." << std::endl + << *output << std::endl); + } return cmsysProcess_State_Exited; } @@ -1422,7 +1427,10 @@ int cmCTest::RunTest(std::vector argv, *retVal = cmsysProcess_GetExitException(cp); std::string outerr = "\n*** Exception executing: "; outerr += cmsysProcess_GetExceptionString(cp); - *output += outerr; + if(output) + { + *output += outerr; + } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl << std::flush); } @@ -1430,7 +1438,10 @@ int cmCTest::RunTest(std::vector argv, { std::string outerr = "\n*** ERROR executing: "; outerr += cmsysProcess_GetErrorString(cp); - *output += outerr; + if(output) + { + *output += outerr; + } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, outerr.c_str() << std::endl << std::flush); } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index ae9099e..93e3ac4 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3422,6 +3422,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) // enable HTTP ERROR parsing ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); + check_curl_result(res, "UPLOAD cannot set fail on error flag: "); // enable uploading res = ::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 87f9037..4d7fd60 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -679,7 +679,6 @@ bool cmFindPackageCommand::HandlePackageMode() if(cmSystemTools::IsOff(def) || !fileFound) { fileFound = this->FindConfig(); - def = this->Makefile->GetDefinition(this->Variable); } // Sanity check. @@ -1598,7 +1597,6 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file) if ((haveResult == false) && (this->Version.empty())) { result = true; - haveResult = true; } ConfigFileInfo configFileInfo; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index eeb9c72..7f355a6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2208,7 +2208,7 @@ void cmMakefile::AddSourceGroup(const std::vector& name, if(i==lastElement) { // group already exists, replace its regular expression - if ( regex ) + if ( regex && sg) { // We only want to set the regular expression. If there are already // source files in the group, we don't want to remove them. @@ -2224,7 +2224,11 @@ void cmMakefile::AddSourceGroup(const std::vector& name, sg = this->GetSourceGroup(currentName); i = 0; // last component found } - + if(!sg) + { + cmSystemTools::Error("Could not create source group "); + return; + } // build the whole source group path const char* fullname = sg->GetFullName(); cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index e41a0ca..06217bb 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -25,14 +25,12 @@ bool cmSetTargetPropertiesCommand // first collect up the list of files std::vector propertyPairs; - bool doingFiles = true; int numFiles = 0; std::vector::const_iterator j; for(j= args.begin(); j != args.end();++j) { if(*j == "PROPERTIES") { - doingFiles = false; // now loop through the rest of the arguments, new style ++j; if (std::distance(j, args.end()) % 2 != 0) @@ -43,15 +41,9 @@ bool cmSetTargetPropertiesCommand propertyPairs.insert(propertyPairs.end(), j, args.end()); break; } - else if (doingFiles) - { - numFiles++; - } else { - this->SetError("called with illegal arguments, maybe missing " - "a PROPERTIES specifier?"); - return false; + numFiles++; } } if(propertyPairs.empty()) ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackDebGenerator.cxx | 5 +++++ Source/cmCTest.cxx | 27 +++++++++++++++++++-------- Source/cmFileCommand.cxx | 1 + Source/cmFindPackageCommand.cxx | 2 -- Source/cmMakefile.cxx | 8 ++++++-- Source/cmSetTargetPropertiesCommand.cxx | 10 +--------- 6 files changed, 32 insertions(+), 21 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 26 00:01:06 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 26 Mar 2015 00:01:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-510-g5d1d995 Message-ID: <20150326040107.26366AD49F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 5d1d995bb7a982b13d691f7a926e497f4c44d6f1 (commit) from 166e29e453e6a48e191b02835b08cf5bd3d0f988 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5d1d995bb7a982b13d691f7a926e497f4c44d6f1 commit 5d1d995bb7a982b13d691f7a926e497f4c44d6f1 Author: Kitware Robot AuthorDate: Thu Mar 26 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Thu Mar 26 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8f0e54c..baf3b2b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150325) +set(CMake_VERSION_PATCH 20150326) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From clinton at elemtech.com Thu Mar 26 00:55:52 2015 From: clinton at elemtech.com (Clinton Stimpson) Date: Thu, 26 Mar 2015 00:55:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1228-g93b7164 Message-ID: <20150326045552.CA338AD40A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 93b7164a34f40d60dbfd625d0aa90b55304ed34f (commit) via 36f7cbca985894fb03e4a395a110869cf67378a5 (commit) from 8e5b1aa579c1ec68fd428ef29eecd9723812c3ed (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93b7164a34f40d60dbfd625d0aa90b55304ed34f commit 93b7164a34f40d60dbfd625d0aa90b55304ed34f Merge: 8e5b1aa 36f7cbc Author: Clinton Stimpson AuthorDate: Thu Mar 26 00:55:51 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 26 00:55:51 2015 -0400 Merge topic 'cpack-archive-prefix' into next 36f7cbca cpack: Fix handling of CPACK_PACKAGING_INSTALL_PREFIX for archives. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36f7cbca985894fb03e4a395a110869cf67378a5 commit 36f7cbca985894fb03e4a395a110869cf67378a5 Author: Clinton Stimpson AuthorDate: Wed Mar 25 22:36:38 2015 -0600 Commit: Clinton Stimpson CommitDate: Wed Mar 25 22:48:47 2015 -0600 cpack: Fix handling of CPACK_PACKAGING_INSTALL_PREFIX for archives. Fixes bug #14677 where the archive generator is used to package components with an install prefix. diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index e2437b5..373170b 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -63,6 +63,13 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME"); filePrefix += "/"; } + const char* installPrefix = this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); + if(installPrefix && installPrefix[0] == '/') + { + // add to file prefix and remove the leading '/' + filePrefix += installPrefix+1; + filePrefix += "/"; + } std::vector::const_iterator fileIt; for (fileIt = component->Files.begin(); fileIt != component->Files.end(); ++fileIt ) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 41032f8..7135f5d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -862,6 +862,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK}) set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) + set(CTEST_RUN_CPackComponentsPrefix ${CTEST_TEST_CPACK}) # Do not try to build RPM if (NOT RPMBUILD_EXECUTABLE) @@ -1035,6 +1036,32 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators") endif() + if(CTEST_RUN_CPackComponentsPrefix) + set(CPackComponents_BUILD_OPTIONS) + if(APPLE) + set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) + endif() + if(NSIS_MAKENSIS_EXECUTABLE) + set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} + -DCPACK_BINARY_NSIS:BOOL=ON) + endif() + + add_test(CPackComponentsPrefix ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackComponentsPrefix" + "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix" + ${build_generator_args} + --build-project CPackComponentsPrefix + --build-two-config + --build-target package + --build-options ${build_options} + -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB} + -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM} + ${CPackComponents_BUILD_OPTIONS} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix") + endif() + if(CTEST_package_X11_TEST) set(X11_build_target_arg --build-target package) else() diff --git a/Tests/CPackComponentsPrefix/CMakeLists.txt b/Tests/CPackComponentsPrefix/CMakeLists.txt new file mode 100644 index 0000000..207dae8 --- /dev/null +++ b/Tests/CPackComponentsPrefix/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.2) +project(CPackComponentsPrefix NONE) + +install(FILES file-runtime.txt + DESTINATION bin COMPONENT Runtime) +install(FILES file-development.txt + DESTINATION lib COMPONENT Development) + +set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 1) +set(CPACK_COMPONENTS_ALL Development) +set(CPACK_ARCHIVE_COMPONENT_INSTALL 1) +set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/My-1.0") +include(CPack) diff --git a/Tests/CPackComponentsPrefix/file-development.txt b/Tests/CPackComponentsPrefix/file-development.txt new file mode 100644 index 0000000..df22d2f --- /dev/null +++ b/Tests/CPackComponentsPrefix/file-development.txt @@ -0,0 +1 @@ +This file is installed with the Development component. diff --git a/Tests/CPackComponentsPrefix/file-runtime.txt b/Tests/CPackComponentsPrefix/file-runtime.txt new file mode 100644 index 0000000..135c13d --- /dev/null +++ b/Tests/CPackComponentsPrefix/file-runtime.txt @@ -0,0 +1 @@ +This file is installed with the Runtime component. ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackArchiveGenerator.cxx | 7 ++++++ Tests/CMakeLists.txt | 27 ++++++++++++++++++++++ Tests/CPackComponentsPrefix/CMakeLists.txt | 13 +++++++++++ Tests/CPackComponentsPrefix/file-development.txt | 1 + Tests/CPackComponentsPrefix/file-runtime.txt | 1 + 5 files changed, 49 insertions(+) create mode 100644 Tests/CPackComponentsPrefix/CMakeLists.txt create mode 100644 Tests/CPackComponentsPrefix/file-development.txt create mode 100644 Tests/CPackComponentsPrefix/file-runtime.txt hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 26 09:02:26 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 26 Mar 2015 09:02:26 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1230-g6450c75 Message-ID: <20150326130226.8474CAD8F1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6450c758c809b4f597af8cac9d9c8f052931953a (commit) via dcf298008f60fa00ddcb225b7a474317ad4d317f (commit) from 93b7164a34f40d60dbfd625d0aa90b55304ed34f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6450c758c809b4f597af8cac9d9c8f052931953a commit 6450c758c809b4f597af8cac9d9c8f052931953a Merge: 93b7164 dcf2980 Author: Brad King AuthorDate: Thu Mar 26 09:02:25 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 26 09:02:25 2015 -0400 Merge topic 'FindMFC-CMP0054' into next dcf29800 FindMFC: Use if(DEFINED) to simplify condition (#15477) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dcf298008f60fa00ddcb225b7a474317ad4d317f commit dcf298008f60fa00ddcb225b7a474317ad4d317f Author: Brad King AuthorDate: Thu Mar 26 09:00:32 2015 -0400 Commit: Brad King CommitDate: Thu Mar 26 09:02:05 2015 -0400 FindMFC: Use if(DEFINED) to simplify condition (#15477) Replace an old hack of the form 'if("${VAR}" MATCHES "^${VAR}$")' with the much simpler 'if(NOT DEFINED ${VAR})'. This was exposed by a CMP0054 warning. diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake index 261ebdb..3547628 100644 --- a/Modules/FindMFC.cmake +++ b/Modules/FindMFC.cmake @@ -36,7 +36,7 @@ if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW) endif() if(MFC_ATTEMPT_TRY_COMPILE) - if("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$") + if(NOT DEFINED MFC_HAVE_MFC) set(CHECK_INCLUDE_FILE_VAR "afxwin.h") configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx) ----------------------------------------------------------------------- Summary of changes: Modules/FindMFC.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 26 09:34:09 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 26 Mar 2015 09:34:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1232-gc8631b5 Message-ID: <20150326133409.AD6E0AD61D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via c8631b528e702c5dd11fe5a41ee7e9972caa24c9 (commit) via a8e7a1047ad3b61238f073ea3d2cd138f207c1ed (commit) from 6450c758c809b4f597af8cac9d9c8f052931953a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c8631b528e702c5dd11fe5a41ee7e9972caa24c9 commit c8631b528e702c5dd11fe5a41ee7e9972caa24c9 Merge: 6450c75 a8e7a10 Author: Brad King AuthorDate: Thu Mar 26 09:34:08 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 26 09:34:08 2015 -0400 Merge topic 'Fortran-GNU-no-isystem' into next a8e7a104 GNU: Do not use -isystem with gfortran http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a8e7a1047ad3b61238f073ea3d2cd138f207c1ed commit a8e7a1047ad3b61238f073ea3d2cd138f207c1ed Author: Brad King AuthorDate: Thu Mar 26 09:32:39 2015 -0400 Commit: Brad King CommitDate: Thu Mar 26 09:33:20 2015 -0400 GNU: Do not use -isystem with gfortran The compiler documents that USE statements search for ".mod" files in directories specified with -I, but not -isystem. Reported-by: Hugh Sorby diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake index dfd7927..e9c8a59 100644 --- a/Modules/Compiler/GNU-Fortran.cmake +++ b/Modules/Compiler/GNU-Fortran.cmake @@ -8,5 +8,8 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form") set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") +# No -isystem for Fortran because it will not find .mod files. +unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran) + # Fortran-specific feature flags. set(CMAKE_Fortran_MODDIR_FLAG -J) ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/GNU-Fortran.cmake | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From clinton at elemtech.com Thu Mar 26 09:48:31 2015 From: clinton at elemtech.com (Clinton Stimpson) Date: Thu, 26 Mar 2015 09:48:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1234-g2d49fa7 Message-ID: <20150326134831.2E48FAD6D7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2d49fa73f23f4591bd22370ee34340a575d02183 (commit) via 34f2dff61d65681cc54366544336d6085fd463b4 (commit) from c8631b528e702c5dd11fe5a41ee7e9972caa24c9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d49fa73f23f4591bd22370ee34340a575d02183 commit 2d49fa73f23f4591bd22370ee34340a575d02183 Merge: c8631b5 34f2dff Author: Clinton Stimpson AuthorDate: Thu Mar 26 09:48:30 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 26 09:48:30 2015 -0400 Merge topic 'cpack-archive-prefix' into next 34f2dff6 cpack: Fix some test failures caused by 36f7cbca9 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=34f2dff61d65681cc54366544336d6085fd463b4 commit 34f2dff61d65681cc54366544336d6085fd463b4 Author: Clinton Stimpson AuthorDate: Thu Mar 26 07:21:27 2015 -0600 Commit: Clinton Stimpson CommitDate: Thu Mar 26 07:21:27 2015 -0600 cpack: Fix some test failures caused by 36f7cbca9 diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 373170b..b42a35e 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -64,7 +64,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, filePrefix += "/"; } const char* installPrefix = this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); - if(installPrefix && installPrefix[0] == '/') + if(installPrefix && installPrefix[0] == '/' && installPrefix[1] != 0) { // add to file prefix and remove the leading '/' filePrefix += installPrefix+1; ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackArchiveGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From bill.hoffman at kitware.com Thu Mar 26 11:43:15 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Thu, 26 Mar 2015 11:43:15 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1236-g99052a9 Message-ID: <20150326154315.7A5E2ACAF9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 99052a9ddb3e60dd978a722229a17a0b4651219f (commit) via e680d43d7dd96096962379f627828a182ac0fa80 (commit) from 2d49fa73f23f4591bd22370ee34340a575d02183 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99052a9ddb3e60dd978a722229a17a0b4651219f commit 99052a9ddb3e60dd978a722229a17a0b4651219f Merge: 2d49fa7 e680d43 Author: Bill Hoffman AuthorDate: Thu Mar 26 11:43:14 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 26 11:43:14 2015 -0400 Merge topic 'clean-scanbuild-warnings' into next e680d43d Fix an unused variable warning from scanbuild. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e680d43d7dd96096962379f627828a182ac0fa80 commit e680d43d7dd96096962379f627828a182ac0fa80 Author: Bill Hoffman AuthorDate: Thu Mar 26 11:05:56 2015 -0400 Commit: Bill Hoffman CommitDate: Thu Mar 26 11:05:56 2015 -0400 Fix an unused variable warning from scanbuild. diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index d079a19..e9cfacc 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -26,14 +26,12 @@ bool cmSetTestsPropertiesCommand // first collect up the list of files std::vector propertyPairs; - bool doingFiles = true; int numFiles = 0; std::vector::const_iterator j; for(j= args.begin(); j != args.end();++j) { if(*j == "PROPERTIES") { - doingFiles = false; // now loop through the rest of the arguments, new style ++j; if (std::distance(j, args.end()) % 2 != 0) @@ -44,15 +42,9 @@ bool cmSetTestsPropertiesCommand propertyPairs.insert(propertyPairs.end(), j, args.end()); break; } - else if (doingFiles) - { - numFiles++; - } else { - this->SetError("called with illegal arguments, maybe " - "missing a PROPERTIES specifier?"); - return false; + numFiles++; } } if(propertyPairs.empty()) @@ -62,7 +54,6 @@ bool cmSetTestsPropertiesCommand return false; } - // now loop over all the targets int i; for(i = 0; i < numFiles; ++i) ----------------------------------------------------------------------- Summary of changes: Source/cmSetTestsPropertiesCommand.cxx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Thu Mar 26 11:57:23 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Thu, 26 Mar 2015 11:57:23 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1239-g5914c81 Message-ID: <20150326155723.C03F1AD84D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 5914c8133421a27f07e6c3d8a1112318cd163df3 (commit) via 8603791553965de4d80a42347022dec1fbd8cd98 (commit) via 5d1d995bb7a982b13d691f7a926e497f4c44d6f1 (commit) from 99052a9ddb3e60dd978a722229a17a0b4651219f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5914c8133421a27f07e6c3d8a1112318cd163df3 commit 5914c8133421a27f07e6c3d8a1112318cd163df3 Merge: 99052a9 8603791 Author: Nils Gladitz AuthorDate: Thu Mar 26 11:57:23 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 26 11:57:23 2015 -0400 Merge topic 'wix-external-expat' into next 86037915 CPackWIX: Add static_casts for XML_Parser. 5d1d995b CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8603791553965de4d80a42347022dec1fbd8cd98 commit 8603791553965de4d80a42347022dec1fbd8cd98 Author: Nils Gladitz AuthorDate: Thu Mar 26 16:56:44 2015 +0100 Commit: Nils Gladitz CommitDate: Thu Mar 26 16:56:44 2015 +0100 CPackWIX: Add static_casts for XML_Parser. "XML_Parser" in cmexpat is a typedef for void* while newer releases of expat seem to use struct XML_ParserStruct *XML_Parser. Add static_casts so that the build works with either variant. diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index ef67b23..e066c28 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -132,8 +132,8 @@ void cmWIXPatchParser::ReportError(int line, int column, const char* msg) void cmWIXPatchParser::ReportValidationError(std::string const& message) { - ReportError(XML_GetCurrentLineNumber(Parser), - XML_GetCurrentColumnNumber(Parser), + ReportError(XML_GetCurrentLineNumber(static_cast(this->Parser)), + XML_GetCurrentColumnNumber(static_cast(this->Parser)), message.c_str()); } ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/CPack/WiX/cmWIXPatchParser.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Thu Mar 26 14:07:35 2015 From: brad.king at kitware.com (Brad King) Date: Thu, 26 Mar 2015 14:07:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1241-ga7fe79c Message-ID: <20150326180735.098A8AD95E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a7fe79c03a8036edbb998809bd339cce2a0ac3f8 (commit) via 4a2ff2b7f27e569032f6c5881e17cb053b32ccc7 (commit) from 5914c8133421a27f07e6c3d8a1112318cd163df3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7fe79c03a8036edbb998809bd339cce2a0ac3f8 commit a7fe79c03a8036edbb998809bd339cce2a0ac3f8 Merge: 5914c81 4a2ff2b Author: Brad King AuthorDate: Thu Mar 26 14:07:34 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 26 14:07:34 2015 -0400 Merge topic 'curl-cygwin-no-windows' into next 4a2ff2b7 curl: Never consider using Windows APIs on Cygwin http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4a2ff2b7f27e569032f6c5881e17cb053b32ccc7 commit 4a2ff2b7f27e569032f6c5881e17cb053b32ccc7 Author: Brad King AuthorDate: Thu Mar 26 14:01:03 2015 -0400 Commit: Brad King CommitDate: Thu Mar 26 14:04:39 2015 -0400 curl: Never consider using Windows APIs on Cygwin Our Windows API header checks are conditioned on if(NOT UNIX) but libarchive checks HAVE_WINDOWS_H anyway so the result leaks into the cache and influenes the curl build. Set the check results to false explicitly for curl when not on Windows to tolerate this. Reported-by: Vyacheslav Karpukhin diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 08bdff5..32e4561 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -524,12 +524,18 @@ check_include_file("features.h" HAVE_FEATURES_H) if(NOT UNIX) check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H) check_include_file_concat("winsock2.h" HAVE_WINSOCK2_H) -endif(NOT UNIX) +else() + set(HAVE_WS2TCPIP_H 0) + set(HAVE_WINSOCK2_H 0) +endif() check_include_file_concat("stdio.h" HAVE_STDIO_H) if(NOT UNIX) check_include_file_concat("windows.h" HAVE_WINDOWS_H) check_include_file_concat("winsock.h" HAVE_WINSOCK_H) -endif(NOT UNIX) +else() + set(HAVE_WINDOWS_H 0) + set(HAVE_WINSOCK_H 0) +endif() check_include_file_concat("inttypes.h" HAVE_INTTYPES_H) check_include_file_concat("sys/filio.h" HAVE_SYS_FILIO_H) ----------------------------------------------------------------------- Summary of changes: Utilities/cmcurl/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From ben.boeckel at kitware.com Thu Mar 26 18:14:02 2015 From: ben.boeckel at kitware.com (Ben Boeckel) Date: Thu, 26 Mar 2015 18:14:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1243-gf195280 Message-ID: <20150326221402.F20F3ACE43@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f19528014b75129c08d5749239c86b2ceabaa6b7 (commit) via a704098de83460e8e9bae02434a6c31e7fc3ffd7 (commit) from a7fe79c03a8036edbb998809bd339cce2a0ac3f8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f19528014b75129c08d5749239c86b2ceabaa6b7 commit f19528014b75129c08d5749239c86b2ceabaa6b7 Merge: a7fe79c a704098 Author: Ben Boeckel AuthorDate: Thu Mar 26 18:14:02 2015 -0400 Commit: CMake Topic Stage CommitDate: Thu Mar 26 18:14:02 2015 -0400 Merge topic 'fix-external-project-generator' into next a704098d ExternalProject: fix the build command for generator overrides http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a704098de83460e8e9bae02434a6c31e7fc3ffd7 commit a704098de83460e8e9bae02434a6c31e7fc3ffd7 Author: Ben Boeckel AuthorDate: Thu Mar 26 18:12:04 2015 -0400 Commit: Ben Boeckel CommitDate: Thu Mar 26 18:12:04 2015 -0400 ExternalProject: fix the build command for generator overrides The `binary_dir` variable is never set, so this is invalid. Instead, use "." which all the other build commands use anyways. Also only set the --config option if it is meaningful. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index d7b985d..0c73d41 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1197,7 +1197,10 @@ function(_ep_get_build_command name step cmd_var) else() set(cmd "${CMAKE_COMMAND}") endif() - set(args --build ${binary_dir} --config ${CMAKE_CFG_INTDIR}) + set(args --build ".") + if (CMAKE_CFG_INTDIR AND NOT CMAKE_CFG_INTDIR STREQUAL ".") + list(APPEND args --config "${CMAKE_CFG_INTDIR}") + endif () if(step STREQUAL "INSTALL") list(APPEND args --target install) endif() ----------------------------------------------------------------------- Summary of changes: Modules/ExternalProject.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 27 00:01:05 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 27 Mar 2015 00:01:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-511-g685d179 Message-ID: <20150327040105.930D2AD799@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 685d179b8b8e0f0b98dbfd227f6ccd88b17749b0 (commit) from 5d1d995bb7a982b13d691f7a926e497f4c44d6f1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=685d179b8b8e0f0b98dbfd227f6ccd88b17749b0 commit 685d179b8b8e0f0b98dbfd227f6ccd88b17749b0 Author: Kitware Robot AuthorDate: Fri Mar 27 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Fri Mar 27 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index baf3b2b..999182f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150326) +set(CMake_VERSION_PATCH 20150327) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From clinton at elemtech.com Fri Mar 27 00:06:12 2015 From: clinton at elemtech.com (Clinton Stimpson) Date: Fri, 27 Mar 2015 00:06:12 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1245-gadfa972 Message-ID: <20150327040612.A4A9CAD7F5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via adfa97275e880a785d9611a60af9df9591fe4af0 (commit) via 7fea419624386df1d36688f687725b5624de5db8 (commit) from f19528014b75129c08d5749239c86b2ceabaa6b7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=adfa97275e880a785d9611a60af9df9591fe4af0 commit adfa97275e880a785d9611a60af9df9591fe4af0 Merge: f195280 7fea419 Author: Clinton Stimpson AuthorDate: Fri Mar 27 00:06:11 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 00:06:11 2015 -0400 Merge topic 'cpack-archive-prefix' into next 7fea4196 Fix KWStyle test failure. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7fea419624386df1d36688f687725b5624de5db8 commit 7fea419624386df1d36688f687725b5624de5db8 Author: Clinton Stimpson AuthorDate: Thu Mar 26 22:05:41 2015 -0600 Commit: Clinton Stimpson CommitDate: Thu Mar 26 22:05:41 2015 -0600 Fix KWStyle test failure. diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index b42a35e..05b5cd9 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -63,7 +63,8 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME"); filePrefix += "/"; } - const char* installPrefix = this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); + const char* installPrefix = + this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); if(installPrefix && installPrefix[0] == '/' && installPrefix[1] != 0) { // add to file prefix and remove the leading '/' ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackArchiveGenerator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From clinton at elemtech.com Fri Mar 27 00:15:38 2015 From: clinton at elemtech.com (Clinton Stimpson) Date: Fri, 27 Mar 2015 00:15:38 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1247-gdf5c75d Message-ID: <20150327041538.4D6C6ACDD4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via df5c75d49d76488736841fe6e3bde1f4d85b0ece (commit) via 798582d0018ee501e0091d4ae1315d3d1b000ca2 (commit) from adfa97275e880a785d9611a60af9df9591fe4af0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df5c75d49d76488736841fe6e3bde1f4d85b0ece commit df5c75d49d76488736841fe6e3bde1f4d85b0ece Merge: adfa972 798582d Author: Clinton Stimpson AuthorDate: Fri Mar 27 00:15:37 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 00:15:37 2015 -0400 Merge topic 'cpack-archive-prefix' into next 798582d0 Fix CPackComponentsPrefix test failure without NSIS. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=798582d0018ee501e0091d4ae1315d3d1b000ca2 commit 798582d0018ee501e0091d4ae1315d3d1b000ca2 Author: Clinton Stimpson AuthorDate: Thu Mar 26 22:14:07 2015 -0600 Commit: Clinton Stimpson CommitDate: Thu Mar 26 22:14:07 2015 -0600 Fix CPackComponentsPrefix test failure without NSIS. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7135f5d..b47ea1b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1041,9 +1041,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(APPLE) set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) endif() - if(NSIS_MAKENSIS_EXECUTABLE) + if(NOT NSIS_MAKENSIS_EXECUTABLE) set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} - -DCPACK_BINARY_NSIS:BOOL=ON) + -DCPACK_BINARY_NSIS:BOOL=OFF) endif() add_test(CPackComponentsPrefix ${CMAKE_CTEST_COMMAND} ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From nilsgladitz at gmail.com Fri Mar 27 07:23:49 2015 From: nilsgladitz at gmail.com (Nils Gladitz) Date: Fri, 27 Mar 2015 07:23:49 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1250-g77b0fa6 Message-ID: <20150327112349.369F7AD341@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 77b0fa6c686212fc32c5f66c2a017b95e3c42405 (commit) via 98a3b2e29ece5195e7948681a410bc5fae880a23 (commit) via 685d179b8b8e0f0b98dbfd227f6ccd88b17749b0 (commit) from df5c75d49d76488736841fe6e3bde1f4d85b0ece (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77b0fa6c686212fc32c5f66c2a017b95e3c42405 commit 77b0fa6c686212fc32c5f66c2a017b95e3c42405 Merge: df5c75d 98a3b2e Author: Nils Gladitz AuthorDate: Fri Mar 27 07:23:48 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 07:23:48 2015 -0400 Merge topic 'wix-fix-utf8' into next 98a3b2e2 CPackWIX: Omit codepage conversion when internal encoding is already UTF-8. 685d179b CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98a3b2e29ece5195e7948681a410bc5fae880a23 commit 98a3b2e29ece5195e7948681a410bc5fae880a23 Author: Nils Gladitz AuthorDate: Fri Mar 27 12:22:15 2015 +0100 Commit: Nils Gladitz CommitDate: Fri Mar 27 12:22:15 2015 +0100 CPackWIX: Omit codepage conversion when internal encoding is already UTF-8. diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 257ce7a..99eabf2 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -430,7 +430,7 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, tmp << name << "=\"" << value << '"'; source.AddProcessingInstruction("define", - cmWIXSourceWriter::WindowsCodepageToUtf8(tmp.str())); + cmWIXSourceWriter::CMakeEncodingToUtf8(tmp.str())); } bool cmCPackWIXGenerator::CreateWiXSourceFiles() diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index aad19da..219fca8 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -10,6 +10,8 @@ See the License for more information. ============================================================================*/ +#include "cmStandardIncludes.h" + #include "cmWIXSourceWriter.h" #include @@ -118,7 +120,7 @@ void cmWIXSourceWriter::AddProcessingInstruction( void cmWIXSourceWriter::AddAttribute( std::string const& key, std::string const& value) { - std::string utf8 = WindowsCodepageToUtf8(value); + std::string utf8 = CMakeEncodingToUtf8(value); File << " " << key << "=\"" << EscapeAttributeValue(utf8) << '"'; } @@ -132,8 +134,11 @@ void cmWIXSourceWriter::AddAttributeUnlessEmpty( } } -std::string cmWIXSourceWriter::WindowsCodepageToUtf8(std::string const& value) +std::string cmWIXSourceWriter::CMakeEncodingToUtf8(std::string const& value) { +#ifdef CMAKE_ENCODING_UTF8 + return value; +#else if(value.empty()) { return std::string(); @@ -167,6 +172,7 @@ std::string cmWIXSourceWriter::WindowsCodepageToUtf8(std::string const& value) &utf8[0], static_cast(utf8.size()), 0, 0); return std::string(&utf8[0], utf8.size()); +#endif } diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 3957d96..3b9999c 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -43,7 +43,7 @@ public: void AddAttributeUnlessEmpty( std::string const& key, std::string const& value); - static std::string WindowsCodepageToUtf8(std::string const& value); + static std::string CMakeEncodingToUtf8(std::string const& value); protected: cmCPackLog* Logger; ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- Source/CPack/WiX/cmWIXSourceWriter.cxx | 10 ++++++++-- Source/CPack/WiX/cmWIXSourceWriter.h | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 09:15:11 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 09:15:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-513-gb6f6722 Message-ID: <20150327131515.7ED7DACFA9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via b6f67227f156794bc21c9cf2d6897a7e68410b67 (commit) via 9c76ff015a393a2a5107a9db7f8ba91eb12c4ffa (commit) from 685d179b8b8e0f0b98dbfd227f6ccd88b17749b0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b6f67227f156794bc21c9cf2d6897a7e68410b67 commit b6f67227f156794bc21c9cf2d6897a7e68410b67 Merge: 685d179 9c76ff0 Author: Brad King AuthorDate: Fri Mar 27 09:15:09 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 09:15:09 2015 -0400 Merge topic 'qtdialog-cpack-qt5-osx' 9c76ff01 QtDialog: Fix CMake packaging with CPack on OS X with Qt5. ----------------------------------------------------------------------- Summary of changes: Source/QtDialog/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 09:15:17 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 09:15:17 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-515-gbd96cd5 Message-ID: <20150327131517.D2E5FAD00D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via bd96cd5a1e935a4a7fb745996d2da4c9f0cb734d (commit) via 4a2ff2b7f27e569032f6c5881e17cb053b32ccc7 (commit) from b6f67227f156794bc21c9cf2d6897a7e68410b67 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd96cd5a1e935a4a7fb745996d2da4c9f0cb734d commit bd96cd5a1e935a4a7fb745996d2da4c9f0cb734d Merge: b6f6722 4a2ff2b Author: Brad King AuthorDate: Fri Mar 27 09:15:16 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 09:15:16 2015 -0400 Merge topic 'curl-cygwin-no-windows' 4a2ff2b7 curl: Never consider using Windows APIs on Cygwin ----------------------------------------------------------------------- Summary of changes: Utilities/cmcurl/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 09:15:19 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 09:15:19 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-517-g6959b5b Message-ID: <20150327131520.011BBAD014@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6959b5be08fa2e244d78178ee987fffb940c740e (commit) via a8e7a1047ad3b61238f073ea3d2cd138f207c1ed (commit) from bd96cd5a1e935a4a7fb745996d2da4c9f0cb734d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6959b5be08fa2e244d78178ee987fffb940c740e commit 6959b5be08fa2e244d78178ee987fffb940c740e Merge: bd96cd5 a8e7a10 Author: Brad King AuthorDate: Fri Mar 27 09:15:18 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 09:15:18 2015 -0400 Merge topic 'Fortran-GNU-no-isystem' a8e7a104 GNU: Do not use -isystem with gfortran ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/GNU-Fortran.cmake | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 09:15:22 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 09:15:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-519-g7865036 Message-ID: <20150327131522.5687CACFF2@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 78650361315beb2a75bdae49988064200710556e (commit) via dcf298008f60fa00ddcb225b7a474317ad4d317f (commit) from 6959b5be08fa2e244d78178ee987fffb940c740e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=78650361315beb2a75bdae49988064200710556e commit 78650361315beb2a75bdae49988064200710556e Merge: 6959b5b dcf2980 Author: Brad King AuthorDate: Fri Mar 27 09:15:21 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 09:15:21 2015 -0400 Merge topic 'FindMFC-CMP0054' dcf29800 FindMFC: Use if(DEFINED) to simplify condition (#15477) ----------------------------------------------------------------------- Summary of changes: Modules/FindMFC.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 09:15:24 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 09:15:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-521-ga92f217 Message-ID: <20150327131524.70039AD02C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a92f217a4bc8eb682b1b6b79076549314caffc1e (commit) via 8603791553965de4d80a42347022dec1fbd8cd98 (commit) from 78650361315beb2a75bdae49988064200710556e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a92f217a4bc8eb682b1b6b79076549314caffc1e commit a92f217a4bc8eb682b1b6b79076549314caffc1e Merge: 7865036 8603791 Author: Brad King AuthorDate: Fri Mar 27 09:15:23 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 09:15:23 2015 -0400 Merge topic 'wix-external-expat' 86037915 CPackWIX: Add static_casts for XML_Parser. ----------------------------------------------------------------------- Summary of changes: Source/CPack/WiX/cmWIXPatchParser.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 09:15:26 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 09:15:26 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-523-g7910cb7 Message-ID: <20150327131526.3E55AAD033@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 7910cb7cfb6b8a1dd3424327d667f6df5fc60b0a (commit) via a704098de83460e8e9bae02434a6c31e7fc3ffd7 (commit) from a92f217a4bc8eb682b1b6b79076549314caffc1e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7910cb7cfb6b8a1dd3424327d667f6df5fc60b0a commit 7910cb7cfb6b8a1dd3424327d667f6df5fc60b0a Merge: a92f217 a704098 Author: Brad King AuthorDate: Fri Mar 27 09:15:25 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 09:15:25 2015 -0400 Merge topic 'fix-external-project-generator' a704098d ExternalProject: fix the build command for generator overrides ----------------------------------------------------------------------- Summary of changes: Modules/ExternalProject.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 09:16:02 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 09:16:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1257-g102daca Message-ID: <20150327131602.1635CAD037@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 102daca0973b2e0980eb6dc5ee6485f4cab31124 (commit) via 7910cb7cfb6b8a1dd3424327d667f6df5fc60b0a (commit) via a92f217a4bc8eb682b1b6b79076549314caffc1e (commit) via 78650361315beb2a75bdae49988064200710556e (commit) via 6959b5be08fa2e244d78178ee987fffb940c740e (commit) via bd96cd5a1e935a4a7fb745996d2da4c9f0cb734d (commit) via b6f67227f156794bc21c9cf2d6897a7e68410b67 (commit) from 77b0fa6c686212fc32c5f66c2a017b95e3c42405 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=102daca0973b2e0980eb6dc5ee6485f4cab31124 commit 102daca0973b2e0980eb6dc5ee6485f4cab31124 Merge: 77b0fa6 7910cb7 Author: Brad King AuthorDate: Fri Mar 27 09:15:48 2015 -0400 Commit: Brad King CommitDate: Fri Mar 27 09:15:48 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 10:58:50 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 10:58:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1260-g7b30a34 Message-ID: <20150327145850.151E7AD9C9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 7b30a3493ede59756b635fc236bf2038df58dce6 (commit) via b76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87 (commit) via 9e14a5dee2b7ec420fcfea49c2f2f41da84e2cbf (commit) from 102daca0973b2e0980eb6dc5ee6485f4cab31124 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b30a3493ede59756b635fc236bf2038df58dce6 commit 7b30a3493ede59756b635fc236bf2038df58dce6 Merge: 102daca b76b52c Author: Brad King AuthorDate: Fri Mar 27 10:58:49 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 10:58:49 2015 -0400 Merge topic 'xcode-default-ARCHS' into next b76b52c0 Xcode: Set ARCHS only when CMAKE_OSX_ARCHITECTURES is specified (#14736) 9e14a5de cmGlobalXCodeGenerator: Simplify ARCHS list with cmJoin http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87 commit b76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87 Author: Brad King AuthorDate: Fri Mar 27 10:46:11 2015 -0400 Commit: Brad King CommitDate: Fri Mar 27 10:52:32 2015 -0400 Xcode: Set ARCHS only when CMAKE_OSX_ARCHITECTURES is specified (#14736) Teach the Xcode generator that ONLY_ACTIVE_ARCH=YES means to use ARCHS, and that the default of ONLY_ACTIVE_ARCH=NO means to use NATIVE_ARCH and ignore ARCHS. In the latter case there is no reason to generate ARCHS. diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index 7f686a2..20f3da3 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -79,7 +79,6 @@ 1DEB928A08733DD80010E9CD = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; ONLY_ACTIVE_ARCH = YES; CODE_SIGNING_REQUIRED = NO; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 447f975..f139ad1 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3381,44 +3381,33 @@ bool cmGlobalXCodeGenerator this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); const char* osxArch = this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); - if(!osxArch || strlen(osxArch) == 0) - { - if(this->XcodeVersion >= 32) - { - osxArch = "$(ARCHS_STANDARD_32_64_BIT)"; - } - else if(this->XcodeVersion == 31) - { - osxArch = "$(ARCHS_STANDARD_32_BIT)"; - } - else if(this->XcodeVersion <= 30) - { -#ifdef __ppc__ - osxArch = "ppc"; -#endif -#ifdef __i386 - osxArch = "i386"; -#endif - } - buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", - this->CreateString("YES")); - } - const char* sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); const char* deploymentTarget = this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); - if(osxArch && sysroot) + std::string archs; + if(sysroot) { - // recompute this as it may have been changed since enable language - this->Architectures.clear(); - cmSystemTools::ExpandListArgument(std::string(osxArch), - this->Architectures); + if(osxArch) + { + // recompute this as it may have been changed since enable language + this->Architectures.clear(); + cmSystemTools::ExpandListArgument(std::string(osxArch), + this->Architectures); + archs = cmJoin(this->Architectures, " "); + } buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); - std::string const& archString = cmJoin(this->Architectures, " "); - buildSettings->AddAttribute("ARCHS", - this->CreateString(archString.c_str())); + } + if (archs.empty()) + { + // Tell Xcode to use NATIVE_ARCH instead of ARCHS. + buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES")); + } + else + { + // Tell Xcode to use ARCHS (ONLY_ACTIVE_ARCH defaults to NO). + buildSettings->AddAttribute("ARCHS", this->CreateString(archs.c_str())); } if(deploymentTarget && *deploymentTarget) { http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e14a5dee2b7ec420fcfea49c2f2f41da84e2cbf commit 9e14a5dee2b7ec420fcfea49c2f2f41da84e2cbf Author: Brad King AuthorDate: Fri Mar 27 09:32:53 2015 -0400 Commit: Brad King CommitDate: Fri Mar 27 09:50:14 2015 -0400 cmGlobalXCodeGenerator: Simplify ARCHS list with cmJoin diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d340e72..447f975 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -21,6 +21,7 @@ #include "cmCustomCommandGenerator.h" #include "cmGeneratorTarget.h" #include "cmGlobalGeneratorFactory.h" +#include "cmAlgorithms.h" #include @@ -3415,16 +3416,7 @@ bool cmGlobalXCodeGenerator this->Architectures); buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); - std::string archString; - const char* sep = ""; - for( std::vector::iterator i = - this->Architectures.begin(); - i != this->Architectures.end(); ++i) - { - archString += sep; - archString += *i; - sep = " "; - } + std::string const& archString = cmJoin(this->Architectures, " "); buildSettings->AddAttribute("ARCHS", this->CreateString(archString.c_str())); } ----------------------------------------------------------------------- Summary of changes: Modules/CompilerId/Xcode-3.pbxproj.in | 1 - Source/cmGlobalXCodeGenerator.cxx | 61 ++++++++++++--------------------- 2 files changed, 21 insertions(+), 41 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 14:45:31 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 14:45:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1263-g58dbf94 Message-ID: <20150327184531.3BF5CACA1C@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 58dbf94b66d3afb955cff3dffe01f39ad383e303 (commit) via 230f2d6e7060e70b7205fc65f6bee7ce37e3f27b (commit) via 564c07f7dd819d9ea070b22ad16849d3be6bb89a (commit) from 7b30a3493ede59756b635fc236bf2038df58dce6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58dbf94b66d3afb955cff3dffe01f39ad383e303 commit 58dbf94b66d3afb955cff3dffe01f39ad383e303 Merge: 7b30a34 230f2d6 Author: Brad King AuthorDate: Fri Mar 27 14:45:29 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 14:45:29 2015 -0400 Merge topic 'ExternalData-recursive-match' into next 230f2d6e ExternalData: Add option to recursively match under directories 564c07f7 ExternalData: Parameterize internal file(GLOB) operation selection http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=230f2d6e7060e70b7205fc65f6bee7ce37e3f27b commit 230f2d6e7060e70b7205fc65f6bee7ce37e3f27b Author: Brad King AuthorDate: Wed Mar 25 10:23:51 2015 -0400 Commit: Brad King CommitDate: Fri Mar 27 14:44:54 2015 -0400 ExternalData: Add option to recursively match under directories Extend the ``DATA{Dir/,...}`` syntax with a new ``RECURSE:`` option to enable recursive matching of associated files. This will allow an entire directory tree of data to be referenced at once. diff --git a/Help/release/dev/ExternalData-recursive-match.rst b/Help/release/dev/ExternalData-recursive-match.rst new file mode 100644 index 0000000..4d8c789 --- /dev/null +++ b/Help/release/dev/ExternalData-recursive-match.rst @@ -0,0 +1,7 @@ +ExternalData-recursive-match +---------------------------- + +* The :module:`ExternalData` module learned a new ``RECURSE:`` + option in ``DATA{}`` references specifying directories. + This allows an entire directory tree of associated files + to be matched. diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index eab266f..883ab69 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -244,7 +244,8 @@ associated file options. For example, the argument ``DATA{MyDataDir/,REGEX:.*}`` will pass the full path to a ``MyDataDir`` directory on the command line and ensure that the directory contains files corresponding to every file or content link in the ``MyDataDir`` -source directory. +source directory. In order to match associated files in subdirectories, +specify a ``RECURSE:`` option, e.g. ``DATA{MyDataDir/,RECURSE:,REGEX:.*}``. Hash Algorithms ^^^^^^^^^^^^^^^ @@ -597,6 +598,7 @@ function(_ExternalData_arg target arg options var_file) # Process options. set(series_option "") + set(recurse_option "") set(associated_files "") set(associated_regex "") foreach(opt ${options}) @@ -606,6 +608,9 @@ function(_ExternalData_arg target arg options var_file) elseif(opt STREQUAL ":") # Activate series matching. set(series_option "${opt}") + elseif(opt STREQUAL "RECURSE:") + # Activate recursive matching in directories. + set(recurse_option "${opt}") elseif("x${opt}" MATCHES "^[^][:/*?]+$") # Specific associated file. list(APPEND associated_files "${opt}") @@ -622,6 +627,9 @@ function(_ExternalData_arg target arg options var_file) if(associated_files OR associated_regex) message(FATAL_ERROR "Series option \"${series_option}\" not allowed with associated files.") endif() + if(recurse_option) + message(FATAL_ERROR "Recurse option \"${recurse_option}\" allowed only with directories.") + endif() # Load a whole file series. _ExternalData_arg_series() elseif(data_is_directory) @@ -634,6 +642,9 @@ function(_ExternalData_arg target arg options var_file) "must list associated files.") endif() else() + if(recurse_option) + message(FATAL_ERROR "Recurse option \"${recurse_option}\" allowed only with directories.") + endif() # Load the named data file. _ExternalData_arg_single() if(associated_files OR associated_regex) @@ -681,11 +692,17 @@ macro(_ExternalData_arg_associated) set(reldir "${reldir}/") endif() _ExternalData_exact_regex(reldir_regex "${reldir}") + if(recurse_option) + set(glob GLOB_RECURSE) + set(reldir_regex "${reldir_regex}(.+/)?") + else() + set(glob GLOB) + endif() # Find files named explicitly. foreach(file ${associated_files}) _ExternalData_exact_regex(file_regex "${file}") - _ExternalData_arg_find_files(GLOB "${reldir}${file}" + _ExternalData_arg_find_files(${glob} "${reldir}${file}" "${reldir_regex}${file_regex}") endforeach() @@ -696,7 +713,7 @@ macro(_ExternalData_arg_associated) set(all "${all}${sep}${reldir_regex}${regex}") set(sep "|") endforeach() - _ExternalData_arg_find_files(GLOB "${reldir}" "${all}") + _ExternalData_arg_find_files(${glob} "${reldir}" "${all}") endmacro() macro(_ExternalData_arg_single) diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index 6c5e59c..b6e24d2 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -44,6 +44,7 @@ ExternalData_Add_Test(Data1 -D Paired=DATA{PairedA.dat,PairedB.dat} -D Meta=DATA{MetaTop.dat,REGEX:Meta[ABC].dat} -D Directory=DATA{Directory/,A.dat,REGEX:[BC].dat} + -D DirRecurse=DATA{DirRecurse/,RECURSE:,A.dat,REGEX:[BC].dat} -D "Semicolons=DATA{Data.dat}\\;DATA{Data.dat}" -P ${CMAKE_CURRENT_SOURCE_DIR}/Data1Check.cmake ) diff --git a/Tests/Module/ExternalData/Data1Check.cmake b/Tests/Module/ExternalData/Data1Check.cmake index 9845a3b..f60c209 100644 --- a/Tests/Module/ExternalData/Data1Check.cmake +++ b/Tests/Module/ExternalData/Data1Check.cmake @@ -90,6 +90,12 @@ foreach(n A B C) message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") endif() endforeach() +foreach(n A Sub1/A Sub2/Dir/A B Sub1/B Sub2/Dir/B C Sub1/C Sub2/Dir/C) + set(file "${DirRecurse}/${n}.dat") + if(NOT EXISTS "${file}") + message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!") + endif() +endforeach() list(LENGTH Semicolons len) if("${len}" EQUAL 2) foreach(file ${Semicolons}) diff --git a/Tests/Module/ExternalData/DirRecurse/A.dat.md5 b/Tests/Module/ExternalData/DirRecurse/A.dat.md5 new file mode 100644 index 0000000..4a78fc7 --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/A.dat.md5 @@ -0,0 +1 @@ +9d980b06c2f0fec3d4872d68175b9822 diff --git a/Tests/Module/ExternalData/DirRecurse/B.dat.md5 b/Tests/Module/ExternalData/DirRecurse/B.dat.md5 new file mode 100644 index 0000000..4557a21 --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/B.dat.md5 @@ -0,0 +1 @@ +8f4add4581551facf27237e6577fd662 diff --git a/Tests/Module/ExternalData/DirRecurse/C.dat.md5 b/Tests/Module/ExternalData/DirRecurse/C.dat.md5 new file mode 100644 index 0000000..a7f23dd --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/C.dat.md5 @@ -0,0 +1 @@ +c1030719c95f3435d8abc39c0d442946 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub1/A.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub1/A.dat.md5 new file mode 100644 index 0000000..4a78fc7 --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub1/A.dat.md5 @@ -0,0 +1 @@ +9d980b06c2f0fec3d4872d68175b9822 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub1/B.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub1/B.dat.md5 new file mode 100644 index 0000000..4557a21 --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub1/B.dat.md5 @@ -0,0 +1 @@ +8f4add4581551facf27237e6577fd662 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub1/C.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub1/C.dat.md5 new file mode 100644 index 0000000..a7f23dd --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub1/C.dat.md5 @@ -0,0 +1 @@ +c1030719c95f3435d8abc39c0d442946 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/A.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/A.dat.md5 new file mode 100644 index 0000000..4a78fc7 --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/A.dat.md5 @@ -0,0 +1 @@ +9d980b06c2f0fec3d4872d68175b9822 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/B.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/B.dat.md5 new file mode 100644 index 0000000..4557a21 --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/B.dat.md5 @@ -0,0 +1 @@ +8f4add4581551facf27237e6577fd662 diff --git a/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/C.dat.md5 b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/C.dat.md5 new file mode 100644 index 0000000..a7f23dd --- /dev/null +++ b/Tests/Module/ExternalData/DirRecurse/Sub2/Dir/C.dat.md5 @@ -0,0 +1 @@ +c1030719c95f3435d8abc39c0d442946 diff --git a/Tests/RunCMake/ExternalData/BadRecurse1-result.txt b/Tests/RunCMake/ExternalData/BadRecurse1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt b/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt new file mode 100644 index 0000000..aedc330 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse1-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Recurse option "RECURSE:" allowed only with directories. +Call Stack \(most recent call first\): + .* + BadRecurse1.cmake:2 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadRecurse1.cmake b/Tests/RunCMake/ExternalData/BadRecurse1.cmake new file mode 100644 index 0000000..f70b9f9 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse1.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Expand_Arguments(Data args DATA{Series.txt,:,RECURSE:}) diff --git a/Tests/RunCMake/ExternalData/BadRecurse2-result.txt b/Tests/RunCMake/ExternalData/BadRecurse2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt b/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt new file mode 100644 index 0000000..3f809ca --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse2-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Recurse option "RECURSE:" allowed only with directories. +Call Stack \(most recent call first\): + .* + BadRecurse2.cmake:2 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadRecurse2.cmake b/Tests/RunCMake/ExternalData/BadRecurse2.cmake new file mode 100644 index 0000000..c4dc35d --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse2.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Expand_Arguments(Data args DATA{Data.txt,RECURSE:}) diff --git a/Tests/RunCMake/ExternalData/BadRecurse3-result.txt b/Tests/RunCMake/ExternalData/BadRecurse3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt b/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt new file mode 100644 index 0000000..37740e0 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse3-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at .*/Modules/ExternalData.cmake:[0-9]+ \(message\): + Unknown option "RECURSE:x" in argument + + DATA{Directory1/,RECURSE:x,Data.dat} + +Call Stack \(most recent call first\): + .* + BadRecurse3.cmake:2 \(ExternalData_Expand_Arguments\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ExternalData/BadRecurse3.cmake b/Tests/RunCMake/ExternalData/BadRecurse3.cmake new file mode 100644 index 0000000..9a22f62 --- /dev/null +++ b/Tests/RunCMake/ExternalData/BadRecurse3.cmake @@ -0,0 +1,2 @@ +include(ExternalData) +ExternalData_Expand_Arguments(Data args DATA{Directory1/,RECURSE:x,Data.dat}) diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake index 241fa1f..b5ab22d 100644 --- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake @@ -9,6 +9,9 @@ run_cmake(BadCustom4) run_cmake(BadHashAlgo1) run_cmake(BadOption1) run_cmake(BadOption2) +run_cmake(BadRecurse1) +run_cmake(BadRecurse2) +run_cmake(BadRecurse3) run_cmake(BadSeries1) run_cmake(BadSeries2) run_cmake(BadSeries3) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=564c07f7dd819d9ea070b22ad16849d3be6bb89a commit 564c07f7dd819d9ea070b22ad16849d3be6bb89a Author: Brad King AuthorDate: Wed Mar 25 09:29:55 2015 -0400 Commit: Brad King CommitDate: Fri Mar 27 14:44:49 2015 -0400 ExternalData: Parameterize internal file(GLOB) operation selection Extend the _ExternalData_arg_find_files signature with an option to specify the kind of file(GLOB) operation to be performed. Set CMP0009 to NEW so that GLOB_RECURSE does not follow symlinks. diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index b3206be..eab266f 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -685,7 +685,8 @@ macro(_ExternalData_arg_associated) # Find files named explicitly. foreach(file ${associated_files}) _ExternalData_exact_regex(file_regex "${file}") - _ExternalData_arg_find_files("${reldir}${file}" "${reldir_regex}${file_regex}") + _ExternalData_arg_find_files(GLOB "${reldir}${file}" + "${reldir_regex}${file_regex}") endforeach() # Find files matching the given regular expressions. @@ -695,13 +696,13 @@ macro(_ExternalData_arg_associated) set(all "${all}${sep}${reldir_regex}${regex}") set(sep "|") endforeach() - _ExternalData_arg_find_files("${reldir}" "${all}") + _ExternalData_arg_find_files(GLOB "${reldir}" "${all}") endmacro() macro(_ExternalData_arg_single) # Match only the named data by itself. _ExternalData_exact_regex(data_regex "${reldata}") - _ExternalData_arg_find_files("${reldata}" "${data_regex}") + _ExternalData_arg_find_files(GLOB "${reldata}" "${data_regex}") endmacro() macro(_ExternalData_arg_series) @@ -756,12 +757,15 @@ macro(_ExternalData_arg_series) # Then match base, number, and extension. _ExternalData_exact_regex(series_base "${relbase}") _ExternalData_exact_regex(series_ext "${ext}") - _ExternalData_arg_find_files("${relbase}*${ext}" + _ExternalData_arg_find_files(GLOB "${relbase}*${ext}" "${series_base}${series_match}${series_ext}") endmacro() -function(_ExternalData_arg_find_files pattern regex) - file(GLOB globbed RELATIVE "${top_src}" "${top_src}/${pattern}*") +function(_ExternalData_arg_find_files glob pattern regex) + cmake_policy(PUSH) + cmake_policy(SET CMP0009 NEW) + file(${glob} globbed RELATIVE "${top_src}" "${top_src}/${pattern}*") + cmake_policy(POP) foreach(entry IN LISTS globbed) if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$") set(relname "${CMAKE_MATCH_1}") ----------------------------------------------------------------------- Summary of changes: Help/release/dev/ExternalData-recursive-match.rst | 7 ++++ Modules/ExternalData.cmake | 35 ++++++++++++++++---- Tests/Module/ExternalData/CMakeLists.txt | 1 + Tests/Module/ExternalData/Data1Check.cmake | 6 ++++ .../{Directory => DirRecurse}/A.dat.md5 | 0 .../{Directory => DirRecurse}/B.dat.md5 | 0 .../{Directory => DirRecurse}/C.dat.md5 | 0 .../{Directory => DirRecurse/Sub1}/A.dat.md5 | 0 .../{Directory => DirRecurse/Sub1}/B.dat.md5 | 0 .../{Directory => DirRecurse/Sub1}/C.dat.md5 | 0 .../{Directory => DirRecurse/Sub2/Dir}/A.dat.md5 | 0 .../{Directory => DirRecurse/Sub2/Dir}/B.dat.md5 | 0 .../{Directory => DirRecurse/Sub2/Dir}/C.dat.md5 | 0 .../BadRecurse1-result.txt} | 0 ...adSeries3-stderr.txt => BadRecurse1-stderr.txt} | 4 +-- Tests/RunCMake/ExternalData/BadRecurse1.cmake | 2 ++ .../BadRecurse2-result.txt} | 0 ...adSeries3-stderr.txt => BadRecurse2-stderr.txt} | 4 +-- Tests/RunCMake/ExternalData/BadRecurse2.cmake | 2 ++ .../BadRecurse3-result.txt} | 0 ...adOption2-stderr.txt => BadRecurse3-stderr.txt} | 6 ++-- Tests/RunCMake/ExternalData/BadRecurse3.cmake | 2 ++ Tests/RunCMake/ExternalData/RunCMakeTest.cmake | 3 ++ 23 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 Help/release/dev/ExternalData-recursive-match.rst copy Tests/Module/ExternalData/{Directory => DirRecurse}/A.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse}/B.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse}/C.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub1}/A.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub1}/B.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub1}/C.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub2/Dir}/A.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub2/Dir}/B.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub2/Dir}/C.dat.md5 (100%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => ExternalData/BadRecurse1-result.txt} (100%) copy Tests/RunCMake/ExternalData/{BadSeries3-stderr.txt => BadRecurse1-stderr.txt} (54%) create mode 100644 Tests/RunCMake/ExternalData/BadRecurse1.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => ExternalData/BadRecurse2-result.txt} (100%) copy Tests/RunCMake/ExternalData/{BadSeries3-stderr.txt => BadRecurse2-stderr.txt} (54%) create mode 100644 Tests/RunCMake/ExternalData/BadRecurse2.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => ExternalData/BadRecurse3-result.txt} (100%) copy Tests/RunCMake/ExternalData/{BadOption2-stderr.txt => BadRecurse3-stderr.txt} (50%) create mode 100644 Tests/RunCMake/ExternalData/BadRecurse3.cmake hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 15:36:07 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 15:36:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1265-gd19d3bd Message-ID: <20150327193607.27BEAAD8E5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d19d3bd1b3e67c566b7a2bf1bbf18c0aff29a559 (commit) via 4d08e6b6dd21658bdcdc4dc1cd2a2b03d377d531 (commit) from 58dbf94b66d3afb955cff3dffe01f39ad383e303 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d19d3bd1b3e67c566b7a2bf1bbf18c0aff29a559 commit d19d3bd1b3e67c566b7a2bf1bbf18c0aff29a559 Merge: 58dbf94 4d08e6b Author: Brad King AuthorDate: Fri Mar 27 15:36:06 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 15:36:06 2015 -0400 Merge topic 'ninja-autogen' into next 4d08e6b6 QtAutogen: Fix rcc rebuild with Ninja generator (#15459) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d08e6b6dd21658bdcdc4dc1cd2a2b03d377d531 commit 4d08e6b6dd21658bdcdc4dc1cd2a2b03d377d531 Author: Brad King AuthorDate: Fri Mar 27 15:27:40 2015 -0400 Commit: Brad King CommitDate: Fri Mar 27 15:33:19 2015 -0400 QtAutogen: Fix rcc rebuild with Ninja generator (#15459) The rcc outputs are byproducts of the cmake_autogen rule, not outputs. We still must run cmake_autogen on every run even if the rcc outputs exist. Ninja requires explicit byproduct specification, which is now possible in CMake since commit v3.2.0-rc1~340^2~2 (Add an option for explicit BYPRODUCTS of custom commands, 2014-11-13). Revise the logic introduced by commit v3.2.0-rc1~480^2 (QtAutogen: Regenerate qrc files if their input changes, 2014-09-17) to specify byproducts explicitly. diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 08092c7..4cb49c8 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -374,7 +374,9 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) #endif std::vector rcc_output; - if(makefile->GetLocalGenerator()->GetGlobalGenerator()->GetName() == "Ninja" + bool const isNinja = + makefile->GetLocalGenerator()->GetGlobalGenerator()->GetName() == "Ninja"; + if(isNinja #if defined(_WIN32) && !defined(__CYGWIN__) || usePRE_BUILD #endif @@ -444,7 +446,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) #endif { cmTarget* autogenTarget = 0; - if (!rcc_output.empty()) + if (!rcc_output.empty() && !isNinja) { std::vector no_byproducts; makefile->AddCustomCommandToOutput(rcc_output, no_byproducts, @@ -464,7 +466,8 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) { autogenTarget = makefile->AddUtilityCommand( autogenTargetName, true, - workingDirectory.c_str(), depends, + workingDirectory.c_str(), + /*byproducts=*/rcc_output, depends, commandLines, false, autogenComment.c_str()); } ----------------------------------------------------------------------- Summary of changes: Source/cmQtAutoGenerators.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Fri Mar 27 16:26:13 2015 From: brad.king at kitware.com (Brad King) Date: Fri, 27 Mar 2015 16:26:13 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1268-g460cc0a Message-ID: <20150327202613.75C0CAD5C4@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 460cc0a18df64a920c7ce51eebd64506d31660db (commit) via ac14cbf01710c08e9bf31670cf40d88512b55752 (commit) via 817d31db9797bfc1c6ff7e60e420532362b14463 (commit) from d19d3bd1b3e67c566b7a2bf1bbf18c0aff29a559 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=460cc0a18df64a920c7ce51eebd64506d31660db commit 460cc0a18df64a920c7ce51eebd64506d31660db Merge: d19d3bd ac14cbf Author: Brad King AuthorDate: Fri Mar 27 16:26:12 2015 -0400 Commit: CMake Topic Stage CommitDate: Fri Mar 27 16:26:12 2015 -0400 Merge topic 'add_dependencies-INTERFACE-libraries' into next ac14cbf0 Allow add_dependencies() on INTERFACE libraries (#15414) 817d31db Help: Format add_dependencies documentation http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac14cbf01710c08e9bf31670cf40d88512b55752 commit ac14cbf01710c08e9bf31670cf40d88512b55752 Author: Brad King AuthorDate: Fri Mar 27 16:25:09 2015 -0400 Commit: Brad King CommitDate: Fri Mar 27 16:25:09 2015 -0400 Allow add_dependencies() on INTERFACE libraries (#15414) Revert commit v3.0.0-rc1~175^2~20 (add_dependencies: Disallow use with INTERFACE_LIBRARY, 2013-12-25). Teach our dependency analysis to transitively follow INTERFACE target utility dependencies as was done or IMPORTED targets in commit v2.8.6~127^2~1 (Allow add_dependencies() on imported targets, 2010-11-19). Extend the InterfaceLibrary test with a case to cover header generation for a header-only INTERFACE library via a custom target. diff --git a/Help/command/add_dependencies.rst b/Help/command/add_dependencies.rst index 1cbac20..c3583cf 100644 --- a/Help/command/add_dependencies.rst +++ b/Help/command/add_dependencies.rst @@ -13,8 +13,8 @@ is one created by one of the :command:`add_executable`, :command:`add_library`, or :command:`add_custom_target` commands. Dependencies added to an :ref:`imported target ` -are followed transitively in its place since the target itself does -not build. +or an :ref:`interface library ` are followed +transitively in its place since the target itself does not build. See the ``DEPENDS`` option of :command:`add_custom_target` and :command:`add_custom_command` commands for adding file-level diff --git a/Help/release/dev/add_dependencies-INTERFACE-libraries.rst b/Help/release/dev/add_dependencies-INTERFACE-libraries.rst new file mode 100644 index 0000000..dfac2af --- /dev/null +++ b/Help/release/dev/add_dependencies-INTERFACE-libraries.rst @@ -0,0 +1,7 @@ +add_dependencies-INTERFACE-libraries +------------------------------------ + +* The :command:`add_dependencies` command learned to allow dependencies + to be added to :ref:`interface libraries `. + Dependencies added to an interface library are followed transitively + in its place since the target itself does not build. diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index b560452..3a74946 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -33,15 +33,6 @@ bool cmAddDependenciesCommand } if(cmTarget* target = this->Makefile->FindTargetToUse(target_name)) { - if (target->GetType() == cmTarget::INTERFACE_LIBRARY) - { - std::ostringstream e; - e << "Cannot add target-level dependencies to INTERFACE library " - "target \"" << target_name << "\".\n"; - this->SetError(e.str()); - return false; - } - std::vector::const_iterator s = args.begin(); ++s; // skip over target_name for (; s != args.end(); ++s) diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index cf2b88e..bbffd5d 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -418,9 +418,11 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, cmTarget const* dependee, bool linking) { - if(dependee->IsImported()) + if(dependee->IsImported() || + dependee->GetType() == cmTarget::INTERFACE_LIBRARY) { - // Skip imported targets but follow their utility dependencies. + // Skip IMPORTED and INTERFACE targets but follow their utility + // dependencies. std::set const& utils = dependee->GetUtilityItems(); for(std::set::const_iterator i = utils.begin(); i != utils.end(); ++i) diff --git a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt index 98f521e..826a9ed 100644 --- a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt +++ b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt @@ -3,6 +3,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) add_library(headeriface INTERFACE) -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/iface_header_builddir.h" - "#define IFACE_HEADER_BUILDDIR\n" -) +add_custom_target(headeriface_gen + COMMENT "Generating iface_header_builddir.h" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/iface_header_builddir.h.in + ${CMAKE_CURRENT_BINARY_DIR}/iface_header_builddir.h + VERBATIM + ) +add_dependencies(headeriface headeriface_gen) diff --git a/Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in b/Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in new file mode 100644 index 0000000..42dd6df --- /dev/null +++ b/Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in @@ -0,0 +1 @@ +#define IFACE_HEADER_BUILDDIR diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake index 08e81c6..201daa7 100644 --- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -7,5 +7,4 @@ run_cmake(whitelist) run_cmake(invalid_signature) run_cmake(global-interface) run_cmake(genex_link) -run_cmake(add_dependencies) run_cmake(add_custom_command-TARGET) diff --git a/Tests/RunCMake/interface_library/add_dependencies-result.txt b/Tests/RunCMake/interface_library/add_dependencies-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/interface_library/add_dependencies-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/interface_library/add_dependencies-stderr.txt b/Tests/RunCMake/interface_library/add_dependencies-stderr.txt deleted file mode 100644 index c550b68..0000000 --- a/Tests/RunCMake/interface_library/add_dependencies-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at add_dependencies.cmake:4 \(add_dependencies\): - add_dependencies Cannot add target-level dependencies to INTERFACE library - target "iface". - -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/interface_library/add_dependencies.cmake b/Tests/RunCMake/interface_library/add_dependencies.cmake deleted file mode 100644 index 12cdfb4..0000000 --- a/Tests/RunCMake/interface_library/add_dependencies.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -add_library(foo empty.cpp) -add_library(iface INTERFACE) -add_dependencies(iface foo) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=817d31db9797bfc1c6ff7e60e420532362b14463 commit 817d31db9797bfc1c6ff7e60e420532362b14463 Author: Brad King AuthorDate: Fri Mar 27 16:23:41 2015 -0400 Commit: Brad King CommitDate: Fri Mar 27 16:24:19 2015 -0400 Help: Format add_dependencies documentation Add reStructuredText markup. diff --git a/Help/command/add_dependencies.rst b/Help/command/add_dependencies.rst index 10997ec..1cbac20 100644 --- a/Help/command/add_dependencies.rst +++ b/Help/command/add_dependencies.rst @@ -7,13 +7,16 @@ Add a dependency between top-level targets. add_dependencies( []...) -Make a top-level depend on other top-level targets to ensure -that they build before does. A top-level target is one -created by ADD_EXECUTABLE, ADD_LIBRARY, or ADD_CUSTOM_TARGET. -Dependencies added to an IMPORTED target are followed transitively in -its place since the target itself does not build. +Make a top-level ```` depend on other top-level targets to +ensure that they build before ```` does. A top-level target +is one created by one of the :command:`add_executable`, +:command:`add_library`, or :command:`add_custom_target` commands. -See the DEPENDS option of ADD_CUSTOM_TARGET and ADD_CUSTOM_COMMAND for -adding file-level dependencies in custom rules. See the -OBJECT_DEPENDS option in SET_SOURCE_FILES_PROPERTIES to add file-level -dependencies to object files. +Dependencies added to an :ref:`imported target ` +are followed transitively in its place since the target itself does +not build. + +See the ``DEPENDS`` option of :command:`add_custom_target` and +:command:`add_custom_command` commands for adding file-level +dependencies in custom rules. See the :prop_sf:`OBJECT_DEPENDS` +source file property to add file-level dependencies to object files. ----------------------------------------------------------------------- Summary of changes: Help/command/add_dependencies.rst | 21 +++++++++++--------- .../dev/add_dependencies-INTERFACE-libraries.rst | 7 +++++++ Source/cmAddDependenciesCommand.cxx | 9 --------- Source/cmComputeTargetDepends.cxx | 6 ++++-- Tests/InterfaceLibrary/headerdir/CMakeLists.txt | 11 +++++++--- .../headerdir/iface_header_builddir.h.in | 1 + .../RunCMake/interface_library/RunCMakeTest.cmake | 1 - .../interface_library/add_dependencies-result.txt | 1 - .../interface_library/add_dependencies-stderr.txt | 6 ------ .../interface_library/add_dependencies.cmake | 4 ---- 10 files changed, 32 insertions(+), 35 deletions(-) create mode 100644 Help/release/dev/add_dependencies-INTERFACE-libraries.rst create mode 100644 Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in delete mode 100644 Tests/RunCMake/interface_library/add_dependencies-result.txt delete mode 100644 Tests/RunCMake/interface_library/add_dependencies-stderr.txt delete mode 100644 Tests/RunCMake/interface_library/add_dependencies.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 28 00:01:06 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 28 Mar 2015 00:01:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-524-g918fe54 Message-ID: <20150328040106.DD28CAD3CE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 918fe54c829ebb39aa6bfbbc3f4eff401047b90a (commit) from 7910cb7cfb6b8a1dd3424327d667f6df5fc60b0a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=918fe54c829ebb39aa6bfbbc3f4eff401047b90a commit 918fe54c829ebb39aa6bfbbc3f4eff401047b90a Author: Kitware Robot AuthorDate: Sat Mar 28 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Sat Mar 28 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 999182f..100894b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150327) +set(CMake_VERSION_PATCH 20150328) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From clinton at elemtech.com Sat Mar 28 00:53:45 2015 From: clinton at elemtech.com (Clinton Stimpson) Date: Sat, 28 Mar 2015 00:53:45 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1270-geb0b17c Message-ID: <20150328045345.642D7AD22E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via eb0b17c2f07271753f202b14a5e52d30f8f5430d (commit) via 68a1304235442e16d4b230800efd72dbac3c4b26 (commit) from 460cc0a18df64a920c7ce51eebd64506d31660db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb0b17c2f07271753f202b14a5e52d30f8f5430d commit eb0b17c2f07271753f202b14a5e52d30f8f5430d Merge: 460cc0a 68a1304 Author: Clinton Stimpson AuthorDate: Sat Mar 28 00:53:44 2015 -0400 Commit: CMake Topic Stage CommitDate: Sat Mar 28 00:53:44 2015 -0400 Merge topic 'cpack-archive-prefix' into next 68a13042 Enable CPack ZIP generator for CPackComponentsPrefix test. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68a1304235442e16d4b230800efd72dbac3c4b26 commit 68a1304235442e16d4b230800efd72dbac3c4b26 Author: Clinton Stimpson AuthorDate: Fri Mar 27 22:53:11 2015 -0600 Commit: Clinton Stimpson CommitDate: Fri Mar 27 22:53:11 2015 -0600 Enable CPack ZIP generator for CPackComponentsPrefix test. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b47ea1b..f2df4af 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1057,6 +1057,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-options ${build_options} -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB} -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM} + -DCPACK_BINARY_ZIP:BOOL=ON ${CPackComponents_BUILD_OPTIONS} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix") ----------------------------------------------------------------------- Summary of changes: Tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Mar 29 00:01:06 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 29 Mar 2015 00:01:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-525-gd35da54 Message-ID: <20150329040106.4AC87AD6A5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d35da548886601c6b478a0c6341aad76feb2cc94 (commit) from 918fe54c829ebb39aa6bfbbc3f4eff401047b90a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d35da548886601c6b478a0c6341aad76feb2cc94 commit d35da548886601c6b478a0c6341aad76feb2cc94 Author: Kitware Robot AuthorDate: Sun Mar 29 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Sun Mar 29 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 100894b..8f75300 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150328) +set(CMake_VERSION_PATCH 20150329) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From domen.vrankar at gmail.com Sun Mar 29 14:58:07 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Sun, 29 Mar 2015 14:58:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1272-g8f5703f Message-ID: <20150329185808.079D1AD4B3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8f5703fd6de2bb597f4b0f1397aaf3356a82cf47 (commit) via 85ec2aa184259e1da15af73094bde6ecfc7026e3 (commit) from eb0b17c2f07271753f202b14a5e52d30f8f5430d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f5703fd6de2bb597f4b0f1397aaf3356a82cf47 commit 8f5703fd6de2bb597f4b0f1397aaf3356a82cf47 Merge: eb0b17c 85ec2aa Author: Domen Vrankar AuthorDate: Sun Mar 29 14:58:06 2015 -0400 Commit: CMake Topic Stage CommitDate: Sun Mar 29 14:58:06 2015 -0400 Merge topic 'cpack-rpm-basic-symlink-handling' into next 85ec2aa1 CPack/RPM basic symlink support http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85ec2aa184259e1da15af73094bde6ecfc7026e3 commit 85ec2aa184259e1da15af73094bde6ecfc7026e3 Author: Domen Vrankar AuthorDate: Sun Mar 29 20:55:20 2015 +0200 Commit: Domen Vrankar CommitDate: Sun Mar 29 20:55:20 2015 +0200 CPack/RPM basic symlink support RPM packages can contain symbolic links to relative paths - including support for multiple relocation paths through generation of post install relocation scripts. This is basic support with limitations described in documentation. Feature is addressing mantis bug report id 15209. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 162eba7..f4c853b 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -4,6 +4,43 @@ # # The builtin (binary) CPack RPM generator (Unix only) # +# Packaging of symbolic links +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# CPackRPM supports packaging of symbolic links. +# +# :: +# +# execute_process(COMMAND ${CMAKE_COMMAND} +# -E create_symlink ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ +# DESTINATION COMPONENT libraries) +# +# Symbolic links will be optimized (paths will be shortened if possible) +# before being added to the package or if multiple relocation paths are +# detected, a post install symlink relocation script will be generated. +# +# Symbolic links may point to locations that are not packaged by the same +# package (either a different component or even not packaged at all) but +# those locations will be treated as if they were a part of the package +# while determining if symlink should be either created or present in a +# post install script - depending on relocation paths. +# +# Currenty there are a few limitations though: +# +# * Only symbolic links with relative path can be packaged. +# +# * For component based packaging component interdependency is not checked +# when processing symbolic links. Symbolic links pointing to content of +# a different component are treated the same way as if pointing to location +# that will not be packaged. +# +# * Symbolic links pointing to a location through one or more intermediate +# symbolic links will not be handled differently - if the intermediate +# symbolic link(s) is also on a relocatable path, relocating it during +# package installation may cause initial symbolic link to point to an +# invalid location. +# # Variables specific to CPack RPM generator # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # @@ -503,6 +540,301 @@ function(cpack_rpm_prepare_relocation_paths) set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE) endfunction() +function(cpack_rpm_symlink_get_relocation_prefixes LOCATION PACKAGE_PREFIXES RETURN_VARIABLE) + foreach(PKG_PREFIX IN LISTS PACKAGE_PREFIXES) + string(REGEX MATCH "^${PKG_PREFIX}/.*" FOUND_ "${LOCATION}") + if(FOUND_) + list(APPEND TMP_PREFIXES "${PKG_PREFIX}") + endif() + endforeach() + + set(${RETURN_VARIABLE} "${TMP_PREFIXES}" PARENT_SCOPE) +endfunction() + +function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) + list(LENGTH PACKAGE_PREFIXES LAST_INDEX) + set(SORTED_PACKAGE_PREFIXES "${PACKAGE_PREFIXES}") + list(SORT SORTED_PACKAGE_PREFIXES) + list(REVERSE SORTED_PACKAGE_PREFIXES) + math(EXPR LAST_INDEX ${LAST_INDEX}-1) + + foreach(SYMLINK_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${SYMLINK_INDEX} SRC_PATH) + list(FIND PACKAGE_PREFIXES "${SRC_PATH}" SYMLINK_INDEX) # reverse magic + string(LENGTH "${SRC_PATH}" SRC_PATH_LEN) + + set(PARTS_CNT 0) + set(SCRIPT_PART "if [ \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}\" != \"${SRC_PATH}\" ]; then\n") + + # both paths relocated + foreach(POINT_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) + list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic + string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) + + if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) + if("${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") + set(INDENT "") + else() + set(SCRIPT_PART "${SCRIPT_PART} if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + set(INDENT " ") + endif() + + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) + math(EXPR PARTS_CNT ${PARTS_CNT}+1) + + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}fi\n") + endforeach() + + if(NOT "${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") + set(SCRIPT_PART "${SCRIPT_PART} fi\n") + endif() + endif() + endforeach() + + # source path relocated + if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) + math(EXPR PARTS_CNT ${PARTS_CNT}+1) + + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT_PART "${SCRIPT_PART} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT_PART "${SCRIPT_PART} ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + set(SCRIPT_PART "${SCRIPT_PART} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT_PART "${SCRIPT_PART} fi\n") + endforeach() + endif() + + if(PARTS_CNT) + set(SCRIPT "${SCRIPT_PART}") + set(SCRIPT "${SCRIPT}fi\n") + endif() + endforeach() + + # point path relocated + foreach(POINT_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) + list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic + string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) + + if(_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) + set(SCRIPT "${SCRIPT}if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT "${SCRIPT} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT "${SCRIPT} ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n") + set(SCRIPT "${SCRIPT} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT "${SCRIPT} fi\n") + endforeach() + + set(SCRIPT "${SCRIPT}fi\n") + endif() + endforeach() + + # no path relocated + if(_RPM_RELOCATION_SCRIPT_X_X) + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_X) + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT "${SCRIPT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT "${SCRIPT} ln -s \"${POINT_}\" \"${SYMLINK_}\"\n") + set(SCRIPT "${SCRIPT}fi\n") + endforeach() + endif() + + set(RPM_SYMLINK_POSTINSTALL "${SCRIPT}" PARENT_SCOPE) +endfunction() + +function(cpack_rpm_symlink_add_for_relocation_script PACKAGE_PREFIXES SYMLINK SYMLINK_RELOCATION_PATHS POINT POINT_RELOCATION_PATHS) + list(LENGTH SYMLINK_RELOCATION_PATHS SYMLINK_PATHS_COUTN) + list(LENGTH POINT_RELOCATION_PATHS POINT_PATHS_COUNT) + + list(APPEND _RPM_RELOCATION_SCRIPT_PAIRS "${SYMLINK}:${POINT}") + list(LENGTH _RPM_RELOCATION_SCRIPT_PAIRS PAIR_NO) + + if(SYMLINK_PATHS_COUTN) + foreach(SYMLINK_RELOC_PATH IN LISTS SYMLINK_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${SYMLINK_RELOC_PATH}" SYMLINK_INDEX) + + # source path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X") + + foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) + + # both paths relocated + list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}") + + # point path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") + endforeach() + endforeach() + elseif(POINT_PATHS_COUNT) + foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) + + # point path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") + endforeach() + endif() + + # no path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_X "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_X") + + # place variables into parent scope + foreach(VAR IN LISTS RELOCATION_VARS) + set(${VAR} "${${VAR}}" PARENT_SCOPE) + endforeach() + set(_RPM_RELOCATION_SCRIPT_PAIRS "${_RPM_RELOCATION_SCRIPT_PAIRS}" PARENT_SCOPE) + set(REQUIRES_SYMLINK_RELOCATION_SCRIPT "true" PARENT_SCOPE) + set(DIRECTIVE "%ghost " PARENT_SCOPE) +endfunction() + +function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXES IS_RELOCATABLE) + # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir + # This is necessary to avoid duplicate files since rpmbuild does + # recursion on its own when encountering a pathname which is a directory + # which is not flagged as %dir + string(STRIP "${INSTALL_FILES_LIST}" INSTALL_FILES_LIST) + string(REPLACE "\n" ";" INSTALL_FILES_LIST + "${INSTALL_FILES_LIST}") + string(REPLACE "\"" "" INSTALL_FILES_LIST + "${INSTALL_FILES_LIST}") + string(LENGTH "${WDIR}" WDR_LEN_) + + list(SORT INSTALL_FILES_LIST) # make file order consistent on all platforms + + foreach(F IN LISTS INSTALL_FILES_LIST) + unset(DIRECTIVE) + + if(IS_SYMLINK "${WDIR}/${F}") + if(IS_RELOCATABLE) + # check that symlink has relocatable format + get_filename_component(SYMLINK_LOCATION_ "${WDIR}/${F}" DIRECTORY) + execute_process(COMMAND ls -la "${WDIR}/${F}" + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE SYMLINK_POINT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(FIND "${SYMLINK_POINT_}" "->" SYMLINK_POINT_INDEX_ REVERSE) + math(EXPR SYMLINK_POINT_INDEX_ ${SYMLINK_POINT_INDEX_}+3) + string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_) + + # get destination path + string(SUBSTRING "${SYMLINK_POINT_}" ${SYMLINK_POINT_INDEX_} ${SYMLINK_POINT_LENGTH_} SYMLINK_POINT_) + + # check if path is relative or absolute + string(SUBSTRING "${SYMLINK_POINT_}" 0 1 SYMLINK_IS_ABSOLUTE_) + + if(${SYMLINK_IS_ABSOLUTE_} STREQUAL "/") + # prevent absolute paths from having /../ or /./ section inside of them + get_filename_component(SYMLINK_POINT_ "${SYMLINK_POINT_}" ABSOLUTE) + else() + # handle relative path + get_filename_component(SYMLINK_POINT_ "${SYMLINK_LOCATION_}/${SYMLINK_POINT_}" ABSOLUTE) + endif() + + string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_) + + cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS") + cpack_rpm_symlink_get_relocation_prefixes("${SYMLINK_POINT_WD_}" "${PACKAGE_PREFIXES}" "POINT_RELOCATIONS") + + list(LENGTH SYMLINK_RELOCATIONS SYMLINK_RELOCATIONS_COUNT) + list(LENGTH POINT_RELOCATIONS POINT_RELOCATIONS_COUNT) + + if(SYMLINK_RELOCATIONS_COUNT AND POINT_RELOCATIONS_COUNT) + # find matching + foreach(SYMLINK_RELOCATION_PREFIX IN LISTS SYMLINK_RELOCATIONS) + list(FIND POINT_RELOCATIONS "${SYMLINK_RELOCATION_PREFIX}" FOUND_INDEX) + if(NOT ${FOUND_INDEX} EQUAL -1) + break() + endif() + endforeach() + + if(NOT ${FOUND_INDEX} EQUAL -1) + # symlinks have the same subpath + if(${SYMLINK_RELOCATIONS_COUNT} EQUAL 1 AND ${POINT_RELOCATIONS_COUNT} EQUAL 1) + # permanent symlink + get_filename_component(SYMLINK_LOCATION_ "${F}" DIRECTORY) + file(RELATIVE_PATH FINAL_PATH_ ${SYMLINK_LOCATION_} ${SYMLINK_POINT_WD_}) + execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${FINAL_PATH_}" "${WDIR}/${F}") + else() + # relocation subpaths + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + endif() + else() + # not on the same relocation path + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + endif() + elseif(POINT_RELOCATIONS_COUNT) + # point is relocatable + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + else() + # is not relocatable or points to non relocatable path - permanent symlink + execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${SYMLINK_POINT_WD_}" "${WDIR}/${F}") + endif() + endif() + elseif(IS_DIRECTORY "${WDIR}/${F}") + set(DIRECTIVE "%dir ") + endif() + + set(INSTALL_FILES "${INSTALL_FILES}${DIRECTIVE}\"${F}\"\n") + endforeach() + + if(REQUIRES_SYMLINK_RELOCATION_SCRIPT) + cpack_rpm_symlink_create_relocation_script("${PACKAGE_PREFIXES}") + endif() + + set(RPM_SYMLINK_POSTINSTALL "${RPM_SYMLINK_POSTINSTALL}" PARENT_SCOPE) + set(CPACK_RPM_INSTALL_FILES "${INSTALL_FILES}" PARENT_SCOPE) +endfunction() + if(CMAKE_BINARY_DIR) message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") endif() @@ -963,9 +1295,10 @@ function(cpack_rpm_generate_package) # destinct parent paths of other relocation paths and remove the # final element (so the install-prefix dir itself is not omitted # from the RPM's content-list) - list(SORT RPM_USED_PACKAGE_PREFIXES) + set(SORTED_RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}") + list(SORT SORTED_RPM_USED_PACKAGE_PREFIXES) set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) + foreach(_RPM_RELOCATION_PREFIX ${SORTED_RPM_USED_PACKAGE_PREFIXES}) if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") @@ -1142,25 +1475,13 @@ function(cpack_rpm_generate_package) set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") endif() - - # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir - # This is necessary to avoid duplicate files since rpmbuild do - # recursion on its own when encountering a pathname which is a directory - # which is not flagged as %dir - string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) - string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - set(CPACK_RPM_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - if(IS_DIRECTORY "${WDIR}/${F}") - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n") - else() - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") - endif() - endforeach() - set(CPACK_RPM_INSTALL_FILES_LIST "") + # Prepare install files + cpack_rpm_prepare_install_files( + "${CPACK_RPM_INSTALL_FILES}" + "${WDIR}" + "${RPM_USED_PACKAGE_PREFIXES}" + "${CPACK_RPM_PACKAGE_RELOCATABLE}" + ) # The name of the final spec file to be used by rpmbuild set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") @@ -1246,6 +1567,7 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %clean %post +\@RPM_SYMLINK_POSTINSTALL\@ \@CPACK_RPM_SPEC_POSTINSTALL\@ %postun diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 51af297..b172f83 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -49,6 +49,42 @@ install(FILES mylib.h DESTINATION include COMPONENT headers) +# Package symbolic links +install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) +install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable/bar COMPONENT libraries) +install(DIRECTORY DESTINATION other_relocatable/depth_two COMPONENT libraries) +install(DIRECTORY DESTINATION non_relocatable/depth_two COMPONENT libraries) +# test symbolic links to same dir +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink depth_three symlink_samedir_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +# test symbolic links to same dir with current dir ./ prefix +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./depth_three symlink_samedir_path_current_dir) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_current_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +# test symbolic links to same dir with longer relative path +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../${CMAKE_INSTALL_LIBDIR}/.././${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two/depth_three symlink_samedir_path_longer) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_longer DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +# test symbolic links to sub dir +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three symlink_subdir_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_subdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one COMPONENT libraries) +# test symbolic links to parent dir +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two symlink_parentdir_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_parentdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) +# test symbolic link to another relocatable path +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././.././../other_relocatable/./depth_two symlink_other_relocatable_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_other_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) +# test symbolic link to non relocatable path +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../non_relocatable/./depth_two symlink_to_non_relocatable_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) +# test symbolic link from non relocatable path +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two symlink_from_non_relocatable_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_from_non_relocatable_path DESTINATION non_relocatable/depth_two COMPONENT libraries) +# test symbolic link relocatable path to its relocatable subpath +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../inside_relocatable_two/depth_two/different_relocatable/bar symlink_relocatable_subpath) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_relocatable_subpath DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +# test symbolic link to location outside package +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./outside_package symlink_outside_package) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_package DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # CPack boilerplate for this project set(CPACK_PACKAGE_NAME "MyLib") set(CPACK_PACKAGE_CONTACT "None") @@ -114,7 +150,8 @@ set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) # can not be used in CPack scripts due to CMAKE_SIZEOF_VOID_P # variable not being set set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}" - "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}") + "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}" "other_relocatable" + "${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable") # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index cf4da74..e747052 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -1,3 +1,7 @@ +# prevent older policies from interfearing with this script +cmake_policy(PUSH) +cmake_policy(VERSION ${CMAKE_VERSION}) + message(STATUS "=============================================================================") message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") message(STATUS "") @@ -138,6 +142,7 @@ if(CPackGen MATCHES "RPM") "An extremely useful application that makes use of MyLib") set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Static libraries used to build programs with MyLib") + set(LIB_SUFFIX "6?4?") # test package info if(${CPackComponentWay} STREQUAL "IgnoreGroup") @@ -174,10 +179,32 @@ if(CPackGen MATCHES "RPM") if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/other_relocatable${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable") set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") - set(check_content_list "^/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") + set(check_content_list "^/usr/foo/bar/lib${LIB_SUFFIX} +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three/symlink_parentdir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_outside_package +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_relocatable_subpath +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_current_dir +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_longer +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/symlink_subdir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable/bar +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_other_relocatable_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_to_non_relocatable_path +/usr/foo/bar/lib${LIB_SUFFIX}/libmylib.a +/usr/foo/bar/non_relocatable +/usr/foo/bar/non_relocatable/depth_two +/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path +/usr/foo/bar/other_relocatable +/usr/foo/bar/other_relocatable/depth_two$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") @@ -188,10 +215,12 @@ if(CPackGen MATCHES "RPM") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}.*") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") set(check_file_match_expected_architecture "armv7hf") set(spec_regex "*applications*") - set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$") + set(check_content_list "^/usr/foo/bar +/usr/foo/bar/bin +/usr/foo/bar/bin/mylibapp$") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") @@ -269,5 +298,59 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'") endif() endforeach() + + ####################### + # verify generated symbolic links + ####################### + file(GLOB_RECURSE symlink_files RELATIVE "${CPackComponentsForAll_BINARY_DIR}" "${CPackComponentsForAll_BINARY_DIR}/*/symlink_*") + + foreach(check_symlink IN LISTS symlink_files) + get_filename_component(symlink_name "${check_symlink}" NAME) + execute_process(COMMAND ls -la "${check_symlink}" + WORKING_DIRECTORY "${CPackComponentsForAll_BINARY_DIR}" + OUTPUT_VARIABLE SYMLINK_POINT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if("${symlink_name}" STREQUAL "symlink_samedir_path" + OR "${symlink_name}" STREQUAL "symlink_samedir_path_current_dir" + OR "${symlink_name}" STREQUAL "symlink_samedir_path_longer") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_three$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_subdir_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_two/depth_three$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_parentdir_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}../$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_to_non_relocatable_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/non_relocatable/depth_two$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_outside_package") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}outside_package$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_other_relocatable_path" + OR "${symlink_name}" STREQUAL "symlink_from_non_relocatable_path" + OR "${symlink_name}" STREQUAL "symlink_relocatable_subpath") + # these links were not canged - post install script only - ignore them + else() + message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'") + endif() + + if(NOT check_symlink) + message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'") + endif() + endforeach() + + # verify post install symlink relocation script + file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/*libraries*.spec") + file(READ ${spec_file} spec_file_content) + file(READ "${CMAKE_CURRENT_LIST_DIR}/symlink_postinstall_expected.txt" symlink_postinstall_expected) + # prepare regex + string(STRIP "${symlink_postinstall_expected}" symlink_postinstall_expected) + string(REPLACE "[" "\\[" symlink_postinstall_expected "${symlink_postinstall_expected}") + string(REPLACE "$" "\\$" symlink_postinstall_expected "${symlink_postinstall_expected}") + string(REPLACE "lib" "lib${LIB_SUFFIX}" symlink_postinstall_expected "${symlink_postinstall_expected}") + # compare + string(REGEX MATCH ".*${symlink_postinstall_expected}.*" symlink_postinstall_expected_matches "${spec_file_content}") + if(NOT symlink_postinstall_expected_matches) + message(FATAL_ERROR "error: unexpected rpm symbolic link postinstall script! generated spec file: '${spec_file_content}'") + endif() endif() endif() + +cmake_policy(POP) diff --git a/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt b/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt new file mode 100644 index 0000000..ba46792 --- /dev/null +++ b/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt @@ -0,0 +1,57 @@ +if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then + if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "$RPM_INSTALL_PREFIX1/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi + fi + if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX2/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "/usr/foo/bar/other_relocatable/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi +fi +if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "$RPM_INSTALL_PREFIX1/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi +fi +if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX2/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi +fi +if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_2=true + fi +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "/usr/foo/bar/other_relocatable/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" +fi ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 364 ++++++++++++++++++-- Tests/CPackComponentsForAll/CMakeLists.txt | 39 ++- .../RunCPackVerifyResult.cmake | 91 ++++- .../symlink_postinstall_expected.txt | 57 +++ 4 files changed, 525 insertions(+), 26 deletions(-) create mode 100644 Tests/CPackComponentsForAll/symlink_postinstall_expected.txt hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 30 00:01:05 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 30 Mar 2015 00:01:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-526-g6474f0e Message-ID: <20150330040105.82238AD13D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 6474f0e2635e13bfa2592ad6ed2d3e026353955a (commit) from d35da548886601c6b478a0c6341aad76feb2cc94 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6474f0e2635e13bfa2592ad6ed2d3e026353955a commit 6474f0e2635e13bfa2592ad6ed2d3e026353955a Author: Kitware Robot AuthorDate: Mon Mar 30 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Mon Mar 30 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8f75300..ef2842a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150329) +set(CMake_VERSION_PATCH 20150330) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:24:51 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:24:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1274-gd17b49b Message-ID: <20150330132451.1F13BAD7A3@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via d17b49beb5e39da975f284a9ac5735c333bc9e2c (commit) via e3f84fc504e96d1bdbc9c70434135903c449bdd1 (commit) from 8f5703fd6de2bb597f4b0f1397aaf3356a82cf47 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d17b49beb5e39da975f284a9ac5735c333bc9e2c commit d17b49beb5e39da975f284a9ac5735c333bc9e2c Merge: 8f5703f e3f84fc Author: Brad King AuthorDate: Mon Mar 30 09:24:50 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 09:24:50 2015 -0400 Merge topic 'cpack-archive-prefix' into next e3f84fc5 cpack: Fix CPACK_PACKAGING_INSTALL_PREFIX handling for archives (#14677) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e3f84fc504e96d1bdbc9c70434135903c449bdd1 commit e3f84fc504e96d1bdbc9c70434135903c449bdd1 Author: Clinton Stimpson AuthorDate: Wed Mar 25 22:36:38 2015 -0600 Commit: Brad King CommitDate: Mon Mar 30 09:22:14 2015 -0400 cpack: Fix CPACK_PACKAGING_INSTALL_PREFIX handling for archives (#14677) Fix the case when the archive generator is used to package components with an install prefix. diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index e2437b5..05b5cd9 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -63,6 +63,14 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME"); filePrefix += "/"; } + const char* installPrefix = + this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); + if(installPrefix && installPrefix[0] == '/' && installPrefix[1] != 0) + { + // add to file prefix and remove the leading '/' + filePrefix += installPrefix+1; + filePrefix += "/"; + } std::vector::const_iterator fileIt; for (fileIt = component->Files.begin(); fileIt != component->Files.end(); ++fileIt ) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 41032f8..f2df4af 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -862,6 +862,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK}) set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) + set(CTEST_RUN_CPackComponentsPrefix ${CTEST_TEST_CPACK}) # Do not try to build RPM if (NOT RPMBUILD_EXECUTABLE) @@ -1035,6 +1036,33 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators") endif() + if(CTEST_RUN_CPackComponentsPrefix) + set(CPackComponents_BUILD_OPTIONS) + if(APPLE) + set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) + endif() + if(NOT NSIS_MAKENSIS_EXECUTABLE) + set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} + -DCPACK_BINARY_NSIS:BOOL=OFF) + endif() + + add_test(CPackComponentsPrefix ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackComponentsPrefix" + "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix" + ${build_generator_args} + --build-project CPackComponentsPrefix + --build-two-config + --build-target package + --build-options ${build_options} + -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB} + -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM} + -DCPACK_BINARY_ZIP:BOOL=ON + ${CPackComponents_BUILD_OPTIONS} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix") + endif() + if(CTEST_package_X11_TEST) set(X11_build_target_arg --build-target package) else() diff --git a/Tests/CPackComponentsPrefix/CMakeLists.txt b/Tests/CPackComponentsPrefix/CMakeLists.txt new file mode 100644 index 0000000..207dae8 --- /dev/null +++ b/Tests/CPackComponentsPrefix/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.2) +project(CPackComponentsPrefix NONE) + +install(FILES file-runtime.txt + DESTINATION bin COMPONENT Runtime) +install(FILES file-development.txt + DESTINATION lib COMPONENT Development) + +set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 1) +set(CPACK_COMPONENTS_ALL Development) +set(CPACK_ARCHIVE_COMPONENT_INSTALL 1) +set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/My-1.0") +include(CPack) diff --git a/Tests/CPackComponentsPrefix/file-development.txt b/Tests/CPackComponentsPrefix/file-development.txt new file mode 100644 index 0000000..df22d2f --- /dev/null +++ b/Tests/CPackComponentsPrefix/file-development.txt @@ -0,0 +1 @@ +This file is installed with the Development component. diff --git a/Tests/CPackComponentsPrefix/file-runtime.txt b/Tests/CPackComponentsPrefix/file-runtime.txt new file mode 100644 index 0000000..135c13d --- /dev/null +++ b/Tests/CPackComponentsPrefix/file-runtime.txt @@ -0,0 +1 @@ +This file is installed with the Runtime component. ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:27:43 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:27:43 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-529-gaa15ef8 Message-ID: <20150330132743.5DAC3AD8B0@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via aa15ef8a840f1451cf88040f1e3ab8ee0fce87fb (commit) via e680d43d7dd96096962379f627828a182ac0fa80 (commit) via a4a1b729c63ec81037af06ac1009d12cc1dc3188 (commit) from 6474f0e2635e13bfa2592ad6ed2d3e026353955a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aa15ef8a840f1451cf88040f1e3ab8ee0fce87fb commit aa15ef8a840f1451cf88040f1e3ab8ee0fce87fb Merge: 6474f0e e680d43 Author: Brad King AuthorDate: Mon Mar 30 09:27:42 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 09:27:42 2015 -0400 Merge topic 'clean-scanbuild-warnings' e680d43d Fix an unused variable warning from scanbuild. a4a1b729 Fix warnings from clang scanbuild. ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackDebGenerator.cxx | 5 +++++ Source/cmCTest.cxx | 27 +++++++++++++++++++-------- Source/cmFileCommand.cxx | 1 + Source/cmFindPackageCommand.cxx | 2 -- Source/cmMakefile.cxx | 8 ++++++-- Source/cmSetTargetPropertiesCommand.cxx | 10 +--------- Source/cmSetTestsPropertiesCommand.cxx | 11 +---------- 7 files changed, 33 insertions(+), 31 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:27:46 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:27:46 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-531-g136a534 Message-ID: <20150330132746.70E99AD8B8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 136a534f7242e7a0352763158c4807b616860df8 (commit) via 98a3b2e29ece5195e7948681a410bc5fae880a23 (commit) from aa15ef8a840f1451cf88040f1e3ab8ee0fce87fb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=136a534f7242e7a0352763158c4807b616860df8 commit 136a534f7242e7a0352763158c4807b616860df8 Merge: aa15ef8 98a3b2e Author: Brad King AuthorDate: Mon Mar 30 09:27:45 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 09:27:45 2015 -0400 Merge topic 'wix-fix-utf8' 98a3b2e2 CPackWIX: Omit codepage conversion when internal encoding is already UTF-8. ----------------------------------------------------------------------- Summary of changes: Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- Source/CPack/WiX/cmWIXSourceWriter.cxx | 10 ++++++++-- Source/CPack/WiX/cmWIXSourceWriter.h | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:27:48 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:27:48 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-534-gac6297e Message-ID: <20150330132748.46904AD8BB@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ac6297ea3859ff552bce76f68110afc2e9678d9c (commit) via b76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87 (commit) via 9e14a5dee2b7ec420fcfea49c2f2f41da84e2cbf (commit) from 136a534f7242e7a0352763158c4807b616860df8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac6297ea3859ff552bce76f68110afc2e9678d9c commit ac6297ea3859ff552bce76f68110afc2e9678d9c Merge: 136a534 b76b52c Author: Brad King AuthorDate: Mon Mar 30 09:27:47 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 09:27:47 2015 -0400 Merge topic 'xcode-default-ARCHS' b76b52c0 Xcode: Set ARCHS only when CMAKE_OSX_ARCHITECTURES is specified (#14736) 9e14a5de cmGlobalXCodeGenerator: Simplify ARCHS list with cmJoin ----------------------------------------------------------------------- Summary of changes: Modules/CompilerId/Xcode-3.pbxproj.in | 1 - Source/cmGlobalXCodeGenerator.cxx | 61 ++++++++++++--------------------- 2 files changed, 21 insertions(+), 41 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:27:50 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:27:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-537-g8bc6cfd Message-ID: <20150330132750.4D136AD8BF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 8bc6cfd72717cbb1166b8aecb38d52d663006284 (commit) via 230f2d6e7060e70b7205fc65f6bee7ce37e3f27b (commit) via 564c07f7dd819d9ea070b22ad16849d3be6bb89a (commit) from ac6297ea3859ff552bce76f68110afc2e9678d9c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8bc6cfd72717cbb1166b8aecb38d52d663006284 commit 8bc6cfd72717cbb1166b8aecb38d52d663006284 Merge: ac6297e 230f2d6 Author: Brad King AuthorDate: Mon Mar 30 09:27:48 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 09:27:48 2015 -0400 Merge topic 'ExternalData-recursive-match' 230f2d6e ExternalData: Add option to recursively match under directories 564c07f7 ExternalData: Parameterize internal file(GLOB) operation selection ----------------------------------------------------------------------- Summary of changes: Help/release/dev/ExternalData-recursive-match.rst | 7 ++++ Modules/ExternalData.cmake | 35 ++++++++++++++++---- Tests/Module/ExternalData/CMakeLists.txt | 1 + Tests/Module/ExternalData/Data1Check.cmake | 6 ++++ .../{Directory => DirRecurse}/A.dat.md5 | 0 .../{Directory => DirRecurse}/B.dat.md5 | 0 .../{Directory => DirRecurse}/C.dat.md5 | 0 .../{Directory => DirRecurse/Sub1}/A.dat.md5 | 0 .../{Directory => DirRecurse/Sub1}/B.dat.md5 | 0 .../{Directory => DirRecurse/Sub1}/C.dat.md5 | 0 .../{Directory => DirRecurse/Sub2/Dir}/A.dat.md5 | 0 .../{Directory => DirRecurse/Sub2/Dir}/B.dat.md5 | 0 .../{Directory => DirRecurse/Sub2/Dir}/C.dat.md5 | 0 .../BadRecurse1-result.txt} | 0 ...adSeries3-stderr.txt => BadRecurse1-stderr.txt} | 4 +-- Tests/RunCMake/ExternalData/BadRecurse1.cmake | 2 ++ .../BadRecurse2-result.txt} | 0 ...adSeries3-stderr.txt => BadRecurse2-stderr.txt} | 4 +-- Tests/RunCMake/ExternalData/BadRecurse2.cmake | 2 ++ .../BadRecurse3-result.txt} | 0 ...adOption2-stderr.txt => BadRecurse3-stderr.txt} | 6 ++-- Tests/RunCMake/ExternalData/BadRecurse3.cmake | 2 ++ Tests/RunCMake/ExternalData/RunCMakeTest.cmake | 3 ++ 23 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 Help/release/dev/ExternalData-recursive-match.rst copy Tests/Module/ExternalData/{Directory => DirRecurse}/A.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse}/B.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse}/C.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub1}/A.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub1}/B.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub1}/C.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub2/Dir}/A.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub2/Dir}/B.dat.md5 (100%) copy Tests/Module/ExternalData/{Directory => DirRecurse/Sub2/Dir}/C.dat.md5 (100%) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => ExternalData/BadRecurse1-result.txt} (100%) copy Tests/RunCMake/ExternalData/{BadSeries3-stderr.txt => BadRecurse1-stderr.txt} (54%) create mode 100644 Tests/RunCMake/ExternalData/BadRecurse1.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => ExternalData/BadRecurse2-result.txt} (100%) copy Tests/RunCMake/ExternalData/{BadSeries3-stderr.txt => BadRecurse2-stderr.txt} (54%) create mode 100644 Tests/RunCMake/ExternalData/BadRecurse2.cmake copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => ExternalData/BadRecurse3-result.txt} (100%) copy Tests/RunCMake/ExternalData/{BadOption2-stderr.txt => BadRecurse3-stderr.txt} (50%) create mode 100644 Tests/RunCMake/ExternalData/BadRecurse3.cmake hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:27:52 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:27:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-539-ga3bdb55 Message-ID: <20150330132752.70A53AD8B8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a3bdb5578d54894832195fa29308ceb6b4ceed93 (commit) via 4d08e6b6dd21658bdcdc4dc1cd2a2b03d377d531 (commit) from 8bc6cfd72717cbb1166b8aecb38d52d663006284 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3bdb5578d54894832195fa29308ceb6b4ceed93 commit a3bdb5578d54894832195fa29308ceb6b4ceed93 Merge: 8bc6cfd 4d08e6b Author: Brad King AuthorDate: Mon Mar 30 09:27:51 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 09:27:51 2015 -0400 Merge topic 'ninja-autogen' 4d08e6b6 QtAutogen: Fix rcc rebuild with Ninja generator (#15459) ----------------------------------------------------------------------- Summary of changes: Source/cmQtAutoGenerators.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:27:54 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:27:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-542-gc117c2b Message-ID: <20150330132754.7FE23AD8B9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c117c2bb5ef162dfa7d4cb2eb1acd0ee48c06297 (commit) via ac14cbf01710c08e9bf31670cf40d88512b55752 (commit) via 817d31db9797bfc1c6ff7e60e420532362b14463 (commit) from a3bdb5578d54894832195fa29308ceb6b4ceed93 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c117c2bb5ef162dfa7d4cb2eb1acd0ee48c06297 commit c117c2bb5ef162dfa7d4cb2eb1acd0ee48c06297 Merge: a3bdb55 ac14cbf Author: Brad King AuthorDate: Mon Mar 30 09:27:53 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 09:27:53 2015 -0400 Merge topic 'add_dependencies-INTERFACE-libraries' ac14cbf0 Allow add_dependencies() on INTERFACE libraries (#15414) 817d31db Help: Format add_dependencies documentation ----------------------------------------------------------------------- Summary of changes: Help/command/add_dependencies.rst | 21 +++++++++++--------- .../dev/add_dependencies-INTERFACE-libraries.rst | 7 +++++++ Source/cmAddDependenciesCommand.cxx | 9 --------- Source/cmComputeTargetDepends.cxx | 6 ++++-- Tests/InterfaceLibrary/headerdir/CMakeLists.txt | 11 +++++++--- .../headerdir/iface_header_builddir.h.in | 1 + .../RunCMake/interface_library/RunCMakeTest.cmake | 1 - .../interface_library/add_dependencies-result.txt | 1 - .../interface_library/add_dependencies-stderr.txt | 6 ------ .../interface_library/add_dependencies.cmake | 4 ---- 10 files changed, 32 insertions(+), 35 deletions(-) create mode 100644 Help/release/dev/add_dependencies-INTERFACE-libraries.rst create mode 100644 Tests/InterfaceLibrary/headerdir/iface_header_builddir.h.in delete mode 100644 Tests/RunCMake/interface_library/add_dependencies-result.txt delete mode 100644 Tests/RunCMake/interface_library/add_dependencies-stderr.txt delete mode 100644 Tests/RunCMake/interface_library/add_dependencies.cmake hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:27:56 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:27:56 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-544-gc1f8c6c Message-ID: <20150330132756.8C6A3AD7A9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via c1f8c6cdf94d650df1bd8ec847ae7ac453550978 (commit) via e3f84fc504e96d1bdbc9c70434135903c449bdd1 (commit) from c117c2bb5ef162dfa7d4cb2eb1acd0ee48c06297 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1f8c6cdf94d650df1bd8ec847ae7ac453550978 commit c1f8c6cdf94d650df1bd8ec847ae7ac453550978 Merge: c117c2b e3f84fc Author: Brad King AuthorDate: Mon Mar 30 09:27:55 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 09:27:55 2015 -0400 Merge topic 'cpack-archive-prefix' e3f84fc5 cpack: Fix CPACK_PACKAGING_INSTALL_PREFIX handling for archives (#14677) ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackArchiveGenerator.cxx | 8 +++++++ Tests/CMakeLists.txt | 28 ++++++++++++++++++++++ Tests/CPackComponentsPrefix/CMakeLists.txt | 13 ++++++++++ Tests/CPackComponentsPrefix/file-development.txt | 1 + Tests/CPackComponentsPrefix/file-runtime.txt | 1 + 5 files changed, 51 insertions(+) create mode 100644 Tests/CPackComponentsPrefix/CMakeLists.txt create mode 100644 Tests/CPackComponentsPrefix/file-development.txt create mode 100644 Tests/CPackComponentsPrefix/file-runtime.txt hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:28:22 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:28:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1285-gf6c6c3a Message-ID: <20150330132822.437CBAD8CE@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f6c6c3af25e552820104f16381f0b1c385b6a7b6 (commit) via c1f8c6cdf94d650df1bd8ec847ae7ac453550978 (commit) via c117c2bb5ef162dfa7d4cb2eb1acd0ee48c06297 (commit) via a3bdb5578d54894832195fa29308ceb6b4ceed93 (commit) via 8bc6cfd72717cbb1166b8aecb38d52d663006284 (commit) via ac6297ea3859ff552bce76f68110afc2e9678d9c (commit) via 136a534f7242e7a0352763158c4807b616860df8 (commit) via aa15ef8a840f1451cf88040f1e3ab8ee0fce87fb (commit) via 6474f0e2635e13bfa2592ad6ed2d3e026353955a (commit) via d35da548886601c6b478a0c6341aad76feb2cc94 (commit) via 918fe54c829ebb39aa6bfbbc3f4eff401047b90a (commit) from d17b49beb5e39da975f284a9ac5735c333bc9e2c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6c6c3af25e552820104f16381f0b1c385b6a7b6 commit f6c6c3af25e552820104f16381f0b1c385b6a7b6 Merge: d17b49b c1f8c6c Author: Brad King AuthorDate: Mon Mar 30 09:28:11 2015 -0400 Commit: Brad King CommitDate: Mon Mar 30 09:28:11 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 09:39:15 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 09:39:15 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1287-g1be2f68 Message-ID: <20150330133915.C8E9D117D5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1be2f68af5206a0dc742449a71e6e5611de50df0 (commit) via b372a99a130ec89561b2ad8d3147298dff3cf4df (commit) from f6c6c3af25e552820104f16381f0b1c385b6a7b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1be2f68af5206a0dc742449a71e6e5611de50df0 commit 1be2f68af5206a0dc742449a71e6e5611de50df0 Merge: f6c6c3a b372a99 Author: Brad King AuthorDate: Mon Mar 30 09:39:15 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 09:39:15 2015 -0400 Merge topic 'UseSWIG-no-MAIN_DEPENDENCY' into next b372a99a UseSWIG: Do not use MAIN_DEPENDENCY on custom commands (#15480) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b372a99a130ec89561b2ad8d3147298dff3cf4df commit b372a99a130ec89561b2ad8d3147298dff3cf4df Author: Felix Schwitzer AuthorDate: Thu Mar 26 21:03:20 2015 +0100 Commit: Brad King CommitDate: Mon Mar 30 09:35:43 2015 -0400 UseSWIG: Do not use MAIN_DEPENDENCY on custom commands (#15480) Add the dependency on the main swig input source file as a normal DEPENDS option. We cannot use MAIN_DEPENDENCY because if there are multiple target languages then multiple custom commands would want to use the same MAIN_DEPENDENCY, but at most one custom command may specify a given source file as its MAIN_DEPENDENCY. Exposed by a CMP0057 warning. diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 7939b1f..7423418 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -204,8 +204,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) ${swig_include_dirs} -o "${swig_generated_file_fullname}" "${swig_source_file_fullname}" - MAIN_DEPENDENCY "${swig_source_file_fullname}" - DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS} + DEPENDS "${swig_source_file_fullname}" ${SWIG_MODULE_${name}_EXTRA_DEPS} COMMENT "Swig source") set_source_files_properties("${swig_generated_file_fullname}" ${swig_extra_generated_files} PROPERTIES GENERATED 1) ----------------------------------------------------------------------- Summary of changes: Modules/UseSWIG.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Mon Mar 30 10:25:21 2015 From: brad.king at kitware.com (Brad King) Date: Mon, 30 Mar 2015 10:25:21 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1289-gbab6126 Message-ID: <20150330142521.ACD77AD7FF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via bab6126b2210146bbe068bd245b9d84044d3200d (commit) via 25095d3c42d46ba76caebcad267f3afa8c54b731 (commit) from 1be2f68af5206a0dc742449a71e6e5611de50df0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bab6126b2210146bbe068bd245b9d84044d3200d commit bab6126b2210146bbe068bd245b9d84044d3200d Merge: 1be2f68 25095d3 Author: Brad King AuthorDate: Mon Mar 30 10:25:20 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 10:25:20 2015 -0400 Merge topic 'cpack-rpm-basic-symlink-handling' into next 25095d3c Revert "CPack/RPM basic symlink support" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25095d3c42d46ba76caebcad267f3afa8c54b731 commit 25095d3c42d46ba76caebcad267f3afa8c54b731 Author: Brad King AuthorDate: Mon Mar 30 10:24:40 2015 -0400 Commit: Brad King CommitDate: Mon Mar 30 10:24:40 2015 -0400 Revert "CPack/RPM basic symlink support" This reverts commit 85ec2aa184259e1da15af73094bde6ecfc7026e3. It needs to be updated to not use symlinks on Windows. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index f4c853b..162eba7 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -4,43 +4,6 @@ # # The builtin (binary) CPack RPM generator (Unix only) # -# Packaging of symbolic links -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# CPackRPM supports packaging of symbolic links. -# -# :: -# -# execute_process(COMMAND ${CMAKE_COMMAND} -# -E create_symlink ) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ -# DESTINATION COMPONENT libraries) -# -# Symbolic links will be optimized (paths will be shortened if possible) -# before being added to the package or if multiple relocation paths are -# detected, a post install symlink relocation script will be generated. -# -# Symbolic links may point to locations that are not packaged by the same -# package (either a different component or even not packaged at all) but -# those locations will be treated as if they were a part of the package -# while determining if symlink should be either created or present in a -# post install script - depending on relocation paths. -# -# Currenty there are a few limitations though: -# -# * Only symbolic links with relative path can be packaged. -# -# * For component based packaging component interdependency is not checked -# when processing symbolic links. Symbolic links pointing to content of -# a different component are treated the same way as if pointing to location -# that will not be packaged. -# -# * Symbolic links pointing to a location through one or more intermediate -# symbolic links will not be handled differently - if the intermediate -# symbolic link(s) is also on a relocatable path, relocating it during -# package installation may cause initial symbolic link to point to an -# invalid location. -# # Variables specific to CPack RPM generator # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # @@ -540,301 +503,6 @@ function(cpack_rpm_prepare_relocation_paths) set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE) endfunction() -function(cpack_rpm_symlink_get_relocation_prefixes LOCATION PACKAGE_PREFIXES RETURN_VARIABLE) - foreach(PKG_PREFIX IN LISTS PACKAGE_PREFIXES) - string(REGEX MATCH "^${PKG_PREFIX}/.*" FOUND_ "${LOCATION}") - if(FOUND_) - list(APPEND TMP_PREFIXES "${PKG_PREFIX}") - endif() - endforeach() - - set(${RETURN_VARIABLE} "${TMP_PREFIXES}" PARENT_SCOPE) -endfunction() - -function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) - list(LENGTH PACKAGE_PREFIXES LAST_INDEX) - set(SORTED_PACKAGE_PREFIXES "${PACKAGE_PREFIXES}") - list(SORT SORTED_PACKAGE_PREFIXES) - list(REVERSE SORTED_PACKAGE_PREFIXES) - math(EXPR LAST_INDEX ${LAST_INDEX}-1) - - foreach(SYMLINK_INDEX RANGE ${LAST_INDEX}) - list(GET SORTED_PACKAGE_PREFIXES ${SYMLINK_INDEX} SRC_PATH) - list(FIND PACKAGE_PREFIXES "${SRC_PATH}" SYMLINK_INDEX) # reverse magic - string(LENGTH "${SRC_PATH}" SRC_PATH_LEN) - - set(PARTS_CNT 0) - set(SCRIPT_PART "if [ \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}\" != \"${SRC_PATH}\" ]; then\n") - - # both paths relocated - foreach(POINT_INDEX RANGE ${LAST_INDEX}) - list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) - list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic - string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) - - if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) - if("${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") - set(INDENT "") - else() - set(SCRIPT_PART "${SCRIPT_PART} if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") - set(INDENT " ") - endif() - - foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) - math(EXPR PARTS_CNT ${PARTS_CNT}+1) - - math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) - list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) - string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) - - math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) - - math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - - set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") - set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") - set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}fi\n") - endforeach() - - if(NOT "${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") - set(SCRIPT_PART "${SCRIPT_PART} fi\n") - endif() - endif() - endforeach() - - # source path relocated - if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) - foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) - math(EXPR PARTS_CNT ${PARTS_CNT}+1) - - math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) - list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) - string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) - - math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) - - math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - - set(SCRIPT_PART "${SCRIPT_PART} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - set(SCRIPT_PART "${SCRIPT_PART} ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") - set(SCRIPT_PART "${SCRIPT_PART} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") - set(SCRIPT_PART "${SCRIPT_PART} fi\n") - endforeach() - endif() - - if(PARTS_CNT) - set(SCRIPT "${SCRIPT_PART}") - set(SCRIPT "${SCRIPT}fi\n") - endif() - endforeach() - - # point path relocated - foreach(POINT_INDEX RANGE ${LAST_INDEX}) - list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) - list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic - string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) - - if(_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) - set(SCRIPT "${SCRIPT}if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") - - foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) - math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) - list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) - string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) - - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) - - math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - - set(SCRIPT "${SCRIPT} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - set(SCRIPT "${SCRIPT} ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n") - set(SCRIPT "${SCRIPT} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") - set(SCRIPT "${SCRIPT} fi\n") - endforeach() - - set(SCRIPT "${SCRIPT}fi\n") - endif() - endforeach() - - # no path relocated - if(_RPM_RELOCATION_SCRIPT_X_X) - foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_X) - math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) - list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) - string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) - - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) - - math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - - set(SCRIPT "${SCRIPT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - set(SCRIPT "${SCRIPT} ln -s \"${POINT_}\" \"${SYMLINK_}\"\n") - set(SCRIPT "${SCRIPT}fi\n") - endforeach() - endif() - - set(RPM_SYMLINK_POSTINSTALL "${SCRIPT}" PARENT_SCOPE) -endfunction() - -function(cpack_rpm_symlink_add_for_relocation_script PACKAGE_PREFIXES SYMLINK SYMLINK_RELOCATION_PATHS POINT POINT_RELOCATION_PATHS) - list(LENGTH SYMLINK_RELOCATION_PATHS SYMLINK_PATHS_COUTN) - list(LENGTH POINT_RELOCATION_PATHS POINT_PATHS_COUNT) - - list(APPEND _RPM_RELOCATION_SCRIPT_PAIRS "${SYMLINK}:${POINT}") - list(LENGTH _RPM_RELOCATION_SCRIPT_PAIRS PAIR_NO) - - if(SYMLINK_PATHS_COUTN) - foreach(SYMLINK_RELOC_PATH IN LISTS SYMLINK_RELOCATION_PATHS) - list(FIND PACKAGE_PREFIXES "${SYMLINK_RELOC_PATH}" SYMLINK_INDEX) - - # source path relocated - list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X") - - foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) - list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) - - # both paths relocated - list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX} "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}") - - # point path relocated - list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") - endforeach() - endforeach() - elseif(POINT_PATHS_COUNT) - foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) - list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) - - # point path relocated - list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") - endforeach() - endif() - - # no path relocated - list(APPEND _RPM_RELOCATION_SCRIPT_X_X "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_X") - - # place variables into parent scope - foreach(VAR IN LISTS RELOCATION_VARS) - set(${VAR} "${${VAR}}" PARENT_SCOPE) - endforeach() - set(_RPM_RELOCATION_SCRIPT_PAIRS "${_RPM_RELOCATION_SCRIPT_PAIRS}" PARENT_SCOPE) - set(REQUIRES_SYMLINK_RELOCATION_SCRIPT "true" PARENT_SCOPE) - set(DIRECTIVE "%ghost " PARENT_SCOPE) -endfunction() - -function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXES IS_RELOCATABLE) - # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir - # This is necessary to avoid duplicate files since rpmbuild does - # recursion on its own when encountering a pathname which is a directory - # which is not flagged as %dir - string(STRIP "${INSTALL_FILES_LIST}" INSTALL_FILES_LIST) - string(REPLACE "\n" ";" INSTALL_FILES_LIST - "${INSTALL_FILES_LIST}") - string(REPLACE "\"" "" INSTALL_FILES_LIST - "${INSTALL_FILES_LIST}") - string(LENGTH "${WDIR}" WDR_LEN_) - - list(SORT INSTALL_FILES_LIST) # make file order consistent on all platforms - - foreach(F IN LISTS INSTALL_FILES_LIST) - unset(DIRECTIVE) - - if(IS_SYMLINK "${WDIR}/${F}") - if(IS_RELOCATABLE) - # check that symlink has relocatable format - get_filename_component(SYMLINK_LOCATION_ "${WDIR}/${F}" DIRECTORY) - execute_process(COMMAND ls -la "${WDIR}/${F}" - WORKING_DIRECTORY "${WDIR}" - OUTPUT_VARIABLE SYMLINK_POINT_ - OUTPUT_STRIP_TRAILING_WHITESPACE) - - string(FIND "${SYMLINK_POINT_}" "->" SYMLINK_POINT_INDEX_ REVERSE) - math(EXPR SYMLINK_POINT_INDEX_ ${SYMLINK_POINT_INDEX_}+3) - string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_) - - # get destination path - string(SUBSTRING "${SYMLINK_POINT_}" ${SYMLINK_POINT_INDEX_} ${SYMLINK_POINT_LENGTH_} SYMLINK_POINT_) - - # check if path is relative or absolute - string(SUBSTRING "${SYMLINK_POINT_}" 0 1 SYMLINK_IS_ABSOLUTE_) - - if(${SYMLINK_IS_ABSOLUTE_} STREQUAL "/") - # prevent absolute paths from having /../ or /./ section inside of them - get_filename_component(SYMLINK_POINT_ "${SYMLINK_POINT_}" ABSOLUTE) - else() - # handle relative path - get_filename_component(SYMLINK_POINT_ "${SYMLINK_LOCATION_}/${SYMLINK_POINT_}" ABSOLUTE) - endif() - - string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_) - - cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS") - cpack_rpm_symlink_get_relocation_prefixes("${SYMLINK_POINT_WD_}" "${PACKAGE_PREFIXES}" "POINT_RELOCATIONS") - - list(LENGTH SYMLINK_RELOCATIONS SYMLINK_RELOCATIONS_COUNT) - list(LENGTH POINT_RELOCATIONS POINT_RELOCATIONS_COUNT) - - if(SYMLINK_RELOCATIONS_COUNT AND POINT_RELOCATIONS_COUNT) - # find matching - foreach(SYMLINK_RELOCATION_PREFIX IN LISTS SYMLINK_RELOCATIONS) - list(FIND POINT_RELOCATIONS "${SYMLINK_RELOCATION_PREFIX}" FOUND_INDEX) - if(NOT ${FOUND_INDEX} EQUAL -1) - break() - endif() - endforeach() - - if(NOT ${FOUND_INDEX} EQUAL -1) - # symlinks have the same subpath - if(${SYMLINK_RELOCATIONS_COUNT} EQUAL 1 AND ${POINT_RELOCATIONS_COUNT} EQUAL 1) - # permanent symlink - get_filename_component(SYMLINK_LOCATION_ "${F}" DIRECTORY) - file(RELATIVE_PATH FINAL_PATH_ ${SYMLINK_LOCATION_} ${SYMLINK_POINT_WD_}) - execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${FINAL_PATH_}" "${WDIR}/${F}") - else() - # relocation subpaths - cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" - "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") - endif() - else() - # not on the same relocation path - cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" - "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") - endif() - elseif(POINT_RELOCATIONS_COUNT) - # point is relocatable - cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" - "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") - else() - # is not relocatable or points to non relocatable path - permanent symlink - execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${SYMLINK_POINT_WD_}" "${WDIR}/${F}") - endif() - endif() - elseif(IS_DIRECTORY "${WDIR}/${F}") - set(DIRECTIVE "%dir ") - endif() - - set(INSTALL_FILES "${INSTALL_FILES}${DIRECTIVE}\"${F}\"\n") - endforeach() - - if(REQUIRES_SYMLINK_RELOCATION_SCRIPT) - cpack_rpm_symlink_create_relocation_script("${PACKAGE_PREFIXES}") - endif() - - set(RPM_SYMLINK_POSTINSTALL "${RPM_SYMLINK_POSTINSTALL}" PARENT_SCOPE) - set(CPACK_RPM_INSTALL_FILES "${INSTALL_FILES}" PARENT_SCOPE) -endfunction() - if(CMAKE_BINARY_DIR) message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") endif() @@ -1295,10 +963,9 @@ function(cpack_rpm_generate_package) # destinct parent paths of other relocation paths and remove the # final element (so the install-prefix dir itself is not omitted # from the RPM's content-list) - set(SORTED_RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}") - list(SORT SORTED_RPM_USED_PACKAGE_PREFIXES) + list(SORT RPM_USED_PACKAGE_PREFIXES) set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${SORTED_RPM_USED_PACKAGE_PREFIXES}) + foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") @@ -1475,13 +1142,25 @@ function(cpack_rpm_generate_package) set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") endif() - # Prepare install files - cpack_rpm_prepare_install_files( - "${CPACK_RPM_INSTALL_FILES}" - "${WDIR}" - "${RPM_USED_PACKAGE_PREFIXES}" - "${CPACK_RPM_PACKAGE_RELOCATABLE}" - ) + + # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir + # This is necessary to avoid duplicate files since rpmbuild do + # recursion on its own when encountering a pathname which is a directory + # which is not flagged as %dir + string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) + string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST + "${CPACK_RPM_INSTALL_FILES_LIST}") + string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST + "${CPACK_RPM_INSTALL_FILES_LIST}") + set(CPACK_RPM_INSTALL_FILES "") + foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) + if(IS_DIRECTORY "${WDIR}/${F}") + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n") + else() + set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + endif() + endforeach() + set(CPACK_RPM_INSTALL_FILES_LIST "") # The name of the final spec file to be used by rpmbuild set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") @@ -1567,7 +1246,6 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %clean %post -\@RPM_SYMLINK_POSTINSTALL\@ \@CPACK_RPM_SPEC_POSTINSTALL\@ %postun diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index b172f83..51af297 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -49,42 +49,6 @@ install(FILES mylib.h DESTINATION include COMPONENT headers) -# Package symbolic links -install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) -install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable/bar COMPONENT libraries) -install(DIRECTORY DESTINATION other_relocatable/depth_two COMPONENT libraries) -install(DIRECTORY DESTINATION non_relocatable/depth_two COMPONENT libraries) -# test symbolic links to same dir -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink depth_three symlink_samedir_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) -# test symbolic links to same dir with current dir ./ prefix -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./depth_three symlink_samedir_path_current_dir) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_current_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) -# test symbolic links to same dir with longer relative path -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../${CMAKE_INSTALL_LIBDIR}/.././${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two/depth_three symlink_samedir_path_longer) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_longer DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) -# test symbolic links to sub dir -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three symlink_subdir_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_subdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one COMPONENT libraries) -# test symbolic links to parent dir -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two symlink_parentdir_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_parentdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) -# test symbolic link to another relocatable path -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././.././../other_relocatable/./depth_two symlink_other_relocatable_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_other_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) -# test symbolic link to non relocatable path -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../non_relocatable/./depth_two symlink_to_non_relocatable_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) -# test symbolic link from non relocatable path -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two symlink_from_non_relocatable_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_from_non_relocatable_path DESTINATION non_relocatable/depth_two COMPONENT libraries) -# test symbolic link relocatable path to its relocatable subpath -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../inside_relocatable_two/depth_two/different_relocatable/bar symlink_relocatable_subpath) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_relocatable_subpath DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) -# test symbolic link to location outside package -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./outside_package symlink_outside_package) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_package DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) - # CPack boilerplate for this project set(CPACK_PACKAGE_NAME "MyLib") set(CPACK_PACKAGE_CONTACT "None") @@ -150,8 +114,7 @@ set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) # can not be used in CPack scripts due to CMAKE_SIZEOF_VOID_P # variable not being set set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}" - "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}" "other_relocatable" - "${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable") + "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}") # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index e747052..cf4da74 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -1,7 +1,3 @@ -# prevent older policies from interfearing with this script -cmake_policy(PUSH) -cmake_policy(VERSION ${CMAKE_VERSION}) - message(STATUS "=============================================================================") message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") message(STATUS "") @@ -142,7 +138,6 @@ if(CPackGen MATCHES "RPM") "An extremely useful application that makes use of MyLib") set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Static libraries used to build programs with MyLib") - set(LIB_SUFFIX "6?4?") # test package info if(${CPackComponentWay} STREQUAL "IgnoreGroup") @@ -179,32 +174,10 @@ if(CPackGen MATCHES "RPM") if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/other_relocatable${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") - set(check_content_list "^/usr/foo/bar/lib${LIB_SUFFIX} -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three/symlink_parentdir_path -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_outside_package -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_relocatable_subpath -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_current_dir -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_longer -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/symlink_subdir_path -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable/bar -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_other_relocatable_path -/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_to_non_relocatable_path -/usr/foo/bar/lib${LIB_SUFFIX}/libmylib.a -/usr/foo/bar/non_relocatable -/usr/foo/bar/non_relocatable/depth_two -/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path -/usr/foo/bar/other_relocatable -/usr/foo/bar/other_relocatable/depth_two$") + set(check_content_list "^/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") @@ -215,12 +188,10 @@ if(CPackGen MATCHES "RPM") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}.*") set(check_file_match_expected_architecture "armv7hf") set(spec_regex "*applications*") - set(check_content_list "^/usr/foo/bar -/usr/foo/bar/bin -/usr/foo/bar/bin/mylibapp$") + set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") @@ -298,59 +269,5 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'") endif() endforeach() - - ####################### - # verify generated symbolic links - ####################### - file(GLOB_RECURSE symlink_files RELATIVE "${CPackComponentsForAll_BINARY_DIR}" "${CPackComponentsForAll_BINARY_DIR}/*/symlink_*") - - foreach(check_symlink IN LISTS symlink_files) - get_filename_component(symlink_name "${check_symlink}" NAME) - execute_process(COMMAND ls -la "${check_symlink}" - WORKING_DIRECTORY "${CPackComponentsForAll_BINARY_DIR}" - OUTPUT_VARIABLE SYMLINK_POINT_ - OUTPUT_STRIP_TRAILING_WHITESPACE) - - if("${symlink_name}" STREQUAL "symlink_samedir_path" - OR "${symlink_name}" STREQUAL "symlink_samedir_path_current_dir" - OR "${symlink_name}" STREQUAL "symlink_samedir_path_longer") - string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_three$" check_symlink "${SYMLINK_POINT_}") - elseif("${symlink_name}" STREQUAL "symlink_subdir_path") - string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_two/depth_three$" check_symlink "${SYMLINK_POINT_}") - elseif("${symlink_name}" STREQUAL "symlink_parentdir_path") - string(REGEX MATCH "^.*${whitespaces}->${whitespaces}../$" check_symlink "${SYMLINK_POINT_}") - elseif("${symlink_name}" STREQUAL "symlink_to_non_relocatable_path") - string(REGEX MATCH "^.*${whitespaces}->${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/non_relocatable/depth_two$" check_symlink "${SYMLINK_POINT_}") - elseif("${symlink_name}" STREQUAL "symlink_outside_package") - string(REGEX MATCH "^.*${whitespaces}->${whitespaces}outside_package$" check_symlink "${SYMLINK_POINT_}") - elseif("${symlink_name}" STREQUAL "symlink_other_relocatable_path" - OR "${symlink_name}" STREQUAL "symlink_from_non_relocatable_path" - OR "${symlink_name}" STREQUAL "symlink_relocatable_subpath") - # these links were not canged - post install script only - ignore them - else() - message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'") - endif() - - if(NOT check_symlink) - message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'") - endif() - endforeach() - - # verify post install symlink relocation script - file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/*libraries*.spec") - file(READ ${spec_file} spec_file_content) - file(READ "${CMAKE_CURRENT_LIST_DIR}/symlink_postinstall_expected.txt" symlink_postinstall_expected) - # prepare regex - string(STRIP "${symlink_postinstall_expected}" symlink_postinstall_expected) - string(REPLACE "[" "\\[" symlink_postinstall_expected "${symlink_postinstall_expected}") - string(REPLACE "$" "\\$" symlink_postinstall_expected "${symlink_postinstall_expected}") - string(REPLACE "lib" "lib${LIB_SUFFIX}" symlink_postinstall_expected "${symlink_postinstall_expected}") - # compare - string(REGEX MATCH ".*${symlink_postinstall_expected}.*" symlink_postinstall_expected_matches "${spec_file_content}") - if(NOT symlink_postinstall_expected_matches) - message(FATAL_ERROR "error: unexpected rpm symbolic link postinstall script! generated spec file: '${spec_file_content}'") - endif() endif() endif() - -cmake_policy(POP) diff --git a/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt b/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt deleted file mode 100644 index ba46792..0000000 --- a/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt +++ /dev/null @@ -1,57 +0,0 @@ -if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then - if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then - if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then - ln -s "$RPM_INSTALL_PREFIX1/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" - CPACK_RPM_RELOCATED_SYMLINK_1=true - fi - fi - if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then - if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then - ln -s "$RPM_INSTALL_PREFIX2/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" - CPACK_RPM_RELOCATED_SYMLINK_0=true - fi - fi - if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then - ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" - CPACK_RPM_RELOCATED_SYMLINK_0=true - fi - if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then - ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" - CPACK_RPM_RELOCATED_SYMLINK_0=true - fi - if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then - ln -s "/usr/foo/bar/other_relocatable/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" - CPACK_RPM_RELOCATED_SYMLINK_1=true - fi -fi -if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then - if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then - ln -s "$RPM_INSTALL_PREFIX1/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" - CPACK_RPM_RELOCATED_SYMLINK_1=true - fi -fi -if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then - if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then - ln -s "$RPM_INSTALL_PREFIX2/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" - CPACK_RPM_RELOCATED_SYMLINK_0=true - fi -fi -if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then - if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then - ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" - CPACK_RPM_RELOCATED_SYMLINK_0=true - fi - if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then - ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" - CPACK_RPM_RELOCATED_SYMLINK_2=true - fi -fi -if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then - ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" -fi -if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then - ln -s "/usr/foo/bar/other_relocatable/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" -fi -if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then - ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" -fi ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 364 ++------------------ Tests/CPackComponentsForAll/CMakeLists.txt | 39 +-- .../RunCPackVerifyResult.cmake | 91 +---- .../symlink_postinstall_expected.txt | 57 --- 4 files changed, 26 insertions(+), 525 deletions(-) delete mode 100644 Tests/CPackComponentsForAll/symlink_postinstall_expected.txt hooks/post-receive -- CMake From bill.hoffman at kitware.com Mon Mar 30 16:10:36 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Mon, 30 Mar 2015 16:10:36 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1291-g1d001d0 Message-ID: <20150330201037.45EC3A9E04@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1d001d0d25b0445bb8a78e8b0f5671f201229a2c (commit) via d9420364a2c38434ac5864c0ca209d9c32f904df (commit) from bab6126b2210146bbe068bd245b9d84044d3200d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d001d0d25b0445bb8a78e8b0f5671f201229a2c commit 1d001d0d25b0445bb8a78e8b0f5671f201229a2c Merge: bab6126 d942036 Author: Bill Hoffman AuthorDate: Mon Mar 30 16:10:36 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 16:10:36 2015 -0400 Merge topic 'clean-scanbuild-warnings' into next d9420364 Move scanbuild exceptions out of dashboard script and into cmake. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d9420364a2c38434ac5864c0ca209d9c32f904df commit d9420364a2c38434ac5864c0ca209d9c32f904df Author: Bill Hoffman AuthorDate: Mon Mar 30 16:08:54 2015 -0400 Commit: Bill Hoffman CommitDate: Mon Mar 30 16:08:54 2015 -0400 Move scanbuild exceptions out of dashboard script and into cmake. diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index f499be1..8c4d400 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -62,6 +62,18 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION # Ignore clang's summary warning, assuming prior text has matched some # other warning expression: "[0-9,]+ warnings? generated." + +# scanbuild exceptions + "char_traits.h:.*: warning: Null pointer argument in call to string length function" + "stl_construct.h:.*: warning: Forming reference to null pointer" + ".*stl_uninitialized.h:75:19: warning: Forming reference to null pointer.*" + ".*stl_vector.h:.*: warning: Returning null reference.*" + "warning: Value stored to 'yymsg' is never read" + "warning: Value stored to 'yytoken' is never read" + "index_encoder.c.241.2. warning: Value stored to .out_start. is never read" + "index.c.*warning: Access to field.*results in a dereference of a null pointer.*loaded from variable.*" + "cm_sha2.*warning: Value stored to.*is never read" + "testProcess.*warning: Dereference of null pointer .loaded from variable .invalidAddress.." ) if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode") ----------------------------------------------------------------------- Summary of changes: CTestCustom.cmake.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) hooks/post-receive -- CMake From domen.vrankar at gmail.com Mon Mar 30 18:06:31 2015 From: domen.vrankar at gmail.com (Domen Vrankar) Date: Mon, 30 Mar 2015 18:06:31 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1294-g8114ac4 Message-ID: <20150330220635.650D8ADAA8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 8114ac4c960dfb5d7174d9323bb0cb070f5e8175 (commit) via b10b0ba74709abea8532a4aa67ecc56a1d277e0c (commit) via 025b37c0d41b1af9e30aabb2046747da6671e0ec (commit) from 1d001d0d25b0445bb8a78e8b0f5671f201229a2c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8114ac4c960dfb5d7174d9323bb0cb070f5e8175 commit 8114ac4c960dfb5d7174d9323bb0cb070f5e8175 Merge: 1d001d0 b10b0ba Author: Domen Vrankar AuthorDate: Mon Mar 30 18:06:28 2015 -0400 Commit: CMake Topic Stage CommitDate: Mon Mar 30 18:06:28 2015 -0400 Merge topic 'cpack-rpm-basic-symlink-handling' into next b10b0ba7 fixup! CPack/RPM limit symlink tests 025b37c0 CPack/RPM basic symlink support http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b10b0ba74709abea8532a4aa67ecc56a1d277e0c commit b10b0ba74709abea8532a4aa67ecc56a1d277e0c Author: Domen Vrankar AuthorDate: Mon Mar 30 23:50:43 2015 +0200 Commit: Domen Vrankar CommitDate: Mon Mar 30 23:51:11 2015 +0200 fixup! CPack/RPM limit symlink tests Symlinks are now only added to package if RPM package generator is tested. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f2df4af..5944d08 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -991,6 +991,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ${build_generator_args} --build-project CPackComponentsForAll --build-options ${build_options} + -DCPACK_GENERATOR:STRING=${CPackGen} -DCPACK_BINARY_${CPackGen}:BOOL=ON ${CPackRun_CPackComponentWay} ${CPackComponentsForAll_BUILD_OPTIONS} diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index b172f83..1cc34b0 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -49,41 +49,43 @@ install(FILES mylib.h DESTINATION include COMPONENT headers) -# Package symbolic links -install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) -install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable/bar COMPONENT libraries) -install(DIRECTORY DESTINATION other_relocatable/depth_two COMPONENT libraries) -install(DIRECTORY DESTINATION non_relocatable/depth_two COMPONENT libraries) -# test symbolic links to same dir -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink depth_three symlink_samedir_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) -# test symbolic links to same dir with current dir ./ prefix -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./depth_three symlink_samedir_path_current_dir) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_current_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) -# test symbolic links to same dir with longer relative path -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../${CMAKE_INSTALL_LIBDIR}/.././${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two/depth_three symlink_samedir_path_longer) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_longer DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) -# test symbolic links to sub dir -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three symlink_subdir_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_subdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one COMPONENT libraries) -# test symbolic links to parent dir -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two symlink_parentdir_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_parentdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) -# test symbolic link to another relocatable path -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././.././../other_relocatable/./depth_two symlink_other_relocatable_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_other_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) -# test symbolic link to non relocatable path -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../non_relocatable/./depth_two symlink_to_non_relocatable_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) -# test symbolic link from non relocatable path -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two symlink_from_non_relocatable_path) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_from_non_relocatable_path DESTINATION non_relocatable/depth_two COMPONENT libraries) -# test symbolic link relocatable path to its relocatable subpath -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../inside_relocatable_two/depth_two/different_relocatable/bar symlink_relocatable_subpath) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_relocatable_subpath DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) -# test symbolic link to location outside package -execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./outside_package symlink_outside_package) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_package DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +if("${CPACK_GENERATOR}" MATCHES "RPM") + # Package symbolic links + install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) + install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable/bar COMPONENT libraries) + install(DIRECTORY DESTINATION other_relocatable/depth_two COMPONENT libraries) + install(DIRECTORY DESTINATION non_relocatable/depth_two COMPONENT libraries) + # test symbolic links to same dir + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink depth_three symlink_samedir_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic links to same dir with current dir ./ prefix + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./depth_three symlink_samedir_path_current_dir) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_current_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic links to same dir with longer relative path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../${CMAKE_INSTALL_LIBDIR}/.././${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two/depth_three symlink_samedir_path_longer) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_longer DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic links to sub dir + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three symlink_subdir_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_subdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one COMPONENT libraries) + # test symbolic links to parent dir + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two symlink_parentdir_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_parentdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) + # test symbolic link to another relocatable path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././.././../other_relocatable/./depth_two symlink_other_relocatable_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_other_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) + # test symbolic link to non relocatable path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../non_relocatable/./depth_two symlink_to_non_relocatable_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) + # test symbolic link from non relocatable path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two symlink_from_non_relocatable_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_from_non_relocatable_path DESTINATION non_relocatable/depth_two COMPONENT libraries) + # test symbolic link relocatable path to its relocatable subpath + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../inside_relocatable_two/depth_two/different_relocatable/bar symlink_relocatable_subpath) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_relocatable_subpath DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic link to location outside package + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./outside_package symlink_outside_package) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_package DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +endif() # CPack boilerplate for this project set(CPACK_PACKAGE_NAME "MyLib") http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=025b37c0d41b1af9e30aabb2046747da6671e0ec commit 025b37c0d41b1af9e30aabb2046747da6671e0ec Author: Domen Vrankar AuthorDate: Sun Mar 29 20:55:20 2015 +0200 Commit: Domen Vrankar CommitDate: Mon Mar 30 23:51:11 2015 +0200 CPack/RPM basic symlink support RPM packages can contain symbolic links to relative paths - including support for multiple relocation paths through generation of post install relocation scripts. This is basic support with limitations described in documentation. Feature is addressing mantis bug report id 15209. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 162eba7..f4c853b 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -4,6 +4,43 @@ # # The builtin (binary) CPack RPM generator (Unix only) # +# Packaging of symbolic links +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# CPackRPM supports packaging of symbolic links. +# +# :: +# +# execute_process(COMMAND ${CMAKE_COMMAND} +# -E create_symlink ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ +# DESTINATION COMPONENT libraries) +# +# Symbolic links will be optimized (paths will be shortened if possible) +# before being added to the package or if multiple relocation paths are +# detected, a post install symlink relocation script will be generated. +# +# Symbolic links may point to locations that are not packaged by the same +# package (either a different component or even not packaged at all) but +# those locations will be treated as if they were a part of the package +# while determining if symlink should be either created or present in a +# post install script - depending on relocation paths. +# +# Currenty there are a few limitations though: +# +# * Only symbolic links with relative path can be packaged. +# +# * For component based packaging component interdependency is not checked +# when processing symbolic links. Symbolic links pointing to content of +# a different component are treated the same way as if pointing to location +# that will not be packaged. +# +# * Symbolic links pointing to a location through one or more intermediate +# symbolic links will not be handled differently - if the intermediate +# symbolic link(s) is also on a relocatable path, relocating it during +# package installation may cause initial symbolic link to point to an +# invalid location. +# # Variables specific to CPack RPM generator # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # @@ -503,6 +540,301 @@ function(cpack_rpm_prepare_relocation_paths) set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE) endfunction() +function(cpack_rpm_symlink_get_relocation_prefixes LOCATION PACKAGE_PREFIXES RETURN_VARIABLE) + foreach(PKG_PREFIX IN LISTS PACKAGE_PREFIXES) + string(REGEX MATCH "^${PKG_PREFIX}/.*" FOUND_ "${LOCATION}") + if(FOUND_) + list(APPEND TMP_PREFIXES "${PKG_PREFIX}") + endif() + endforeach() + + set(${RETURN_VARIABLE} "${TMP_PREFIXES}" PARENT_SCOPE) +endfunction() + +function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) + list(LENGTH PACKAGE_PREFIXES LAST_INDEX) + set(SORTED_PACKAGE_PREFIXES "${PACKAGE_PREFIXES}") + list(SORT SORTED_PACKAGE_PREFIXES) + list(REVERSE SORTED_PACKAGE_PREFIXES) + math(EXPR LAST_INDEX ${LAST_INDEX}-1) + + foreach(SYMLINK_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${SYMLINK_INDEX} SRC_PATH) + list(FIND PACKAGE_PREFIXES "${SRC_PATH}" SYMLINK_INDEX) # reverse magic + string(LENGTH "${SRC_PATH}" SRC_PATH_LEN) + + set(PARTS_CNT 0) + set(SCRIPT_PART "if [ \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}\" != \"${SRC_PATH}\" ]; then\n") + + # both paths relocated + foreach(POINT_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) + list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic + string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) + + if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) + if("${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") + set(INDENT "") + else() + set(SCRIPT_PART "${SCRIPT_PART} if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + set(INDENT " ") + endif() + + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) + math(EXPR PARTS_CNT ${PARTS_CNT}+1) + + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}fi\n") + endforeach() + + if(NOT "${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") + set(SCRIPT_PART "${SCRIPT_PART} fi\n") + endif() + endif() + endforeach() + + # source path relocated + if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) + math(EXPR PARTS_CNT ${PARTS_CNT}+1) + + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT_PART "${SCRIPT_PART} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT_PART "${SCRIPT_PART} ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + set(SCRIPT_PART "${SCRIPT_PART} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT_PART "${SCRIPT_PART} fi\n") + endforeach() + endif() + + if(PARTS_CNT) + set(SCRIPT "${SCRIPT_PART}") + set(SCRIPT "${SCRIPT}fi\n") + endif() + endforeach() + + # point path relocated + foreach(POINT_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) + list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic + string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) + + if(_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) + set(SCRIPT "${SCRIPT}if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT "${SCRIPT} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT "${SCRIPT} ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n") + set(SCRIPT "${SCRIPT} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT "${SCRIPT} fi\n") + endforeach() + + set(SCRIPT "${SCRIPT}fi\n") + endif() + endforeach() + + # no path relocated + if(_RPM_RELOCATION_SCRIPT_X_X) + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_X) + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT "${SCRIPT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT "${SCRIPT} ln -s \"${POINT_}\" \"${SYMLINK_}\"\n") + set(SCRIPT "${SCRIPT}fi\n") + endforeach() + endif() + + set(RPM_SYMLINK_POSTINSTALL "${SCRIPT}" PARENT_SCOPE) +endfunction() + +function(cpack_rpm_symlink_add_for_relocation_script PACKAGE_PREFIXES SYMLINK SYMLINK_RELOCATION_PATHS POINT POINT_RELOCATION_PATHS) + list(LENGTH SYMLINK_RELOCATION_PATHS SYMLINK_PATHS_COUTN) + list(LENGTH POINT_RELOCATION_PATHS POINT_PATHS_COUNT) + + list(APPEND _RPM_RELOCATION_SCRIPT_PAIRS "${SYMLINK}:${POINT}") + list(LENGTH _RPM_RELOCATION_SCRIPT_PAIRS PAIR_NO) + + if(SYMLINK_PATHS_COUTN) + foreach(SYMLINK_RELOC_PATH IN LISTS SYMLINK_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${SYMLINK_RELOC_PATH}" SYMLINK_INDEX) + + # source path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X") + + foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) + + # both paths relocated + list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}") + + # point path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") + endforeach() + endforeach() + elseif(POINT_PATHS_COUNT) + foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) + + # point path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") + endforeach() + endif() + + # no path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_X "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_X") + + # place variables into parent scope + foreach(VAR IN LISTS RELOCATION_VARS) + set(${VAR} "${${VAR}}" PARENT_SCOPE) + endforeach() + set(_RPM_RELOCATION_SCRIPT_PAIRS "${_RPM_RELOCATION_SCRIPT_PAIRS}" PARENT_SCOPE) + set(REQUIRES_SYMLINK_RELOCATION_SCRIPT "true" PARENT_SCOPE) + set(DIRECTIVE "%ghost " PARENT_SCOPE) +endfunction() + +function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXES IS_RELOCATABLE) + # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir + # This is necessary to avoid duplicate files since rpmbuild does + # recursion on its own when encountering a pathname which is a directory + # which is not flagged as %dir + string(STRIP "${INSTALL_FILES_LIST}" INSTALL_FILES_LIST) + string(REPLACE "\n" ";" INSTALL_FILES_LIST + "${INSTALL_FILES_LIST}") + string(REPLACE "\"" "" INSTALL_FILES_LIST + "${INSTALL_FILES_LIST}") + string(LENGTH "${WDIR}" WDR_LEN_) + + list(SORT INSTALL_FILES_LIST) # make file order consistent on all platforms + + foreach(F IN LISTS INSTALL_FILES_LIST) + unset(DIRECTIVE) + + if(IS_SYMLINK "${WDIR}/${F}") + if(IS_RELOCATABLE) + # check that symlink has relocatable format + get_filename_component(SYMLINK_LOCATION_ "${WDIR}/${F}" DIRECTORY) + execute_process(COMMAND ls -la "${WDIR}/${F}" + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE SYMLINK_POINT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(FIND "${SYMLINK_POINT_}" "->" SYMLINK_POINT_INDEX_ REVERSE) + math(EXPR SYMLINK_POINT_INDEX_ ${SYMLINK_POINT_INDEX_}+3) + string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_) + + # get destination path + string(SUBSTRING "${SYMLINK_POINT_}" ${SYMLINK_POINT_INDEX_} ${SYMLINK_POINT_LENGTH_} SYMLINK_POINT_) + + # check if path is relative or absolute + string(SUBSTRING "${SYMLINK_POINT_}" 0 1 SYMLINK_IS_ABSOLUTE_) + + if(${SYMLINK_IS_ABSOLUTE_} STREQUAL "/") + # prevent absolute paths from having /../ or /./ section inside of them + get_filename_component(SYMLINK_POINT_ "${SYMLINK_POINT_}" ABSOLUTE) + else() + # handle relative path + get_filename_component(SYMLINK_POINT_ "${SYMLINK_LOCATION_}/${SYMLINK_POINT_}" ABSOLUTE) + endif() + + string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_) + + cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS") + cpack_rpm_symlink_get_relocation_prefixes("${SYMLINK_POINT_WD_}" "${PACKAGE_PREFIXES}" "POINT_RELOCATIONS") + + list(LENGTH SYMLINK_RELOCATIONS SYMLINK_RELOCATIONS_COUNT) + list(LENGTH POINT_RELOCATIONS POINT_RELOCATIONS_COUNT) + + if(SYMLINK_RELOCATIONS_COUNT AND POINT_RELOCATIONS_COUNT) + # find matching + foreach(SYMLINK_RELOCATION_PREFIX IN LISTS SYMLINK_RELOCATIONS) + list(FIND POINT_RELOCATIONS "${SYMLINK_RELOCATION_PREFIX}" FOUND_INDEX) + if(NOT ${FOUND_INDEX} EQUAL -1) + break() + endif() + endforeach() + + if(NOT ${FOUND_INDEX} EQUAL -1) + # symlinks have the same subpath + if(${SYMLINK_RELOCATIONS_COUNT} EQUAL 1 AND ${POINT_RELOCATIONS_COUNT} EQUAL 1) + # permanent symlink + get_filename_component(SYMLINK_LOCATION_ "${F}" DIRECTORY) + file(RELATIVE_PATH FINAL_PATH_ ${SYMLINK_LOCATION_} ${SYMLINK_POINT_WD_}) + execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${FINAL_PATH_}" "${WDIR}/${F}") + else() + # relocation subpaths + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + endif() + else() + # not on the same relocation path + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + endif() + elseif(POINT_RELOCATIONS_COUNT) + # point is relocatable + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + else() + # is not relocatable or points to non relocatable path - permanent symlink + execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${SYMLINK_POINT_WD_}" "${WDIR}/${F}") + endif() + endif() + elseif(IS_DIRECTORY "${WDIR}/${F}") + set(DIRECTIVE "%dir ") + endif() + + set(INSTALL_FILES "${INSTALL_FILES}${DIRECTIVE}\"${F}\"\n") + endforeach() + + if(REQUIRES_SYMLINK_RELOCATION_SCRIPT) + cpack_rpm_symlink_create_relocation_script("${PACKAGE_PREFIXES}") + endif() + + set(RPM_SYMLINK_POSTINSTALL "${RPM_SYMLINK_POSTINSTALL}" PARENT_SCOPE) + set(CPACK_RPM_INSTALL_FILES "${INSTALL_FILES}" PARENT_SCOPE) +endfunction() + if(CMAKE_BINARY_DIR) message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") endif() @@ -963,9 +1295,10 @@ function(cpack_rpm_generate_package) # destinct parent paths of other relocation paths and remove the # final element (so the install-prefix dir itself is not omitted # from the RPM's content-list) - list(SORT RPM_USED_PACKAGE_PREFIXES) + set(SORTED_RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}") + list(SORT SORTED_RPM_USED_PACKAGE_PREFIXES) set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) + foreach(_RPM_RELOCATION_PREFIX ${SORTED_RPM_USED_PACKAGE_PREFIXES}) if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") @@ -1142,25 +1475,13 @@ function(cpack_rpm_generate_package) set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") endif() - - # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir - # This is necessary to avoid duplicate files since rpmbuild do - # recursion on its own when encountering a pathname which is a directory - # which is not flagged as %dir - string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) - string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - set(CPACK_RPM_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - if(IS_DIRECTORY "${WDIR}/${F}") - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n") - else() - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") - endif() - endforeach() - set(CPACK_RPM_INSTALL_FILES_LIST "") + # Prepare install files + cpack_rpm_prepare_install_files( + "${CPACK_RPM_INSTALL_FILES}" + "${WDIR}" + "${RPM_USED_PACKAGE_PREFIXES}" + "${CPACK_RPM_PACKAGE_RELOCATABLE}" + ) # The name of the final spec file to be used by rpmbuild set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") @@ -1246,6 +1567,7 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %clean %post +\@RPM_SYMLINK_POSTINSTALL\@ \@CPACK_RPM_SPEC_POSTINSTALL\@ %postun diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 51af297..b172f83 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -49,6 +49,42 @@ install(FILES mylib.h DESTINATION include COMPONENT headers) +# Package symbolic links +install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) +install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable/bar COMPONENT libraries) +install(DIRECTORY DESTINATION other_relocatable/depth_two COMPONENT libraries) +install(DIRECTORY DESTINATION non_relocatable/depth_two COMPONENT libraries) +# test symbolic links to same dir +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink depth_three symlink_samedir_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +# test symbolic links to same dir with current dir ./ prefix +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./depth_three symlink_samedir_path_current_dir) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_current_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +# test symbolic links to same dir with longer relative path +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../${CMAKE_INSTALL_LIBDIR}/.././${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two/depth_three symlink_samedir_path_longer) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_longer DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +# test symbolic links to sub dir +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three symlink_subdir_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_subdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one COMPONENT libraries) +# test symbolic links to parent dir +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two symlink_parentdir_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_parentdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) +# test symbolic link to another relocatable path +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././.././../other_relocatable/./depth_two symlink_other_relocatable_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_other_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) +# test symbolic link to non relocatable path +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../non_relocatable/./depth_two symlink_to_non_relocatable_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) +# test symbolic link from non relocatable path +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two symlink_from_non_relocatable_path) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_from_non_relocatable_path DESTINATION non_relocatable/depth_two COMPONENT libraries) +# test symbolic link relocatable path to its relocatable subpath +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../inside_relocatable_two/depth_two/different_relocatable/bar symlink_relocatable_subpath) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_relocatable_subpath DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +# test symbolic link to location outside package +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./outside_package symlink_outside_package) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_package DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # CPack boilerplate for this project set(CPACK_PACKAGE_NAME "MyLib") set(CPACK_PACKAGE_CONTACT "None") @@ -114,7 +150,8 @@ set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) # can not be used in CPack scripts due to CMAKE_SIZEOF_VOID_P # variable not being set set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}" - "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}") + "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}" "other_relocatable" + "${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable") # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index cf4da74..e747052 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -1,3 +1,7 @@ +# prevent older policies from interfearing with this script +cmake_policy(PUSH) +cmake_policy(VERSION ${CMAKE_VERSION}) + message(STATUS "=============================================================================") message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") message(STATUS "") @@ -138,6 +142,7 @@ if(CPackGen MATCHES "RPM") "An extremely useful application that makes use of MyLib") set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Static libraries used to build programs with MyLib") + set(LIB_SUFFIX "6?4?") # test package info if(${CPackComponentWay} STREQUAL "IgnoreGroup") @@ -174,10 +179,32 @@ if(CPackGen MATCHES "RPM") if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/other_relocatable${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable") set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") - set(check_content_list "^/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") + set(check_content_list "^/usr/foo/bar/lib${LIB_SUFFIX} +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three/symlink_parentdir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_outside_package +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_relocatable_subpath +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_current_dir +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_longer +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/symlink_subdir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable/bar +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_other_relocatable_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_to_non_relocatable_path +/usr/foo/bar/lib${LIB_SUFFIX}/libmylib.a +/usr/foo/bar/non_relocatable +/usr/foo/bar/non_relocatable/depth_two +/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path +/usr/foo/bar/other_relocatable +/usr/foo/bar/other_relocatable/depth_two$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") @@ -188,10 +215,12 @@ if(CPackGen MATCHES "RPM") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}.*") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") set(check_file_match_expected_architecture "armv7hf") set(spec_regex "*applications*") - set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$") + set(check_content_list "^/usr/foo/bar +/usr/foo/bar/bin +/usr/foo/bar/bin/mylibapp$") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") @@ -269,5 +298,59 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'") endif() endforeach() + + ####################### + # verify generated symbolic links + ####################### + file(GLOB_RECURSE symlink_files RELATIVE "${CPackComponentsForAll_BINARY_DIR}" "${CPackComponentsForAll_BINARY_DIR}/*/symlink_*") + + foreach(check_symlink IN LISTS symlink_files) + get_filename_component(symlink_name "${check_symlink}" NAME) + execute_process(COMMAND ls -la "${check_symlink}" + WORKING_DIRECTORY "${CPackComponentsForAll_BINARY_DIR}" + OUTPUT_VARIABLE SYMLINK_POINT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if("${symlink_name}" STREQUAL "symlink_samedir_path" + OR "${symlink_name}" STREQUAL "symlink_samedir_path_current_dir" + OR "${symlink_name}" STREQUAL "symlink_samedir_path_longer") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_three$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_subdir_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_two/depth_three$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_parentdir_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}../$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_to_non_relocatable_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/non_relocatable/depth_two$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_outside_package") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}outside_package$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_other_relocatable_path" + OR "${symlink_name}" STREQUAL "symlink_from_non_relocatable_path" + OR "${symlink_name}" STREQUAL "symlink_relocatable_subpath") + # these links were not canged - post install script only - ignore them + else() + message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'") + endif() + + if(NOT check_symlink) + message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'") + endif() + endforeach() + + # verify post install symlink relocation script + file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/*libraries*.spec") + file(READ ${spec_file} spec_file_content) + file(READ "${CMAKE_CURRENT_LIST_DIR}/symlink_postinstall_expected.txt" symlink_postinstall_expected) + # prepare regex + string(STRIP "${symlink_postinstall_expected}" symlink_postinstall_expected) + string(REPLACE "[" "\\[" symlink_postinstall_expected "${symlink_postinstall_expected}") + string(REPLACE "$" "\\$" symlink_postinstall_expected "${symlink_postinstall_expected}") + string(REPLACE "lib" "lib${LIB_SUFFIX}" symlink_postinstall_expected "${symlink_postinstall_expected}") + # compare + string(REGEX MATCH ".*${symlink_postinstall_expected}.*" symlink_postinstall_expected_matches "${spec_file_content}") + if(NOT symlink_postinstall_expected_matches) + message(FATAL_ERROR "error: unexpected rpm symbolic link postinstall script! generated spec file: '${spec_file_content}'") + endif() endif() endif() + +cmake_policy(POP) diff --git a/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt b/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt new file mode 100644 index 0000000..ba46792 --- /dev/null +++ b/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt @@ -0,0 +1,57 @@ +if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then + if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "$RPM_INSTALL_PREFIX1/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi + fi + if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX2/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "/usr/foo/bar/other_relocatable/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi +fi +if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "$RPM_INSTALL_PREFIX1/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi +fi +if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX2/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi +fi +if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_2=true + fi +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "/usr/foo/bar/other_relocatable/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" +fi ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 364 ++++++++++++++++++-- Tests/CMakeLists.txt | 1 + Tests/CPackComponentsForAll/CMakeLists.txt | 41 ++- .../RunCPackVerifyResult.cmake | 91 ++++- .../symlink_postinstall_expected.txt | 57 +++ 5 files changed, 528 insertions(+), 26 deletions(-) create mode 100644 Tests/CPackComponentsForAll/symlink_postinstall_expected.txt hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 31 00:01:07 2015 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 31 Mar 2015 00:01:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-545-ga6b0b83 Message-ID: <20150331040108.543A8AD67A@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via a6b0b835acfedfe4f46e15b165b2aa9496371580 (commit) from c1f8c6cdf94d650df1bd8ec847ae7ac453550978 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6b0b835acfedfe4f46e15b165b2aa9496371580 commit a6b0b835acfedfe4f46e15b165b2aa9496371580 Author: Kitware Robot AuthorDate: Tue Mar 31 00:01:04 2015 -0400 Commit: Kitware Robot CommitDate: Tue Mar 31 00:01:04 2015 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ef2842a..f4f3aa6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 20150330) +set(CMake_VERSION_PATCH 20150331) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 08:30:02 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 08:30:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1296-g3e031d1 Message-ID: <20150331123002.9513DADCEA@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3e031d185c129ef233b5a82735153558f86f1674 (commit) via 4adf1dad2a6e462364bae81030c928599d11c24f (commit) from 8114ac4c960dfb5d7174d9323bb0cb070f5e8175 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e031d185c129ef233b5a82735153558f86f1674 commit 3e031d185c129ef233b5a82735153558f86f1674 Merge: 8114ac4 4adf1da Author: Brad King AuthorDate: Tue Mar 31 08:30:01 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 08:30:01 2015 -0400 Merge topic 'makefile-DELETE_ON_ERROR' into next 4adf1dad Makefile: Tell GNU make to delete rule outputs on error (#15474) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4adf1dad2a6e462364bae81030c928599d11c24f commit 4adf1dad2a6e462364bae81030c928599d11c24f Author: Brad King AuthorDate: Mon Mar 30 16:32:26 2015 -0400 Commit: Brad King CommitDate: Mon Mar 30 16:35:48 2015 -0400 Makefile: Tell GNU make to delete rule outputs on error (#15474) Add .DELETE_ON_ERROR to the "build.make" files that contain the actual build rules that generate files. This tells GNU make to delete the output of a rule if the recipe modifies the output but returns failure. This is particularly useful for custom commands that use shell redirection to produce a file. Do not add .DELETE_ON_ERROR for Borland or Watcom make tools because they may not tolerate it and would not honor it anyway. Other make tools that do not understand .DELETE_ON_ERROR will not be hurt. Suggested-by: Andrey Vihrov diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 120d2f8..005f0d6 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -46,6 +46,7 @@ public: cmMakefile *, bool optional); virtual bool AllowNotParallel() const { return false; } + virtual bool AllowDeleteOnError() const { return false; } }; #endif diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 50a901e..a76a835 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -128,6 +128,9 @@ public: /** Does the make tool tolerate .NOTPARALLEL? */ virtual bool AllowNotParallel() const { return true; } + /** Does the make tool tolerate .DELETE_ON_ERROR? */ + virtual bool AllowDeleteOnError() const { return true; } + virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; protected: void WriteMainMakefile2(); diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index 0e577b5..7bc209b 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -45,6 +45,7 @@ public: cmMakefile *, bool optional); virtual bool AllowNotParallel() const { return false; } + virtual bool AllowDeleteOnError() const { return false; } }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 641cd23..2cd2d3e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -122,6 +122,14 @@ void cmMakefileTargetGenerator::CreateRuleFile() return; } this->LocalGenerator->WriteDisclaimer(*this->BuildFileStream); + if (this->GlobalGenerator->AllowDeleteOnError()) + { + std::vector no_depends; + std::vector no_commands; + this->LocalGenerator->WriteMakeRule( + *this->BuildFileStream, "Delete rule output on recipe failure.", + ".DELETE_ON_ERROR", no_depends, no_commands, false); + } this->LocalGenerator->WriteSpecialTargetsTop(*this->BuildFileStream); } ----------------------------------------------------------------------- Summary of changes: Source/cmGlobalBorlandMakefileGenerator.h | 1 + Source/cmGlobalUnixMakefileGenerator3.h | 3 +++ Source/cmGlobalWatcomWMakeGenerator.h | 1 + Source/cmMakefileTargetGenerator.cxx | 8 ++++++++ 4 files changed, 13 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 08:59:32 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 08:59:32 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1298-gbc236b2 Message-ID: <20150331125932.7321EADE6F@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via bc236b26c8444d855799e78fc6190273141c2792 (commit) via 845c83756e282feb6086c93d52ee0a0d4eacce9c (commit) from 3e031d185c129ef233b5a82735153558f86f1674 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bc236b26c8444d855799e78fc6190273141c2792 commit bc236b26c8444d855799e78fc6190273141c2792 Merge: 3e031d1 845c837 Author: Brad King AuthorDate: Tue Mar 31 08:59:31 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 08:59:31 2015 -0400 Merge topic 'doc-list-xref' into next 845c8375 Help: Add link target to cmake-language.7 lists section http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=845c83756e282feb6086c93d52ee0a0d4eacce9c commit 845c83756e282feb6086c93d52ee0a0d4eacce9c Author: Brad King AuthorDate: Tue Mar 31 08:50:40 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 08:51:03 2015 -0400 Help: Add link target to cmake-language.7 lists section diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst index 3e0297c..4a9f0b5 100644 --- a/Help/manual/cmake-language.7.rst +++ b/Help/manual/cmake-language.7.rst @@ -538,6 +538,8 @@ The :manual:`cmake-variables(7)` manual documents many variables that are provided by CMake or have meaning to CMake when set by project code. +.. _`CMake Language Lists`: + Lists ===== ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-language.7.rst | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 08:59:37 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 08:59:37 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1301-g1409adb Message-ID: <20150331125937.79121ADE70@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1409adbd6d548f7ef95d1abbc85c76f13f5c8e22 (commit) via c46125dfac88d566f0bac380bbdee845e839082f (commit) via d51c1f090a5df5a8cd8d58faeee3544b52463924 (commit) from bc236b26c8444d855799e78fc6190273141c2792 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1409adbd6d548f7ef95d1abbc85c76f13f5c8e22 commit 1409adbd6d548f7ef95d1abbc85c76f13f5c8e22 Merge: bc236b2 c46125d Author: Brad King AuthorDate: Tue Mar 31 08:59:36 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 08:59:36 2015 -0400 Merge topic 'doc-COMPILE_OPTIONS-cleanup' into next c46125df Help: Refine COMPILE_OPTIONS property documentation d51c1f09 Help: Fix xref typos in target_compile_options docs http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c46125dfac88d566f0bac380bbdee845e839082f commit c46125dfac88d566f0bac380bbdee845e839082f Author: Brad King AuthorDate: Tue Mar 31 08:55:16 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 08:58:11 2015 -0400 Help: Refine COMPILE_OPTIONS property documentation Make wording of the directory and target properties more consitent and complementary. Specify that the value is a ";-list" with a link to the cmake-language(7) manual section on lists. diff --git a/Help/prop_dir/COMPILE_OPTIONS.rst b/Help/prop_dir/COMPILE_OPTIONS.rst index 5530860..877deb0 100644 --- a/Help/prop_dir/COMPILE_OPTIONS.rst +++ b/Help/prop_dir/COMPILE_OPTIONS.rst @@ -3,8 +3,8 @@ COMPILE_OPTIONS List of options to pass to the compiler. -This property specifies the list of options given so far to the -:command:`add_compile_options` command. +This property holds a :ref:`;-list ` of options +given so far to the :command:`add_compile_options` command. This property is used to initialize the :prop_tgt:`COMPILE_OPTIONS` target property when a target is created, which is used by the generators to set diff --git a/Help/prop_tgt/COMPILE_OPTIONS.rst b/Help/prop_tgt/COMPILE_OPTIONS.rst index 27cbec1..36d786a 100644 --- a/Help/prop_tgt/COMPILE_OPTIONS.rst +++ b/Help/prop_tgt/COMPILE_OPTIONS.rst @@ -3,12 +3,13 @@ COMPILE_OPTIONS List of options to pass to the compiler. -This property specifies the list of options specified so far for this -property. +This property holds a :ref:`;-list ` of options +specified so far for its target. Use the :command:`target_compile_options` +command to append more options. This property is intialized by the :prop_dir:`COMPILE_OPTIONS` directory -property, which is used by the generators to set the options for the -compiler. +property when a target is created, and is used by the generators to set +the options for the compiler. Contents of ``COMPILE_OPTIONS`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d51c1f090a5df5a8cd8d58faeee3544b52463924 commit d51c1f090a5df5a8cd8d58faeee3544b52463924 Author: Brad King AuthorDate: Tue Mar 31 08:51:05 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 08:51:05 2015 -0400 Help: Fix xref typos in target_compile_options docs Fix links to the COMPILE_OPTIONS directory and target properties. diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst index 3362c5d..73e01e7 100644 --- a/Help/command/target_compile_options.rst +++ b/Help/command/target_compile_options.rst @@ -20,8 +20,8 @@ alternative commands exist to add preprocessor definitions (:command:`target_compile_definitions` and :command:`add_definitions`) or include directories (:command:`target_include_directories` and :command:`include_directories`). See documentation of the -:prop_tgt:`directory ` and -:prop_tgt:` target ` ``COMPILE_OPTIONS`` properties. +:prop_dir:`directory ` and +:prop_tgt:`target ` ``COMPILE_OPTIONS`` properties. The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` ----------------------------------------------------------------------- Summary of changes: Help/command/target_compile_options.rst | 4 ++-- Help/prop_dir/COMPILE_OPTIONS.rst | 4 ++-- Help/prop_tgt/COMPILE_OPTIONS.rst | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 09:17:48 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 09:17:48 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-547-gda68bd3 Message-ID: <20150331131748.89317AD438@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via da68bd3828bb4adc3dd64d2f7db3131d41529ef2 (commit) via d9420364a2c38434ac5864c0ca209d9c32f904df (commit) from a6b0b835acfedfe4f46e15b165b2aa9496371580 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=da68bd3828bb4adc3dd64d2f7db3131d41529ef2 commit da68bd3828bb4adc3dd64d2f7db3131d41529ef2 Merge: a6b0b83 d942036 Author: Brad King AuthorDate: Tue Mar 31 09:17:47 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 09:17:47 2015 -0400 Merge topic 'clean-scanbuild-warnings' d9420364 Move scanbuild exceptions out of dashboard script and into cmake. ----------------------------------------------------------------------- Summary of changes: CTestCustom.cmake.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 09:17:50 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 09:17:50 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-549-ge6fe5b4 Message-ID: <20150331131750.9A660AD475@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via e6fe5b46d5b0adff67fd5af0d014a1735b66fcc2 (commit) via 845c83756e282feb6086c93d52ee0a0d4eacce9c (commit) from da68bd3828bb4adc3dd64d2f7db3131d41529ef2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6fe5b46d5b0adff67fd5af0d014a1735b66fcc2 commit e6fe5b46d5b0adff67fd5af0d014a1735b66fcc2 Merge: da68bd3 845c837 Author: Brad King AuthorDate: Tue Mar 31 09:17:49 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 09:17:49 2015 -0400 Merge topic 'doc-list-xref' 845c8375 Help: Add link target to cmake-language.7 lists section ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-language.7.rst | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 09:17:52 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 09:17:52 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-552-gd66f052 Message-ID: <20150331131752.60B87AD440@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via d66f052e9401ea3ae8194bace96d2596d8f9b4ae (commit) via c46125dfac88d566f0bac380bbdee845e839082f (commit) via d51c1f090a5df5a8cd8d58faeee3544b52463924 (commit) from e6fe5b46d5b0adff67fd5af0d014a1735b66fcc2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d66f052e9401ea3ae8194bace96d2596d8f9b4ae commit d66f052e9401ea3ae8194bace96d2596d8f9b4ae Merge: e6fe5b4 c46125d Author: Brad King AuthorDate: Tue Mar 31 09:17:51 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 09:17:51 2015 -0400 Merge topic 'doc-COMPILE_OPTIONS-cleanup' c46125df Help: Refine COMPILE_OPTIONS property documentation d51c1f09 Help: Fix xref typos in target_compile_options docs ----------------------------------------------------------------------- Summary of changes: Help/command/target_compile_options.rst | 4 ++-- Help/prop_dir/COMPILE_OPTIONS.rst | 4 ++-- Help/prop_tgt/COMPILE_OPTIONS.rst | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 09:17:54 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 09:17:54 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-554-ged98912 Message-ID: <20150331131754.53EAFAD49E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ed989122c3b997b19c714ce511619e6b6204a1f1 (commit) via b372a99a130ec89561b2ad8d3147298dff3cf4df (commit) from d66f052e9401ea3ae8194bace96d2596d8f9b4ae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed989122c3b997b19c714ce511619e6b6204a1f1 commit ed989122c3b997b19c714ce511619e6b6204a1f1 Merge: d66f052 b372a99 Author: Brad King AuthorDate: Tue Mar 31 09:17:53 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 09:17:53 2015 -0400 Merge topic 'UseSWIG-no-MAIN_DEPENDENCY' b372a99a UseSWIG: Do not use MAIN_DEPENDENCY on custom commands (#15480) ----------------------------------------------------------------------- Summary of changes: Modules/UseSWIG.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 09:18:32 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 09:18:32 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1307-g2e0dac4 Message-ID: <20150331131832.06DE9AD4E5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 2e0dac4c00494b3de4f8032f3f45724e1d232e3f (commit) via ed989122c3b997b19c714ce511619e6b6204a1f1 (commit) via d66f052e9401ea3ae8194bace96d2596d8f9b4ae (commit) via e6fe5b46d5b0adff67fd5af0d014a1735b66fcc2 (commit) via da68bd3828bb4adc3dd64d2f7db3131d41529ef2 (commit) via a6b0b835acfedfe4f46e15b165b2aa9496371580 (commit) from 1409adbd6d548f7ef95d1abbc85c76f13f5c8e22 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e0dac4c00494b3de4f8032f3f45724e1d232e3f commit 2e0dac4c00494b3de4f8032f3f45724e1d232e3f Merge: 1409adb ed98912 Author: Brad King AuthorDate: Tue Mar 31 09:18:05 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 09:18:05 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 10:36:58 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 10:36:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1309-gf3c457f Message-ID: <20150331143658.BBB05ADF9D@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f3c457f81e18c4f3b9fa7ca66c1f255a508e381d (commit) via 93a3ec8b7705c6edfa08a59a789d193fcb4cf4c1 (commit) from 2e0dac4c00494b3de4f8032f3f45724e1d232e3f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3c457f81e18c4f3b9fa7ca66c1f255a508e381d commit f3c457f81e18c4f3b9fa7ca66c1f255a508e381d Merge: 2e0dac4 93a3ec8 Author: Brad King AuthorDate: Tue Mar 31 10:36:58 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 10:36:58 2015 -0400 Merge topic 'cpack-fix-preinstall-tool' into next 93a3ec8b CPack: Fix make tool selection during preinstall (#15483) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93a3ec8b7705c6edfa08a59a789d193fcb4cf4c1 commit 93a3ec8b7705c6edfa08a59a789d193fcb4cf4c1 Author: Brad King AuthorDate: Tue Mar 31 10:26:29 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 10:30:25 2015 -0400 CPack: Fix make tool selection during preinstall (#15483) The CMAKE_MAKE_PROGRAM selected by CMake while configuring the project should also be used to drive the "preinstall" target during packaging. Teach CPack to use "cmake --build" instead of constructing the build command line itself. The "cmake --build" command already knows how to select the proper make tool. diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index ee255af..67005ef 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -655,26 +655,19 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths()); // Does this generator require pre-install? - if ( globalGenerator->GetPreinstallTargetName() ) + if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) { - globalGenerator->FindMakeProgram(this->MakefileMap); - std::string cmakeMakeProgram - = this->MakefileMap->GetSafeDefinition("CMAKE_MAKE_PROGRAM"); - std::vector buildCommand; - globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram, - installProjectName, installDirectory, - globalGenerator->GetPreinstallTargetName(), - buildConfig, false, false); - std::string buildCommandStr = - cmSystemTools::PrintSingleCommand(buildCommand); + std::string buildCommand = + globalGenerator->GenerateCMakeBuildCommand( + preinstall, buildConfig, "", false); cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Install command: " << buildCommandStr << std::endl); + "- Install command: " << buildCommand << std::endl); cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Run preinstall target for: " << installProjectName << std::endl); std::string output; int retVal = 1; bool resB = - cmSystemTools::RunSingleCommand(buildCommand, + cmSystemTools::RunSingleCommand(buildCommand.c_str(), &output, &retVal, installDirectory.c_str(), @@ -684,12 +677,12 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/PreinstallOutput.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << buildCommandStr << std::endl + ofs << "# Run command: " << buildCommand << std::endl << "# Directory: " << installDirectory << std::endl << "# Output:" << std::endl << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " << buildCommandStr + "Problem running install command: " << buildCommand << std::endl << "Please check " << tmpFile << " for errors" << std::endl); ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackGenerator.cxx | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 11:24:08 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 11:24:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1311-g1d136a8 Message-ID: <20150331152408.B54D3AD8D1@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 1d136a8197a3583b034f52ab2fb4e8caacb6ef29 (commit) via 0778016a0bba246e46f628aecd64e0f8afcc0fdb (commit) from f3c457f81e18c4f3b9fa7ca66c1f255a508e381d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d136a8197a3583b034f52ab2fb4e8caacb6ef29 commit 1d136a8197a3583b034f52ab2fb4e8caacb6ef29 Merge: f3c457f 0778016 Author: Brad King AuthorDate: Tue Mar 31 11:24:08 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 11:24:08 2015 -0400 Merge topic 'solaris-fix-target_link_libraries-test' into next 0778016a Tests: Do not try to use invalid "ld -v" flag on Solaris http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0778016a0bba246e46f628aecd64e0f8afcc0fdb commit 0778016a0bba246e46f628aecd64e0f8afcc0fdb Author: Brad King AuthorDate: Tue Mar 31 11:20:20 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 11:21:36 2015 -0400 Tests: Do not try to use invalid "ld -v" flag on Solaris Fix the CMakeCommands.target_link_libraries test to use "-V" instead of "-v" on Solaris because the latter does not exist. diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt index 818b8c9..741c73e 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/CMakeLists.txt @@ -22,8 +22,18 @@ generate_export_header(staticlib1) add_library(staticlib2 STATIC staticlib2.cpp) generate_export_header(staticlib2) target_link_libraries(staticlib1 LINK_PUBLIC staticlib2) + +# Try adding a private link item to be propagated out of a static lib. +set(private_link "") if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang) - target_link_libraries(staticlib1 LINK_PRIVATE "-Wl,-v") + if (CMAKE_SYSTEM_NAME STREQUAL "SunOS") + set(private_link "-Wl,-V") + else() + set(private_link "-Wl,-v") + endif() +endif() +if(private_link) + target_link_libraries(staticlib1 LINK_PRIVATE "${private_link}") endif() add_executable(staticlib_exe staticlib_exe.cpp) ----------------------------------------------------------------------- Summary of changes: .../target_link_libraries/cmp0022/CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 11:31:58 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 11:31:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1313-g079d87a Message-ID: <20150331153159.42EBCADD86@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 079d87ab511129a47ec67e9e9690696434b41bfc (commit) via 1570a4df9246c5f9b7a6818c367ddb596b84d083 (commit) from 1d136a8197a3583b034f52ab2fb4e8caacb6ef29 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=079d87ab511129a47ec67e9e9690696434b41bfc commit 079d87ab511129a47ec67e9e9690696434b41bfc Merge: 1d136a8 1570a4d Author: Brad King AuthorDate: Tue Mar 31 11:31:57 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 11:31:57 2015 -0400 Merge topic 'UseSWIG-no-MAIN_DEPENDENCY' into next 1570a4df Help: Add notes for topic 'UseSWIG-no-MAIN_DEPENDENCY' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1570a4df9246c5f9b7a6818c367ddb596b84d083 commit 1570a4df9246c5f9b7a6818c367ddb596b84d083 Author: Brad King AuthorDate: Tue Mar 31 11:28:47 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 11:31:27 2015 -0400 Help: Add notes for topic 'UseSWIG-no-MAIN_DEPENDENCY' diff --git a/Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst b/Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst new file mode 100644 index 0000000..5311cf1 --- /dev/null +++ b/Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst @@ -0,0 +1,9 @@ +UseSWIG-no-MAIN_DEPENDENCY +-------------------------- + +* The :module:`UseSWIG` module ``SWIG_ADD_MODULE`` macro no + longer attaches the swig invocation custom command to the + ``.i`` source file in IDE projects. This is because only + one custom command can be safely attached to a given source + file, and adding multiple modules with the same ``.i`` file + for different languages requires more than one such command. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 11:34:11 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 11:34:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1315-ge84114c Message-ID: <20150331153411.B9EB6ADDF9@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via e84114c69c2ceddd3f9565ddf420664c70788dec (commit) via 44990732a8c2340193667c200987503bbbcb442f (commit) from 079d87ab511129a47ec67e9e9690696434b41bfc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e84114c69c2ceddd3f9565ddf420664c70788dec commit e84114c69c2ceddd3f9565ddf420664c70788dec Merge: 079d87a 4499073 Author: Brad King AuthorDate: Tue Mar 31 11:34:11 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 11:34:11 2015 -0400 Merge topic 'makefile-DELETE_ON_ERROR' into next 44990732 Help: Add notes for topic 'makefile-DELETE_ON_ERROR' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44990732a8c2340193667c200987503bbbcb442f commit 44990732a8c2340193667c200987503bbbcb442f Author: Brad King AuthorDate: Tue Mar 31 11:33:53 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 11:33:53 2015 -0400 Help: Add notes for topic 'makefile-DELETE_ON_ERROR' diff --git a/Help/release/dev/makefile-DELETE_ON_ERROR.rst b/Help/release/dev/makefile-DELETE_ON_ERROR.rst new file mode 100644 index 0000000..c7c45fd --- /dev/null +++ b/Help/release/dev/makefile-DELETE_ON_ERROR.rst @@ -0,0 +1,7 @@ +makefile-DELETE_ON_ERROR +------------------------ + +* The Makefile generators now add ``.DELETE_ON_ERROR`` to the + makefiles that contain the actual build rules for files on disk. + This tells GNU make to remove rule outputs when their recipe + modifies an output but fails. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/makefile-DELETE_ON_ERROR.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Help/release/dev/makefile-DELETE_ON_ERROR.rst hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 13:09:00 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 13:09:00 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1318-g85de1dd Message-ID: <20150331170900.BF507ADB32@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 85de1ddd36462a7ef0fbcc6ea3ecd7d62a515491 (commit) via ff7ecb92c57c91ba0da0bb833dc92fd9a7d9d2fb (commit) via 79fe11f106d1587f3e31cb0749ce45805b585d93 (commit) from e84114c69c2ceddd3f9565ddf420664c70788dec (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85de1ddd36462a7ef0fbcc6ea3ecd7d62a515491 commit 85de1ddd36462a7ef0fbcc6ea3ecd7d62a515491 Merge: e84114c ff7ecb9 Author: Brad King AuthorDate: Tue Mar 31 13:08:59 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 13:08:59 2015 -0400 Merge topic 'add-GreenHills-MULTI-generator' into next ff7ecb92 GHS: Initialize CMAKE__FLAGS[_] 79fe11f1 GHS: Fix tests by finding make program when cleaning http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ff7ecb92c57c91ba0da0bb833dc92fd9a7d9d2fb commit ff7ecb92c57c91ba0da0bb833dc92fd9a7d9d2fb Author: Geoff Viola AuthorDate: Tue Mar 31 13:05:52 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 13:07:40 2015 -0400 GHS: Initialize CMAKE__FLAGS[_] diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake new file mode 100644 index 0000000..836d741 --- /dev/null +++ b/Modules/Compiler/GHS-C.cmake @@ -0,0 +1,7 @@ +set(CMAKE_C_VERBOSE_FLAG "-v") + +set(CMAKE_C_FLAGS_INIT "") +set(CMAKE_C_FLAGS_DEBUG_INIT "-Odebug -g") +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Ospace") +set(CMAKE_C_FLAGS_RELEASE_INIT "-O") +set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O -g") diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake new file mode 100644 index 0000000..cd449f7 --- /dev/null +++ b/Modules/Compiler/GHS-CXX.cmake @@ -0,0 +1,7 @@ +set(CMAKE_CXX_VERBOSE_FLAG "-v") + +set(CMAKE_CXX_FLAGS_INIT "") +set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Ospace") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O -g") diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 0455721..c7337d8 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -59,13 +59,13 @@ void cmGlobalGhsMultiGenerator::EnableLanguage( mf->AddDefinition("CMAKE_C_COMPILER", std::string(ghsCompRootStart + "ccarm.exe").c_str()); mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); - mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHSC"); + mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS"); mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE"); mf->AddDefinition("CMAKE_CXX_COMPILER", std::string(ghsCompRootStart + "cxarm.exe").c_str()); mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE"); - mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHSCXX"); + mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS"); mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); if (!ghsCompRoot.empty()) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=79fe11f106d1587f3e31cb0749ce45805b585d93 commit 79fe11f106d1587f3e31cb0749ce45805b585d93 Author: Geoff Viola AuthorDate: Sun Mar 29 20:56:21 2015 -0600 Commit: Brad King CommitDate: Tue Mar 31 13:05:02 2015 -0400 GHS: Fix tests by finding make program when cleaning diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index afd05ae..0455721 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -19,6 +19,7 @@ #include const char *cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; +const char *cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild"; cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator() : OSDirRelative(false) @@ -104,10 +105,13 @@ std::string const &cmGlobalGhsMultiGenerator::GetGhsBuildCommand() std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() { - std::string makeProgram = cmSystemTools::FindProgram("gbuild"); + std::vector userPaths; + userPaths.push_back(this->GetCompRoot()); + std::string makeProgram = + cmSystemTools::FindProgram(DEFAULT_MAKE_PROGRAM, userPaths); if (makeProgram.empty()) { - makeProgram = "gbuild"; + makeProgram = DEFAULT_MAKE_PROGRAM; } return makeProgram; } diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index d5948da..2fea75a 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -120,6 +120,7 @@ private: bool OSDirRelative; bool GhsBuildCommandInitialized; std::string GhsBuildCommand; + static const char *DEFAULT_MAKE_PROGRAM; }; #endif ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/GHS-C.cmake | 7 +++++++ Modules/Compiler/GHS-CXX.cmake | 7 +++++++ Source/cmGlobalGhsMultiGenerator.cxx | 12 ++++++++---- Source/cmGlobalGhsMultiGenerator.h | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 Modules/Compiler/GHS-C.cmake create mode 100644 Modules/Compiler/GHS-CXX.cmake hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 14:03:55 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 14:03:55 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1320-g9aa6d85 Message-ID: <20150331180355.9DB3FAD99E@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 9aa6d8588b8ec2b0ebe9792ab732c428cca8e032 (commit) via 1e29843bedbeddb204314b6dc951687c59d6ea6b (commit) from 85de1ddd36462a7ef0fbcc6ea3ecd7d62a515491 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9aa6d8588b8ec2b0ebe9792ab732c428cca8e032 commit 9aa6d8588b8ec2b0ebe9792ab732c428cca8e032 Merge: 85de1dd 1e29843 Author: Brad King AuthorDate: Tue Mar 31 14:03:54 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 14:03:54 2015 -0400 Merge topic 'cpack-rpm-basic-symlink-handling' into next 1e29843b fixup! CPack/RPM basic symlink support http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1e29843bedbeddb204314b6dc951687c59d6ea6b commit 1e29843bedbeddb204314b6dc951687c59d6ea6b Author: Brad King AuthorDate: Tue Mar 31 14:03:03 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 14:03:05 2015 -0400 fixup! CPack/RPM basic symlink support Move documentation to end since it is not the primary functionality of the generator. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index f4c853b..b8d518c 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -4,43 +4,6 @@ # # The builtin (binary) CPack RPM generator (Unix only) # -# Packaging of symbolic links -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# CPackRPM supports packaging of symbolic links. -# -# :: -# -# execute_process(COMMAND ${CMAKE_COMMAND} -# -E create_symlink ) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ -# DESTINATION COMPONENT libraries) -# -# Symbolic links will be optimized (paths will be shortened if possible) -# before being added to the package or if multiple relocation paths are -# detected, a post install symlink relocation script will be generated. -# -# Symbolic links may point to locations that are not packaged by the same -# package (either a different component or even not packaged at all) but -# those locations will be treated as if they were a part of the package -# while determining if symlink should be either created or present in a -# post install script - depending on relocation paths. -# -# Currenty there are a few limitations though: -# -# * Only symbolic links with relative path can be packaged. -# -# * For component based packaging component interdependency is not checked -# when processing symbolic links. Symbolic links pointing to content of -# a different component are treated the same way as if pointing to location -# that will not be packaged. -# -# * Symbolic links pointing to a location through one or more intermediate -# symbolic links will not be handled differently - if the intermediate -# symbolic link(s) is also on a relocatable path, relocating it during -# package installation may cause initial symbolic link to point to an -# invalid location. -# # Variables specific to CPack RPM generator # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # @@ -455,6 +418,41 @@ # # May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM__PACKAGE_PREFIX # from relocatable RPM prefix paths. +# +# Packaging of Symbolic Links +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# CPackRPM supports packaging of symbolic links:: +# +# execute_process(COMMAND ${CMAKE_COMMAND} +# -E create_symlink ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ +# DESTINATION COMPONENT libraries) +# +# Symbolic links will be optimized (paths will be shortened if possible) +# before being added to the package or if multiple relocation paths are +# detected, a post install symlink relocation script will be generated. +# +# Symbolic links may point to locations that are not packaged by the same +# package (either a different component or even not packaged at all) but +# those locations will be treated as if they were a part of the package +# while determining if symlink should be either created or present in a +# post install script - depending on relocation paths. +# +# Currenty there are a few limitations though: +# +# * Only symbolic links with relative path can be packaged. +# +# * For component based packaging component interdependency is not checked +# when processing symbolic links. Symbolic links pointing to content of +# a different component are treated the same way as if pointing to location +# that will not be packaged. +# +# * Symbolic links pointing to a location through one or more intermediate +# symbolic links will not be handled differently - if the intermediate +# symbolic link(s) is also on a relocatable path, relocating it during +# package installation may cause initial symbolic link to point to an +# invalid location. #============================================================================= # Copyright 2007-2009 Kitware, Inc. ----------------------------------------------------------------------- Summary of changes: Modules/CPackRPM.cmake | 72 +++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 37 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 14:04:51 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 14:04:51 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1322-gf416e06 Message-ID: <20150331180451.9AC56AD9C8@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via f416e0618d670641bb7c66d5130dcc3856396825 (commit) via 681f3a2f012dcd17f63faa3c6f932ae92278e3bd (commit) from 9aa6d8588b8ec2b0ebe9792ab732c428cca8e032 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f416e0618d670641bb7c66d5130dcc3856396825 commit f416e0618d670641bb7c66d5130dcc3856396825 Merge: 9aa6d85 681f3a2 Author: Brad King AuthorDate: Tue Mar 31 14:04:50 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 14:04:50 2015 -0400 Merge topic 'cpack-rpm-basic-symlink-handling' into next 681f3a2f CPackRPM: Add basic symlink support (#15209) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=681f3a2f012dcd17f63faa3c6f932ae92278e3bd commit 681f3a2f012dcd17f63faa3c6f932ae92278e3bd Author: Domen Vrankar AuthorDate: Sun Mar 29 20:55:20 2015 +0200 Commit: Brad King CommitDate: Tue Mar 31 14:04:13 2015 -0400 CPackRPM: Add basic symlink support (#15209) RPM packages can contain symbolic links to relative paths - including support for multiple relocation paths through generation of post install relocation scripts. Add basic support with limitations described in documentation. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 162eba7..b8d518c 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -418,6 +418,41 @@ # # May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM__PACKAGE_PREFIX # from relocatable RPM prefix paths. +# +# Packaging of Symbolic Links +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# CPackRPM supports packaging of symbolic links:: +# +# execute_process(COMMAND ${CMAKE_COMMAND} +# -E create_symlink ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ +# DESTINATION COMPONENT libraries) +# +# Symbolic links will be optimized (paths will be shortened if possible) +# before being added to the package or if multiple relocation paths are +# detected, a post install symlink relocation script will be generated. +# +# Symbolic links may point to locations that are not packaged by the same +# package (either a different component or even not packaged at all) but +# those locations will be treated as if they were a part of the package +# while determining if symlink should be either created or present in a +# post install script - depending on relocation paths. +# +# Currenty there are a few limitations though: +# +# * Only symbolic links with relative path can be packaged. +# +# * For component based packaging component interdependency is not checked +# when processing symbolic links. Symbolic links pointing to content of +# a different component are treated the same way as if pointing to location +# that will not be packaged. +# +# * Symbolic links pointing to a location through one or more intermediate +# symbolic links will not be handled differently - if the intermediate +# symbolic link(s) is also on a relocatable path, relocating it during +# package installation may cause initial symbolic link to point to an +# invalid location. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -503,6 +538,301 @@ function(cpack_rpm_prepare_relocation_paths) set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE) endfunction() +function(cpack_rpm_symlink_get_relocation_prefixes LOCATION PACKAGE_PREFIXES RETURN_VARIABLE) + foreach(PKG_PREFIX IN LISTS PACKAGE_PREFIXES) + string(REGEX MATCH "^${PKG_PREFIX}/.*" FOUND_ "${LOCATION}") + if(FOUND_) + list(APPEND TMP_PREFIXES "${PKG_PREFIX}") + endif() + endforeach() + + set(${RETURN_VARIABLE} "${TMP_PREFIXES}" PARENT_SCOPE) +endfunction() + +function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) + list(LENGTH PACKAGE_PREFIXES LAST_INDEX) + set(SORTED_PACKAGE_PREFIXES "${PACKAGE_PREFIXES}") + list(SORT SORTED_PACKAGE_PREFIXES) + list(REVERSE SORTED_PACKAGE_PREFIXES) + math(EXPR LAST_INDEX ${LAST_INDEX}-1) + + foreach(SYMLINK_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${SYMLINK_INDEX} SRC_PATH) + list(FIND PACKAGE_PREFIXES "${SRC_PATH}" SYMLINK_INDEX) # reverse magic + string(LENGTH "${SRC_PATH}" SRC_PATH_LEN) + + set(PARTS_CNT 0) + set(SCRIPT_PART "if [ \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}\" != \"${SRC_PATH}\" ]; then\n") + + # both paths relocated + foreach(POINT_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) + list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic + string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) + + if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) + if("${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") + set(INDENT "") + else() + set(SCRIPT_PART "${SCRIPT_PART} if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + set(INDENT " ") + endif() + + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) + math(EXPR PARTS_CNT ${PARTS_CNT}+1) + + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}fi\n") + endforeach() + + if(NOT "${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") + set(SCRIPT_PART "${SCRIPT_PART} fi\n") + endif() + endif() + endforeach() + + # source path relocated + if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) + math(EXPR PARTS_CNT ${PARTS_CNT}+1) + + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT_PART "${SCRIPT_PART} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT_PART "${SCRIPT_PART} ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + set(SCRIPT_PART "${SCRIPT_PART} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT_PART "${SCRIPT_PART} fi\n") + endforeach() + endif() + + if(PARTS_CNT) + set(SCRIPT "${SCRIPT_PART}") + set(SCRIPT "${SCRIPT}fi\n") + endif() + endforeach() + + # point path relocated + foreach(POINT_INDEX RANGE ${LAST_INDEX}) + list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) + list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic + string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) + + if(_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) + set(SCRIPT "${SCRIPT}if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT "${SCRIPT} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT "${SCRIPT} ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n") + set(SCRIPT "${SCRIPT} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + set(SCRIPT "${SCRIPT} fi\n") + endforeach() + + set(SCRIPT "${SCRIPT}fi\n") + endif() + endforeach() + + # no path relocated + if(_RPM_RELOCATION_SCRIPT_X_X) + foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_X) + math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) + list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) + string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) + + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) + + math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) + string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) + + set(SCRIPT "${SCRIPT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + set(SCRIPT "${SCRIPT} ln -s \"${POINT_}\" \"${SYMLINK_}\"\n") + set(SCRIPT "${SCRIPT}fi\n") + endforeach() + endif() + + set(RPM_SYMLINK_POSTINSTALL "${SCRIPT}" PARENT_SCOPE) +endfunction() + +function(cpack_rpm_symlink_add_for_relocation_script PACKAGE_PREFIXES SYMLINK SYMLINK_RELOCATION_PATHS POINT POINT_RELOCATION_PATHS) + list(LENGTH SYMLINK_RELOCATION_PATHS SYMLINK_PATHS_COUTN) + list(LENGTH POINT_RELOCATION_PATHS POINT_PATHS_COUNT) + + list(APPEND _RPM_RELOCATION_SCRIPT_PAIRS "${SYMLINK}:${POINT}") + list(LENGTH _RPM_RELOCATION_SCRIPT_PAIRS PAIR_NO) + + if(SYMLINK_PATHS_COUTN) + foreach(SYMLINK_RELOC_PATH IN LISTS SYMLINK_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${SYMLINK_RELOC_PATH}" SYMLINK_INDEX) + + # source path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X") + + foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) + + # both paths relocated + list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}") + + # point path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") + endforeach() + endforeach() + elseif(POINT_PATHS_COUNT) + foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) + list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) + + # point path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") + endforeach() + endif() + + # no path relocated + list(APPEND _RPM_RELOCATION_SCRIPT_X_X "${PAIR_NO}") + list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_X") + + # place variables into parent scope + foreach(VAR IN LISTS RELOCATION_VARS) + set(${VAR} "${${VAR}}" PARENT_SCOPE) + endforeach() + set(_RPM_RELOCATION_SCRIPT_PAIRS "${_RPM_RELOCATION_SCRIPT_PAIRS}" PARENT_SCOPE) + set(REQUIRES_SYMLINK_RELOCATION_SCRIPT "true" PARENT_SCOPE) + set(DIRECTIVE "%ghost " PARENT_SCOPE) +endfunction() + +function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXES IS_RELOCATABLE) + # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir + # This is necessary to avoid duplicate files since rpmbuild does + # recursion on its own when encountering a pathname which is a directory + # which is not flagged as %dir + string(STRIP "${INSTALL_FILES_LIST}" INSTALL_FILES_LIST) + string(REPLACE "\n" ";" INSTALL_FILES_LIST + "${INSTALL_FILES_LIST}") + string(REPLACE "\"" "" INSTALL_FILES_LIST + "${INSTALL_FILES_LIST}") + string(LENGTH "${WDIR}" WDR_LEN_) + + list(SORT INSTALL_FILES_LIST) # make file order consistent on all platforms + + foreach(F IN LISTS INSTALL_FILES_LIST) + unset(DIRECTIVE) + + if(IS_SYMLINK "${WDIR}/${F}") + if(IS_RELOCATABLE) + # check that symlink has relocatable format + get_filename_component(SYMLINK_LOCATION_ "${WDIR}/${F}" DIRECTORY) + execute_process(COMMAND ls -la "${WDIR}/${F}" + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE SYMLINK_POINT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(FIND "${SYMLINK_POINT_}" "->" SYMLINK_POINT_INDEX_ REVERSE) + math(EXPR SYMLINK_POINT_INDEX_ ${SYMLINK_POINT_INDEX_}+3) + string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_) + + # get destination path + string(SUBSTRING "${SYMLINK_POINT_}" ${SYMLINK_POINT_INDEX_} ${SYMLINK_POINT_LENGTH_} SYMLINK_POINT_) + + # check if path is relative or absolute + string(SUBSTRING "${SYMLINK_POINT_}" 0 1 SYMLINK_IS_ABSOLUTE_) + + if(${SYMLINK_IS_ABSOLUTE_} STREQUAL "/") + # prevent absolute paths from having /../ or /./ section inside of them + get_filename_component(SYMLINK_POINT_ "${SYMLINK_POINT_}" ABSOLUTE) + else() + # handle relative path + get_filename_component(SYMLINK_POINT_ "${SYMLINK_LOCATION_}/${SYMLINK_POINT_}" ABSOLUTE) + endif() + + string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_) + + cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS") + cpack_rpm_symlink_get_relocation_prefixes("${SYMLINK_POINT_WD_}" "${PACKAGE_PREFIXES}" "POINT_RELOCATIONS") + + list(LENGTH SYMLINK_RELOCATIONS SYMLINK_RELOCATIONS_COUNT) + list(LENGTH POINT_RELOCATIONS POINT_RELOCATIONS_COUNT) + + if(SYMLINK_RELOCATIONS_COUNT AND POINT_RELOCATIONS_COUNT) + # find matching + foreach(SYMLINK_RELOCATION_PREFIX IN LISTS SYMLINK_RELOCATIONS) + list(FIND POINT_RELOCATIONS "${SYMLINK_RELOCATION_PREFIX}" FOUND_INDEX) + if(NOT ${FOUND_INDEX} EQUAL -1) + break() + endif() + endforeach() + + if(NOT ${FOUND_INDEX} EQUAL -1) + # symlinks have the same subpath + if(${SYMLINK_RELOCATIONS_COUNT} EQUAL 1 AND ${POINT_RELOCATIONS_COUNT} EQUAL 1) + # permanent symlink + get_filename_component(SYMLINK_LOCATION_ "${F}" DIRECTORY) + file(RELATIVE_PATH FINAL_PATH_ ${SYMLINK_LOCATION_} ${SYMLINK_POINT_WD_}) + execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${FINAL_PATH_}" "${WDIR}/${F}") + else() + # relocation subpaths + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + endif() + else() + # not on the same relocation path + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + endif() + elseif(POINT_RELOCATIONS_COUNT) + # point is relocatable + cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" + "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") + else() + # is not relocatable or points to non relocatable path - permanent symlink + execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${SYMLINK_POINT_WD_}" "${WDIR}/${F}") + endif() + endif() + elseif(IS_DIRECTORY "${WDIR}/${F}") + set(DIRECTIVE "%dir ") + endif() + + set(INSTALL_FILES "${INSTALL_FILES}${DIRECTIVE}\"${F}\"\n") + endforeach() + + if(REQUIRES_SYMLINK_RELOCATION_SCRIPT) + cpack_rpm_symlink_create_relocation_script("${PACKAGE_PREFIXES}") + endif() + + set(RPM_SYMLINK_POSTINSTALL "${RPM_SYMLINK_POSTINSTALL}" PARENT_SCOPE) + set(CPACK_RPM_INSTALL_FILES "${INSTALL_FILES}" PARENT_SCOPE) +endfunction() + if(CMAKE_BINARY_DIR) message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") endif() @@ -963,9 +1293,10 @@ function(cpack_rpm_generate_package) # destinct parent paths of other relocation paths and remove the # final element (so the install-prefix dir itself is not omitted # from the RPM's content-list) - list(SORT RPM_USED_PACKAGE_PREFIXES) + set(SORTED_RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}") + list(SORT SORTED_RPM_USED_PACKAGE_PREFIXES) set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) + foreach(_RPM_RELOCATION_PREFIX ${SORTED_RPM_USED_PACKAGE_PREFIXES}) if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") @@ -1142,25 +1473,13 @@ function(cpack_rpm_generate_package) set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") endif() - - # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir - # This is necessary to avoid duplicate files since rpmbuild do - # recursion on its own when encountering a pathname which is a directory - # which is not flagged as %dir - string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) - string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - set(CPACK_RPM_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - if(IS_DIRECTORY "${WDIR}/${F}") - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}%dir \"${F}\"\n") - else() - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") - endif() - endforeach() - set(CPACK_RPM_INSTALL_FILES_LIST "") + # Prepare install files + cpack_rpm_prepare_install_files( + "${CPACK_RPM_INSTALL_FILES}" + "${WDIR}" + "${RPM_USED_PACKAGE_PREFIXES}" + "${CPACK_RPM_PACKAGE_RELOCATABLE}" + ) # The name of the final spec file to be used by rpmbuild set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") @@ -1246,6 +1565,7 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %clean %post +\@RPM_SYMLINK_POSTINSTALL\@ \@CPACK_RPM_SPEC_POSTINSTALL\@ %postun diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f2df4af..5944d08 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -991,6 +991,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ${build_generator_args} --build-project CPackComponentsForAll --build-options ${build_options} + -DCPACK_GENERATOR:STRING=${CPackGen} -DCPACK_BINARY_${CPackGen}:BOOL=ON ${CPackRun_CPackComponentWay} ${CPackComponentsForAll_BUILD_OPTIONS} diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index 51af297..1cc34b0 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -49,6 +49,44 @@ install(FILES mylib.h DESTINATION include COMPONENT headers) +if("${CPACK_GENERATOR}" MATCHES "RPM") + # Package symbolic links + install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) + install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable/bar COMPONENT libraries) + install(DIRECTORY DESTINATION other_relocatable/depth_two COMPONENT libraries) + install(DIRECTORY DESTINATION non_relocatable/depth_two COMPONENT libraries) + # test symbolic links to same dir + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink depth_three symlink_samedir_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic links to same dir with current dir ./ prefix + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./depth_three symlink_samedir_path_current_dir) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_current_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic links to same dir with longer relative path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../${CMAKE_INSTALL_LIBDIR}/.././${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two/depth_three symlink_samedir_path_longer) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_longer DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic links to sub dir + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three symlink_subdir_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_subdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one COMPONENT libraries) + # test symbolic links to parent dir + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two symlink_parentdir_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_parentdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries) + # test symbolic link to another relocatable path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././.././../other_relocatable/./depth_two symlink_other_relocatable_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_other_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) + # test symbolic link to non relocatable path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../non_relocatable/./depth_two symlink_to_non_relocatable_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries) + # test symbolic link from non relocatable path + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two symlink_from_non_relocatable_path) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_from_non_relocatable_path DESTINATION non_relocatable/depth_two COMPONENT libraries) + # test symbolic link relocatable path to its relocatable subpath + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../inside_relocatable_two/depth_two/different_relocatable/bar symlink_relocatable_subpath) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_relocatable_subpath DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) + # test symbolic link to location outside package + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./outside_package symlink_outside_package) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_package DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries) +endif() + # CPack boilerplate for this project set(CPACK_PACKAGE_NAME "MyLib") set(CPACK_PACKAGE_CONTACT "None") @@ -114,7 +152,8 @@ set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) # can not be used in CPack scripts due to CMAKE_SIZEOF_VOID_P # variable not being set set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}" - "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}") + "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}" "other_relocatable" + "${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable") # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index cf4da74..e747052 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -1,3 +1,7 @@ +# prevent older policies from interfearing with this script +cmake_policy(PUSH) +cmake_policy(VERSION ${CMAKE_VERSION}) + message(STATUS "=============================================================================") message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") message(STATUS "") @@ -138,6 +142,7 @@ if(CPackGen MATCHES "RPM") "An extremely useful application that makes use of MyLib") set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Static libraries used to build programs with MyLib") + set(LIB_SUFFIX "6?4?") # test package info if(${CPackComponentWay} STREQUAL "IgnoreGroup") @@ -174,10 +179,32 @@ if(CPackGen MATCHES "RPM") if(check_file_libraries_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_LIBRARIES_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/other_relocatable${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable") set(check_file_match_expected_architecture "") # we don't explicitly set this value so it is different on each platform - ignore it set(spec_regex "*libraries*") - set(check_content_list "^/usr/foo/bar/lib.*\n/usr/foo/bar/lib.*/libmylib.a$") + set(check_content_list "^/usr/foo/bar/lib${LIB_SUFFIX} +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/depth_three/symlink_parentdir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_outside_package +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_relocatable_subpath +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_current_dir +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/depth_two/symlink_samedir_path_longer +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_one/symlink_subdir_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/different_relocatable/bar +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_other_relocatable_path +/usr/foo/bar/lib${LIB_SUFFIX}/inside_relocatable_two/depth_two/symlink_to_non_relocatable_path +/usr/foo/bar/lib${LIB_SUFFIX}/libmylib.a +/usr/foo/bar/non_relocatable +/usr/foo/bar/non_relocatable/depth_two +/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path +/usr/foo/bar/other_relocatable +/usr/foo/bar/other_relocatable/depth_two$") elseif(check_file_headers_match) set(check_file_match_expected_summary ".*${CPACK_RPM_headers_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_RPM_headers_PACKAGE_DESCRIPTION}.*") @@ -188,10 +215,12 @@ if(CPackGen MATCHES "RPM") elseif(check_file_applications_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") - set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}.*") + set(check_file_match_expected_relocation_path "Relocations${whitespaces}:${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") set(check_file_match_expected_architecture "armv7hf") set(spec_regex "*applications*") - set(check_content_list "^/usr/foo/bar\n/usr/foo/bar/bin\n/usr/foo/bar/bin/mylibapp$") + set(check_content_list "^/usr/foo/bar +/usr/foo/bar/bin +/usr/foo/bar/bin/mylibapp$") elseif(check_file_Unspecified_match) set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") set(check_file_match_expected_description ".*DESCRIPTION.*") @@ -269,5 +298,59 @@ if(CPackGen MATCHES "RPM") message(FATAL_ERROR "error: '${check_file}' rpm package content does not match expected value - regex '${check_content_list}'; RPM output: '${check_package_content}'; generated spec file: '${spec_file_content}'") endif() endforeach() + + ####################### + # verify generated symbolic links + ####################### + file(GLOB_RECURSE symlink_files RELATIVE "${CPackComponentsForAll_BINARY_DIR}" "${CPackComponentsForAll_BINARY_DIR}/*/symlink_*") + + foreach(check_symlink IN LISTS symlink_files) + get_filename_component(symlink_name "${check_symlink}" NAME) + execute_process(COMMAND ls -la "${check_symlink}" + WORKING_DIRECTORY "${CPackComponentsForAll_BINARY_DIR}" + OUTPUT_VARIABLE SYMLINK_POINT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if("${symlink_name}" STREQUAL "symlink_samedir_path" + OR "${symlink_name}" STREQUAL "symlink_samedir_path_current_dir" + OR "${symlink_name}" STREQUAL "symlink_samedir_path_longer") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_three$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_subdir_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}depth_two/depth_three$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_parentdir_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}../$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_to_non_relocatable_path") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}${CPACK_PACKAGING_INSTALL_PREFIX}/non_relocatable/depth_two$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_outside_package") + string(REGEX MATCH "^.*${whitespaces}->${whitespaces}outside_package$" check_symlink "${SYMLINK_POINT_}") + elseif("${symlink_name}" STREQUAL "symlink_other_relocatable_path" + OR "${symlink_name}" STREQUAL "symlink_from_non_relocatable_path" + OR "${symlink_name}" STREQUAL "symlink_relocatable_subpath") + # these links were not canged - post install script only - ignore them + else() + message(FATAL_ERROR "error: unexpected rpm symbolic link '${check_symlink}'") + endif() + + if(NOT check_symlink) + message(FATAL_ERROR "symlink points to unexpected location '${SYMLINK_POINT_}'") + endif() + endforeach() + + # verify post install symlink relocation script + file(GLOB_RECURSE spec_file "${CPackComponentsForAll_BINARY_DIR}/*libraries*.spec") + file(READ ${spec_file} spec_file_content) + file(READ "${CMAKE_CURRENT_LIST_DIR}/symlink_postinstall_expected.txt" symlink_postinstall_expected) + # prepare regex + string(STRIP "${symlink_postinstall_expected}" symlink_postinstall_expected) + string(REPLACE "[" "\\[" symlink_postinstall_expected "${symlink_postinstall_expected}") + string(REPLACE "$" "\\$" symlink_postinstall_expected "${symlink_postinstall_expected}") + string(REPLACE "lib" "lib${LIB_SUFFIX}" symlink_postinstall_expected "${symlink_postinstall_expected}") + # compare + string(REGEX MATCH ".*${symlink_postinstall_expected}.*" symlink_postinstall_expected_matches "${spec_file_content}") + if(NOT symlink_postinstall_expected_matches) + message(FATAL_ERROR "error: unexpected rpm symbolic link postinstall script! generated spec file: '${spec_file_content}'") + endif() endif() endif() + +cmake_policy(POP) diff --git a/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt b/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt new file mode 100644 index 0000000..ba46792 --- /dev/null +++ b/Tests/CPackComponentsForAll/symlink_postinstall_expected.txt @@ -0,0 +1,57 @@ +if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then + if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "$RPM_INSTALL_PREFIX1/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi + fi + if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX2/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "$RPM_INSTALL_PREFIX0/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "/usr/foo/bar/other_relocatable/depth_two" "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi +fi +if [ "$RPM_INSTALL_PREFIX1" != "/usr/foo/bar/other_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "$RPM_INSTALL_PREFIX1/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_1=true + fi +fi +if [ "$RPM_INSTALL_PREFIX2" != "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX2/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi +fi +if [ "$RPM_INSTALL_PREFIX0" != "/usr/foo/bar/lib" ]; then + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" + CPACK_RPM_RELOCATED_SYMLINK_0=true + fi + if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then + ln -s "$RPM_INSTALL_PREFIX0/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" + CPACK_RPM_RELOCATED_SYMLINK_2=true + fi +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_0" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two/different_relocatable/bar" "/usr/foo/bar/lib/inside_relocatable_one/depth_two/symlink_relocatable_subpath" +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_1" ]; then + ln -s "/usr/foo/bar/other_relocatable/depth_two" "/usr/foo/bar/lib/inside_relocatable_two/depth_two/symlink_other_relocatable_path" +fi +if [ -z "$CPACK_RPM_RELOCATED_SYMLINK_2" ]; then + ln -s "/usr/foo/bar/lib/inside_relocatable_two/depth_two" "/usr/foo/bar/non_relocatable/depth_two/symlink_from_non_relocatable_path" +fi ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 14:10:26 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 14:10:26 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1324-ga58c3eb Message-ID: <20150331181026.6CD49A6CA7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via a58c3eb495ae81acb0e443963dfb024f26c139c9 (commit) via 68e13e98f5c719cba641bf7a3a01cbfd7c6bd394 (commit) from f416e0618d670641bb7c66d5130dcc3856396825 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a58c3eb495ae81acb0e443963dfb024f26c139c9 commit a58c3eb495ae81acb0e443963dfb024f26c139c9 Merge: f416e06 68e13e9 Author: Brad King AuthorDate: Tue Mar 31 14:10:25 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 14:10:25 2015 -0400 Merge topic 'cpack-rpm-basic-symlink-handling' into next 68e13e98 Help: Add notes for topic 'cpack-rpm-basic-symlink-handling' http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68e13e98f5c719cba641bf7a3a01cbfd7c6bd394 commit 68e13e98f5c719cba641bf7a3a01cbfd7c6bd394 Author: Brad King AuthorDate: Tue Mar 31 14:07:13 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 14:10:19 2015 -0400 Help: Add notes for topic 'cpack-rpm-basic-symlink-handling' diff --git a/Help/release/dev/cpack-rpm-basic-symlink-handling.rst b/Help/release/dev/cpack-rpm-basic-symlink-handling.rst new file mode 100644 index 0000000..3af4cf1 --- /dev/null +++ b/Help/release/dev/cpack-rpm-basic-symlink-handling.rst @@ -0,0 +1,6 @@ +cpack-rpm-basic-symlink-handling +-------------------------------- + +* The :module:`CPackRPM` module learned to package symbolic links + more cleanly and now supports directory symlinks with recent + ``rpmbuild`` versions. ----------------------------------------------------------------------- Summary of changes: Help/release/dev/cpack-rpm-basic-symlink-handling.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/cpack-rpm-basic-symlink-handling.rst hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 14:11:22 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 14:11:22 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-557-gad09756 Message-ID: <20150331181122.466DCAA2E6@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via ad09756fed4257dca08b032bf2cbad7dd82a0d80 (commit) via 68e13e98f5c719cba641bf7a3a01cbfd7c6bd394 (commit) via 681f3a2f012dcd17f63faa3c6f932ae92278e3bd (commit) from ed989122c3b997b19c714ce511619e6b6204a1f1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad09756fed4257dca08b032bf2cbad7dd82a0d80 commit ad09756fed4257dca08b032bf2cbad7dd82a0d80 Merge: ed98912 68e13e9 Author: Brad King AuthorDate: Tue Mar 31 14:11:20 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 14:11:20 2015 -0400 Merge topic 'cpack-rpm-basic-symlink-handling' 68e13e98 Help: Add notes for topic 'cpack-rpm-basic-symlink-handling' 681f3a2f CPackRPM: Add basic symlink support (#15209) ----------------------------------------------------------------------- Summary of changes: .../dev/cpack-rpm-basic-symlink-handling.rst | 6 + Modules/CPackRPM.cmake | 362 ++++++++++++++++++-- Tests/CMakeLists.txt | 1 + Tests/CPackComponentsForAll/CMakeLists.txt | 41 ++- .../RunCPackVerifyResult.cmake | 91 ++++- .../symlink_postinstall_expected.txt | 57 +++ 6 files changed, 532 insertions(+), 26 deletions(-) create mode 100644 Help/release/dev/cpack-rpm-basic-symlink-handling.rst create mode 100644 Tests/CPackComponentsForAll/symlink_postinstall_expected.txt hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 14:11:58 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 14:11:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.2.1-559-g0021435 Message-ID: <20150331181158.6B55DAB416@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, master has been updated via 00214357ba6166d829da68a65c0d50a61c663bd5 (commit) via 1570a4df9246c5f9b7a6818c367ddb596b84d083 (commit) from ad09756fed4257dca08b032bf2cbad7dd82a0d80 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00214357ba6166d829da68a65c0d50a61c663bd5 commit 00214357ba6166d829da68a65c0d50a61c663bd5 Merge: ad09756 1570a4d Author: Brad King AuthorDate: Tue Mar 31 14:11:57 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 14:11:57 2015 -0400 Merge topic 'UseSWIG-no-MAIN_DEPENDENCY' 1570a4df Help: Add notes for topic 'UseSWIG-no-MAIN_DEPENDENCY' ----------------------------------------------------------------------- Summary of changes: Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Help/release/dev/UseSWIG-no-MAIN_DEPENDENCY.rst hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 14:12:14 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 14:12:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1327-g6011d83 Message-ID: <20150331181214.3FFBCAB998@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 6011d83d46a2e74dd96040db5ea1b162aab155e1 (commit) via 00214357ba6166d829da68a65c0d50a61c663bd5 (commit) via ad09756fed4257dca08b032bf2cbad7dd82a0d80 (commit) from a58c3eb495ae81acb0e443963dfb024f26c139c9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6011d83d46a2e74dd96040db5ea1b162aab155e1 commit 6011d83d46a2e74dd96040db5ea1b162aab155e1 Merge: a58c3eb 0021435 Author: Brad King AuthorDate: Tue Mar 31 14:12:08 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 14:12:08 2015 -0400 Merge branch 'master' into next ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 14:55:58 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 14:55:58 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1329-g3720acd Message-ID: <20150331185558.67F8EAD4CD@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 3720acd7bfebe5f6ab4221162e6d1dae4eb6d19a (commit) via 7b1cdb00279908cacabada92f8a53e4986465423 (commit) from 6011d83d46a2e74dd96040db5ea1b162aab155e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3720acd7bfebe5f6ab4221162e6d1dae4eb6d19a commit 3720acd7bfebe5f6ab4221162e6d1dae4eb6d19a Merge: 6011d83 7b1cdb0 Author: Brad King AuthorDate: Tue Mar 31 14:55:57 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 14:55:57 2015 -0400 Merge topic 'jsoncpp-isfinite' into next 7b1cdb00 jsoncpp: Provide 'isfinite' implementation on older AIX and HP-UX http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b1cdb00279908cacabada92f8a53e4986465423 commit 7b1cdb00279908cacabada92f8a53e4986465423 Author: ?dne Hovda AuthorDate: Mon Mar 30 21:32:25 2015 +0200 Commit: Brad King CommitDate: Tue Mar 31 14:55:00 2015 -0400 jsoncpp: Provide 'isfinite' implementation on older AIX and HP-UX Newer AIX and HP-UX platforms provide 'isfinite' as a macro. Older versions do not, so add the definition if it is not provided. diff --git a/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp b/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp index 7f8e6f1..15222d6 100644 --- a/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp +++ b/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp @@ -27,6 +27,20 @@ # define isfinite finite #endif +// AIX +#if defined(_AIX) +# if !defined(isfinite) +# define isfinite finite +# endif +#endif + +// HP-UX +#if defined(__hpux) +# if !defined(isfinite) +# define isfinite finite +# endif +#endif + // Ancient glibc #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 # if !defined(isfinite) ----------------------------------------------------------------------- Summary of changes: Utilities/cmjsoncpp/src/lib_json/json_writer.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) hooks/post-receive -- CMake From bill.hoffman at kitware.com Tue Mar 31 15:05:15 2015 From: bill.hoffman at kitware.com (Bill Hoffman) Date: Tue, 31 Mar 2015 15:05:15 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1331-g0740c79 Message-ID: <20150331190515.780B3AD9B7@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 0740c7982f8f91f97223e6167d975eb488df2fc2 (commit) via 4c693cebe35c199d8fba8ce49b3a8bfec441bfe9 (commit) from 3720acd7bfebe5f6ab4221162e6d1dae4eb6d19a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0740c7982f8f91f97223e6167d975eb488df2fc2 commit 0740c7982f8f91f97223e6167d975eb488df2fc2 Merge: 3720acd 4c693ce Author: Bill Hoffman AuthorDate: Tue Mar 31 15:05:14 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 15:05:14 2015 -0400 Merge topic 'test_cpack_symlinks' into next 4c693ceb Add a test case for CPack with symbolic links in the source tree. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c693cebe35c199d8fba8ce49b3a8bfec441bfe9 commit 4c693cebe35c199d8fba8ce49b3a8bfec441bfe9 Author: Bill Hoffman AuthorDate: Tue Mar 31 15:04:39 2015 -0400 Commit: Bill Hoffman CommitDate: Tue Mar 31 15:04:39 2015 -0400 Add a test case for CPack with symbolic links in the source tree. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 7b9c810..1242332 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -203,6 +203,11 @@ add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) add_RunCMake_test(CTestCommandLine) +# Only run this test on unix platforms that support +# symbolic links +if(UNIX) + add_RunCMake_test(CPackSymlinks) +endif() set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) diff --git a/Tests/RunCMake/CPackSymlinks/CMakeLists.txt b/Tests/RunCMake/CPackSymlinks/CMakeLists.txt new file mode 100644 index 0000000..dbaa24c --- /dev/null +++ b/Tests/RunCMake/CPackSymlinks/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CPackSymlinks/CPack_TestSymlinks.cmake b/Tests/RunCMake/CPackSymlinks/CPack_TestSymlinks.cmake new file mode 100644 index 0000000..845c377 --- /dev/null +++ b/Tests/RunCMake/CPackSymlinks/CPack_TestSymlinks.cmake @@ -0,0 +1 @@ +include(CPack) diff --git a/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake b/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake new file mode 100644 index 0000000..3431eae --- /dev/null +++ b/Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake @@ -0,0 +1,21 @@ +include(RunCMake) + +function(run_cpack_symlink_test TEST_NAME) + set(RunCMake_TEST_NO_CLEAN TRUE) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-source") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + execute_process( + COMMAND "${CMAKE_COMMAND}" -E tar xvf + "${RunCMake_SOURCE_DIR}/testcpacksym.tar" + WORKING_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}" + ) + run_cmake(${TEST_NAME}) + run_cmake_command(${TEST_NAME} ${CMAKE_CPACK_COMMAND} + --config CPackSourceConfig.cmake) +endfunction() + +run_cpack_symlink_test(CPack_TestSymlinks) diff --git a/Tests/RunCMake/CPackSymlinks/testcpacksym.tar b/Tests/RunCMake/CPackSymlinks/testcpacksym.tar new file mode 100644 index 0000000..6e5017e Binary files /dev/null and b/Tests/RunCMake/CPackSymlinks/testcpacksym.tar differ ----------------------------------------------------------------------- Summary of changes: Tests/RunCMake/CMakeLists.txt | 5 +++++ .../{CPackRPM => CPackSymlinks}/CMakeLists.txt | 3 --- .../CPackSymlinks/CPack_TestSymlinks.cmake | 1 + Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake | 21 ++++++++++++++++++++ .../RunCMake/CPackSymlinks/testcpacksym.tar | Bin 12292 -> 10240 bytes 5 files changed, 27 insertions(+), 3 deletions(-) copy Tests/RunCMake/{CPackRPM => CPackSymlinks}/CMakeLists.txt (72%) create mode 100644 Tests/RunCMake/CPackSymlinks/CPack_TestSymlinks.cmake create mode 100644 Tests/RunCMake/CPackSymlinks/RunCMakeTest.cmake copy Modules/CPack.DS_Store.in => Tests/RunCMake/CPackSymlinks/testcpacksym.tar (64%) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 16:06:47 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 16:06:47 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1333-g128b0c6 Message-ID: <20150331200647.355CDADA01@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via 128b0c61bf2b5fed81e1f9ee1970e9bd63668f1e (commit) via b687d672815d45aab9d8043eef23405525aa98e2 (commit) from 0740c7982f8f91f97223e6167d975eb488df2fc2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=128b0c61bf2b5fed81e1f9ee1970e9bd63668f1e commit 128b0c61bf2b5fed81e1f9ee1970e9bd63668f1e Merge: 0740c79 b687d67 Author: Brad King AuthorDate: Tue Mar 31 16:06:46 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 16:06:46 2015 -0400 Merge topic 'ctest-repeat-until-fail' into next b687d672 Tests: Fix RunCMake.CTestCommandLine expected output time matching http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b687d672815d45aab9d8043eef23405525aa98e2 commit b687d672815d45aab9d8043eef23405525aa98e2 Author: Brad King AuthorDate: Tue Mar 31 16:04:29 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 16:04:29 2015 -0400 Tests: Fix RunCMake.CTestCommandLine expected output time matching When matching ctest command-line output, we must account for the formatting of times that take 10 seconds or more. The values are right-justified, so use " +" to match any amount of space before them. diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt index 0bc4f70..6e133cd 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stdout.txt @@ -1,26 +1,26 @@ ^Test project .*/Tests/RunCMake/CTestCommandLine/repeat-until-fail-build Start 1: initialization - Test #1: initialization ................... Passed [0-9.]+ sec + Test #1: initialization ................... Passed +[0-9.]+ sec Start 1: initialization - Test #1: initialization ................... Passed [0-9.]+ sec + Test #1: initialization ................... Passed +[0-9.]+ sec Start 1: initialization -1/4 Test #1: initialization ................... Passed [0-9.]+ sec +1/4 Test #1: initialization ................... Passed +[0-9.]+ sec Start 2: test1 - Test #2: test1 ............................ Passed [0-9.]+ sec + Test #2: test1 ............................ Passed +[0-9.]+ sec Start 2: test1 - Test #2: test1 ............................\*\*\*Failed [0-9.]+ sec + Test #2: test1 ............................\*\*\*Failed +[0-9.]+ sec Start 3: hello - Test #3: hello ............................ Passed [0-9.]+ sec + Test #3: hello ............................ Passed +[0-9.]+ sec Start 3: hello - Test #3: hello ............................ Passed [0-9.]+ sec + Test #3: hello ............................ Passed +[0-9.]+ sec Start 3: hello -3/4 Test #3: hello ............................ Passed [0-9.]+ sec +3/4 Test #3: hello ............................ Passed +[0-9.]+ sec Start 4: goodbye - Test #4: goodbye .......................... Passed [0-9.]+ sec + Test #4: goodbye .......................... Passed +[0-9.]+ sec Start 4: goodbye - Test #4: goodbye .......................... Passed [0-9.]+ sec + Test #4: goodbye .......................... Passed +[0-9.]+ sec Start 4: goodbye -4/4 Test #4: goodbye .......................... Passed [0-9.]+ sec +4/4 Test #4: goodbye .......................... Passed +[0-9.]+ sec + 75% tests passed, 1 tests failed out of 4 + ----------------------------------------------------------------------- Summary of changes: .../repeat-until-fail-ctest-stdout.txt | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 16:26:24 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 16:26:24 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1335-gdd7fb25 Message-ID: <20150331202624.DEADDAD7FF@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via dd7fb25261b19798e72e62f080560a504f0e3522 (commit) via 3113d86df4b469abdf3852671dc985420e06d363 (commit) from 128b0c61bf2b5fed81e1f9ee1970e9bd63668f1e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd7fb25261b19798e72e62f080560a504f0e3522 commit dd7fb25261b19798e72e62f080560a504f0e3522 Merge: 128b0c6 3113d86 Author: Brad King AuthorDate: Tue Mar 31 16:26:24 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 16:26:24 2015 -0400 Merge topic 'suppress-osx-arch-linker-warning' into next 3113d86d CTestCustom: Suppress OS X universal binary link arch warnings http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3113d86df4b469abdf3852671dc985420e06d363 commit 3113d86df4b469abdf3852671dc985420e06d363 Author: Brad King AuthorDate: Tue Mar 31 16:25:37 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 16:25:37 2015 -0400 CTestCustom: Suppress OS X universal binary link arch warnings diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 8c4d400..d716498 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -53,6 +53,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" "cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast "ld: warning: directory not found for option .-(F|L)" + "ld: warning: in .*/libgcc.a, file is not of required architecture" "warning.*This version of Mac OS X is unsupported" "clang.*: warning: argument unused during compilation: .-g" "note: in expansion of macro" # diagnostic context note ----------------------------------------------------------------------- Summary of changes: CTestCustom.cmake.in | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- CMake From brad.king at kitware.com Tue Mar 31 16:29:28 2015 From: brad.king at kitware.com (Brad King) Date: Tue, 31 Mar 2015 16:29:28 -0400 (EDT) Subject: [Cmake-commits] CMake branch, next, updated. v3.2.1-1337-gb190c08 Message-ID: <20150331202929.05670AD8B5@public.kitware.com> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake". The branch, next has been updated via b190c080a71b5ad153d58a40256d6144d2e84b32 (commit) via e86f44b72616ebce43dcd62d170f7ca90ff31fdf (commit) from dd7fb25261b19798e72e62f080560a504f0e3522 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b190c080a71b5ad153d58a40256d6144d2e84b32 commit b190c080a71b5ad153d58a40256d6144d2e84b32 Merge: dd7fb25 e86f44b Author: Brad King AuthorDate: Tue Mar 31 16:29:27 2015 -0400 Commit: CMake Topic Stage CommitDate: Tue Mar 31 16:29:27 2015 -0400 Merge topic 'cpack-deb-format-cast' into next e86f44b7 cmCPackDebGenerator: Cast file mode to proper type for %o formatter http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e86f44b72616ebce43dcd62d170f7ca90ff31fdf commit e86f44b72616ebce43dcd62d170f7ca90ff31fdf Author: Brad King AuthorDate: Tue Mar 31 16:28:28 2015 -0400 Commit: Brad King CommitDate: Tue Mar 31 16:28:28 2015 -0400 cmCPackDebGenerator: Cast file mode to proper type for %o formatter diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 87764e1..fcf4122 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -805,12 +805,14 @@ static int put_arobj(CF *cfp, struct stat *sb) if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) (void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid, - sb->st_mode, (long long)sb->st_size + lname, ARFMAG); + (unsigned)sb->st_mode, (long long)sb->st_size + lname, + ARFMAG); else { lname = 0; (void)sprintf(ar_hb, HDR2, name, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid, - sb->st_mode, (long long)sb->st_size, ARFMAG); + (unsigned)sb->st_mode, (long long)sb->st_size, + ARFMAG); } off_t size = sb->st_size; ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackDebGenerator.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) hooks/post-receive -- CMake