[Cmake-commits] CMake branch, master, updated. v3.8.0-1006-ge3858dd

2017-04-28 Thread Kitware Robot
This is an automated email from 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  e3858dd50b521d1abf466ac5bc55e70a3fdcc5db (commit)
  from  d828d0eb084cf094119d2b47dae0053267aba138 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e3858dd50b521d1abf466ac5bc55e70a3fdcc5db
commit e3858dd50b521d1abf466ac5bc55e70a3fdcc5db
Author: Kitware Robot <kwro...@kitware.com>
AuthorDate: Sat Apr 29 00:01:11 2017 -0400
Commit: Kitware Robot <kwro...@kitware.com>
CommitDate: Sat Apr 29 00:01:11 2017 -0400

CMake Nightly Date Stamp

diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d18bf2c..b789dc0 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 8)
-set(CMake_VERSION_PATCH 20170428)
+set(CMake_VERSION_PATCH 20170429)
 #set(CMake_VERSION_RC 1)

---

Summary of changes:
 Source/CMakeVersion.cmake |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


hooks/post-receive
-- 
CMake
___
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits


Re: [cmake-developers] Patch: Don't emit warning when config file not found

2017-04-28 Thread Christoph Grüninger
Hi Brad,
great idea! Your suggestion will make everybody happy.
I attached two patches implementing it.

Bye
ChristophFrom 0df376954173184ca78becf3ab1888e6f718af8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= 
Date: Fri, 28 Apr 2017 08:19:20 +0200
Subject: [PATCH 1/2] cmFindPackageCommand: shorten output for missing package
 in config mode

If CONFIG or MODULE is given and the package is not REQUIRED,
output a one-liner instead of the lengthy warning.
---
 Source/cmFindPackageCommand.cxx | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 17fa92ccd..dfb21f45d 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -727,7 +727,8 @@ bool cmFindPackageCommand::HandlePackageMode()
 }
   }
 
