Re: [CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Kim Walisch
Thanks for your comment, I seem to have misunderstood the usage of BUILD_SHARED_LIBS. I will remove the hack to serve either a static or shared libprimesieve from my cmake config file. Kim On Feb 14, 2018 11:42 PM, "Hendrik Sattler" wrote: > > > Am 14. Februar 2018 21:47:24 MEZ schrieb Kim Wali

[CMake] Auto generating package configuration file?

2018-02-14 Thread Damien R
Hi, I know that I could write FooConfig.cmake.in, call configure_package_config_file() to generate package configuration file and call write_basic_package_version_file() to generate a version file. Typically FooConfig.cmake.in contains: @PACKAGE_INIT@ find_dependency(...) My question is why do I

Re: [CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Hendrik Sattler
Am 14. Februar 2018 21:47:24 MEZ schrieb Kim Walisch : >Thanks, I got it working! > >Unfortunately I could not make the generator expression work inside >PrimesieveConfig.cmake.in, here is the error message: > >CMake Error: > Error evaluating generator expression: >$ > Expression did not ev

Re: [CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Kim Walisch
Thanks, I got it working! Unfortunately I could not make the generator expression work inside PrimesieveConfig.cmake.in, here is the error message: CMake Error: Error evaluating generator expression: $ Expression did not evaluate to a known generator expression Note that in my main CMake

Re: [CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Kim Walisch
CMake currently does not allow alias libraries for import targets: $ cmake .. CMake Error at /usr/local/lib/cmake/primesieve/PrimesieveConfig.cmake:7 (add_library): add_library cannot create ALIAS target "my_libprimesieve" because target "Primesieve::libprimesieve-static" is IMPORTED. Call Sta

Re: [CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Robert Maynard
If you want to support consumers that are building shared and static libraries themselves you can do this by using an import library with a generator expression. A simplified version of how do this, besides the import library can be found at: https://github.com/robertmaynard/Sandbox/blob/master/CM

Re: [CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread ThePhD
I think you can use what's called an "Alias Library": https://cmake.org/cmake/help/latest/command/add_library.html#alias-libraries if (BUILD_SHARED_LIBS) add_library(my_libprimesieve ALIAS libprimesieve) else add_library(my_libprimesieve ALIAS libprimesieve-static) endif(BUILD_SHARED_LIB

[CMake] Config.cmake.in: Conditionally serve static or shared library

2018-02-14 Thread Kim Walisch
Hi, My primesieve project builds as both a static and a shared library, hence there are 2 targets in my main CMakeLists.txt: 1) libprimesieve (shared library) 2) libprimesieve-static I am now trying to add support for find_package(Primesieve). Ideally I would like that users can link against lib

Re: [CMake] MinGW-w64/MSYS2 (or Cygwin) and NAG Fortran - how to combine?

2018-02-14 Thread Brad King
On 2/14/2018 3:16 AM, Arjen Markus wrote: > The MinGW version of Cmake reports Windows for both variables Great, that's expected. Then Windows-NAG-Fortran would be the proper module for flags for a compiler targeting a Windows environment. > and the MSYS2 version reports MSYS. If CMAKE_SYSTEM_N

Re: [CMake] MinGW-w64/MSYS2 (or Cygwin) and NAG Fortran - how to combine?

2018-02-14 Thread Arjen Markus
Hi Brad, Alan, See below. > -Original Message- > From: Alan W. Irwin [mailto:ir...@beluga.phys.uvic.ca] > Sent: Tuesday, February 13, 2018 11:55 PM > > In general, you get native packages from the mingw64 repository and > POSIX-aware > packages from the msys2 repository for this dual-n