endif()
set(site_config_path "${LIBCXX_BINARY_DIR}/__config_site")
-if (LIBCXX_NEEDS_SITE_CONFIG)
- configure_file("include/__config_site.in"
- "${site_config_path}"
- @ONLY)
-elseif(EXISTS "${site_config_path}")
- message(STATUS "Removing stale site configuration ${site_config_path}")
- file(REMOVE "${site_config_path}")
-endif()
+configure_file("include/__config_site.in"
+ "${site_config_path}"
+ @ONLY)
function(cxx_add_config_site target)
- if (LIBCXX_NEEDS_SITE_CONFIG)
- if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
- target_compile_options(${target} PUBLIC /FI "${site_config_path}")
- else()
- target_compile_options(${target} PUBLIC -include "${site_config_path}")
- endif()
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
+ target_compile_options(${target} PUBLIC /FI "${site_config_path}")
+ else()
+ target_compile_options(${target} PUBLIC -include "${site_config_path}")
endif()
endfunction()
)
endif()
-if (LIBCXX_NEEDS_SITE_CONFIG)
- # Generate a custom __config header. The new header is created
- # by prepending __config_site to the current __config header.
- add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
- COMMAND ${Python3_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
- ${LIBCXX_BINARY_DIR}/__config_site
- ${LIBCXX_SOURCE_DIR}/include/__config
- -o ${LIBCXX_BINARY_DIR}/__generated_config
- DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
- ${LIBCXX_BINARY_DIR}/__config_site
- )
- # Add a target that executes the generation commands.
- add_custom_target(cxx-generated-config ALL
- DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
- set(generated_config_deps cxx-generated-config)
-else()
- set(files
- ${files}
- __config
- )
-endif()
+# Generate a custom __config header. The new header is created
+# by prepending __config_site to the current __config header.
+add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
+ COMMAND ${Python3_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
+ ${LIBCXX_BINARY_DIR}/__config_site
+ ${LIBCXX_SOURCE_DIR}/include/__config
+ -o ${LIBCXX_BINARY_DIR}/__generated_config
+ DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
+ ${LIBCXX_BINARY_DIR}/__config_site
+)
+# Add a target that executes the generation commands.
+add_custom_target(cxx-generated-config ALL
+ DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
+set(generated_config_deps cxx-generated-config)
# In some build configurations (like bootstrapping clang), we need to be able to
# install the libcxx headers before the CMake configuration for libcxx runs. Making
list(APPEND out_files ${dst})
endforeach()
- if (LIBCXX_NEEDS_SITE_CONFIG)
- # Copy the generated header as __config into build directory.
- set(src ${LIBCXX_BINARY_DIR}/__generated_config)
- set(dst ${output_dir}/__config)
- add_custom_command(OUTPUT ${dst}
- DEPENDS ${src} ${generated_config_deps}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
- COMMENT "Copying CXX __config")
- list(APPEND out_files ${dst})
- endif()
+ # Copy the generated header as __config into build directory.
+ set(src ${LIBCXX_BINARY_DIR}/__generated_config)
+ set(dst ${output_dir}/__config)
+ add_custom_command(OUTPUT ${dst}
+ DEPENDS ${src} ${generated_config_deps}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+ COMMENT "Copying CXX __config")
+ list(APPEND out_files ${dst})
add_custom_target(${CXX_HEADER_TARGET} ALL DEPENDS ${out_files} ${LIBCXX_CXX_ABI_HEADER_TARGET})
else()
)
endforeach()
- if (LIBCXX_NEEDS_SITE_CONFIG)
- # Install the generated header as __config.
- install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
- RENAME __config
- COMPONENT ${CXX_HEADER_TARGET})
- endif()
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT ${CXX_HEADER_TARGET})
if (NOT CMAKE_CONFIGURATION_TYPES)
add_custom_target(install-${CXX_HEADER_TARGET}