-  if (result && !found && (!this->Quiet || this->Required)) {
+  if (result && !found &&
+  (this->Required || !(this->Quiet || (this->UseConfigFiles || !this->UseFindModules {
 // The variable is not set.
 std::ostringstream e;
 std::ostringstream aw;
@@ -827,6 +828,13 @@ bool cmFindPackageCommand::HandlePackageMode()
   this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, aw.str());
 }
   }
+  else if (result && !found && !this->Quiet) {
+  std::ostringstream aw;
+  aw << "Could NOT find " << this->Name
+ << " (missing: " << this->Name
+ << "-config.cmake)";
+  this->Makefile->DisplayStatus(aw.str().c_str(), -1);
+  }
 
   // Set a variable marking whether the package was found.
   this->Makefile->AddDefinition(foundVar, found ? "1" : "0");
-- 
2.12.0

From e67f01eead80309258decff22bf3134c1bb71bb3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= 
Date: Fri, 28 Apr 2017 23:36:20 +0200
Subject: [PATCH 2/2] cmFindPackageCommand: Split condition to improve
 readability

---
 Source/cmFindPackageCommand.cxx | 193 +---
 1 file changed, 99 insertions(+), 94 deletions(-)

diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index dfb21f45d..d0eb967a9 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -727,113 +727,118 @@ bool cmFindPackageCommand::HandlePackageMode()
 }
   }
 
-  if (result && !found &&
-  (this->Required || !(this->Quiet || (this->UseConfigFiles || !this->UseFindModules {
-// The variable is not set.
-std::ostringstream e;
-std::ostringstream aw;
-if (configFileSetFOUNDFalse) {
-  /* clang-format off */
-  e << "Found package configuration file:\n"
-"  " << this->FileFound << "\n"
-"but it set " << foundVar << " to FALSE so package \"" <<
-this->Name << "\" is considered to be NOT FOUND.";
-  /* clang-format on */
-  if (!notFoundMessage.empty()) {
-e << " Reason given by package: \n" << notFoundMessage << "\n";
-  }
-}
-// If there are files in ConsideredConfigs, it means that FooConfig.cmake
-// have been found, but they didn't have appropriate versions.
-else if (!this->ConsideredConfigs.empty()) {
-  std::vector::const_iterator duplicate_end =
-cmRemoveDuplicates(this->ConsideredConfigs);
-  e << "Could not find a configuration file for package \"" << this->Name
-<< "\" that "
-<< (this->VersionExact ? "exactly matches" : "is compatible with")
-<< " requested version \"" << this->Version << "\".\n"
-<< "The following configuration files were considered but not "
-   "accepted:\n";
-  for (std::vector::const_iterator i =
- this->ConsideredConfigs.begin();
-   i != duplicate_end; ++i) {
-e << "  " << i->filename << ", version: " << i->version << "\n";
-  }
-} else {
-  std::string requestedVersionString;
-  if (!this->Version.empty()) {
-requestedVersionString = " (requested version ";
-requestedVersionString += this->Version;
-requestedVersionString += ")";
+  // package not found
+  if (result && !found) {
+// warn if package required and not quiet or in config mode
+if (this->Required ||
+!(this->Quiet || this->UseConfigFiles || !this->UseFindModules)) {
+  // The variable is not set.
+  std::ostringstream e;
+  std::ostringstream aw;
+  if (configFileSetFOUNDFalse) {
+/* clang-format off */
+e << "Found package configuration file:\n"
+  "  " << this->FileFound << "\n"
+  "but it set " << foundVar << " to FALSE so package \"" <<
+  this->Name << "\" is considered to be NOT FOUND.";
+/* clang-format on */
+if (!notFoundMessage.empty()) {
+  e << " Reason given by package: \n" << notFoundMessage << "\n";
+}
   }
-
-  if (this->UseConfigFiles) {
-if (this->UseFindModules) {
-  e << "By not providing 

[Cmake-commits] CMake branch, master, updated. v3.8.0-1005-gd828d0e

2017-04-28 Thread Kitware Robot
This is an automated email from 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  d828d0eb084cf094119d2b47dae0053267aba138 (commit)
   via  47990f9fef31eb4369bb01d72a6d86de332ae196 (commit)
   via  a8667467ea6337faddb0eeb7a8d0b08154338ac0 (commit)
  from  2911d4701675d17b817f8fbe607bb5a493cacf0c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d828d0eb084cf094119d2b47dae0053267aba138
commit d828d0eb084cf094119d2b47dae0053267aba138
Merge: 2911d47 47990f9
Author: Brad King 
AuthorDate: Fri Apr 28 13:55:36 2017 +
Commit: Kitware Robot 
CommitDate: Fri Apr 28 09:55:44 2017 -0400

Merge topic 'refactor-ipo-flags'

47990f9f Inline and remove AddFeatureFlags method
a8667467 Add IPO compiler flags more consistently in generators

Acked-by: Kitware Robot 
Merge-request: !772


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=47990f9fef31eb4369bb01d72a6d86de332ae196
commit 47990f9fef31eb4369bb01d72a6d86de332ae196
Author: Brad King 
AuthorDate: Thu Apr 27 16:21:37 2017 -0400
Commit: Brad King 
CommitDate: Thu Apr 27 16:21:59 2017 -0400

Inline and remove AddFeatureFlags method

The method implementation is now only one call of another method, so
inline it at call sites and remove it.

diff --git a/Source/cmCommonTargetGenerator.cxx 
b/Source/cmCommonTargetGenerator.cxx
index 8114020..391d65c 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -43,14 +43,6 @@ const char* cmCommonTargetGenerator::GetFeature(const 
std::string& feature)
   return this->GeneratorTarget->GetFeature(feature, this->ConfigName);
 }
 
-void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
-  const std::string& lang)
-{
-  // Add language-specific flags.
-  this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, lang,
- this->ConfigName);
-}
-
 void cmCommonTargetGenerator::AddModuleDefinitionFlag(
   cmLinkLineComputer* linkLineComputer, std::string& flags)
 {
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 8ba2e22..c36145f 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -28,9 +28,6 @@ public:
   std::string const& GetConfigName() const;
 
 protected:
-  // Add language feature flags.
-  void AddFeatureFlags(std::string& flags, const std::string& lang);
-
   // Feature query methods.
   const char* GetFeature(const std::string& feature);
 
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx 
b/Source/cmMakefileExecutableTargetGenerator.cxx
index a719887..272d45b 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -150,7 +150,8 @@ void 
cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
   linkLanguage, *this->GeneratorTarget));
 
   // Add language feature flags.
-  this->AddFeatureFlags(flags, linkLanguage);
+  this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ linkLanguage, this->ConfigName);
 
   this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
  linkLanguage, this->ConfigName);
@@ -433,7 +434,8 @@ void 
cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   }
 
   // Add language feature flags.
-  this->AddFeatureFlags(flags, linkLanguage);
+  this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ linkLanguage, this->ConfigName);
 
   this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
  linkLanguage, this->ConfigName);
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx 
b/Source/cmMakefileLibraryTargetGenerator.cxx
index 2823977..ec01208 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -395,9 +395,10 @@ void 
cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
 vars.LinkFlags = linkFlags.c_str();
 vars.TargetCompilePDB = targetOutPathCompilePDB.c_str();
 
-// Add language feature flags.
+// Add language-specific flags.
 std::string langFlags;
-this->AddFeatureFlags(langFlags, linkLanguage);
+this->LocalGenerator->AddLanguageFlags(langFlags, this->GeneratorTarget,
+

[Cmake-commits] CMake branch, master, updated. v3.8.0-1002-g2911d47

2017-04-28 Thread Kitware Robot
This is an automated email from 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  2911d4701675d17b817f8fbe607bb5a493cacf0c (commit)
   via  b61e9f8382de26ffe8cc137dfd6d63556d0bf66f (commit)
   via  12512bdb518ca1278a59997c959272625d7f6b6b (commit)
   via  f320907b3d288930c80411a8e97f63eef0e8ec8b (commit)
   via  28d83837978aefc7f6e467b41ff792817da9ec95 (commit)
   via  2a207aaca1d8414624dd4cfe8fcb19d03fe84546 (commit)
   via  81841426fc12864008999893c11e555df06df292 (commit)
   via  4c2ae38b0b25e7908c25ae939ba235dcaf336c39 (commit)
  from  34a083a1951306aa9d0c0a5f14ac17706f475546 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2911d4701675d17b817f8fbe607bb5a493cacf0c
commit 2911d4701675d17b817f8fbe607bb5a493cacf0c
Merge: b61e9f8 f320907
Author: Brad King 
AuthorDate: Fri Apr 28 13:53:44 2017 +
Commit: Kitware Robot 
CommitDate: Fri Apr 28 09:53:50 2017 -0400

Merge topic 'fix-qhalt-for-xl'

f320907b XL: Fix the use of the -qhalt flag for varying OSs

Acked-by: Kitware Robot 
Merge-request: !771


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b61e9f8382de26ffe8cc137dfd6d63556d0bf66f
commit b61e9f8382de26ffe8cc137dfd6d63556d0bf66f
Merge: 12512bd 4c2ae38
Author: Brad King 
AuthorDate: Fri Apr 28 13:52:22 2017 +
Commit: Kitware Robot 
CommitDate: Fri Apr 28 09:52:41 2017 -0400

Merge topic 'FindBoost-compile-features'

4c2ae38b Boost Fiber actually require at least C++11.

Acked-by: Kitware Robot 
Merge-request: !749


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=12512bdb518ca1278a59997c959272625d7f6b6b
commit 12512bdb518ca1278a59997c959272625d7f6b6b
Merge: 34a083a 28d8383
Author: Brad King 
AuthorDate: Fri Apr 28 13:51:56 2017 +
Commit: Kitware Robot 
CommitDate: Fri Apr 28 09:52:07 2017 -0400

Merge topic 'separgs-native'

28d83837 separgs: Use NATIVE_COMMAND where appropriate
2a207aac separgs: Add a NATIVE_COMMAND mode
81841426 separgs: Migrate tests to RunCMake tests

Acked-by: Kitware Robot 
Merge-request: !753


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f320907b3d288930c80411a8e97f63eef0e8ec8b
commit f320907b3d288930c80411a8e97f63eef0e8ec8b
Author: Chuck Atkins 
AuthorDate: Thu Apr 27 10:12:18 2017 -0400
Commit: Chuck Atkins 
CommitDate: Thu Apr 27 13:29:28 2017 -0400

XL: Fix the use of the -qhalt flag for varying OSs

The valid settings to pass to the IBM XL compiler for the -qhalt flag
vary widely by language and platform.  Based on existing documentation,
the following table shows which error levels are valid to pass to
-qhalt= since -qhalt=e is not always available.

OS   |  xlc  |  xlC  |   xlf   |
-|---|--
AIX  | iwes  | iw s  | ilwesu  |
BlueGene | iwes  | iwes  | ilwesu  |
OS X | iwesu | iwesu | ilwesu  |
Linux|  w|  w| ilwesu  |

diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake
index f976c99..f14373d 100644
--- a/Modules/Compiler/XL-C.cmake
+++ b/Modules/Compiler/XL-C.cmake
@@ -4,5 +4,4 @@ string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
 string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
 
 # -qthreaded = Ensures that all optimizations will be thread-safe
-# -qhalt=e   = Halt on error messages (rather than just severe errors)
-string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded -qhalt=e")
+string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded")
diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake
index 545d657..4fdc43e 100644
--- a/Modules/Compiler/XL-CXX.cmake
+++ b/Modules/Compiler/XL-CXX.cmake
@@ -4,8 +4,7 @@ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
 string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
 
 # -qthreaded = Ensures that all optimizations will be thread-safe
-# -qhalt=e   = Halt on error messages (rather than just severe errors)
-string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded -qhalt=e")
+string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded")
 
 set(CMAKE_CXX_COMPILE_OBJECT
   " -+-o  -c 
")
diff --git a/Modules/Platform/AIX-XL-C.cmake b/Modules/Platform/AIX-XL-C.cmake
index 5e437fa..cbfd58b 100644
--- a/Modules/Platform/AIX-XL-C.cmake
+++ b/Modules/Platform/AIX-XL-C.cmake
@@ -1,2 +1,5 @@
 include(Platform/AIX-XL)
 

[Cmake-commits] CMake branch, master, updated. v3.8.0-994-g34a083a

2017-04-28 Thread Kitware Robot
This is an automated email from 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  34a083a1951306aa9d0c0a5f14ac17706f475546 (commit)
   via  afb21342ead475a12636f29f7cd77cbe38d05ed1 (commit)
  from  02d11868827417e88cbbee795703421dfdb342f6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=34a083a1951306aa9d0c0a5f14ac17706f475546
commit 34a083a1951306aa9d0c0a5f14ac17706f475546
Merge: 02d1186 afb2134
Author: Brad King 
AuthorDate: Fri Apr 28 13:12:12 2017 +
Commit: Kitware Robot 
CommitDate: Fri Apr 28 09:12:22 2017 -0400

Merge topic 'bindexplib-consts'

afb21342 bindexplib: fix constants symbols export

Acked-by: Kitware Robot 
Merge-request: !763


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=afb21342ead475a12636f29f7cd77cbe38d05ed1
commit afb21342ead475a12636f29f7cd77cbe38d05ed1
Author: Mikhail Paulyshka 
AuthorDate: Wed Apr 26 00:37:37 2017 +0300
Commit: Mikhail Paulyshka 
CommitDate: Wed Apr 26 22:23:33 2017 +0300

bindexplib: fix constants symbols export

diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 6026a57..691e3ae 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -235,35 +235,29 @@ public:
   symbol.erase(posAt);
 }
   }
-  // For i386 builds we don't need to remove _
+  // For i386 builds we need to remove _
   if (this->IsI386 && symbol[0] == '_') {
 symbol.erase(0, 1);
   }
 
-  /*
-  Check whether it is "Scalar deleting destructor" and
-  "Vector deleting destructor"
-  */
+  // Check whether it is "Scalar deleting destructor" and "Vector
+  // deleting destructor"
+  // if scalarPrefix and vectorPrefix are not found then print the
+  // symbol
   const char* scalarPrefix = "??_G";
   const char* vectorPrefix = "??_E";
-  // original code had a check for
-  // symbol.find("real@") == std::string::npos)
-  // but if this disallows memmber functions with the name real
-  // if scalarPrefix and vectorPrefix are not found then print
-  // the symbol
   if (symbol.compare(0, 4, scalarPrefix) &&
   symbol.compare(0, 4, vectorPrefix)) {
 SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1]
  .Characteristics;
-if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) {
-  // Read only (i.e. constants) must be excluded
-  this->DataSymbols.insert(symbol);
-} else {
-  if (pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ) ||
-  (SectChar & IMAGE_SCN_MEM_EXECUTE)) {
-this->Symbols.insert(symbol);
-  } else {
-// printf(" strange symbol: %s \n",symbol.c_str());
+
+if (SectChar & IMAGE_SCN_MEM_EXECUTE) {
+  this->Symbols.insert(symbol);
+} else if (SectChar & IMAGE_SCN_MEM_READ) {
+  // skip __real@ and __xmm@
+  if (symbol.find("_real") == std::string::npos &&
+  symbol.find("_xmm") == std::string::npos) {
+this->DataSymbols.insert(symbol);
   }
 }
   }
diff --git a/Tests/RunCMake/AutoExportDll/foo.c 
b/Tests/RunCMake/AutoExportDll/foo.c
index 4b1318b..e70fbb5 100644
--- a/Tests/RunCMake/AutoExportDll/foo.c
+++ b/Tests/RunCMake/AutoExportDll/foo.c
@@ -13,3 +13,5 @@ int bar()
 {
   return 5;
 }
+
+const char testconst[] = "testconst";
diff --git a/Tests/RunCMake/AutoExportDll/say.cxx 
b/Tests/RunCMake/AutoExportDll/say.cxx
index 51060e8..eb9c0ff 100644
--- a/Tests/RunCMake/AutoExportDll/say.cxx
+++ b/Tests/RunCMake/AutoExportDll/say.cxx
@@ -13,6 +13,14 @@ int WINAPI foo();
 int bar();
 int objlib();
 void justnop();
+
+// test const export
+#ifdef _WIN32
+// data symbols must be explicitly imported
+__declspec(dllimport) extern const char testconst[];
+#else
+extern const char testconst[];
+#endif
 }
 
 // test c++ functions
@@ -43,6 +51,8 @@ int main()
   bar();
   objlib();
   printf("\n");
+  printf("%s", testconst);
+  printf("\n");
 #ifdef HAS_JUSTNOP
   justnop();
 #endif

---

Summary of changes:
 Source/bindexplib.cxx|   32 +---
 Tests/RunCMake/AutoExportDll/foo.c   |2 ++
 Tests/RunCMake/AutoExportDll/say.cxx |   10 

[CMake] About multiple toolchains support in big project

2017-04-28 Thread 刘松
Hi CMake experts,

I want to use CMake build system for large projects, which will uses different 
toolchains.

Let’s take one simple example:

There are two project, one is using the arm cross toolchain, another one is 
using the dsp toolchain.


cmake_projects/
├── CMakeLists.txt
├── arm_project
│   └── CMakeLists.txt
├── arm_project2
│   └── CMakeLists.txt
├── dsp_project
│   └── CMakeLists.txt
└── dsp_project2
└── CMakeLists.txt


Inside the cmake_projects/CMakeLists.txt:

add_subdirectory(arm_project)

add_subdirectory(arm_project2)

add_subdirectory(dsp_project)

add_subdirectory(dsp_project2)


Then, I want to build it:

mkdir build
cd build && cmake -DCMAKE_TOOLCHAIN_FILE= ../


You know that the CMAKE_TOOLCHAIN_FILE needs to be specified along with cmake 
command line, so in above example what’s the  should be ?

Yes, there might be another solution:


cmake_projects/
├── CMakeLists.txt
├── arm
│   └── CMakeLists.txt
├── dsp
│   └── CMakeLists.txt

├── arm_project
│   └── CMakeLists.txt
├── arm_project2
│   └── CMakeLists.txt
├── dsp_project
│   └── CMakeLists.txt
└── dsp_project2
└── CMakeLists.txt


so that inside arm/CMakeLists.txt


add_subdirectory(arm_project)
add_subdirectory(arm_project2)


and inside dsp/CMakeLists.txt


add_subdirectory(dsp_project)
add_subdirectory(dsp_project2)


Then, build it with

mkdir build_arm
cd build_arm && cmake -DCMAKE_TOOLCHAIN_FILE= ../arm

mkdir build_dsp
cd build_dsp && cmake -DCMAKE_TOOLCHAIN_FILE= ../dsp


But this way I need to sperate the arm and dsp build folder structure, but 
logically I need to keep the build folder structure as same as source code.

Or, let developer don’t be aware of the toolchain difference it’s just choosing 
the right one…

But if it’s supporting specifying the CMAKE_TOOLCHAIN_FILE inside the 
CMakeLists.txt, it might solving this problem.

Any suggestions or ideas ? Thanks in advanced.

Thanks,
Song
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] Inconsistent parsing of bracket comments in command arguments

2017-04-28 Thread Volo Zyko
Hi,

I've encountered the following behavior. Code like 'set(FOO#[[bar]]
1)' is parsed fine by cmake, but for the code 'set(FOO #[[bar]]1)'
cmake reports:

  Syntax Error in cmake code at column 13

  Argument not separated from preceding token by whitespace.

Is this by design or just an omission? As for me either separation
should be required on both sides of bracket comment or it should allow
to omit separation on both sides too.

 Volo Zyko
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] DLL handling under CMake

2017-04-28 Thread Nils Gladitz

On 04/27/2017 10:43 AM, Louis-Paul CORDIER wrote:

I added my current code for handling Qt library in my project at the 
end of this email. (I put a huge part of it if someone want to reuse 
it). You will notice that this code is handling the case where you are 
debugging using Visual Studio, to avoid the missing .DLL issue.


FWIW in case of Qt5 you do not have to manually construct or guess DLL 
locations.


You can retrieve the DLL locations from the imported targets (e.g. 
"Qt5::Widgets") that Qt5 provides by querying the LOCATION_ 
target properties (e.g. LOCATION_DEBUG or LOCATION_RELEASE).


Nils
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


[CMake] DLL handling under CMake

2017-04-28 Thread Louis-Paul CORDIER

Hi,

