[CMake] CMake:question of the time when the command will happen in add_custom_command(...)

2016-04-21 Thread Chaos Zhang
Hi all,

I have some trouble when i use PRE_BUILD | PRE_LINK | POST_BUILD in command
"add_custom_command(...)". When i use POST_BUILD, i found the command will
execute before target had been built, like this:

1 [root@VM_33_35_centos build]# make
2 Scanning dependencies of target main
3 [100%] Building C object CMakeFiles/main.dir/main.c.o
4 Linking C executable main
5 This is pre build 
6 This is post build
7 [100%] Built target main

In my CMakeLists.txt, the content is:
 1 cmake_minimum_required(VERSION 2.8)
 2 add_executable(main main.c)
 3 add_custom_command(TARGET main
 4 PRE_BUILD
 5 COMMAND echo "This is pre build "
 6 )
 7 add_custom_command(TARGET main
 8 POST_BUILD
 9 COMMAND echo "This is post build"
 10 )

Why the command echo "This is post build" in 8 line(CMakeLists.txt) did not
execute after [100%] Built target main in 7 line(Linux command)?




--
View this message in context: 
http://cmake.3232098.n2.nabble.com/CMake-question-of-the-time-when-the-command-will-happen-in-add-custom-command-tp7593314.html
Sent from the CMake mailing list archive at Nabble.com.
-- 

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] How to add dependency relations between libs and executable

2016-04-21 Thread vakano
Hi, Chuck, J,

Thanks for you all great help! It is clear for me now ^.^

vakano



--
View this message in context: 
http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264p7593313.html
Sent from the CMake mailing list archive at Nabble.com.
-- 

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-commits] CMake branch, master, updated. v3.5.2-486-g02f663f

2016-04-21 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  02f663f15c173bf61147771076b7f822b0a8eb7c (commit)
  from  9b5929da22bc521602b547be945c2252496ecf01 (commit)

Those revisions listed 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=02f663f15c173bf61147771076b7f822b0a8eb7c
commit 02f663f15c173bf61147771076b7f822b0a8eb7c
Author: Kitware Robot <kwro...@kitware.com>
AuthorDate: Fri Apr 22 00:01:05 2016 -0400
Commit: Kitware Robot <kwro...@kitware.com>
CommitDate: Fri Apr 22 00:01:05 2016 -0400

CMake Nightly Date Stamp

diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 62c5b16..d066f87 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 5)
-set(CMake_VERSION_PATCH 20160421)
+set(CMake_VERSION_PATCH 20160422)
 #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] Using Clang + Ninja on Windows?

2016-04-21 Thread Gonzalo



El 21/04/16 a las 18:30, Cristian Adam escribiĆ³:}

> Note that you have to match Visual C++ and Clang's build, 32 or 64 
bit. You can't mix them,
> or you'll have weird errors 
.


I wonder.  Are the C and C++ ABIs of both compilers compatible? That is, 
can I develop a program with clang but use visualc++ dlls or viceversa.



--
Gonzalo GarramuƱo
ggarr...@gmail.com

-- 

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] Using Clang + Ninja on Windows?

2016-04-21 Thread Cristian Adam
On Wed, Apr 20, 2016 at 4:01 PM, Johan Holmberg  wrote:

> Hi!
>
> How should I setup CMake to build a C/C++ application on Windows using
> clang/clang++ as compilers and Ninja as build tool?
>
> I tried specifying "-GNinja" to cmake, and setting CC/CXX to
> clang/clang++. But this didn't work. I get errors like:
>
>   clang.exe: error: no such file or directory: '/nologo'
>
> indicating that CMake thinks it should pass Visual C++ style options to
> clang.
>
> I'm thinking about fooling CMake that clang/clang++ are cross compilers (I
> know how to get cross compiling working in other cases). But since
> clang/clang++ are the native tools for Windows, I was hoping to be able to
> use Clang + Ninja on Windows almost like I use on Linux.
>
> If I run Clang from the command line, I can build my application, so my
> Clang-installation works.
>
> I'm using CMake 3.5.1 and Clang 3.8.0.
>
> /Johan Holmberg
>
>
Hi,

On Windows Clang works only with Visual C++, since they don't provide
libc++. MinGW is not supported.
Clang provides a Visual C++'s cl.exe replacement.

You need to have the official windows
 Clang and Visual C++ Express
