diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -417,20 +417,23 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) - set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) + set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}/include/c++/v1) set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) + set(LIBCXX_INSTALL_HEADER_DIR include/c++/v1) if(LIBCXX_LIBDIR_SUBDIR) string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) endif() elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) - set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) + set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}/include/c++/v1) set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX}) + set(LIBCXX_INSTALL_HEADER_DIR include/c++/v1) else() set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) - set(LIBCXX_HEADER_DIR ${CMAKE_BINARY_DIR}) + set(LIBCXX_HEADER_DIR ${CMAKE_BINARY_DIR}/include/c++/v1) set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX}) + set(LIBCXX_INSTALL_HEADER_DIR include/c++/v1) endif() file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -211,12 +211,10 @@ set(CXX_HEADER_TARGET cxx-headers) endif() if(LIBCXX_HEADER_DIR) - set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1) - set(out_files) foreach(f ${files}) set(src ${CMAKE_CURRENT_SOURCE_DIR}/${f}) - set(dst ${output_dir}/${f}) + set(dst ${LIBCXX_HEADER_DIR}/${f}) add_custom_command(OUTPUT ${dst} DEPENDS ${src} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} @@ -226,7 +224,7 @@ # Copy the generated header as __config into build directory. set(src ${LIBCXX_BINARY_DIR}/__generated_config) - set(dst ${output_dir}/__config) + set(dst ${LIBCXX_HEADER_DIR}/__config) add_custom_command(OUTPUT ${dst} DEPENDS ${src} cxx-generated-config COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} @@ -238,9 +236,9 @@ add_dependencies(${CXX_HEADER_TARGET} generate-cxx-headers ${LIBCXX_CXX_ABI_HEADER_TARGET}) # TODO: Use target_include_directories once we figure out why that breaks the runtimes build if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") - target_compile_options(${CXX_HEADER_TARGET} INTERFACE /I "${output_dir}") + target_compile_options(${CXX_HEADER_TARGET} INTERFACE /I "${LIBCXX_HEADER_DIR}") else() - target_compile_options(${CXX_HEADER_TARGET} INTERFACE -I "${output_dir}") + target_compile_options(${CXX_HEADER_TARGET} INTERFACE -I "${LIBCXX_HEADER_DIR}") endif() # Make sure the generated __config_site header is included when we build the library. @@ -257,7 +255,7 @@ foreach(file ${files}) get_filename_component(dir ${file} DIRECTORY) install(FILES ${file} - DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir} + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${LIBCXX_INSTALL_HEADER_DIR}/${dir} COMPONENT ${CXX_HEADER_TARGET} PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ )