Re: [CMake] Can find_package(...) distinguish between debug and release installs?

2018-04-09 Thread Bo Zhou
Hi,

Generally speaking, no, you might have to use the suffix or special name to
distinguish the different library, such as with the "_d" suffix.

The Boost module of CMake is a considerable example, since it could
generate different names for Debug and Release libraries on Windows.

At POSIX(UNIX, OSX, Linux), sometimes user mixes the library, it still
works well. On Windows, it's dangerous or even won't work with mixed
libraries which were built by different Visual Studios with different
runtime libraries.

Cheers.

On Tue, Apr 10, 2018 at 10:56 AM, Saad Khattak  wrote:

> Hi,
>
> When find_package(LibA) sets the LibA_FOUND variable, is it possible to
> know if the package found is the Debug or Release build (or both)? I have a
> fairly complex build setup where I need to be able to distinguish if
> find_package(LibA) found a Debug or Release build.
>
> - Saad
>
> --
>
> 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] Can find_package(...) distinguish between debug and release installs?

2018-04-09 Thread Saad Khattak
Hi,

When find_package(LibA) sets the LibA_FOUND variable, is it possible to
know if the package found is the Debug or Release build (or both)? I have a
fairly complex build setup where I need to be able to distinguish if
find_package(LibA) found a Debug or Release build.

- Saad
-- 

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] passing a URL to cmake on the command line

2018-04-09 Thread Szilárd Páll
Hi,

My bad, looks like we had an offending line in our CMake scripts, something like

set(MY_URL
"http://default-url.com/foobar.tar.gz"; CACHE PATH
"URL from where to download")

The PATH type seems to have caused the issue rather than the mechanism
of passing the URL to on the bash command line to cmake.

Thanks for the quick feedback!

Cheers,
--
Szilárd


On Mon, Apr 9, 2018 at 5:44 PM, Haocheng Liu  wrote:
> Hi Szilard,
>
> I tried it in CMake 3.10 and it works fine(No slash is dropped).  Which
> version of CMake are you using?
>
> On Mon, Apr 9, 2018 at 11:24 AM, Szilárd Páll  wrote:
>>
>> Hi,
>>
>> I'm trying to pass a URL (that's used in ExternalProject_Add), and I'm
>> having trouble convincing bash + cmake to cooperate. No matter what
>> I've done, one fo the "/" gets dropped from "http://";.
>>
>> Any ideas how can I construct an invocation similar to the one below
>> that will actually work?
>>
>> cmake . -DMY_CUSTOM_URL='http://my-server.com/foobar.tar.gz'
>>
>>
>> Thanks,
>> --
>> Szilárd
>> --
>>
>> 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
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-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] Transitive linker flags

2018-04-09 Thread Zaak Beekman
Hi,

I'm defining a static library target and, conditionally, when on windows, I
need to pass a whole bunch of windows system libraries and tell Visual
Studio that any target linking against this static library should pass
additional linker flags ( `\NODEFAULTLIB:libcd \INCREMENTAL:NO` ). I tried
setting the LINKER_FLAGS property on the target with

+  set_property(TARGET ECI_C
+PROPERTY
+APPEND
+LINK_FLAGS "${prefix}NODEFAULTLIB${colon}\"libcd\"")
+set_property(TARGET ECI_C
+PROPERTY
+APPEND
+LINK_FLAGS "${prefix}INCREMENTAL${colon}NO")

however, these flags did not seem to get transitively propagated to the
executable linking against this ECI_C static library. Am I doing something
wrong, or should I just specify the flags through the
`target_link_libraries( ECI_C INTERFACE FLAG1 FLAG2 )` command?  What's the
"right"/canonical way to do this?

Also, I'm extremely new to developing on Windows with MSVS, and I'm writing
CMake files to generate visual studio projects to more or less match some
that have been manually written. Without ignoring the `libcd` library I get
linker errors like

error LNK2019: unresolved external symbol __imp_fopen

Which seems strange that I should have to ignore the standard C debug
library to fix. Without the `\INCREMENTAL:NO` flag I get warnings like

   warning LNK4217: locally defined symbol malloc imported in function
inittask

Are the manually written VS solution files or source code that I've
inherited doing something silly that requires these MSVS linker flags to be
set? It feels like this, along with the sheer quantity of system libraries
that are being passed to the linker may be a bit of a cludge. I'm
wondering, if it's worth spending my limited time investigating this
further or is this expected/common-practice/acceptable usage?

