Why does CMake install(TARGETS) install header files even if I don't specify PUBLIC_HEADER? - Stack Overflow

I have the following install command:install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "$<TA

I have the following install command:

install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "$<TARGET_FILE_DIR:${PROJECT_NAME}>")

Why does this command install an include directory with C++ .h header files from my dependency library libjxl?

-- Installing: C:/code/texture-streaming/decoder/bin/x64/release/include/jxl/decode_cxx.h

I was under the impression that I would have to use PUBLIC_HEADER to install header files. But I'm only asking for RUNTIME.

cmake version 3.31.6

CMakeLists.txt

cmake_minimum_required(VERSION 3.21)

project(jpegxl-decoder VERSION 0.0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(MSVC)
    add_compile_options(
        /permissive- 
        /Zc:preprocessor
    )
endif()

add_subdirectory(extern)
add_subdirectory(app)

app/CMakeLists.txt

project(app)

add_executable(${PROJECT_NAME} app.cpp)
target_link_libraries(${PROJECT_NAME} PUBLIC jxl)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "$<TARGET_FILE_DIR:${PROJECT_NAME}>")

extern/CMakeLists.txt

include(FetchContent)

set(BUILD_TESTING OFF CACHE BOOL "")
set(JPEGXL_ENABLE_TOOLS OFF CACHE BOOL "")

FetchContent_Declare(
  Libjxl
  GIT_REPOSITORY .git
  GIT_TAG        v0.11.1
)

FetchContent_MakeAvailable(Libjxl)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744091329a4557134.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信