Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread Richard Szabo
The reason going to object libs instead of static libs is the
limitation of windows dynamic libraries that export simbols must be in
the liner command line object it can not be added to the static
libraries linked to the dlls.
with gcc this problem can be solved with

-Wl,--whole-archive
 libs with export
-Wl,--no-whole-archive

but I did not find something similar to MSVC  and have the problem
that I have have code generators between user code and core runtime
which generate c++ code in separate libs.

So my idea was to use object libs to solve the problem but now I face
the issue with the transitive linkage. :(.

Cheers
Richard





On Wed, 22 May 2019 at 20:33, Richard Szabo  wrote:
>
> With Public it is still the same problem :(
>
> cmake_minimum_required(VERSION 3.14)
> project(test_object_lib_nesting)
>
> set(CMAKE_CXX_STANDARD 14)
>
> add_library(first_object_lib OBJECT first.cpp)
>
> add_library(second_object_lib OBJECT second.cpp)
>
> target_link_libraries(second_object_lib PUBLIC first_object_lib)
>
> add_executable(test_object_lib_nesting main.cpp)
>
> target_link_libraries(test_object_lib_nesting second_object_lib)
>
>
> /cmake -E cmake_link_script
> CMakeFiles/test_object_lib_nesting.dir/link.txt --verbose=1
> /usr/bin/clang++-6.0  -g
> CMakeFiles/test_object_lib_nesting.dir/main.cpp.o
> CMakeFiles/second_object_lib.dir/second.cpp.o  -o
> test_object_lib_nesting
> CMakeFiles/second_object_lib.dir/second.cpp.o: In function
> `Second::get_second()':
> /home/csita/CLionProjects/test_object_lib_nesting/second.cpp:10:
> undefined reference to `First::get_first() const'
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)
>
> I read the issue and it seems that there is no solution jet 
>
> Is there an easy / not so easy workaround ?
> I have a dependency tree which can go down to 20 - 30 libs. (code
> generator ) also diamond graph. :(.
>
> Cheers
> Richard
>
> On Wed, 22 May 2019 at 14:25, Robert Maynard  
> wrote:
> >
> > This is a known limitation of the current design. Only directly linked
> > object library objects are propagated.
> >
> > For more details on why see: 
> > https://gitlab.kitware.com/cmake/cmake/issues/18090
> >
> > On Wed, May 22, 2019 at 1:48 AM Richard Szabo  wrote:
> > >
> > > Hi cmakers
> > >
> > > I'm trying to get the following example working:
> > > ```
> > > cmake_minimum_required(VERSION 3.14)
> > > project(test_object_lib_nesting)
> > >
> > > set(CMAKE_CXX_STANDARD 14)
> > >
> > > add_library(first_object_lib OBJECT first.cpp)
> > >
> > > add_library(second_object_lib OBJECT second.cpp)
> > >
> > > target_link_libraries(second_object_lib first_object_lib)
> > >
> > > add_executable(test_object_lib_nesting main.cpp)
> > >
> > > target_link_libraries(test_object_lib_nesting second_object_lib)
> > > ```
> > >
> > > The problem I have that the linker command line will have only the
> > > second.cpp.o for linking the first.cpp.o will not be added as link
> > > object to the exe. Causing missing symbols on exe linkage.
> > >
> > > How to transitively resolve and link "nested" Object library targets ?.
> > > --
> > >
> > > 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:
> > > https://cmake.org/mailman/listinfo/cmake
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread Richard Szabo
With Public it is still the same problem :(

cmake_minimum_required(VERSION 3.14)
project(test_object_lib_nesting)

set(CMAKE_CXX_STANDARD 14)

add_library(first_object_lib OBJECT first.cpp)

add_library(second_object_lib OBJECT second.cpp)

target_link_libraries(second_object_lib PUBLIC first_object_lib)

add_executable(test_object_lib_nesting main.cpp)

target_link_libraries(test_object_lib_nesting second_object_lib)


/cmake -E cmake_link_script
CMakeFiles/test_object_lib_nesting.dir/link.txt --verbose=1
/usr/bin/clang++-6.0  -g
CMakeFiles/test_object_lib_nesting.dir/main.cpp.o
CMakeFiles/second_object_lib.dir/second.cpp.o  -o
test_object_lib_nesting
CMakeFiles/second_object_lib.dir/second.cpp.o: In function
`Second::get_second()':
/home/csita/CLionProjects/test_object_lib_nesting/second.cpp:10:
undefined reference to `First::get_first() const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I read the issue and it seems that there is no solution jet 

Is there an easy / not so easy workaround ?
I have a dependency tree which can go down to 20 - 30 libs. (code
generator ) also diamond graph. :(.

Cheers
Richard

On Wed, 22 May 2019 at 14:25, Robert Maynard  wrote:
>
> This is a known limitation of the current design. Only directly linked
> object library objects are propagated.
>
> For more details on why see: 
> https://gitlab.kitware.com/cmake/cmake/issues/18090
>
> On Wed, May 22, 2019 at 1:48 AM Richard Szabo  wrote:
> >
> > Hi cmakers
> >
> > I'm trying to get the following example working:
> > ```
> > cmake_minimum_required(VERSION 3.14)
> > project(test_object_lib_nesting)
> >
> > set(CMAKE_CXX_STANDARD 14)
> >
> > add_library(first_object_lib OBJECT first.cpp)
> >
> > add_library(second_object_lib OBJECT second.cpp)
> >
> > target_link_libraries(second_object_lib first_object_lib)
> >
> > add_executable(test_object_lib_nesting main.cpp)
> >
> > target_link_libraries(test_object_lib_nesting second_object_lib)
> > ```
> >
> > The problem I have that the linker command line will have only the
> > second.cpp.o for linking the first.cpp.o will not be added as link
> > object to the exe. Causing missing symbols on exe linkage.
> >
> > How to transitively resolve and link "nested" Object library targets ?.
> > --
> >
> > 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:
> > https://cmake.org/mailman/listinfo/cmake
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to use Ninja on Windows with MSVC?

2019-05-22 Thread Michael Jackson
Cool tip. Didn’t know that. I should compact my script a bit. I do that for the 
Intel Fortran compiler that we use but didn’t think of it for the vcvarsall.bat 
file.

 

--

Mike Jackson 

 

From: Juan Sanchez 
Date: Wednesday, May 22, 2019 at 11:41 AM
To: Michael Jackson 
Cc: Robert Dailey , CMake 
Subject: Re: [CMake] How to use Ninja on Windows with MSVC?

 

 

 

On Wed, May 22, 2019 at 10:27 AM Michael Jackson  
wrote:

Do this all the time both for our CDash nightlies and when I am developing on 
Windows. The essential pieces of the puzzle are the following:

1: Ninja needs to be on your path
2: The compilers need to be on your path.

1 can be solved in a few different ways. The brute force is to edit the system 
path variable and place the folder containing Ninja into the system path. I do 
NOT recommend doing this. Repeat. DON'T DO IT. You can edit your "User" PATH 
environment variable and add to the PATH. This is the more recommended way but 
a bit tedious to get into that dialog box to adjust. We will come back to this..

For 2, use the "Visual Studio Command Prompt" which has all the paths to the 
compilers setup for you. Now the question becomes, how to combine 1 and 2. My 
own solution (which is far from optimal, but works) is that I setup my own 
"short cut" to a command prompt that launches my own custom .bat file that sits 
on my desktop. In that .bat file is basically a copy of the vcvarsall.bat file 
and then I add to that my own specific PATH values for things like Qt, hdf5, 
cmake, ninja that on located on my system. I keep both the shortcut and the 
.bat file on my desktop so all I need to do is double click to get a correctly 
configured command prompt for my dev environment. If a version of something 
changes I just edit the .bat file and I am ready to go. You can then also do 
"cmake-gui.exe ." from inside a build folder to have CMake-Gui launch with all 
the correctly identified compilers. 

 

For this option, you can use the batch command, "call", to read in the 
environment of another ".bat" script, so that you do not have to make copies of 
the vcvarsall.bat files.  As long as you are not using "setlocal" in a script, 
then the environment variables will propagate up to the caller.

 

 For example your script can have (for VS 2015) :

call "%VS140COMNTOOLS%VsVars32.bat"  

 

and the add lines setting additional PATH values.

 

Regards,

 

Juan

 

 


I am happy to share the .bat file if you are interested. I have it updated for 
VS2017 at the moment but have been doing it this way since VS2013.

--
Michael Jackson | Owner, President
  BlueQuartz Software
[e] mike.jack...@bluequartz.net
[w] www.bluequartz.net 

On 5/22/19, 9:58 AM, "CMake on behalf of Robert Dailey" 
 wrote:

From the command line, I want to generate Ninja build scripts that
utilize a specific version of MSVC compiler. Basically I'd like the
combination of `-G"Visual Studio 15 2017"` with regards to its ability
to find the C and C++ compiler on the system via registry/environment
variables, and `-G"Ninja"` with regards to it being the build driver
for that compiler.

Is this even possible?
-- 



-- 

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:
https://cmake.org/mailman/listinfo/cmake

-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to use Ninja on Windows with MSVC?

2019-05-22 Thread Robert Dailey
Thanks everyone. I fully understand about compilers being on PATH or
setting the CMAKE__COMPILER variables. However, what is really
important is the system introspection done by CMake to find the IDEs
when you select the visual studio generators. I was hoping that logic
could be shared. This would save a lot of work in setting up
environment and/or hunting down vcvars batch files.

On Wed, May 22, 2019 at 10:44 AM Michael Ellery  wrote:
>
>
>
> > On May 22, 2019, at 6:58 AM, Robert Dailey  wrote:
> >
> > From the command line, I want to generate Ninja build scripts that
> > utilize a specific version of MSVC compiler. Basically I'd like the
> > combination of `-G"Visual Studio 15 2017"` with regards to its ability
> > to find the C and C++ compiler on the system via registry/environment
> > variables, and `-G"Ninja"` with regards to it being the build driver
> > for that compiler.
> >
> > Is this even possible?
> > —
>
>
> In addition to the other suggestions about using a MSVC command prompt (which 
> work just fine for manual builds), Here’s what I’ve done when needing to 
> automate the build using powershell:
>
>
> Invoke-BatchFile "${env:ProgramFiles(x86)}\\Microsoft Visual 
> Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" x86_amd64
> Get-ChildItem env:* | Sort-Object name
>
>
> …which invokes the vcvarsall batch and imports all of the environment vars 
> that were set by that invocation. vcvarsall is provided exactly for the 
> purpose of setting your env for building and it supports a few different arch 
> arguments to select the right toolchain.
>
> HTH,
> Mike
>
>
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] question ? [cmake could not find a include_dir]

2019-05-22 Thread Hendrik Sattler
How about using the same build directory?


Am 22. Mai 2019 18:02:28 MESZ schrieb "Agata Krasoń" :
>Hello,
>
>I am trying to build from source an application.
>I add in cmake-gui : XIOT_INCLUDE_DIR - path do include dir
>When I compile on linux ...
>It gives me an error:
>
>[image: Screenshot_20190522_175230.png]
>[image: Screenshot_20190522_175209.png]
>
>Do you have any idea ?
>What could be a problem?
>
>I would appreciate for any help.
>
>Best,
>Agata
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Visual Studio platform name ("Win32", "x64") back on CMake GUI window?

2019-05-22 Thread Niels Dekker

Thanks for your support, Robert! Here it is:

  #19290 "Visual Studio platform name Current Generator back on CMake 
GUI window?"

  https://gitlab.kitware.com/cmake/cmake/issues/19290

Kind regards, Niels

On 2019-05-22, Robert Maynard wrote:

Can you submit this to our issue tracker please (
https://gitlab.kitware.com/cmake/cmake/issues )

On Wed, May 22, 2019 at 9:44 AM Niels Dekker wrote:


Previous versions of CMake GUI (prior to CMake 3.14) always displayed
the name of the selected platform (typically "Win32" or "Win64") with
the current generator, for example:

   "Current Generator: Visual Studio 14 2015 Win64"

It was very convenient to have the platform name displayed on the main
window of the CMake GUI.

When a new Visual Studio project is generated "from scratch" by CMake
3.14, the platform name is no longer displayed with the Current
Generator. As I just tested with CMake 3.14.4, generating for VS2017
x64.

Would it be possible to get the VS platform name back onto the CMake 
GUI

main window?


--
Niels Dekker
Scientific programmer
LKEB, Leiden University Medical Center
--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Visual Studio platform name ("Win32", "x64") back on CMake GUI window?

2019-05-22 Thread Robert Maynard via CMake
Can you submit this to our issue tracker please (
https://gitlab.kitware.com/cmake/cmake/issues )

On Wed, May 22, 2019 at 9:44 AM Niels Dekker
 wrote:
>
> Previous versions of CMake GUI (prior to CMake 3.14) always displayed
> the name of the selected platform (typically "Win32" or "Win64") with
> the current generator, for example:
>
>"Current Generator: Visual Studio 14 2015 Win64"
>
> It was very convenient to have the platform name displayed on the main
> window of the CMake GUI.
>
> When a new Visual Studio project is generated "from scratch" by CMake
> 3.14, the platform name is no longer displayed with the Current
> Generator. As I just tested with CMake 3.14.4, generating for VS2017
> x64.
>
> Would it be possible to get the VS platform name back onto the CMake GUI
> main window?
>
>
> Kind regards, Niels
> --
> Niels Dekker
> Scientific programmer
> LKEB, Leiden University Medical Center
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to use Ninja on Windows with MSVC?

2019-05-22 Thread Michael Ellery


> On May 22, 2019, at 6:58 AM, Robert Dailey  wrote:
> 
> From the command line, I want to generate Ninja build scripts that
> utilize a specific version of MSVC compiler. Basically I'd like the
> combination of `-G"Visual Studio 15 2017"` with regards to its ability
> to find the C and C++ compiler on the system via registry/environment
> variables, and `-G"Ninja"` with regards to it being the build driver
> for that compiler.
> 
> Is this even possible?
> — 


In addition to the other suggestions about using a MSVC command prompt (which 
work just fine for manual builds), Here’s what I’ve done when needing to 
automate the build using powershell:


Invoke-BatchFile "${env:ProgramFiles(x86)}\\Microsoft Visual 
Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" x86_amd64
Get-ChildItem env:* | Sort-Object name


…which invokes the vcvarsall batch and imports all of the environment vars that 
were set by that invocation. vcvarsall is provided exactly for the purpose of 
setting your env for building and it supports a few different arch arguments to 
select the right toolchain.

HTH,
Mike


-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to use Ninja on Windows with MSVC?

2019-05-22 Thread Juan Sanchez
On Wed, May 22, 2019 at 10:27 AM Michael Jackson <
mike.jack...@bluequartz.net> wrote:

> Do this all the time both for our CDash nightlies and when I am developing
> on Windows. The essential pieces of the puzzle are the following:
>
> 1: Ninja needs to be on your path
> 2: The compilers need to be on your path.
>
> 1 can be solved in a few different ways. The brute force is to edit the
> system path variable and place the folder containing Ninja into the system
> path. I do NOT recommend doing this. Repeat. DON'T DO IT. You can edit your
> "User" PATH environment variable and add to the PATH. This is the more
> recommended way but a bit tedious to get into that dialog box to adjust. We
> will come back to this..
>
> For 2, use the "Visual Studio Command Prompt" which has all the paths to
> the compilers setup for you. Now the question becomes, how to combine 1 and
> 2. My own solution (which is far from optimal, but works) is that I setup
> my own "short cut" to a command prompt that launches my own custom .bat
> file that sits on my desktop. In that .bat file is basically a copy of the
> vcvarsall.bat file and then I add to that my own specific PATH values for
> things like Qt, hdf5, cmake, ninja that on located on my system. I keep
> both the shortcut and the .bat file on my desktop so all I need to do is
> double click to get a correctly configured command prompt for my dev
> environment. If a version of something changes I just edit the .bat file
> and I am ready to go. You can then also do "cmake-gui.exe ." from inside a
> build folder to have CMake-Gui launch with all the correctly identified
> compilers.
>

For this option, you can use the batch command, "call", to read in the
environment of another ".bat" script, so that you do not have to make
copies of the vcvarsall.bat files.  As long as you are not using "setlocal"
in a script, then the environment variables will propagate up to the caller.

 For example your script can have (for VS 2015) :
call "%VS140COMNTOOLS%VsVars32.bat"

and the add lines setting additional PATH values.

Regards,

Juan



>
> I am happy to share the .bat file if you are interested. I have it updated
> for VS2017 at the moment but have been doing it this way since VS2013.
>
> --
> Michael Jackson | Owner, President
>   BlueQuartz Software
> [e] mike.jack...@bluequartz.net
> [w] www.bluequartz.net 
>
> On 5/22/19, 9:58 AM, "CMake on behalf of Robert Dailey" <
> cmake-boun...@cmake.org on behalf of rcdailey.li...@gmail.com> wrote:
>
> From the command line, I want to generate Ninja build scripts that
> utilize a specific version of MSVC compiler. Basically I'd like the
> combination of `-G"Visual Studio 15 2017"` with regards to its ability
> to find the C and C++ compiler on the system via registry/environment
> variables, and `-G"Ninja"` with regards to it being the build driver
> for that compiler.
>
> Is this even possible?
> --
>
>
>
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to use Ninja on Windows with MSVC?

2019-05-22 Thread Michael Jackson
Do this all the time both for our CDash nightlies and when I am developing on 
Windows. The essential pieces of the puzzle are the following:

1: Ninja needs to be on your path
2: The compilers need to be on your path.

1 can be solved in a few different ways. The brute force is to edit the system 
path variable and place the folder containing Ninja into the system path. I do 
NOT recommend doing this. Repeat. DON'T DO IT. You can edit your "User" PATH 
environment variable and add to the PATH. This is the more recommended way but 
a bit tedious to get into that dialog box to adjust. We will come back to this..

For 2, use the "Visual Studio Command Prompt" which has all the paths to the 
compilers setup for you. Now the question becomes, how to combine 1 and 2. My 
own solution (which is far from optimal, but works) is that I setup my own 
"short cut" to a command prompt that launches my own custom .bat file that sits 
on my desktop. In that .bat file is basically a copy of the vcvarsall.bat file 
and then I add to that my own specific PATH values for things like Qt, hdf5, 
cmake, ninja that on located on my system. I keep both the shortcut and the 
.bat file on my desktop so all I need to do is double click to get a correctly 
configured command prompt for my dev environment. If a version of something 
changes I just edit the .bat file and I am ready to go. You can then also do 
"cmake-gui.exe ." from inside a build folder to have CMake-Gui launch with all 
the correctly identified compilers. 

I am happy to share the .bat file if you are interested. I have it updated for 
VS2017 at the moment but have been doing it this way since VS2013.

--
Michael Jackson | Owner, President
  BlueQuartz Software
[e] mike.jack...@bluequartz.net
[w] www.bluequartz.net 

On 5/22/19, 9:58 AM, "CMake on behalf of Robert Dailey" 
 wrote:

From the command line, I want to generate Ninja build scripts that
utilize a specific version of MSVC compiler. Basically I'd like the
combination of `-G"Visual Studio 15 2017"` with regards to its ability
to find the C and C++ compiler on the system via registry/environment
variables, and `-G"Ninja"` with regards to it being the build driver
for that compiler.

Is this even possible?
-- 



-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to use Ninja on Windows with MSVC?

2019-05-22 Thread Marc CHEVRIER
The easiest way is to launch a CMD with the correct development environment 
(see for example 
https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs).

Le 22 mai 2019 à 15:58 +0200, Robert Dailey , a écrit 
:
> From the command line, I want to generate Ninja build scripts that
> utilize a specific version of MSVC compiler. Basically I'd like the
> combination of `-G"Visual Studio 15 2017"` with regards to its ability
> to find the C and C++ compiler on the system via registry/environment
> variables, and `-G"Ninja"` with regards to it being the build driver
> for that compiler.
>
> Is this even possible?
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to use Ninja on Windows with MSVC?

2019-05-22 Thread Haocheng Liu via CMake
You can run `CMake -GNinja ` in a visual studio
command line prompt where It could find the right C/C++ compiler via the
environment. Normally you can find the command line prompt in the windows
menu.

On Wed, May 22, 2019 at 9:58 AM Robert Dailey 
wrote:

> From the command line, I want to generate Ninja build scripts that
> utilize a specific version of MSVC compiler. Basically I'd like the
> combination of `-G"Visual Studio 15 2017"` with regards to its ability
> to find the C and C++ compiler on the system via registry/environment
> variables, and `-G"Ninja"` with regards to it being the build driver
> for that compiler.
>
> Is this even possible?
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>


-- 
Best regards
Haocheng

Haocheng LIU
Kitware, Inc.
R&D Engineer
1712 Route 9, Suite 300
Clifton Park, NY 12065-8662
Phone: 518-881-4421 <(518)%20881-4421>
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] How to use Ninja on Windows with MSVC?

2019-05-22 Thread Robert Dailey
>From the command line, I want to generate Ninja build scripts that
utilize a specific version of MSVC compiler. Basically I'd like the
combination of `-G"Visual Studio 15 2017"` with regards to its ability
to find the C and C++ compiler on the system via registry/environment
variables, and `-G"Ninja"` with regards to it being the build driver
for that compiler.

Is this even possible?
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Visual Studio platform name ("Win32", "x64") back on CMake GUI window?

2019-05-22 Thread Niels Dekker
Previous versions of CMake GUI (prior to CMake 3.14) always displayed 
the name of the selected platform (typically "Win32" or "Win64") with 
the current generator, for example:


  "Current Generator: Visual Studio 14 2015 Win64"

It was very convenient to have the platform name displayed on the main 
window of the CMake GUI.


When a new Visual Studio project is generated "from scratch" by CMake 
3.14, the platform name is no longer displayed with the Current 
Generator. As I just tested with CMake 3.14.4, generating for VS2017 
x64.


Would it be possible to get the VS platform name back onto the CMake GUI 
main window?



Kind regards, Niels
--
Niels Dekker
Scientific programmer
LKEB, Leiden University Medical Center
--

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Problems with cross compile for android

2019-05-22 Thread Daniel Kroker
Hello,

i have some problems with cross compile for android.
i need to build libssh for android.

If i run CMake like:
cmake .. -DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=/home/da/Android/standalone-toolchain-4.9
-DCMAKE_SYSTEM_VERSION=21

i get the following error:

 -mtune=xscale -funwind-tables -no-canonical-prefixes  -g  -fPIE -pie
-Wl,--gc-sections -Wl,-z,nocopyreloc 
CMakeFiles/cmTC_88c04.dir/testCCompiler.c.o  -o cmTC_88c04
   
/home/da/Android/standalone-toolchain-4.9/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld:
error: cannot open crtbegin_dynamic.o: No such file or directory
   
/home/da/Android/standalone-toolchain-4.9/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld:
error: cannot open crtend_android.o: No such file or directory
    external/jemalloc/src/jemalloc.c:1422: error: undefined reference to
'pthread_atfork'
    external/jemalloc/src/jemalloc.c:1422: error: undefined reference to
'pthread_atfork'
    external/jemalloc/src/jemalloc.c:1422: error: undefined reference to
'pthread_atfork'
    external/jemalloc/src/jemalloc.c:1422: error: undefined reference to
'pthread_atfork'
    external/jemalloc/src/jemalloc.c:1358: error: undefined reference to
'atexit'
    clang80: error: linker command failed with exit code 1 (use -v to
see invocation)
    make[1]: *** [CMakeFiles/cmTC_88c04.dir/build.make:87: cmTC_88c04]
Error 1
    make[1]: Leaving directory
'/home/da/Downloads/libssh-0.7.4/build/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_88c04/fast] Error 2


if i run
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake
-DANDROID_STL_TYPE=gnustl_static -DCMAKE_SYSTEM_VERSION=21
-DANDROID_TOOLCHAIN=clang -DANDROID_PLATFORM=android-21
-DANDROID_ABI=arm64-v8a

i get the following message:
-- Performing Test HAVE_COMPILER__FUNCTION__ - Failed
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - not found
-- Looking for stdint.h
-- Looking for stdint.h - not found
-- Looking for stddef.h
-- Looking for stddef.h - not found
-- Check size of unsigned short
-- Check size of unsigned short - failed
-- Check size of unsigned int
-- Check size of unsigned int - failed
-- Check size of unsigned long
-- Check size of unsigned long - failed
CMake Error at /usr/share/cmake-3.13/Modules/TestBigEndian.cmake:49
(message):
  no suitable type found
Call Stack (most recent call first):
  ConfigureChecks.cmake:271 (test_big_endian)
  CMakeLists.txt:80 (include)

looks like that he doesnt find any header file.

Whats the best way to cross compile under linux for android?
Thanks for any suggestions.

Regards
Daniel

-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread Robert Maynard via CMake
This is a known limitation of the current design. Only directly linked
object library objects are propagated.

For more details on why see: https://gitlab.kitware.com/cmake/cmake/issues/18090

On Wed, May 22, 2019 at 1:48 AM Richard Szabo  wrote:
>
> Hi cmakers
>
> I'm trying to get the following example working:
> ```
> cmake_minimum_required(VERSION 3.14)
> project(test_object_lib_nesting)
>
> set(CMAKE_CXX_STANDARD 14)
>
> add_library(first_object_lib OBJECT first.cpp)
>
> add_library(second_object_lib OBJECT second.cpp)
>
> target_link_libraries(second_object_lib first_object_lib)
>
> add_executable(test_object_lib_nesting main.cpp)
>
> target_link_libraries(test_object_lib_nesting second_object_lib)
> ```
>
> The problem I have that the linker command line will have only the
> second.cpp.o for linking the first.cpp.o will not be added as link
> object to the exe. Causing missing symbols on exe linkage.
>
> How to transitively resolve and link "nested" Object library targets ?.
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread Petr Kmoch
Hi Richard,

does it help if you specify the linking as PUBLIC? I.e.:

target_link_libraries(second_object_lib PUBLIC first_object_lib)

Petr

On Wed, 22 May 2019 at 07:48, Richard Szabo  wrote:

> Hi cmakers
>
> I'm trying to get the following example working:
> ```
> cmake_minimum_required(VERSION 3.14)
> project(test_object_lib_nesting)
>
> set(CMAKE_CXX_STANDARD 14)
>
> add_library(first_object_lib OBJECT first.cpp)
>
> add_library(second_object_lib OBJECT second.cpp)
>
> target_link_libraries(second_object_lib first_object_lib)
>
> add_executable(test_object_lib_nesting main.cpp)
>
> target_link_libraries(test_object_lib_nesting second_object_lib)
> ```
>
> The problem I have that the linker command line will have only the
> second.cpp.o for linking the first.cpp.o will not be added as link
> object to the exe. Causing missing symbols on exe linkage.
>
> How to transitively resolve and link "nested" Object library targets ?.
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Troubles with booost and ExternalLibraries_Add

2019-05-22 Thread Steven Truppe

Hi everyone,


i'm trying to get the boost library working with cmake and
externalproject_add:


https://paste.debian.net/1082645/


best regards!

--

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Problems with ExternalProject_Add

2019-05-22 Thread Steven Truppe

Hi everyone,


i'm trying to use ExternalProject_Add like the following:

set(BOOST_VERSION 1.68.0)
set(BOOST_VERSION_NODOTS 1_68_0)
set(BOOST_URI 
https://dl.bintray.com/boostorg/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_HASH 5d8b4503582fffa9eefdb9045359c239)

ExternalProject_Add(external_boost
PREFIX ${CMAKE_BINARY_DIR}/boost
URL ${BOOST_URL}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/boost
URL_HASH MD5=${BOOST_HASH}
CONFIGURE_COMMAND  cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ && 
./bootstrab --prefix=${OUTPUT_PATH}/boost
BUILD_COMMAND  cd ${CMAKE_BINARY_DIR}/boost/src/external_boost/ 
&& ./b2
BUILD_IN_SOURCE 1
INSTALL_DIR ${OUTPUT_PATH}/boost

The problem is that he tells me that the md5 sum isn't correct, but i did 
md5sum ${BOOST_URL}.


I now play around with this for nearnly an hour and i allways get the same 
error.

I hope someone here can help me out.

best regards,
Steven Truppe

-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread hex

Without cycling dependencies you can do something like this:

/add_executable(test_object_lib_nesting main.cpp)//
//
//target_link_libraries(test_object_lib_nesting//
//    second_object_lib//
//    first_object_lib//
//)/


The problem I have that the linker command line will have only the
second.cpp.o for linking the first.cpp.o will not be added as link
object to the exe. Causing missing symbols on exe linkage.

How to transitively resolve and link "nested" Object library targets ?.
-- 

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:
https://cmake.org/mailman/listinfo/cmake