Custom Directory for CMake Library Output

前端 未结 1 1162
再見小時候
再見小時候 2020-12-05 18:17

In CMake, I can\'t seem to output my library in ../out/library, only library. When I do the ../out/library path, it tells me it can\'t find the library, as if it wants to li

相关标签:
1条回答
  • 2020-12-05 18:40

    The LIBRARY_OUTPUT_DIRECTORY target property specifies the directory where library target files will be built.

    set_target_properties(JE3D PROPERTIES
             LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/out/library)
    

    If all the libraries are in one directory, I find it more convenient to set the CMAKE_LIBRARY_OUTPUT_DIRECTORY variable, which is used to initialize the LIBRARY_OUTPUT_DIRECTORY property when creating a target.

    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/out/library)
    

    Edit: Check comments if your target is a static library

    0 讨论(0)
提交回复
热议问题