I'm using CMake for a while now for cross-platform project.

In opposition to Linux, Windows does not have a library system 
management through a repository system. I would say that 99% of 
applications that have common libraries between them does not share the 
runtimes. Each time, the .dll files are duplicated for each application. 
We have to live with that, and to create proper CMakeLists.txt that can 
handle DLL integration.


I think many of CMake users have the following pipeline on Windows:

1. Run CMake (this will execute some find_library to get the correct 
.lib files)

2. Compile the application
3. Run the INSTALL target
4. Copy the .dll files into the output binary folder.
5. Package the application with the DLL inside (e.g innosetup)

Currently find_library does not search for runtime, but only for .lib. 
So even if a developer is using find_library, he/she has to implement 
some additional CMake code to retrieve the path to .dll files and copy 
them using the install or the file CMake commands. I added my current 
code for handling Qt library in my project at the end of this email. (I 
put a huge part of it if someone want to reuse it). You will notice that 
this code is handling the case where you are debugging using Visual 
Studio, to avoid the missing .DLL issue.


This steps are tedious and I'm wondering if there is a mechanism that 
exists or that have to be imagined to make the DLL nightmare end.


All the best

Louis-Paul Cordier


...

#Folder where compiled files for release/debug install will be placed
set(G3_RELEASE_DIR  "release")
set(G3_DEBUG_DIR "debug")

