Re: [CMake] LOCATION target property, generator expressions

2018-10-04 Thread Hendrik Greving
Hi, we would like to.. (*) keep modularity and flexibility (i.e. avoid hard-coding relative paths) w/ binaries and libraries in build tree at flexible locations. (*) update rpath in the target binary based on relative paths from $ORIGIN, such that a user or any other script can move the build (and

[CMake] find_package Module/Config mode and nontrivial package version checks

2018-10-04 Thread Joachim Wuttke
The find_package command docs [1,2] recommend that user code should generally look for packages using the Module mode signature. What then about user code that ought to check for version compatibility? Module mode only offers a check for an EXACT version string, and does not terminate if that cond

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Marc CHEVRIER
For now, clearly it is not supported. Introducing a generator expression breaks the parsing of arguments of command target_link_libraries. @Björn I suggest to you to log an issue (see https://gitlab.kitware.com/cmake/cmake/issues) about that (don't forget to put a short example demonstrating the p

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Eric Noulard
Le jeu. 4 oct. 2018 à 18:59, Marc CHEVRIER a écrit : > I am afraid that you cannot mix "optimized" or "debug" keywords with > "generator expressions" because keywords handling is done during evaluation > of command "target_link_libraries" and "generator expressions" are > evaluated during generat

[CMake] Object libraries and relative paths in Ninja

2018-10-04 Thread Daniel Eiband
Hi, For a simple test I've got the following directory structure: |- build |- project | |- CMakeLists.txt | |- Main.cpp |- CMakeLists.txt |- Test.cpp project/CMakeLists.txt has the following content: cmake_minimum_required(VERSION 3.12) project(Reproducer LANGUAGES CXX) add_subdirecto

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Björn Blissing
Hi Marc, If that is the case that mixing of “optimized” and “debug” keywords with generator expressions is impossible, I think this should be mentioned in the official documentation. It took us the better part of an afternoon to track down why we suddenly had a dependency to a library called “o

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Eric Noulard
Le jeu. 4 oct. 2018 à 18:34, Björn Blissing a écrit : > Hi Andrew, > > > > That works, but as previously said. The third party find module I am using > do not differentiate between debug and release libraries. To make matters > even worse the keywords “optimized” and “debug” is already in the var

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Marc CHEVRIER
I am afraid that you cannot mix "optimized" or "debug" keywords with "generator expressions" because keywords handling is done during evaluation of command "target_link_libraries" and "generator expressions" are evaluated during generation. And target_link_libraries expect following pattern: [] [

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Björn Blissing
Hi Andrew, That works, but as previously said. The third party find module I am using do not differentiate between debug and release libraries. To make matters even worse the keywords "optimized" and "debug" is already in the variable list, trying to split them will be painful. The workaround

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Andrew Fuller
What about this: list(APPEND FOO_LIBRARIES_OPT foo) list(APPEND FOO_LIBRARIES_DBG foo_d) target_link_libraries(my_exe PUBLIC debug "$<$:${FOO_LIBRARIES_DBG}>" optimized "$<$:${FOO_LIBRARIES_OPT}>" "$<$:bar>" ) A little more verbose. F

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Björn Blissing
Hi Andrew, When I put the genex inside double quotes I get: optimized.lib;foo.lib;debug.lib;foo_d.lib;bar.lib; --- for both debug and release builds Regards, Björn From: Andrew Fuller Sent: Thursday, October 4, 2018 5:54 PM To: Björn Blissing ; Eric Noulard Cc: CMake Mailinglist Subject

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Andrew Fuller
What happens if you put the genex inside double quotes? target_link_libraries(my_exe PUBLIC "$<$:${FOO_LIBRARIES}>" "$<$:bar>" ) From: CMake on behalf of Björn Blissing Sent: October 4, 2018 8:49:19 AM To: Eric Noulard Cc: CMake Mailingl

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Björn Blissing
Hi Eric, I tried to do a self contained minimal example: cmake_minimum_required(VERSION 3.12) project(expension_error LANGUAGES CXX) add_executable(my_exe main.cpp) option(USE_FOOLIB "Use foo.lib" ON) option(USE_BARLIB "Use bar.lib" ON) list(APPEND FOO_LIBRARIES optimized foo) list(APPEND FOO_

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Eric Noulard
Le jeu. 4 oct. 2018 à 16:53, Björn Blissing a écrit : > Hello Eric, > > > > The minimal example was just to display the expansion error. In real life > the code uses a Boolean variable (and the rest of the CMake code is much > larger as well). > It was just to show the expansion error you get if

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Björn Blissing
Hello Eric, The minimal example was just to display the expansion error. In real life the code uses a Boolean variable (and the rest of the CMake code is much larger as well). It was just to show the expansion error you get if you try to use a conditional generator expression inside a target_li

Re: [CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Eric Noulard
Le jeu. 4 oct. 2018 à 16:06, Björn Blissing a écrit : > Hello, > > > > I am having trouble with a conditional generator expression inside target > link libraries, which seems to expand incorrectly (or at least not the way > I expect). > > > > In short, I have a list of libraries that is found by

[CMake] Trouble with conditional generator expression inside target_link_libraries

2018-10-04 Thread Björn Blissing
Hello, I am having trouble with a conditional generator expression inside target link libraries, which seems to expand incorrectly (or at least not the way I expect). In short, I have a list of libraries that is found by a CMake module. The list is composed of a number of elements each preceded

Re: [CMake] Writing foo-config.cmake with find_dependency

2018-10-04 Thread Mateusz Loskot
On Mon, 1 Oct 2018 at 21:45, Mateusz Loskot wrote: > > The library has number of dependencies on third-party libraries, > namely database access client libraries. I've reached the point > where I need to 'list' those dependencies in soci-config.cmake [3] > Namely, I need to make friend with find_d

Re: [CMake] Call function from name and list, including empty elements?

2018-10-04 Thread Craig Scott
Sorry for the delay, a few more replies to your latest questions embedded below. On Sun, Sep 30, 2018 at 6:06 PM Jan Wielemaker wrote: > > > I've come as far as understanding: > > > > - The generator creates cmake_install.cmake > > - make/ninja/... install calls cmake -P cma

Re: [CMake] Automoc fails on MSYS2/MinGW

2018-10-04 Thread Dmitry Mikushin
Hi Ray, Thanks - done: https://github.com/Alexpux/MINGW-packages/issues/4508 Kind regards, - Dmitry Mikushin. чт, 4 окт. 2018 г. в 15:20, Ray Donnelly : > Hi Dmitry, > > You should report this on MSYS2's github repo (Alexpux), we apply some > patches to Qt's CMake files and one of those may ha

Re: [CMake] Automoc fails on MSYS2/MinGW

2018-10-04 Thread Ray Donnelly
Hi Dmitry, You should report this on MSYS2's github repo (Alexpux), we apply some patches to Qt's CMake files and one of those may have caused this issue. It's unlikely to be a problem with CMake. On Thu, Oct 4, 2018 at 12:14 PM Dmitry Mikushin wrote: > > Dear all, > > I'm currently looking into

[CMake] Automoc fails on MSYS2/MinGW

2018-10-04 Thread Dmitry Mikushin
Dear all, I'm currently looking into an error from Automoc below, which gives no clue about the cause of failure (Output is empty). The mechanics of Automoc in CMake is not clear. Looks like "cmake_autogen" only launches a command described in variables. But where the command return value is check