File: CMakeLists.txt

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (35 lines) | stat: -rw-r--r-- 1,250 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
set(test_name CommandLineInitTests)
set(test_suite UnitTests)

# We don't call add_llvm_unittest() here, because the function automatically
# links the test against TestMain.cpp, in which main() function calls
# llvm::cl::ParseCommandLineOptions, and it makes the test always pass.
# The following code mainly comes from `add_unittest` in
# llvm/cmake/modules/AddLLVM.cmake, except that gtest_main is excluded from
# target_link_libraries to prevent the test linking against TestMain.cpp.

if (NOT LLVM_BUILD_TESTS)
  set(EXCLUDE_FROM_ALL ON)
endif()

if (SUPPORTS_VARIADIC_MACROS_FLAG)
  list(APPEND LLVM_COMPILE_FLAGS "-Wno-variadic-macros")
endif ()
# Some parts of gtest rely on this GNU extension, don't warn on it.
if(SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG)
  list(APPEND LLVM_COMPILE_FLAGS "-Wno-gnu-zero-variadic-macro-arguments")
endif()

list(APPEND LLVM_LINK_COMPONENTS Support)

add_llvm_executable(${test_name}
  IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH
  CommandLineInitTest.cpp)

target_link_libraries(${test_name} PRIVATE llvm_gtest)

add_dependencies(${test_suite} ${test_name})

set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
set_output_directory(${test_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir})