Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is CMake ignoring CMAKE_LIBRARY_OUTPUT_DIRECTORY?

I just read this answer, suggesting the use of CMAKE_LIBRARY_OUTPUT_DIRECTORY for setting the directory in which library targets are created. Well, this doesn't seem to work for me:

# etc. etc.
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib/")

cuda_add_library(
    mykernels
    src/kernel_wrappers/kernel1.cu
    src/kernel_wrappers/kernel2.cu)

When I make, the library libmyktkernels.a is created in the main project folder (where my CMakeFiles.txt is located), not in the lib/ subdirectory. Why is that?

like image 451
einpoklum Avatar asked Jul 18 '16 20:07

einpoklum


1 Answers

Use CMAKE_ARCHIVE_OUTPUT_DIRECTORY for the static libraries.

CMAKE_LIBRARY_OUTPUT_DIRECTORY applies only to dynamic libraries.

like image 106
Velkan Avatar answered Sep 25 '22 09:09

Velkan