find_package(Qt5 ${QT5VC2015_VERSION} EXACT COMPONENTS Core OpenGL 
Concurrent REQUIRED)


QT5_WRAP_UI(...)
QT5_WRAP_CPP(...)
target_include_directories(...)
target_compile_definitions(...)

#Add Qt libraries to the linker
target_link_libraries(${PROJECT_NAME}
  ${Qt5Widgets_LIBRARIES}
  ${Qt5OpenGL_LIBRARIES}
  ${Qt5Concurrent_LIBRARIES}
  )

if( WIN32 )
  SET(QT_DLL
  Qt5Core
  Qt5Gui
  Qt5Widgets
  Qt5OpenGL
  Qt5Concurrent
  )

foreach( _file ${QT_DLL} )
  list( APPEND DLL_LIBRARIES  "${QT5_DIR}/bin/${_file}.dll" )
  list( APPEND DLL_LIBRARIES_D  "${QT5_DIR}/bin/${_file}d.dll" )
endforeach( _file ${QT_DLL} )

#TODO: add the platform libraries.

endif( WIN32 )

# I add other DLLs of other project's library by appending to 
DLL_LIBRARIES and DLL_LIBRARIES_D


#Handle DLLs under Windows.
if(WIN32)

  set(DLL_LIBRARIES_PATH "")
  set(DLL_LIBRARIES_D_PATH "")

  #Process Release libraries.
  foreach( _file ${DLL_LIBRARIES} )