or Community installed.

Then it's just a matter of:

   1. Opening a Visual C++ 2013 64 bit command prompt window
   2. Putting clang's cl.exe in the path and setting clang's INCLUDE path
   first

   set PATH=c:\Program Files\LLVM\msbuild-bin\;%PATH%
   set INCLUDE=c:\Program Files\LLVM\lib\clang\3.8.0\include\;%INCLUDE%

   3. cmake -G "Ninja"
   4. Ninja

CMake / Ninja will think that they compile with Visual C++, but instead
will use clang.

Note that you have to match Visual C++ and Clang's build, 32 or 64 bit. You
can't mix them,
or you'll have weird errors
.

Cheers,
Cristian.

P.S. This is actually a re-post, this time adding the mailing list.
-- 

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] Using Clang + Ninja on Windows?

2016-04-21 Thread Brad King
On 04/21/2016 10:15 AM, Johan Holmberg wrote:
> I chose the binaries behaving like "gcc"
> 
> I realize that Cristian Adams recommended using the "cl.exe" wrapper in
> his response, but I wanted at least to try using the "gcc-like" binaries
> first, hoping that they should work with CMake.

I think that is the problem.  See below.

> E:\work\proj\hello1\build> cmake -GNinja ..\src
> -- The C compiler identification is Clang 3.8.0
> -- The CXX compiler identification is Clang 3.8.0

>From the compiler id files you sent me I see:

$ strings build/CMakeFiles/3.5.1/CompilerIdC/a.exe | grep INFO
INFO:compiler[Clang]
INFO:simulate[MSVC]
INFO:compiler_version[0003.0008.]
INFO:simulate_version[0018.]
INFO:platform[Windows]
INFO:arch[x64]
INFO:dialect_default[11]

$ strings build/CMakeFiles/3.5.1/CompilerIdCXX/a.exe | grep INFO
INFO:compiler[Clang]
INFO:simulate[MSVC]
INFO:platform[Windows]
INFO:arch[x64]
INFO:dialect_default[11]
INFO:compiler_version[0003.0008.]
INFO:simulate_version[0018.]

The "INFO:simulate[MSVC]" lines mean that CMake has detected that the given
Clang compiler defines _MSC_VER and therefore acts like MSVC and not GNU
(i.e. uses the msvc ABI instead of the gnu ABI).

CMake then assumes that the compiler command line is compatible with "cl".
We have code that switches off this here:

 
https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/Windows-Clang.cmake;hb=v3.5.2
 
https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/Clang.cmake;hb=v3.5.2

When all that was written clang-cl was still under development and our
assumption was that there is no such thing as a Clang that acts like
MSVC but is not cl-compatible on the command line.

-Brad

-- 

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-commits] CMake branch, next, updated. v3.5.2-1056-g59d754d

2016-04-21 Thread Brad King
This is an automated email from 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  59d754def532ee6fdb086a28ce1a77b61146c47a (commit)
   via  33acf8893ac1406946c18ab671ff3a0308da85fa (commit)
  from  529bab6793427b69f0e122652ec1d59b6cafe803 (commit)

Those revisions listed 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=59d754def532ee6fdb086a28ce1a77b61146c47a
commit 59d754def532ee6fdb086a28ce1a77b61146c47a
Merge: 529bab6 33acf88
Author: Brad King 
AuthorDate: Thu Apr 21 10:15:07 2016 -0400
Commit: CMake Topic Stage 
CommitDate: Thu Apr 21 10:15:07 2016 -0400

Merge topic 'autogen-updates' into next

33acf889 Autogen: Fix for unsafe NameCollisionTest() method


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=33acf8893ac1406946c18ab671ff3a0308da85fa
commit 33acf8893ac1406946c18ab671ff3a0308da85fa
Author: Sebastian Holtermann 
AuthorDate: Thu Apr 21 15:50:53 2016 +0200
Commit: Brad King 
CommitDate: Thu Apr 21 10:13:30 2016 -0400

Autogen: Fix for unsafe NameCollisionTest() method

