5

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?

einpoklum
  • 118,144
  • 57
  • 340
  • 684

1 Answers1

14

Use CMAKE_ARCHIVE_OUTPUT_DIRECTORY for the static libraries.

CMAKE_LIBRARY_OUTPUT_DIRECTORY applies only to dynamic libraries.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
Velkan
  • 7,067
  • 6
  • 43
  • 87