# Convert path to CMake path to avoid escaping issues.
file(TO_CMAKE_PATH ${_file} _file_cmake_path)

#check file existance
if(NOT EXISTS ${_file_cmake_path})
  message(FATAL_ERROR "Missing dll file: ${_file_cmake_path}")
endif(NOT EXISTS ${_file_cmake_path})

# Add the DLL to the installation process.
install(FILES ${_file_cmake_path}
  DESTINATION ${G3_RELEASE_DIR}
  CONFIGURATIONS Release RelWithDebInfo MinSizeRel Release_CMT 
Release_Net)


# Extract the folder path of the DLL. It allows to add the folder 
where the
# DLLs are stored to the PATH environment of Visual Studio, in 
order to avoid

# copying DLL after each builds.
if(MSVC)
  get_filename_component(_dll_folder ${_file} DIRECTORY)
  list(APPEND DLL_LIBRARIES_PATH ${_dll_folder})
endif(MSVC)

  endforeach( _file ${DLL_LIBRARIES} )

  #Process Debug libraries.
  foreach( _file ${DLL_LIBRARIES_D} )

# Convert path to CMake path to avoid escaping issues.
file(TO_CMAKE_PATH ${_file} _file_cmake_path)

#check file existance
if(NOT EXISTS ${_file_cmake_path})
  message(FATAL_ERROR "Missing dll file: ${_file_cmake_path}")
