Re: [CMake] Dependencies of an external project

2019-11-19 Thread Marc CHEVRIER
ExternalProject does its work at build time, so too late for find_package which is executed at config time. Have a look at module FetchContent which does its work before config time. Le 19 nov. 2019 à 16:13 +0100, hex , a écrit : > I have an external CMake project that gets exported on install.

Re: [CMake] CHECK_CXX_COMPILER_FLAG doesn't give correct result for -fsanitize=address

2019-10-25 Thread Marc CHEVRIER
This is the expected behaviour. As you already discovered, it is possible to control the compilation and link steps with variables as described in  https://cmake.org/cmake/help/latest/module/CheckCXXSourceCompiles.html#module:CheckCXXSourceCompiles. To specify, in a more clean way, link

Re: [CMake] Separating spaces are escaped by JOIN generator expression

2019-08-06 Thread Marc CHEVRIER
                    ${CMAKE_CURRENT_SOURCE_DIR}/${DICTIONARY_LINKDEF} >     DEPENDS  MyLibrary ${DICTIONARY_HEADERS} ${DICTIONARY_LINKDEF} >     COMMAND_EXPAND_LISTS > ) > > > Le mar. 6 août 2019 à 02:56, Marc CHEVRIER a > > écrit : > > > Oops, I mean: $ To generate

Re: [CMake] Separating spaces are escaped by JOIN generator expression

2019-08-05 Thread Marc CHEVRIER
If you want to define a list, try to use $ rather than a space to separate the items. This way, you will get a CMake list rather than a string: list(APPEND DICTIONARY_INCLUDES "-I$,$-I>") Le 5 août 2019 à 22:56 +0200, Dakeryas , a écrit : > I am facing the exact same issue when when joining

Re: [CMake] FindPython3 Python_FIND_VIRTUALENV seems to be ignored

2019-08-01 Thread Marc CHEVRIER
This is a bug already identified (see https://gitlab.kitware.com/cmake/cmake/issues/19525). I am currently working on a fix. Le 1 août 2019 à 11:33 +0200, sebastian.muell...@zf.com, a écrit : > Hi all, > > I’ve been trying to convince Cmake 15.1 to use the python installation in my > virtual

Re: [CMake] Getting library name from library target to pass to legacy Makefile

2019-07-22 Thread Marc CHEVRIER
uck with 3.12.4 for the > foreseeable future. Is there a way to get the equivalent behavior in older > versions? > > > On Mon, Jul 22, 2019 at 1:04 AM Marc CHEVRIER > > wrote: > > > You can use generator expression TARGET_FILE_BASE_NAME, available with > > >

Re: [CMake] Getting library name from library target to pass to legacy Makefile

2019-07-22 Thread Marc CHEVRIER
You can use generator expression TARGET_FILE_BASE_NAME, available with version 3.15. Le 22 juil. 2019 à 05:24 +0200, Dustyn Blasig , a écrit : > Hi All, > > I am integrating a legacy Makefile with our CMake flow, and need to pass the > name of a CMake library target to the Makefile via

Re: [CMake] Moving build artifacts to custom directory

2019-07-03 Thread Marc CHEVRIER
Have a look at variables ‘CMAKE_*_OUTPUT_DIRECTORY’ (Like CMAKE_ARCHIVE_OUTPUT_DIRECTORY. See  https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html) and target properties ‘*_OUTPUT_DIRECTORY’ (Like ARCHIVE_OUTPUT_DIRECTORY. See 

Re: [CMake] CMake is Converting lists to strings

2019-06-12 Thread Marc CHEVRIER
You are wrongly using the STRING(REPLACE …) command. The right way to use it to avoid list conversion is to expand the list inside  quotes (to preserve list items separators): STRING (REPLACE "../" "" SIMPLE_LIST "${SIMPLE_LIST}") Without the quotes, all list elements are concatenated in the

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

Re: [CMake] How to pass linker options with whitespace?

2019-05-13 Thread Marc CHEVRIER
You have to use SHELL token (see documentation of add_link_options) add_link_options ("SHELL:-s USE_WEBGL2=1"  "SHELL:-s FULL_ES2=1") Le 12 mai 2019 à 21:14 +0200, Fredrik Orderud , a écrit : > I'm struggling to figure out how to pass "-s USE_WEBGL2=1 -s > FULL_ES2=1" (without the quotes) as

Re: [CMake] PIE-pie_off and CMP0083-cmp0083_new fail for openSuse Leap 15.0

2019-03-20 Thread Marc CHEVRIER
clearly, from what shown on http://paste.opensuse.org/14067189, c++ compiler from OpenSuse Leap is buggy. Expected output from readelf for executable tests_1 is « Elf file type is EXEC (Executable file) » which is not the case. Option -no-pie is not taken into account. This explains the

Re: [CMake] Remove a custom command added with add_custom_command( POST_BUILD ...)

2019-03-05 Thread Marc CHEVRIER
In the meantime if this POST_BUILD command calls a specific tool you can create a no-op shell script with the same name and put its location in the PATH variable. Le 6 mars 2019 à 07:41 +0100, Olivier Gomez , a écrit : > Thank you for your suggestions. > I think the best option is a patch but

Re: [cmake-developers] Mandatory export of a static library dependency

2019-02-28 Thread Marc CHEVRIER
extra source file > compared to the static version. Or, worked until the export stage. > > -Lassi > > From: Marc CHEVRIER > Sent: torstai 28. helmikuuta 2019 11.37 > To: cmake-developers@cmake.org; Lassi Niemistö > Subject: Re: [cmake-developers] Mandatory export of a stati

Re: [cmake-developers] Mandatory export of a static library dependency

2019-02-28 Thread Marc CHEVRIER
Hi, It is perfectly normal that CMake requires static library to be exported when command ’target_link_libraries(fooshared barstatic)’ is specified because this is equivalent to command 'target_link_libraries(fooshared PUBLIC barstatic)’. As you have already discovered, using command

Re: [CMake] Static Libraries and target_link_libraries

2019-01-25 Thread Marc CHEVRIER
It is quite inexact because a target can store many information like include directories or preprocessor definitions for example (through properties like INCLUDE_DIRECTORIES or COMPILE_DEFINITIONS). So it make sense to enable to specify link libraries to a static library using PRIVATE or

Re: [cmake-developers] real functions (was: $LIST_LENGTH{} syntax)

2019-01-22 Thread Marc CHEVRIER
I am not convince that the proposed syntax is a good idea because it introduce a new syntax just to solve one action on a list. What about introducing a syntax similar to the version comparison: • LENGTH_EQUAL • LENGTH_GREATER • LENGTH_LOWER • etc… To use it: if (my_list LENGTH_EQUAL 1)   # do

Re: [CMake] set_property imported_location_release

2018-12-21 Thread Marc CHEVRIER
0100, Lars , a écrit : > Marc, > > Appreciate the quick and helpful response. > > In a config file that supports multiple platforms, do I need to create > import_location_path variable and populate it depending on platform and 32/64 > etc? Any other options? > > Thanks. > >

Re: [CMake] set_property imported_location_release

2018-12-21 Thread Marc CHEVRIER
Properties IMPORTED_LOCATION* do not support generator expressions. Generally speaking, if a property supports generator expression, it is explicitly specified in documentation. Le 21 déc. 2018 à 13:07 +0100, Lars , a écrit : > Hello, > > Trying to import an external library but having some

Re: [CMake] target_link_libraries not populating INCLUDE_DIRECTORIES?

2018-12-21 Thread Marc CHEVRIER
Command target_link_libraries do not populate directly the properties of the target due to many constraints regarding the values given to the command (generator expressions, other targets, etc…). The full contents is taken into account at generation time not at the configuration time. This is

Re: [CMake] [MSVC] Setting warning level on target feels like long-time bug

2018-12-09 Thread Marc CHEVRIER
I think the discussion is shifting from the initial problem which was unwanted warning « Command line warning D9025: overriding '/W3' with '/W4' ». Changing defaults is not a good idea from my point of view because relying on defaults can be problematic if Microsoft decide to change the default

Re: [CMake] How force cmake debug/release

2018-12-06 Thread Marc CHEVRIER
Have a look at the documentation : https://cmake.org/cmake/help/v3.13/ Le 6 déc. 2018 à 09:51 +0100, Andy , a écrit : > In cmake I have: > if (${CMAKE_BUILD_TYPE} STREQUAL Release) >   message(WARNING "Release") > endif() > > if (${CMAKE_BUILD_TYPE} STREQUAL Debug) >   message(WARNING "Debug") >

Re: [CMake] cmake 3.12 - python libs / 32 / 64 bits

2018-11-16 Thread Marc CHEVRIER
) >> set_target_properties( python PROPERTIES IMPORTED_LOCATION /usr/lib32/ >> libpython2.6.so ) >> target_include_directories(python SYSTEM ... >> > > I think you can do that but it replaces the use of find_package(Python2 > COMPONENTS Development) > may be

Re: [CMake] cmake 3.12 - python libs / 32 / 64 bits

2018-11-14 Thread Marc CHEVRIER
The way you proceed is wrong. The system configuration is determined during the 'project' function call. Setting information after this call is useless. So, in your example, on a 64bit system, the compilation configuration will be 64bit (variable CMAKE_SIZEOF_VOID_P has value 8). This explain why

Re: [CMake] java_home usage

2018-10-22 Thread Marc CHEVRIER
Variable must be specified using upper case. So 'set (JAVA_HOME ...)' should be OK (or environment variable JAVA_HOME is OK as well). javac is expected to be in $JAVA_HOME/bin. Le lun. 22 oct. 2018 à 10:16, Stéphane Ancelot a écrit : > Hi, > > If I set java_home in cmake 3.12 ,

Re: [CMake] Howot add jar files in final jar file

2018-10-22 Thread Marc CHEVRIER
Option INCLUDE_JARS is used to specify classpath javac option for java sources compilation. Currently, there is no possibility to add jars using add_jar command. You have to use a custom command for that purpose. Le lun. 22 oct. 2018 à 11:05, Stéphane Ancelot a écrit : > Hi, > > I have to

Re: [CMake] target_compile_flags and PUBLIC

2018-10-09 Thread Marc CHEVRIER
Have a look at '$' and '$' generator expressions. Le mar. 9 oct. 2018 à 09:48, Biddiscombe, John A. a écrit : > I have a problem with exported flags from a project. > > If I use `target_compile_options(hpx PUBLIC ${flags})` hpx is compiled > with the flags, and all 500+ tests within the project

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

2018-10-04 Thread Marc CHEVRIER
arch?q=optimized.lib+cmake > > > > Regards, > > Björn > > > > > > *From:* Marc CHEVRIER > *Sent:* Thursday, October 4, 2018 6:59 PM > *To:* Björn Blissing > *Cc:* Andrew Fuller ; Eric Noulard < > eric.noul...@gmail.com>; CMake Mailinglist > >

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] How to append a string on list inside a function

2018-09-27 Thread Marc CHEVRIER
Using a cache variable seems not required. A function creates a new scope and inherit a copy of all variables defined in the upper scope. So, by adding a set command using PARENT_SCOPE in your function you can update the variable in the parent scope: function(addTest targetName)

Re: [CMake] LOCATION target property, generator expressions

2018-09-25 Thread Marc CHEVRIER
LINK_FLAGS does not support expressions. However, property LINK_OPTIONS (and INTERFACE counterpart) support generator expressions. These properties are new for version 3.13 which will be available soon (probably next month). Le mer. 26 sept. 2018 à 05:21, Hendrik Greving <

Re: [CMake] Labels on tests defined on another subdirectory

2018-09-19 Thread Marc CHEVRIER
) add_subdirectory("my_dir") and in "my_dir": add_test(TEST1 ...) set_property(TEST TEST1 APPEND PROPERTY LABELS ${MY_LABELS}) Le mer. 19 sept. 2018 à 19:45, Raffi Enficiaud < raffi.enfici...@mines-paris.org> a écrit : > On 19.09.18 08:25, Marc CHEVRIER wrote: > >

Re: [CMake] Labels on tests defined on another subdirectory

2018-09-19 Thread Marc CHEVRIER
directory property 'TESTS' returns the tests created in the *current* directory only. The main reason to this limitation is the fact that tests created in different directories can have same name. Le mer. 19 sept. 2018 à 02:22, Raffi Enficiaud < raffi.enfici...@mines-paris.org> a écrit : > Hi,

Re: [CMake] Appending to CMAKE_CXX_FLAGS

2018-09-11 Thread Marc CHEVRIER
seeing a property (from the first link you sent) that would allow me to do > that. > > > > -- > > Michael Jackson | Owner, President > > BlueQuartz Software > > [e] mike.jack...@bluequartz.net > > [w] www.bluequartz.net > > > > *From: *

Re: [CMake] Appending to CMAKE_CXX_FLAGS

2018-09-11 Thread Marc CHEVRIER
The best approach is to use properties (see https://cmake.org/cmake/help/git-master/manual/cmake-properties.7.html). At directory level and target level you can use property 'COMPILE_OPTIONS'. These properties can be updated using, respectively 'add_compile_options' and 'target_compile_options'.

Re: [CMake] [CMAKE] cmake_device_link.o: nvcc fatal: Unknown option 'Wl, -start-group'

2018-09-08 Thread Marc CHEVRIER
Hi, To avoid this, put link flags in ‘LINK_FLAGS’ target properly. ´target_link_libraries’ is populating ´LINK_LIBRARIES’ target property. Le sam. 8 sept. 2018 à 01:40, Alvin Chu a écrit : > Hi cmake team, > I'm using cmake 3.12.1, and building a project which has cuda codes, the > cmake file

Re: [CMake] Export a custom property of a target

2018-08-22 Thread Marc CHEVRIER
'define_property' is nearly useless except for documentation. Export of custom properties is managed through target property 'EXPORT_PROPERTIES'. Le mer. 22 août 2018 à 15:58, Raphael Grimm a écrit : > Hi, > > I added a custom target property via 'define_property' >

Re: [CMake] specifying path for license file for commercial compiler?

2018-07-09 Thread Marc CHEVRIER
ises many more issues as > I need my project to be able to build with many different versions of the > Intel compiler. > > > > Thanks in advance, > > > >- Tom > > > > > > *From: *Marc CHEVRIER > *Date: *Saturday, July 7, 2018 at 1:49 AM > *

Re: [CMake] specifying path for license file for commercial compiler?

2018-07-06 Thread Marc CHEVRIER
May be using a toolchain file is more appropriate. See https://cmake.org/cmake/help/v3.12/manual/cmake-toolchains.7.html Le ven. 6 juil. 2018 à 22:59, Clune, Thomas L. (GSFC-6101) < thomas.l.cl...@nasa.gov> a écrit : > To use the Intel compiler, one must use an environment variable that >

Re: [CMake] How to specify library dir for imported interface?

2018-07-04 Thread Marc CHEVRIER
Next version of CMake (3.13) will supports properties LINK_OPTIONS as well as INTERFACE_LINK_OPTIONS. Le mer. 4 juil. 2018 à 16:02, Francis Giraldeau a écrit : > > However, it seems no property exists to actually specify the library dir > > of imported target, nor the linker flags to pass when

Re: [CMake] Adding a target to 'all' that was previously excluded

2018-07-04 Thread Marc CHEVRIER
You can use a new target, built by all, depending on your initial target: add_custom_target(build_blah_X ALL) add_dependencies(build_blah_X blah_X) Le mer. 4 juil. 2018 à 03:33, Andrew White a écrit : > How do I add an excluded (executable) target to the build. I know that if > I add a

Re: [CMake] Changing link flags for one target

2018-07-04 Thread Marc CHEVRIER
LINK_FLAGS property do not support generator expressions. In CMake 3.13, directory and target properties LINK_OPTIONS, supporting generator expressions, managed by commands add_link_options and target_link_options are introduced, . For earlier versions you can use global variables to set flags

Re: [CMake] Different INSTALL target settings per project

2018-07-03 Thread Marc CHEVRIER
FYI, next release (3.13) will relaxing this contraint so you will be able to apply this strategy. Le mar. 3 juil. 2018 à 08:05, Andrew White a écrit : > We have a number of projects that include other projects. Some of the > parent projects are cross-compile projects with various odd

Re: [CMake] how to deprecate a target?

2018-07-02 Thread Marc CHEVRIER
FYI: Starting with CMake 3.11, it is now possible to define an alias of an imported target. Le lun. 2 juil. 2018 à 09:27, Petr Kmoch a écrit : > Hi Bram. > > Wild idea: could you also define a non-namespaced target `foo` and craft > it such that linking against it generates a linker warning?

Re: [CMake] Interface source paths evaluated relative to dependent library

2018-06-25 Thread Marc CHEVRIER
e > BUILD_INTERFACE generator expression and line breaks / list items? > It seems to work fine in target_sources when enclosing multiple > lines/files, but in target_include_directories I need one > BUILD_INTERFACE expression per directory or I get an error. > > Thanks again, > > Ric

Re: [CMake] Interface source paths evaluated relative to dependent library

2018-06-25 Thread Marc CHEVRIER
You can manage different paths (one for build export and one for install export) by using '$' and '$'. '$' accepts absolute paths and '$ expects paths relative to the install prefix (CMAKE_INSTALL_PREFIX variable). . Le lun. 25 juin 2018 à 16:23, Rich T a écrit : > Hi everyone, I've a question

Re: [CMake] FindPythonLibs on macOS

2018-06-22 Thread Marc CHEVRIER
There is no specific reason. But, starting with CMake 3.12, a new approach to manage python is available (modules FindPython2, FindPython3 and FindPython) which take care of consistency between interpreter and libraries and rely, when possible, on python-config tool. Le ven. 22 juin 2018 à

Re: [CMake] Null alias targets?

2018-06-14 Thread Marc CHEVRIER
Starting with CMake v3.11, it is now possible to aliasing an imported target. So you can have something like that: if (BUILD_MY_LIB) add_library(my_lib SHARED ) add_library(MY_NAMESPACE::mylib ALIAS my_lib) else() add_library(system_lib SHARED IMPORTED GLOBAL) set_property(TARGET

Re: [CMake] losing CMakeCache.txt after changing the compiler...

2018-06-06 Thread Marc CHEVRIER
functions, you can easily ensure to use always the correct compiler for each build environment. Le mer. 6 juin 2018 à 16:50, René J. V. Bertin a écrit : > Marc CHEVRIER wrote: > > > You can easily avoid this bad experience by using different builds > > environments : one per compile

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread Marc CHEVRIER
Le dim. 3 juin 2018 à 18:40, Hendrik Sattler a écrit : > > > Am 3. Juni 2018 16:33:12 MESZ schrieb Marc CHEVRIER < > marc.chevr...@gmail.com>: > >In fact, the right way to manage « composite » options is to use « > >SHELL: » > >prefix (introduced in up-com

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread Marc CHEVRIER
> realloc_lhs>") > > you get a single quoted token "-assume realloc_lhs" on the compile line > which the compiler doesn't understand. The correct thing is > > > GOOD: > add_compile_options("$<$:-assume;realloc_lhs>") > > > On Sun, Ju

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread Marc CHEVRIER
) and that worked too. Thanks all! > > On Sun, Jun 3, 2018 at 12:18 AM Marc CHEVRIER > wrote: > >> Did you try with $ rather than the ; character? >> >> Le dim. 3 juin 2018 à 06:24, Craig Scott a >> écrit : >> >>> On Sun, Jun 3, 2018 at 12:34

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread Marc CHEVRIER
Did you try with $ rather than the ; character? Le dim. 3 juin 2018 à 06:24, Craig Scott a écrit : > On Sun, Jun 3, 2018 at 12:34 PM, Neil Carlson > wrote: > >> On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell >> wrote: >> >>> It should be a CMake list, which is delineated by semicolons. >>>

Re: [CMake] losing CMakeCache.txt after changing the compiler...

2018-06-02 Thread Marc CHEVRIER
You can easily avoid this bad experience by using different builds environments : one per compiler ! Le sam. 2 juin 2018 à 11:43, René J.V. Bertin a écrit : > Hi, > > This happened once too often for me: I apply successive tweaks to a > CMakeCache file, reinvoke make (or ninja) and then at some