In the old version the call to std::map::erase()
invalidates both bit _and_ ait.
The new version does not call erase() but works on a const std::map.

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 60e26b4..3c6db2d 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1554,32 +1554,27 @@ bool cmQtAutoGenerators::NameCollisionTest(
   const std::map& genFiles,
   std::multimap& collisions)
 {
-  typedef std::map::iterator Iter;
+  typedef std::map::const_iterator Iter;
   typedef std::map::value_type VType;
-  // Create local copy
-  std::map localGen ( genFiles );
-  for(Iter ait = localGen.begin(); ait != localGen.end(); ++ait )
+  for(Iter ait = genFiles.begin(); ait != genFiles.end(); ++ait )
 {
-bool skip_aname ( false );
-Iter bit = (++Iter(ait));
-while ( bit != localGen.end() )
+bool first_match ( true );
+for (Iter bit = (++Iter(ait)); bit != genFiles.end(); ++bit)
   {
-if(ait->second == bit->second)
-  {
-if ( !skip_aname )
-  {
-  skip_aname = true;
-  collisions.insert(VType(ait->second, ait->first));
-  }
-collisions.insert(VType(bit->second, bit->first));
-Iter old = bit;
-++bit;
-localGen.erase(old);
-  }
-else
+  if(ait->second == bit->second)
+{
+if (first_match)
   {
-++bit;
+  if (collisions.find(ait->second) != collisions.end())
+{
+// We already know of this collision from before
+break;
+}
+  collisions.insert(VType(ait->second, ait->first));
+  first_match = false;
   }
+collisions.insert(VType(bit->second, bit->first));
+}
   }
 }
 

---

Summary of changes:
 Source/cmQtAutoGenerators.cxx |   37 -
 1 file changed, 16 insertions(+), 21 deletions(-)


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


Re: [CMake] Using Clang + Ninja on Windows?

2016-04-21 Thread Johan Holmberg
On Wed, Apr 20, 2016 at 5:54 PM, Brad King  wrote:

> On 04/20/2016 10:01 AM, Johan Holmberg wrote:
> > I tried specifying "-GNinja" to cmake, and setting CC/CXX to
> > clang/clang++.
>
> Good.
>
> > But this didn't work. I get errors like:
> >
> >   clang.exe: error: no such file or directory: '/nologo'
> >
> > indicating that CMake thinks it should pass Visual C++ style
> > options to clang.
>
> There are multiple variants of Clang that behave like "gcc" or "cl".
> Which one is this?  What installer did you use for Clang?
>


I used the installer at http://llvm.org/releases/3.8.0/LLVM-3.8.0-win64.exe
.

I chose the binaries behaving like "gcc": After installation I added the
"bin" directory to my PATH (actual command "set
path=e:\work\install\LLVM\bin;%PATH%"). In the new bin-directory there are
binaries called "clang.exe" and "clang++.exe" + a bunch of other binaries
eg. "clang-cl.exe". I did NOT put the directory
"e:\work\install\LLVM\msbuild-bin" in my PATH (containing a binary
"cl.exe").

I realize that Cristian Adams recommended using the "cl.exe" wrapper in his
response, but I wanted at least to try using the "gcc-like" binaries first,
hoping that they should work with CMake. I will probably try his advice
later, but as I understand it, both ways should be possible to get working
with CMake.


> CMake should start out by printing the compiler id for the C and
> CXX compilers.  What did it show?
>
>
CMake starts by saying:

E:\work\proj\hello1\build> cmake -GNinja ..\src
-- The C compiler identification is Clang 3.8.0
-- The CXX compiler identification is Clang 3.8.0
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- broken
[...rest removed...]


Please try a minimum test project like
>
> >type CMakeLists.txt
> cmake_minimum_required(VERSION 3.5)
> project(Test)
>
> in a fresh build tree and post the files
>
> CMakeFiles/CMake*.log
> CMakeFiles/*/CMake*Compiler.cmake
>
> to see what CMake detected about the compiler.
> Thanks,
> -Brad
>
>

OK, I attach the files to this mail. There were three file created:

build/CMakeFiles/3.5.1/CMakeRCCompiler.cmake
build/CMakeFiles/CMakeError.log
build/CMakeFiles/CMakeOutput.log

On my Windows machine I have Visual Studio 2008, 2012, 2013 and 2015. I
used CMake 3.5.1 and Ninja 1.6.0.

/Johan Holmberg
The system is: Windows - 6.1.7601 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: E:/work/install/LLVM/bin/clang.exe 
Build flags: 
Id flags: 

The output was:
0


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.exe"

The C compiler identification is Clang, found in "E:/work/proj/hello1/build/CMakeFiles/3.5.1/CompilerIdC/a.exe"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: E:/work/install/LLVM/bin/clang++.exe 
Build flags: 
Id flags: 

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe"

The CXX compiler identification is Clang, found in "E:/work/proj/hello1/build/CMakeFiles/3.5.1/CompilerIdCXX/a.exe"

Determining if the C compiler works failed with the following output:
Change Dir: E:/work/proj/hello1/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/Users/holmberg/home/bin/ninja.exe" "cmTC_98675"
[1/2] Building C object CMakeFiles\cmTC_98675.dir\testCCompiler.c.obj

FAILED: E:\work\install\LLVM\bin\clang.exe   /nologo   /DWIN32 /D_WINDOWS /W3  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_98675.dir\testCCompiler.c.obj /FdCMakeFiles\cmTC_98675.dir\ -c testCCompiler.c

clang.exe: error: no such file or directory: '/nologo'

clang.exe: error: no such file or directory: '/DWIN32'

clang.exe: error: no such file or directory: '/D_WINDOWS'

clang.exe: error: no such file or directory: '/W3'

clang.exe: error: no such file or directory: '/D_DEBUG'

clang.exe: error: no such file or directory: '/MDd'

clang.exe: error: no such file or directory: '/Zi'

clang.exe: error: no such file or directory: '/Ob0'

clang.exe: error: no such file or directory: '/Od'

clang.exe: error: no such file or directory: '/RTC1'

clang.exe: error: no such file or directory: '/showIncludes'

clang.exe: error: no such file or directory: '/FoCMakeFiles\cmTC_98675.dir\testCCompiler.c.obj'

clang.exe: error: no such file or directory: '/FdCMakeFiles\cmTC_98675.dir\'

ninja: build stopped: subcommand failed.



set(CMAKE_RC_COMPILER "rc")
set(CMAKE_RC_COMPILER_ARG1 "")
set(CMAKE_RC_COMPILER_LOADED 1)
set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC)
set(CMAKE_RC_OUTPUT_EXTENSION .res)
set(CMAKE_RC_COMPILER_ENV_VAR "RC")
-- 

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: 

[cmake-developers] [CMake 0016074]: Setting link_directories in toolchain file is only used for compiler tests, and inhibits effect of repeating the command

2016-04-21 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
https://cmake.org/Bug/view.php?id=16074 
== 
Reported By:Antonio
Assigned To:
== 
Project:CMake
Issue ID:   16074
Category:   (No Category)
Reproducibility:have not tried
Severity:   minor
Priority:   normal
Status: new
== 
Date Submitted: 2016-04-21 09:58 EDT
Last Modified:  2016-04-21 09:58 EDT
== 
Summary:Setting link_directories in toolchain file is only
used for compiler tests, and inhibits effect of repeating the command
Description: 
In the attached example,
TOOLCHAIN FILE:
link_directories("D:/abcd")

CMAKELISTS.TXT:
project(dummyProject)
cmake_minimum_required(VERSION 3.4)
link_directories("D:/abcd")
link_directories("D:/efgh")
add_library(dummyTarget SHARED dummy.cpp)

At linking stage, only the "-LD:/efgh" will be there:
cmd.exe /C "cd . &&  -shared -o libdummyTarget.dll
-Wl,--out-implib,libdummyTarget.dll.a
-Wl,--major-image-version,0,--minor-image-version,0
CMakeFiles/dummyTarget.dir/dummy.cpp.obj -LD:/efgh -lkernel32 -luser32 -lgdi32
-lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."

Note: In the CMakeOutput.log file is possible to see that -LD:/abcd is used in
the preliminary compiler tests.

Use case:
I am dealing with a toolchain where the std library is in a specific location,
and to pass the preliminary cmake compiler tests I must set the std library
location with a link_directories command. Since it is toolchain specific, it
makes sense to set in the toolchain file. I can pass the compiler tests if I
call `link_directories` in the toolchain file.

The only workaround I could find so far was to directly set the flag (still in
the toolchain file):

# SET(CMAKE_EXE_LINKER_FLAGS "-LD:/abcd")
# SET(CMAKE_SHARED_LINKER_FLAGS "-LD:/abcd")
# SET(CMAKE_MODULE_LINKER_FLAGS "-LD:/abcd")

Steps to Reproduce: 
1) Take the project in attachment
2) Configure with the attached toolchain, for example using ninja generator
3a) With ninja, run ninja -v to see the command line
3b) With make, run make.exe VERBOSE=1 to see the command line
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-04-21 09:58 AntonioNew Issue
2016-04-21 09:58 AntonioFile Added: CMakeBugProject.zip 
  
==

-- 

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-developers


Re: [CMake] How to add dependency relations between libs and executable

2016-04-21 Thread Chuck Atkins
> in your proj_a example, when target_link_librairies invoke Lib B directly
> which generated in another project b, how does proj_a recognize it



> I think the reason is proj_a, b, c are all the sub directories of
> project root, if no root layer, B can not be invoked in proj_a, right?
>

That's correct.  In the example I gave, while proj_a, proj_b, and proj_c
are all sub-directories of the root level, only the root level, proj_b and
proj_c CMakeLists.txt files contain a separate project(...) command, which
meas that proj_b and proj_c can be configured and used independently but
proj_a cannot and needs to be configured from the root level where the B
and C targets are, in addition to their own separate projects, both
contained in the root level project(...) where A can see them.

- Chuck
-- 

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] How to set link option

2016-04-21 Thread vakano
Hi, 

I have some link option as below:

-Wl, -rpath, ${PROJECT_TOP}/dist  ../proj_a/lib_a.a -lb -Wl, --whole-archive
../proj_c/lib_c.a

Thanks,
Le





--
View this message in context: 
http://cmake.3232098.n2.nabble.com/How-to-set-link-option-tp7593307.html
Sent from the CMake mailing list archive at Nabble.com.
-- 

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-developers] [CMake 0016073]: InstallRequiredSystemLibraries needs updating for MSVS2015

2016-04-21 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
https://cmake.org/Bug/view.php?id=16073 
== 
Reported By:Lewoco
Assigned To:
== 
Project:CMake
Issue ID:   16073
Category:   Modules
Reproducibility:always
Severity:   minor
Priority:   normal
Status: new
== 
Date Submitted: 2016-04-21 03:38 EDT
Last Modified:  2016-04-21 03:38 EDT
== 
Summary:InstallRequiredSystemLibraries needs updating for
MSVS2015
Description: 
Many system DLL's required by MSVS2015 are not identified by
InstallRequiredSystemLibraries.


Steps to Reproduce: 
- add_executable a simple hello world
- Use InstallRequiredSystemLibraries to install the required libraries
- Build an installer using WiX (or whatever)
- Install it on Windows 7 (no updates)

BUG: executable cannot be run because of missing DLL's.

Note:
- Updates might have helped but I didn't try it.
- Probably also affects Windows 8/8.1.
- Might not affect Windows 10? (see link)

https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/


Additional Information: 
Right now I'm using the following code to select the additional required
libraries. Please integrate something similar into
InstallRequiredSystemLibraries:

# InstallRequiredSystemLibraries does not properly support MSVS 14 yet, so do it
manually.
unset(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_DEBUG)
unset(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_RELEASE)
if(DEFINED MSVC_VERSION AND NOT MSVC_VERSION LESS 1900)
# Internal: Architecture-appropriate library directory names.
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM")
set(_winsdk_arch8 arm) # what the WDK for Win8+ calls this architecture
else()
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
set(_winsdk_arch8 x64) # what the WDK for Win8+ calls this
architecture
else()
set(_winsdk_arch8 x86) # what the WDK for Win8+ calls this
architecture
endif()
endif()

# The CRT is distributed with MSVS.
get_filename_component(MSVS_DIR
   
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;ShellFolder]"
ABSOLUTE)

# As of MSVC 19 the CRT depends on the 'univeral' CRT (which is part of
Windows development kit 10 and above).
#
http://blogs.msdn.com/b/vcblog/archive/2015/03/03/introducing-the-universal-crt.aspx
get_filename_component(WINDOWS_KIT_DIR
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed
Roots;KitsRoot10]" ABSOLUTE)

file(GLOB CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_DEBUG
   
"${MSVS_DIR}/VC/redist/debug_nonredist/${_winsdk_arch8}/Microsoft.VC140.DebugCRT/*.dll"
"${WINDOWS_KIT_DIR}/Redist/ucrt/DLLs/${_winsdk_arch8}/api-ms-win-*.dll"
"${WINDOWS_KIT_DIR}/bin/${_winsdk_arch8}/ucrt/*.dll"
)
file(GLOB CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_RELEASE
"${MSVS_DIR}/VC/redist/${_winsdk_arch8}/Microsoft.VC140.CRT/*.dll"
"${WINDOWS_KIT_DIR}/Redist/ucrt/DLLs/${_winsdk_arch8}/*.dll"
)
endif()

== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-04-21 03:38 Lewoco New Issue
==

-- 

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-developers


Re: [cmake-developers] Autogen subdirectories patches

2016-04-21 Thread Sebastian Holtermann

Am 19.04.2016 um 19:28 schrieb Brad King:

On 04/19/2016 11:09 AM, Sebastian Holtermann wrote:

https://cmake.org/Bug/view.php?id=12873
https://cmake.org/Bug/view.php?id=16068

They introduce
- same name collision checks during moc/qrc/ui generation
- moc/qrc generation in subdirectories to support
sources with the name in different subdirectories
- A test for equally named sources in different subdirectories

Please review.


Thanks!  I've applied them locally and merged the cleanup/refactoring
commits to 'next' for testing first.  Once those test cleanly I'll move
on to the rest.


It is good too see the patches made it into the next branch.
Thanks and sorry for the wrong indentation btw..


Now there is another issue I have a partially fix for.

As of now all included mocs and uis get generated in
CMAKE_CURRENT_BINARY_DIR/
because they must be within INCLUDE_DIRECTORIES.
I think a more robust approach would be to generate them in
CMAKE_CURRENT_BINARY_DIR/TARGET_automoc.dir/
and to add the _automoc.dir to INCLUDE_DIRECTORIES.

I've attached a patch that does does so
- it is relative to current "next" branch.

It is incomplete though because I didn't manage to get
CMAKE_CURRENT_BINARY_DIR/TARGET_automoc.dir/
into INCLUDE_DIRECTORIES in Source/cmQtAutoGeneratorInitializer.cxx.
(GetAutogenTargetBuildDir() in Source/cmQtAutoGeneratorInitializer.cxx)

If someone could do that or give me pointers on how to do it
then this could be another improvement.

-Sebastian

>From aa246261ba1f98ca245f8c5a93b6c93c7fbe8ec5 Mon Sep 17 00:00:00 2001
From: Sebastian Holtermann 
Date: Thu, 21 Apr 2016 08:44:11 +0200
Subject: [PATCH] Autogen: Generate included moc and ui files in
 TARGET_automoc.dir/

---
 Source/cmQtAutoGenerators.cxx | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index c6ee751..29e2e47 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -564,6 +564,13 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
 this->SearchHeadersForCppFile(absFilename, headerExtensions, headerFiles);
 }
 
+  // Prepend included mocs with build subdirectory
+  for(std::map::iterator
+  it = includedMocs.begin(); it != includedMocs.end(); ++it)
+{
+  it->second = this->TargetBuildSubDir + it->second;
+}
+
   {
   std::vector mocSkipped;
   cmSystemTools::ExpandListArgument(this->SkipMoc, mocSkipped);
@@ -1261,7 +1268,8 @@ bool cmQtAutoGenerators::GenerateUiFiles(
   {
   const std::string & uiFileName = *sit;
   const std::string uiInputFile = sourcePath + uiFileName + ".ui";
-  const std::string uiOutputFile = "ui_" + uiFileName + ".h";
+  const std::string uiOutputFile = this->TargetBuildSubDir
+   + "ui_" + uiFileName + ".h";
   sourceMap[uiInputFile] = uiOutputFile;
   testMap[uiInputFile] = uiOutputFile;
   }
@@ -1321,6 +1329,13 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
  );
   if (this->GenerateAll || !success || sourceNewerThanUi >= 0)
 {
+// make sure the directory for the resulting ui file exists
+std::string uiDir = uiBuildFile.substr(0, uiBuildFile.rfind('/'));
+if (!cmsys::SystemTools::FileExists(uiDir.c_str(), false))
+  {
+  cmsys::SystemTools::MakeDirectory(uiDir.c_str());
+  }
+
 std::string msg = "Generating ";
 msg += uiOutputFile;
 cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue
-- 
2.8.0.rc3

-- 

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-developers