[cfe-commits] r158897 - /cfe/trunk/unittests/CMakeLists.txt
Chandler Carruth
chandlerc at gmail.com
Wed Jun 20 22:23:23 PDT 2012
Author: chandlerc
Date: Thu Jun 21 00:23:23 2012
New Revision: 158897
URL: http://llvm.org/viewvc/llvm-project?rev=158897&view=rev
Log:
Switch Clang to re-use the the newly factored common LLVM
implementation. Yay for '-' lines in CMake!
Modified:
cfe/trunk/unittests/CMakeLists.txt
Modified: cfe/trunk/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/CMakeLists.txt?rev=158897&r1=158896&r2=158897&view=diff
==============================================================================
--- cfe/trunk/unittests/CMakeLists.txt (original)
+++ cfe/trunk/unittests/CMakeLists.txt Thu Jun 21 00:23:23 2012
@@ -1,51 +1,14 @@
+add_custom_target(ClangUnitTests)
+set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang tests")
+
# add_clang_unittest(test_dirname file1.cpp file2.cpp)
#
# Will compile the list of files together and link against the clang
# Produces a binary named 'basename(test_dirname)'.
function(add_clang_unittest test_dirname)
- string(REGEX MATCH "([^/]+)$" test_name ${test_dirname})
- if (CMAKE_BUILD_TYPE)
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
- ${CLANG_BINARY_DIR}/unittests/${test_dirname}/${CMAKE_BUILD_TYPE})
- else()
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
- ${CLANG_BINARY_DIR}/unittests/${test_dirname})
- endif()
- if( NOT LLVM_BUILD_TESTS )
- set(EXCLUDE_FROM_ALL ON)
- endif()
-
- add_clang_executable(${test_name} ${ARGN})
- target_link_libraries(${test_name}
- gtest
- gtest_main
- LLVMSupport # gtest needs it for raw_ostream.
- )
-
- add_dependencies(ClangUnitTests ${test_name})
- set_target_properties(${test_name} PROPERTIES FOLDER "Clang tests")
+ add_unittest(ClangUnitTests ${test_dirname} ${ARGN})
endfunction()
-add_custom_target(ClangUnitTests)
-set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang tests")
-
-include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
-
-add_definitions(-DGTEST_HAS_RTTI=0)
-if( LLVM_COMPILER_IS_GCC_COMPATIBLE )
- llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")
-elseif( MSVC )
- llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-")
-endif()
-
-if (NOT LLVM_ENABLE_THREADS)
- add_definitions(-DGTEST_HAS_PTHREAD=0)
-endif()
-
-if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
- add_definitions("-Wno-variadic-macros")
-endif()
-
add_clang_unittest(BasicTests
Basic/FileManagerTest.cpp
Basic/SourceManagerTest.cpp
More information about the cfe-commits
mailing list