admin管理员组

文章数量:1402976

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)

本文标签: Why does CMake install(TARGETS) install header files even if I don39t specify PUBLICHEADERStack Overflow