Re: [CMake] how do you allow CMAKE_CUDA_COMPILER to be optional via project LANGUAGE?

2018-08-28 Thread Quang Ha
It works perfectly - thanks! QT On Tue, 28 Aug 2018 at 12:37, Robert Maynard wrote: > The way Eric suggest with check_language is what I use when I want to > conditionally support CUDA. > > On Tue, Aug 28, 2018 at 10:28 AM Eric Noulard > wrote: > >> >> >> Le mar. 28 août 2018 à 19:07, Quang Ha

Re: [CMake] how do you allow CMAKE_CUDA_COMPILER to be optional via project LANGUAGE?

2018-08-28 Thread Robert Maynard
The way Eric suggest with check_language is what I use when I want to conditionally support CUDA. On Tue, Aug 28, 2018 at 10:28 AM Eric Noulard wrote: > > > Le mar. 28 août 2018 à 19:07, Quang Ha a écrit : > >> Hi all, >> >> So this question is again about project(foo LANGUAGES CXX CUDA). Is it

Re: [CMake] how do you allow CMAKE_CUDA_COMPILER to be optional via project LANGUAGE?

2018-08-28 Thread Eric Noulard
Le mar. 28 août 2018 à 19:07, Quang Ha a écrit : > Hi all, > > So this question is again about project(foo LANGUAGES CXX CUDA). Is it > possible to switch off CUDA if Cmake couldn't find CUDA compiler? I.e. > something along the line: > May be you can only: project(foo LANGUAGES CXX) then i

[CMake] how do you allow CMAKE_CUDA_COMPILER to be optional via project LANGUAGE?

2018-08-28 Thread Quang Ha
Hi all, So this question is again about project(foo LANGUAGES CXX CUDA). Is it possible to switch off CUDA if Cmake couldn't find CUDA compiler? I.e. something along the line: if (CUDA_FOUND) set_language_to_CUDA_and_CXX else(CUDA_FOUND) set_language_to_CXX_only endif(CUDA_FOUND) The main re

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

2018-08-28 Thread Eric Noulard
I cc the list because I think you drop it inadvertently. Le mar. 28 août 2018 à 16:18, George PF a écrit : > > Because generator expressions are not handled in every cmake construct: > > > https://cmake.org/cmake/help/v3.12/manual/cmake-generator-expressions.7.html > > > > genex is probably not

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

2018-08-28 Thread Eric Noulard
Le mar. 28 août 2018 à 15:39, George PF a écrit : > 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

[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] protobuf and imports relative to root (and --proto_path)

2018-08-28 Thread David Jobet
Hello, thanks for your answer. Here's a mockup : projectroot/lib1 projectroot/lib1/CMakeLists.txt projectroot/lib1/a.proto projectroot/lib1/b.proto projectroot/lib1/test.cc See below for the content of the files. Here's the cmake output : $ cmake --build build [0/1] Re-running CMake... -- Config

Re: [CMake] Find parent of ${PROJECT_SOURCE_DIR}

2018-08-28 Thread Petr Kmoch
Hi, can you elaborate on how the commands you've shown "don't work?" What do they do and how does it differ from what you need? Petr On Tue, 28 Aug 2018 at 08:33, Ke Gao wrote: > Hi, > > I tried different way of using GET_FILENAME_COMPONENT to find the parent > path of PROJECT_SOURCE_DIR, or a