[CMake] cmake - two targets that depends on single static library that should be compiled based on the target that is being built

2019-07-02 Thread ugesh reddy
Hello, I couldn't find any solution's for this problem even after posting the question on Reddit/stack overflow, so I am posting it here. My question is as follows: I have a static library and two target executables, let's call them **libA**, **EXE1**, **EXE2**. **libA** has pre-processor macro

Re: [CMake] cmake - two targets that depends on single static library that should be compiled based on the target that is being built

2019-07-02 Thread Kyle Edwards
On Tue, 2019-07-02 at 14:18 +0200, ugesh reddy wrote: > Hello, > > I couldn't find any solution's for this problem even after posting > the question on Reddit/stack overflow, so I am posting it here. > > My question is as follows: > > I have a static library and two target executables, let's cal

Re: [CMake] cmake - two targets that depends on single static library that should be compiled based on the target that is being built

2019-07-02 Thread ugesh reddy
Ok, seems there is no other way then. Thank you for the clarification. On Tue, Jul 2, 2019 at 3:44 PM Kyle Edwards wrote: > On Tue, 2019-07-02 at 14:18 +0200, ugesh reddy wrote: > > Hello, > > > > I couldn't find any solution's for this problem even after posting > > the question on Reddit/stack

[CMake] Combining two static libraries into one

2019-07-02 Thread vinay kumar Kotegowder
Hi Everyone, I have a requirement on combining two static library into one. Can anyone tell me how can I achieve this? Regards, Vinay -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to

Re: [CMake] Combining two static libraries into one

2019-07-02 Thread Kyle Edwards
On Tue, 2019-07-02 at 20:44 +0530, vinay kumar Kotegowder wrote: > Hi Everyone, > > I have a requirement on combining two static library into one. > Can anyone tell me how can I achieve this? > > Regards, > Vinay If you just want to make a library such that linking against that library links aga

Re: [CMake] Combining two static libraries into one

2019-07-02 Thread Cristian Adam
On Tue, Jul 2, 2019 at 5:14 PM vinay kumar Kotegowder < vinay.kotegow...@gmail.com> wrote: > Hi Everyone, > > I have a requirement on combining two static library into one. > Can anyone tell me how can I achieve this? > > Regards, > Vinay > > If your compiler is GCC or Visual C++, you can use this

[CMake] compiling .cpp/.cxx with CUDA compiler

2019-07-02 Thread Kai Germaschewski
For background, a bunch of projects help writing portable C++ code that can be compiled into CUDA device code as one option, e.g. hemi, kokkos, RAJA ( https://devblogs.nvidia.com/simple-portable-parallel-c-hemi-2/). As a consequence, if available those source files need to be compiled with the CUDA

Re: [CMake] compiling .cpp/.cxx with CUDA compiler

2019-07-02 Thread Robert Maynard
In general I go with the source property approach, since you can pass it a collection of files to be marked as CUDA. If you are aware of when all sources have been added to a target you can easily mark them all as cuda with: get_target_property(source_files SOURCES) set_source_files_properties(${

Re: [CMake] compiling .cpp/.cxx with CUDA compiler

2019-07-02 Thread Dmitry Mikushin
Compiling C++ code with CUDA compiler practically means only to implicitly include a bunch of CUDA-specific headers like cuda_runtime_api.h. Other than that, it's the same as compiling with the host C++ compiler. Thus, you can get the desired behavior by explicitly including those headers in case o

Re: [CMake] compiling .cpp/.cxx with CUDA compiler

2019-07-02 Thread Kai Germaschewski
On Tue, Jul 2, 2019 at 2:48 PM Robert Maynard wrote: > get_target_property(source_files SOURCES) > set_source_files_properties(${source_files} PROPERTIES LANGUAGE CUDA) > Thanks, that'll work for the time being, I can put this into a function/macro and it'll look alright. --Kai -- Powered by

[CMake] Moving build artifacts to custom directory

2019-07-02 Thread vinay kumar Kotegowder
Hi Everyone, How do I move the build artifacts(ELFs, Static libraries, custom intermediate files) to custom folder at the build of "cmake --build ." ? Also does "cmake --build . -- clean" takes care of cleaning these build artifacts from the directory to which they previously moved? Regards, Vin