Files
clang-p2996/lldb/tools/intel-features/CMakeLists.txt
Pavel Labath f753bfeeec Fix LLVM_LINK_LLVM_DYLIB build (pr35053)
Summary:
r316368 broke this build when it introduced a reference to a pthread
function to the Utility module. This caused cmake to generate an
incorrect link line (wrong order of libs) because it did not see the
dependency from Utility to the system libraries. Instead these libraries
were being manually added to each final target.

This changes moves the dependency management from the individual targets
to the lldbUtility module, which is consistent with how llvm does it.
The final targets will pick up these libraries as they will be a part of
the link interface of the module.

Technically, some of these dependencies could go into the host module,
as that's where most of the os-specific code is, but I did not try to
investigate which ones.

Reviewers: zturner, sylvestre.ledru

Subscribers: lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D39246

llvm-svn: 316997
2017-10-31 13:23:19 +00:00

68 lines
2.2 KiB
CMake

# Flags to control each individual feature
option(LLDB_BUILD_INTEL_MPX "Enable Building of Intel(R) Memory Protection Extensions" ON)
option(LLDB_BUILD_INTEL_PT "Enable Building of Intel(R) Processor Trace Tool" OFF)
# Return if all features are OFF
if (NOT LLDB_BUILD_INTEL_MPX AND NOT LLDB_BUILD_INTEL_PT)
return()
endif()
LIST (APPEND FEATURE_LIBS "")
# Add feature specific subdirectories based on flags
if (LLDB_BUILD_INTEL_MPX AND CMAKE_SYSTEM_NAME MATCHES "Linux")
add_subdirectory(intel-mpx)
LIST (APPEND FEATURE_LIBS ${FEATURE_LIBS} lldbIntelMPX)
SET (CLI_WRAPPER_PREPROCESSORS "${CLI_WRAPPER_PREPROCESSORS} -DBUILD_INTEL_MPX")
endif()
if (LLDB_BUILD_INTEL_PT)
add_subdirectory(intel-pt)
LIST (APPEND FEATURE_LIBS ${FEATURE_LIBS} lldbIntelPT)
SET (CLI_WRAPPER_PREPROCESSORS "${CLI_WRAPPER_PREPROCESSORS} -DBUILD_INTEL_PT")
endif()
# Add python wrapper if python not disabled
if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
set(LLDB_INTEL_FEATURES_PYTHON_WRAP
${LLDB_BINARY_DIR}/tools/intel-features/scripts/IntelFeaturesPythonWrap.cpp)
set_source_files_properties(${LLDB_INTEL_FEATURES_PYTHON_WRAP}
PROPERTIES GENERATED 1)
if (CLANG_CL)
set_source_files_properties(${LLDB_INTEL_FEATURES_PYTHON_WRAP}
PROPERTIES COMPILE_FLAGS -Wno-unused-function)
endif()
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set_property(SOURCE ${LLDB_INTEL_FEATURES_PYTHON_WRAP}
APPEND_STRING PROPERTY COMPILE_FLAGS
" -Wno-sequence-point -Wno-cast-qual")
endif ()
add_subdirectory(scripts)
endif()
if (NOT CLI_WRAPPER_PREPROCESSORS)
return()
endif()
set_source_files_properties(cli-wrapper.cpp PROPERTIES
COMPILE_FLAGS ${CLI_WRAPPER_PREPROCESSORS})
add_lldb_library(lldbIntelFeatures SHARED
cli-wrapper.cpp
${LLDB_INTEL_FEATURES_PYTHON_WRAP}
LINK_LIBS
${FEATURE_LIBS}
)
# Add link dependencies for python wrapper
if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
add_dependencies(lldbIntelFeatures intel-features-swig_wrapper)
endif()
install(TARGETS lldbIntelFeatures
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})