summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-07-05 03:50:03 +0000
committerEric Fiselier <eric@efcs.ca>2017-07-05 03:50:03 +0000
commit635430895af397183fd76a95e47af776c740d571 (patch)
treeeb21e3f5419abff637d9836b98183e2d9c9d2731 /libcxx/test
parent459877388bc48de1ea96033205531810b1fac59d (diff)
downloadbcm5719-llvm-635430895af397183fd76a95e47af776c740d571.tar.gz
bcm5719-llvm-635430895af397183fd76a95e47af776c740d571.zip
Add dummy CMake target for *.pass.cpp tests when LIBCXX_CONFIGURE_IDE=ON.
In order for IDE's like CLion to correctly parse and highlight the tests it needs to know roughly how to build them. This patch adds a dummy CMake target for each/all of the .pass.cpp tests in the test suite to solve this problem. The target is only created when LIBCXX_CONFIGURE_IDE=ON, so it shouldn't affect most users. Originally I wasn't sure that this change deserved to live upstream, but it's quite frustrating to edit libc++ tests using CLion or Visual Studio without it, in particular the filesystem tests which rely heavily on macros. Even though the change should have no effect on non-IDE users/configurations I decided to commit it upstream with the hopes it will benefit somebody other than me. llvm-svn: 307118
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/CMakeLists.txt33
1 files changed, 33 insertions, 0 deletions
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 6f2eac0546f..7b8a8322a11 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -85,3 +85,36 @@ if (LIBCXX_GENERATE_COVERAGE)
set(extract_dirs "${LIBCXX_SOURCE_DIR}/include;${LIBCXX_SOURCE_DIR}/src")
setup_lcov_test_target_coverage("cxx" "${output_dir}" "${capture_dirs}" "${extract_dirs}")
endif()
+
+
+if (LIBCXX_CONFIGURE_IDE)
+ # Create dummy targets for each of the tests in the test suite, this allows
+ # IDE's such as CLion to correctly highlight the tests because it knows
+ # roughly what include paths/compile flags/macro definitions are needed.
+ include_directories(support)
+ file(GLOB_RECURSE LIBCXX_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/*.pass.cpp)
+ file(GLOB LIBCXX_TEST_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/support/*)
+ file(GLOB_RECURSE LIBCXX_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/*)
+ add_executable(libcxx_test_objects EXCLUDE_FROM_ALL
+ ${LIBCXX_TESTS} ${LIBCXX_TEST_HEADERS} ${LIBCXX_HEADERS})
+ add_dependencies(libcxx_test_objects cxx)
+
+ set(STATIC_ROOT ${LIBCXX_SOURCE_DIR}/test/std/experimental/filesystem/Inputs/static_test_env)
+ add_definitions(-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="${STATIC_ROOT}")
+
+ set(DYNAMIC_ROOT ${LIBCXX_BINARY_DIR}/test/filesystem/Output/dynamic_env)
+ add_definitions(-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="${DYNAMIC_ROOT}")
+
+ set(DYNAMIC_HELPER "python ${LIBCXX_SOURCE_DIR}/test/support/filesystem_dynamic_test_helper.py ")
+ add_definitions(-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="${DYNAMIC_HELPER}")
+
+ split_list(LIBCXX_COMPILE_FLAGS)
+ split_list(LIBCXX_LINK_FLAGS)
+
+ set_target_properties(libcxx_test_objects
+ PROPERTIES
+ COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
+ LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
+ EXCLUDE_FROM_ALL ON
+ )
+endif()
OpenPOWER on IntegriCloud