Ticket #50547: patch-CMakeLists.diff

File patch-CMakeLists.diff, 2.3 KB (added by RJVB (René Bertin), 9 years ago)
  • CMakeLists.txt

    diff --git CMakeLists.txt CMakeLists.txt
    index e5b7482..136476b 100644
    project (ClangLazy) 
    33
    44set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
    55find_package(Clang 3.6 MODULE REQUIRED)
     6# message(STATUS "Found Clang version ${LLVM_VERSION}")
    67
    78set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
    89set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
    add_definitions (-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS) 
    1213add_definitions (-D_GNU_SOURCE -DHAVE_CLANG_CONFIG_H)
    1314
    1415set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -fno-exceptions -fno-rtti")
    15 set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
     16# set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
    1617if(NOT WIN32)
    1718    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
    1819endif()
    LIST(REMOVE_ITEM LLVM_LIBS_LIST "-lLLVMSupport") # Remove element 
    3435macro(add_clang_plugin name)
    3536    set (srcs ${ARGN})
    3637
     38    add_definitions(${LLVM_CFLAGS})
     39
    3740    include_directories(${CLANG_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})
    3841    link_directories("${LLVM_INSTALL_PREFIX}/lib" ${LLVM_LIBRARY_DIRS})
    3942
    macro(add_clang_plugin name) 
    5154    foreach (llvm_lib ${LLVM_LIBS_LIST})
    5255        target_link_libraries( ${name} ${llvm_lib} )
    5356    endforeach()
     57    target_link_libraries( ${name} "-lLLVM-${LLVM_VERSION}" )
    5458
    5559    foreach (user_lib ${USER_LIBS})
    5660        target_link_libraries( ${name} ${user_lib} )
    set_target_properties(ClangLazy PROPERTIES 
    129133
    130134include("GNUInstallDirs")
    131135install(TARGETS ClangLazy     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    132                               LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
     136                              LIBRARY DESTINATION @LLVM_INSTALL_PREFIX@/lib
    133137                              ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
    134138if(NOT WIN32)
    135139    install(FILES ${CMAKE_SOURCE_DIR}/clazy DESTINATION bin PERMISSIONS OWNER_WRITE OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE)