066e659d6e
* rocprofiler-sdk-codeobj: use pkg-config to find libdw / libelf
The current version of source/lib/rocprofiler-sdk-codeobj/CMakeLists.txt
adds -ldw and -lelf to target_link_libraries. However, on a system where
libdw-dev / libelf-dev is missing, the cmake configuration phase will
run properly and a compile time error will eventually be raised.
This patch changes the CMakelists.txt to search for libelf libdw and
configures the target as needed. Systems missing the required support
should report an error when running cmake instead of in the middle of
the compilation.
* Use INTERFACE targets
* Resolve issues with Findlib{dw,elf}
---------
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
42 γραμμές
1.6 KiB
CMake
42 γραμμές
1.6 KiB
CMake
#
|
|
# ROCTx Marker Library
|
|
#
|
|
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "roctx")
|
|
|
|
find_package(rocprofiler-register REQUIRED)
|
|
|
|
add_library(rocprofiler-sdk-roctx-shared-library SHARED)
|
|
add_library(rocprofiler::rocprofiler-sdk-roctx-shared-library ALIAS
|
|
rocprofiler-sdk-roctx-shared-library)
|
|
add_library(rocprofiler-sdk-roctx::rocprofiler-sdk-roctx-shared-library ALIAS
|
|
rocprofiler-sdk-roctx-shared-library)
|
|
|
|
target_sources(rocprofiler-sdk-roctx-shared-library PRIVATE roctx.cpp)
|
|
target_include_directories(
|
|
rocprofiler-sdk-roctx-shared-library
|
|
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/source/include>
|
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/include>
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
target_link_libraries(
|
|
rocprofiler-sdk-roctx-shared-library
|
|
PRIVATE rocprofiler-register::rocprofiler-register rocprofiler::rocprofiler-headers
|
|
rocprofiler::rocprofiler-build-flags rocprofiler::rocprofiler-memcheck
|
|
rocprofiler::rocprofiler-common-library)
|
|
|
|
set_target_properties(
|
|
rocprofiler-sdk-roctx-shared-library
|
|
PROPERTIES OUTPUT_NAME rocprofiler-sdk-roctx
|
|
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
|
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
|
VERSION ${PROJECT_VERSION}
|
|
SKIP_BUILD_RPATH OFF
|
|
BUILD_RPATH "\$ORIGIN"
|
|
INSTALL_RPATH "\$ORIGIN"
|
|
DEFINE_SYMBOL rocprofiler_EXPORTS)
|
|
|
|
install(
|
|
TARGETS rocprofiler-sdk-roctx-shared-library
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT roctx
|
|
EXPORT rocprofiler-sdk-roctx-targets)
|