endif(NOT EXISTS ${_file_cmake_path})

# Add the DLL to the installation process.
install(FILES ${_file_cmake_path}
  DESTINATION ${G3_DEBUG_DIR}
  CONFIGURATIONS Debug)

# Extract the folder path of the DLL. It allows to add the folder 
where the
# DLLs are stored to the PATH environment of Visual Studio, in 
order to avoid

# copying DLL after each builds.
if(MSVC)
  get_filename_component(_dll_folder ${_file} DIRECTORY)
  list(APPEND DLL_LIBRARIES_PATH_D ${_dll_folder})
endif(MSVC)

  endforeach( _file ${DLL_LIBRARIES_D} )

  if(MSVC)
#Remove duplicate entries
list(REMOVE_DUPLICATES DLL_LIBRARIES_PATH)
list(REMOVE_DUPLICATES DLL_LIBRARIES_PATH_D)

#Set architecture
if(ARCH_X64)
  set(DLL_LIBRARIES_ARCH "x64")
else(ARCH_X64)
  set(DLL_LIBRARIES_ARCH "Win32")
endif(ARCH_X64)

# The output file goes in the build dir.
# @ONLY means only variables of the form @VAR@ will be substituted.
# This method need DLL_LIBRARIES_ARCH, DLL_LIBRARIES_PATH and 
DLL_LIBRARIES_PATH_D
# variables to be set. DONT FORGET TO RESTART VISUAL STUDIO if DLL 
paths changes, as

# vcxproj.user files are loaded only once