einpoklum
einpoklum

Reputation: 132128

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?

Upvotes: 5

Views: 3302

Answers (2)

Paul Paulson
Paul Paulson

Reputation: 1

For me, setting CMAKE_RUNTIME_OUTPUT_DIRECTORY worked. I have no idea why, looks like a bug.

Upvotes: 0

Velkan
Velkan

Reputation: 7592

Use CMAKE_ARCHIVE_OUTPUT_DIRECTORY for the static libraries.

CMAKE_LIBRARY_OUTPUT_DIRECTORY applies only to dynamic libraries.

Upvotes: 14

Related Questions