[CMake] Joining an OBJECT and a SHARED library

2018-09-05 Thread George PF
Hi, is there a way to "join" an the OBJECT library with a SHARED library it creates? The abclib and its component abc_tmp, all .c file have #include "foo.h": add_library(abc_tmp OBJECT z1. z2.c) # generate... add_library(abclib SHARED $ generated.c) Then adding the library foo, whi

Re: [CMake] find_package with COMPONENTS never honors REQUIRED

2018-08-30 Thread George PF
> The documentation is intriguing about REQUIRED COMPONENTS interaction That's... one way to put it. > "A package-specific list of required components may be listed after the > ``COMPONENTS`` option (or after the ``REQUIRED`` option if present). > Additional optional components may be listed

[CMake] find_package with COMPONENTS never honors REQUIRED

2018-08-30 Thread George PF
Hi, once COMPONENTS is added to a find_package statement, any REQUIRED statement ceases to have an effect: cmake_minimum_required(VERSION 3.12) # find_package(FailsCorrectly REQUIRED) find_package(Qt REQUIRED COMPONENTS REQUIRED Qt5XYZ REQUIRED) find_package(Qt REQUIRED COM

Re: [CMake] Iterating over a generator expression list, specifically $ of an OBJECT library

2018-08-29 Thread George PF
> I cc the list because I think you drop it inadvertently. Ah, thanks. I'll pay more attention to that now. > Le mar. 28 août 2018 à 16:18, George PF a écrit : > > > > Because generator expressions are not handled in every cmake construct: > > > > > htt

[CMake] Iterating over a generator expression list, specifically $ of an OBJECT library

2018-08-28 Thread George PF
Hello, how can e.g. $ be iterated over in cmake? This builds the lib, but the loop is never run: add_library(objlib12 OBJECT lib1.c lib2.c) foreach(o IN LISTS $) message("obj ${o}") endforeach() But the $ variable is set correctly, as this builds a shared library: add_

Re: [CMake] Adding an individual define to each source file of a library

2018-08-24 Thread George PF
>> foreach(x IN LISTS mysrcs) >> message("at ${x}") >> set_property(SOURCE x APPEND PROPERTY COMPILE_DEFINITIONS >> "TEST1;TEST2;") > > almost there but you forgot to take value of 'x' > > set_property(SOURCE ${x} APPEND PROPERTY COMPILE_DEFINITIONS "TEST1;TEST2;") > > works fo

Re: [CMake] Adding an individual define to each source file of a library

2018-08-23 Thread George PF
> > However, whatever I write into 'set_property()' - no APPEND, single entry, > > not quoted - does not end up > > on the compiler command line. Is there a type mismatch which is silently > > ignored? > > > > Or you are doing this in a directory which is not the one where the target > is defined

Re: [CMake] Adding an individual define to each source file of a library

2018-08-23 Thread George PF
match which is silently ignored? As to __FILE__ or similar, the define is used as a variable, i.e. the .c suffix would have to be removed via the c processor. The current directory is also used. I think replacing .c and appending the name of the current directory will be easier in cmake. > Le je

[CMake] Adding an individual define to each source file of a library

2018-08-23 Thread George PF
Hello, following "modern cmake" conventions I want to create a library where every single file is compiled with an individual define (-D_fileX_, required for a macro which integrates code into every translation unit). So following this add_library(mylib SHARED file1.c file2.c) target_l