diff options
Diffstat (limited to 'cmake/modules/AddLLDB.cmake')
-rw-r--r-- | cmake/modules/AddLLDB.cmake | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake index 4c6f1efd673da..2fd8b384d9e36 100644 --- a/cmake/modules/AddLLDB.cmake +++ b/cmake/modules/AddLLDB.cmake @@ -4,7 +4,7 @@ function(add_lldb_library name) cmake_parse_arguments(PARAM "MODULE;SHARED;STATIC;OBJECT;PLUGIN" "" - "DEPENDS;LINK_LIBS;LINK_COMPONENTS" + "EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS" ${ARGN}) llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS}) list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS}) @@ -35,6 +35,8 @@ function(add_lldb_library name) endif() #PIC not needed on Win + # FIXME: Setting CMAKE_CXX_FLAGS here is a no-op, use target_compile_options + # or omit this logic instead. if (NOT WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") endif() @@ -64,11 +66,9 @@ function(add_lldb_library name) ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) endif() if (NOT CMAKE_CONFIGURATION_TYPES) - add_custom_target(install-${name} - DEPENDS ${name} - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=${name} - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") + add_llvm_install_targets(install-${name} + DEPENDS ${name} + COMPONENT ${name}) endif() endif() endif() @@ -76,10 +76,10 @@ function(add_lldb_library name) # Hack: only some LLDB libraries depend on the clang autogenerated headers, # but it is simple enough to make all of LLDB depend on some of those # headers without negatively impacting much of anything. - get_property(CLANG_TABLEGEN_TARGETS GLOBAL PROPERTY CLANG_TABLEGEN_TARGETS) - if(CLANG_TABLEGEN_TARGETS) - add_dependencies(${name} ${CLANG_TABLEGEN_TARGETS}) - endif() + add_dependencies(${name} clang-tablegen-targets) + + # Add in any extra C++ compilation flags for this library. + target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS}) set_target_properties(${name} PROPERTIES FOLDER "lldb libraries") endfunction(add_lldb_library) @@ -95,17 +95,21 @@ function(add_lldb_executable name) list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS}) add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}) - target_link_libraries(${name} ${ARG_LINK_LIBS}) + target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS}) set_target_properties(${name} PROPERTIES FOLDER "lldb executables") if(LLDB_BUILD_FRAMEWORK) if(ARG_INCLUDE_IN_FRAMEWORK) + if(NOT IOS) + set(resource_dir "/Resources") + set(resource_dots "../") + endif() string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR}) set_target_properties(${name} PROPERTIES - RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>/Resources + RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>${resource_dir} BUILD_WITH_INSTALL_RPATH On - INSTALL_RPATH "@loader_path/../../../../${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}") + INSTALL_RPATH "@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}") # For things inside the framework we don't need functional install targets # because CMake copies the resources and headers from the build directory. # But we still need this target to exist in order to use the @@ -115,6 +119,8 @@ function(add_lldb_executable name) if(ARG_GENERATE_INSTALL) add_custom_target(install-${name} DEPENDS ${name}) add_dependencies(install-liblldb ${name}) + add_custom_target(install-${name}-stripped DEPENDS ${name}) + add_dependencies(install-liblldb-stripped ${name}) endif() else() set_target_properties(${name} PROPERTIES @@ -128,11 +134,9 @@ function(add_lldb_executable name) COMPONENT ${name} RUNTIME DESTINATION bin) if (NOT CMAKE_CONFIGURATION_TYPES) - add_custom_target(install-${name} - DEPENDS ${name} - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=${name} - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") + add_llvm_install_targets(install-${name} + DEPENDS ${name} + COMPONENT ${name}) endif() endif() |