Re: [CMake] Best practice for configuration-dependent defaults?

2018-08-23 Thread Petr Kmoch
Hi Sam, it seems to me that your user-facing option is not actually Boolean, but tri-state: On vs. Off vs. Use_default. So I would represent it accordingly: present the user with a string variable (with suitable STRINGS property https://cmake.org/cmake/help/latest/prop_cache/STRINGS.html), and the

Re: [CMake] protobuf and imports relative to root (and --proto_path)

2018-08-23 Thread Alexander Neundorf
On 2018 M08 23, Thu 12:50:14 CEST David Jobet wrote: > Hello, > > I'm trying to port an existing project from premake to cmake. > I'm trying to avoid modifying the source files while doing so. > > Right now, we have several libraries (read in different directories) using > proto files with import

Re: [CMake] Problem with creating shared library

2018-08-23 Thread Sebastián Mancilla
I forgot to update the include path in the patch I sent you. It should be like this (note that it contains just "include", not "include/kImageAnnotator"): target_include_directories(kImageAnnotator PUBLIC $ $ $ ) And kImageAnnotator.h should change the exp

Re: [CMake] Copy file from Source to Build dir based on CMAKE_CFG_INTDIR

2018-08-23 Thread Michael Jackson
Hmm, That works great for MSVC compiles but not so great when I use ninja or makefiles (any of the single config generators). I was looking through the generator expressions on the Cmake doc site but didn't really come across anything that seems like it would get me what is needed. I guess I jus

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

2018-08-23 Thread Eric Noulard
Le jeu. 23 août 2018 à 19:18, George PF a écrit : > > > 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 th

Re: [CMake] Copy file from Source to Build dir based on CMAKE_CFG_INTDIR

2018-08-23 Thread Robert Maynard
You can use `file(GENERATE` and the `$` generator expression. Here is an example: https://gitlab.kitware.com/cmake/cmake/blob/v3.12.1/Tests/CudaOnly/ExportPTX/CMakeLists.txt#L13 On Thu, Aug 23, 2018 at 1:47 PM Michael Jackson wrote: > > I would like to copy some files from my source dir into my b

[CMake] Copy file from Source to Build dir based on CMAKE_CFG_INTDIR

2018-08-23 Thread Michael Jackson
I would like to copy some files from my source dir into my binary RUNTIME_DIR based on the current configuration being compiled. For generators like “makefiles” and “ninja” this is easy and straight forward. I am having an issue getting my head wrapped around how to use CMAKE_CFG_INTDIR properly

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] Build flags not applied during compiler testing on Ubuntu

2018-08-23 Thread Brad King
On 08/22/2018 04:23 PM, Richard Shaw wrote: > Here's the contents: > > set(CMAKE_EXECUTABLE_SUFFIX_C ".elf") > set(CMAKE_EXECUTABLE_SUFFIX_CXX ".elf") > set(CMAKE_EXECUTABLE_SUFFIX_ASM ".elf") [snip] On 08/22/2018 05:05 PM, Richard Shaw wrote: > One step closer: > ...me forcing the binary output to

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

2018-08-23 Thread Eric Noulard
Le jeu. 23 août 2018 à 18:31, George PF a écrit : > Thank you for the precise pointers, I added to the same CMakeLists.txt: > > get_property(mysrcs TARGET mylib PROPERTY SOURCES) > > foreach(x IN LISTS mysrcs) > message("at ${x}") > set_property(SOURCE x APPEND PROPERTY CO

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

2018-08-23 Thread George PF
Thank you for the precise pointers, I added to the same CMakeLists.txt: get_property(mysrcs TARGET mylib PROPERTY SOURCES) foreach(x IN LISTS mysrcs) message("at ${x}") set_property(SOURCE x APPEND PROPERTY COMPILE_DEFINITIONS "TEST1;TEST2;") #set_source_files_pr

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

2018-08-23 Thread Eric Noulard
Le jeu. 23 août 2018 à 13:02, George PF a écrit : > 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 th

Re: [CMake] Android project with CMake and Visual Studio and without Nsight Tegra

2018-08-23 Thread Roman Wüger
No one? > Am 15.08.2018 um 17:01 schrieb Roman Wüger : > > Why isn‘t it enough to install the SDK and NDK? > > Regards > Roman > >> Am 09.08.2018 um 09:02 schrieb Roman Wüger : >> >> Hello, >> >> is it somehow possible to build an Android project with CMake and Visual >> Studio without the N

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

2018-08-23 Thread Raphael Grimm
I am using it for passing meta-data between my projects. Is there a way to do this with cmake 3.10.2 (I am on Ubuntu 18)? On 22.08.2018 16:03, Marc CHEVRIER wrote: 'define_property' is nearly useless except for documentation. Export of custom properties is managed through target property 'EX

[CMake] protobuf and imports relative to root (and --proto_path)

2018-08-23 Thread David Jobet
Hello, I'm trying to port an existing project from premake to cmake. I'm trying to avoid modifying the source files while doing so. Right now, we have several libraries (read in different directories) using proto files with imports between them. All imports are made relative to the root of the pr

[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

Re: [CMake] Is cmake failed with any Error message?

2018-08-23 Thread Petr Kmoch
Hi Maomao. The output includes this line: Configuring incomplete, errors occurred! This means that indeed, CMake has failed to configure the project. Which means no Makefile (or oher buildsystem) was generated and therefore the project cannot be built. A successful run of CMake ends with outp