• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(plugin_sources
2  ChromeClassTester.cpp
3  FindBadConstructsAction.cpp
4  FindBadConstructsConsumer.cpp
5  CheckIPCVisitor.cpp)
6
7if(WIN32)
8  # Clang doesn't support loadable modules on Windows. Unfortunately, building
9  # the plugin as a static library and linking clang against it doesn't work.
10  # Since clang doesn't reference any symbols in our static library, the linker
11  # strips it out completely.
12  # Instead, we rely on the fact that the SOURCES property of a target is no
13  # read-only after CMake 3.1 and use it to compile the plugin directly into
14  # clang...
15  cmake_minimum_required(VERSION 3.1)
16  # Paths must be absolute, since we're modifying a target in another directory.
17  set(absolute_sources "")
18  foreach(source ${plugin_sources})
19    list(APPEND absolute_sources ${CMAKE_CURRENT_SOURCE_DIR}/${source})
20  endforeach()
21  set_property(TARGET clang APPEND PROPERTY SOURCES ${absolute_sources})
22
23  cr_add_test(plugins_test
24    python tests/test.py
25    ${CMAKE_BINARY_DIR}/bin/clang
26    )
27else()
28  add_llvm_loadable_module(libFindBadConstructs ${plugin_sources})
29  add_dependencies(libFindBadConstructs clang)
30
31  cr_install(TARGETS libFindBadConstructs LIBRARY DESTINATION lib)
32
33  cr_add_test(plugins_test
34    python tests/test.py
35    ${CMAKE_BINARY_DIR}/bin/clang
36    $<TARGET_FILE:libFindBadConstructs>
37    )
38endif()
39