summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/include/CMakeLists.txt40
-rw-r--r--libcxx/lib/CMakeLists.txt2
2 files changed, 27 insertions, 15 deletions
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index b98e09260ca..5bf92f016b6 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -2,6 +2,23 @@ if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
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 ${PYTHON_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(generate_config_header ALL
+ DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
+ set(generated_config_deps generate_config_header)
+endif()
+
set(LIBCXX_HEADER_PATTERN
PATTERN "*"
PATTERN "CMakeLists.txt" EXCLUDE
@@ -16,6 +33,15 @@ if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
FILES_MATCHING
${LIBCXX_HEADER_PATTERN}
)
+
+ if (LIBCXX_NEEDS_SITE_CONFIG)
+ # Copy the generated header as __config into build directory.
+ add_custom_command(
+ TARGET generate_config_header POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${LIBCXX_BINARY_DIR}/__generated_config
+ ${LLVM_BINARY_DIR}/include/c++/v1/__config)
+ endif()
endif()
if (LIBCXX_INSTALL_HEADERS)
@@ -28,20 +54,6 @@ if (LIBCXX_INSTALL_HEADERS)
)
if (LIBCXX_NEEDS_SITE_CONFIG)
- # Generate and install 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 ${PYTHON_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(generate_config_header ALL
- DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
- set(generated_config_deps generate_config_header)
# Install the generated header as __config.
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
diff --git a/libcxx/lib/CMakeLists.txt b/libcxx/lib/CMakeLists.txt
index 5d7111156c3..30fdc307507 100644
--- a/libcxx/lib/CMakeLists.txt
+++ b/libcxx/lib/CMakeLists.txt
@@ -283,7 +283,7 @@ if (LIBCXX_ENABLE_STATIC)
endif()
# Add a meta-target for both libraries.
-add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS})
+add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS} ${generated_config_deps})
if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)
OpenPOWER on IntegriCloud