Thanks,
Zaak

Izaak "Zaak" Beekman

---

HPC Scientist
ParaTools Inc. 
1509 16th St, NW
Washington, DC 20036
mobile: (917) 797-3239
---
-- 

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] passing a URL to cmake on the command line

2018-04-09 Thread Haocheng Liu
Hi Szilard,

I tried it in CMake 3.10 and it works fine(No slash is dropped).  Which
version of CMake are you using?

On Mon, Apr 9, 2018 at 11:24 AM, Szilárd Páll  wrote:

> Hi,
>
> I'm trying to pass a URL (that's used in ExternalProject_Add), and I'm
> having trouble convincing bash + cmake to cooperate. No matter what
> I've done, one fo the "/" gets dropped from "http://";.
>
> Any ideas how can I construct an invocation similar to the one below
> that will actually work?
>
> cmake . -DMY_CUSTOM_URL='http://my-server.com/foobar.tar.gz'
>
>
> Thanks,
> --
> Szilárd
> --
>
> 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
21 Corporate Drive
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] passing a URL to cmake on the command line

2018-04-09 Thread Szilárd Páll
Hi,

I'm trying to pass a URL (that's used in ExternalProject_Add), and I'm
having trouble convincing bash + cmake to cooperate. No matter what
I've done, one fo the "/" gets dropped from "http://";.

Any ideas how can I construct an invocation similar to the one below
that will actually work?

cmake . -DMY_CUSTOM_URL='http://my-server.com/foobar.tar.gz'


Thanks,
--
Szilárd
-- 

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] CMake import targets, recommended Naming scheme and static/shared libraries

2018-04-09 Thread Norbert Lange
Hello,

I would like to add support for some software components, that have
not been compiled with CMake.
There are 2 options, either write a Find script or generate configs.
Later option would be more robust, as substantial changes could
be ironed out when the config is version-specific.


*) Import Name scheme

CMake seems to prefer CamelCase for their inbuilt find modules, but
this is troublesome, as usually libraries are lowercase.
eg.:

add_library(foo SHARED)

install(TARGETS foo EXPORT foo-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT foo
)

install(EXPORT foo-targets "${CMAKE_INSTALL_LIBDIR}/cmake"
   NAMESPACE Foo::
)

would result in Foo::foo.

Not ideal, from the standpoint of using the CMake automatisms,
lowercase ("library-case") would be best.

*) Static + Shared libraries

often both are available.
is there a recommended suffix (prefix), and would static and non-static
versions be the same COMPONENT or a different one?

add_library(foo-static STATIC)

install(TARGETS foo-static EXPORT foo-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT foo-static
)

install(EXPORT foo-targets "${CMAKE_INSTALL_LIBDIR}/cmake"
   NAMESPACE Foo::
)

So is there any resource describing and weighting these options?
CMake doesnt seem to be particularly well equipped to allow a choice
between static/shared dependencies.

Norbert
-- 

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] Generator expression for "is in list"?

2018-04-09 Thread CHEVRIER, Marc
Operator IN_LIST in generator expressions will be available in CMake version 
3.12, (i.e. the next version).
In the meantime, I am afraid there is no solution in the context of generator 
expressions. However, you can directly use the contents of the property in your 
CMakeLists.txt.
Example:
get_property (link_libs TARGET mytarget PROPERTY LINK_LIBRARIES)
if (“mylib” IN_LIST link_libs)
   …
endif()

The only difference is the evaluation time:

  *   Generator expressions are evaluated after all CMakeLists.txt processing, 
so any changes to the target done AFTER the use of 
$ will be taken into account.
  *   Using get_property: evaluation is done at the point where the command is 
used, so any changes done AFTER will NOT be taken into account




From: CMake  on behalf of Sam Edwards 

Date: Saturday 7 April 2018 at 23:35
To: "cmake@cmake.org" 
Subject: [CMake] Generator expression for "is in list"?

Hello list!

I'm trying to write a generator expression that only evaluates if my target is 
directly (not transitively) linked into the consuming target. I figured the 
easiest way to do that would be to test if the target's name appears in 
$, however I'm not seeing a generator 
expression for substring or "string in list" tests.

What is the preferred way to accomplish this?

Best,
Sam
-- 

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