Re: [CMake] How do static libraries get linked in Ninja?

2017-01-05 Thread Robert Maynard
Do you mean you don't see where the static library is created or where
the static library is listed on the link line for the dynamic library?

On Thu, Jan 5, 2017 at 11:30 AM, Robert Dailey  wrote:
> I have two targets in CMake: a static library and a shared library.
> The shared library specifies the static library as a target link
> library.
>
> When I generate for Ninja, and I run:
>
> $ ninja -v
>
> During the link command for the shared library, I do not see the
> static library specified to g++. I do see *.so files, but not *.a
> files. Why are static libraries not showing up on the command line for
> the link step? There must be some black magic happening that I'm not
> seeing...
> --
>
> 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
-- 

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] Tracing ctest crash on windows

2017-01-05 Thread Aaron Boxer
Thanks, Bill and Jakob.  I did what you suggested and found the problem
Aaron

On Thu, Jan 5, 2017 at 11:51 AM, Bill Hoffman 
wrote:

> On 1/5/2017 9:32 AM, Jakob van Bethlehem wrote:
>
>>
>> CTest is not some magical tool that internally runs your test or
>> something like that - instead CTest just fires up your test executable
>> and does clever things with the output. In the same way you can just set
>> your test project as startup-project, and debug it like any other
>> executable.
>>
>> Sincerely,
>> Jakob
>>
>> On Wed, Jan 4, 2017 at 2:43 PM, Aaron Boxer > > wrote:
>>
>> Hello,
>> I am on windows, with visual studio 2015.
>> Some of my ctest tests are crashing with exception.
>> Is there a way of debugging these tests ?
>>
>> When I run in debug mode, I get an exception dialog,
>> but can't drop into debugging environment.
>>
> If you run ctest -VV it will show the full command line.  Best way is to
> just run the same command in the debugger.
>
> -Bill
>
>
> --
>
> 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/opensou
> rce/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] To include external libraries using Cmake

2017-01-05 Thread Matthew Woehlke
On 2017-01-05 05:10, aishwarya selvaraj wrote:
> Thanks for feedback :
> 
>> IF (${ARMADILLO} STREQUAL “ARMADILLO-NOTFOUND”)
>>   # do what you want
>> ENDIF ()
> ​
> I tried this way of writing :
> 
> IF (${ARMADILLO} STREQUAL "ARMADILLO-NOTFOUND")
> include(ExternalProject)
> ExternalProject_Add(armadillo
> URL https://github.com/lsolanka/armadillo/archive/master.zip
>  PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo-latest)
> ENDIF()
> 
> and
> 
> IF (ARMADILLO STREQUAL ARMADILLO-NOTFOUND)
>include(ExternalProject)
>MESSAGE(STATUS "Trying to install armadillo...")
> ExternalProject_Add(armadillo
> URL https://github.com/lsolanka/armadillo/archive/master.zip
> PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo-latest)
> ENDIF()

`if(NOT ARMADILLO)` is probably better...

> ​But both of them gave me an error :
>   CMake Error: The following variables are used in this project, but
>   they are set to NOTFOUND. Please set them or make sure they are set
>   and tested correctly in the CMake files:
>   ARMADILLO
> linked by target "tsm" in directory /home/computing9/TSM_cmake
>   SNDFILE
> linked by target "tsm" in directory /home/computing9/TSM_cmake

Ah... I was mostly replying to Parag; I hadn't actually looked that
closely at your original problem.

What you're trying to do is similar to a "superbuild" with optional
components. The usual way to do this is to treat *your own project* as
one of several external projects, so that the "superbuild" consists
solely of external projects. Something like:

  set(mydeps)
  if(NOT armadillo)
externalproject_add(armadillo ...)
list(APPEND mydeps armadillo
  endif()
  # similar for other externals
  externalproject_add(myproject ... DEPENDS ${mydeps})

This way, by the time your project configures, the library exists.
(You'll probably end up looking for the library twice; once in the
superbuild to decide whether to build it, and again in your project
proper where you'll a) assume it exists and hard error otherwise, and b)
want to specify as an additional search path where the superbuild will
produce it.)

Without this, trying to set up the rules so that you can both link the
library that will be created, and also get the dependencies correct so
that the build knows how to produce it when needed, is probably going to
be tricky. (Read: I'm not convinced it's impossible, but I've never seen
someone actually doing this and wouldn't recommend it.)

An alternative that may work is to set up the externals as subprojects
and have CMake fetch them at configure time if they are needed, and then
incorporate their builds directly in your own build (i.e. using
add_subdirectory rather than externalproject_add); then you can link to
the library target names when you build them yourself, and everything
will work.

p.s. I don't recommend always obtaining the current master of externals.
It's usually safer to pick a SHA and bump it as needed, so that you are
insulated against breaking changes upstream. I'm also not sure why you
are fetching snapshots instead of just using the git repositories directly.

-- 
Matthew
-- 

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] Tracing ctest crash on windows

2017-01-05 Thread Bill Hoffman

On 1/5/2017 9:32 AM, Jakob van Bethlehem wrote:


CTest is not some magical tool that internally runs your test or
something like that - instead CTest just fires up your test executable
and does clever things with the output. In the same way you can just set
your test project as startup-project, and debug it like any other
executable.

Sincerely,
Jakob

On Wed, Jan 4, 2017 at 2:43 PM, Aaron Boxer mailto:boxe...@gmail.com>> wrote:

Hello,
I am on windows, with visual studio 2015.
Some of my ctest tests are crashing with exception.
Is there a way of debugging these tests ?

When I run in debug mode, I get an exception dialog,
but can't drop into debugging environment.
If you run ctest -VV it will show the full command line.  Best way is to 
just run the same command in the debugger.


-Bill

--

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 do static libraries get linked in Ninja?

2017-01-05 Thread Robert Dailey
I have two targets in CMake: a static library and a shared library.
The shared library specifies the static library as a target link
library.

When I generate for Ninja, and I run:

$ ninja -v

During the link command for the shared library, I do not see the
static library specified to g++. I do see *.so files, but not *.a
files. Why are static libraries not showing up on the command line for
the link step? There must be some black magic happening that I'm not
seeing...
-- 

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] cpack multiple packages

2017-01-05 Thread Dvir Yitzchaki
Hi Domen.

That works perfectly. This is my code if anyone’s interested:

function(install_common)
foreach(component ${ALL_COMPONENTS})
 install(${ARGV} COMPONENT ${component})
endforeach()
endfunction()

where ALL_COMPONENTS is a global variable holding all components.

Thanks,
Dvir

From: Domen Vrankar [mailto:domen.vran...@gmail.com]
Sent: Thursday, December 22, 2016 20:43
To: Dvir Yitzchaki 
Cc: Eric Noulard ; cmake@cmake.org
Subject: Re: [CMake] cpack multiple packages

2016-12-21 12:29 GMT+01:00 Dvir Yitzchaki 
mailto:dvir.yitzch...@ceva-dsp.com>>:
Thanks, but as I understand a component can only belong to one group.
How can I get the same component/target on multiple packages?

Usually you wouldn't want to package same file on same location with same 
filename since during unpackaging they would override each other so this is not 
supported out of the box.

Usually in such cases I would split packages even further so that one package 
would be base package of others (but automatic dependency tracking between them 
would require something more sophisticated than zip - RPM, Deb or some other 
CPack supported packager perhaps).
However if you really need to do something like that you could write a function 
that you would call instead of install(...) command which would just forward to 
it and the first parameter would have a list of components to which the file 
should belong. For e.g. some pseudo code:
function(my_install my_list other_params_that_get_forwarded...)
foreach(component_name_ IN LISTS my_list)
install(other_params_that_get_forwarded... COMPONENT ${component_name_})
endforeach()
endfunction()

my_install("first;second;and_anotherone" "TARGETS target_name" "DESTINATION 
some_dir")
Hope this helps.
Regards,
Domen
-- 

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] Tracing ctest crash on windows

2017-01-05 Thread Jakob van Bethlehem
Hej,

CTest is not some magical tool that internally runs your test or something
like that - instead CTest just fires up your test executable and does
clever things with the output. In the same way you can just set your test
project as startup-project, and debug it like any other executable.

Sincerely,
Jakob

On Wed, Jan 4, 2017 at 2:43 PM, Aaron Boxer  wrote:

> Hello,
> I am on windows, with visual studio 2015.
> Some of my ctest tests are crashing with exception.
> Is there a way of debugging these tests ?
>
> When I run in debug mode, I get an exception dialog,
> but can't drop into debugging environment.
>
> Thanks,
> Aaron
>
> --
>
> 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
>
-- 

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] To include external libraries using Cmake

2017-01-05 Thread aishwarya selvaraj
Thanks for feedback :

> IF (${ARMADILLO} STREQUAL “ARMADILLO-NOTFOUND”)
>   # do what you want
> ENDIF ()
​
I tried this way of writing :

IF (${ARMADILLO} STREQUAL "ARMADILLO-NOTFOUND")
include(ExternalProject)
ExternalProject_Add(armadillo
URL https://github.com/lsolanka/armadillo/archive/master.zip
 PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo-latest)
ENDIF()

and

IF (ARMADILLO STREQUAL ARMADILLO-NOTFOUND)
   include(ExternalProject)
   MESSAGE(STATUS "Trying to install armadillo...")
ExternalProject_Add(armadillo
URL https://github.com/lsolanka/armadillo/archive/master.zip
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo-latest)
ENDIF()


​But both of them gave me an error :
--












* Armadillo Library location: ARMADILLO-NOTFOUND-- Trying to install
armadillo...-- Sndfile Library location: SNDFILE-NOTFOUND-- Trying to
install libsndfile...CMake Error: The following variables are used in this
project, but they are set to NOTFOUND.Please set them or make sure they are
set and tested correctly in the CMake files:ARMADILLOlinked by target
"tsm" in directory /home/computing9/TSM_cmakeSNDFILElinked by target
"tsm" in directory /home/computing9/TSM_cmake-- Configuring incomplete,
errors occurred!See also
"/home/computing9/TSM_cmake/build/CMakeFiles/CMakeOutput.log".*
ExternalProject_add command is not instlling the mentioned libraries from
the specifies link .
Any suggestions ?


Regards
Aishwarya Selvaraj
-- 

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