0% found this document useful (0 votes)
23 views

RTTR CMakeLists

This document configures an external project to build and install the rttr library. It downloads the rttr source code, builds it using ExternalProject, and imports the built library as a static library target called RTTR::Core_Lib for use in the project.

Uploaded by

no contract
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

RTTR CMakeLists

This document configures an external project to build and install the rttr library. It downloads the rttr source code, builds it using ExternalProject, and imports the built library as a static library target called RTTR::Core_Lib for use in the project.

Uploaded by

no contract
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

include(ExternalProject)

ExternalProject_Add(rttr_project
PREFIX rttr
URL https://github.com/rttrorg/rttr/archive/v0.9.6.tar.gz
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_INSTALL_LIBDIR=lib
-DBUILD_EXAMPLES=OFF -DBUILD_DOCUMENTATION=OFF -DBUILD_UNIT_TESTS=OFF
-DBUILD_PACKAGE=OFF -DBUILD_STATIC=ON
)

ExternalProject_Get_Property(rttr_project install_dir)
file(MAKE_DIRECTORY "${install_dir}/include")
file(MAKE_DIRECTORY "${install_dir}/lib")
# fails on Win: execute_process(COMMAND touch "${install_dir}/lib/librttr_core.a")
# CMake >=3.12: file(TOUCH "${install_dir}/lib/librttr_core.a")
if(NOT EXISTS "${install_dir}/lib/librttr_core.a")
file(WRITE "${install_dir}/lib/librttr_core.a" "dummy file to be replaced by
build")
endif()

add_library(RTTR::Core_Lib STATIC IMPORTED)


add_dependencies(RTTR::Core_Lib rttr_project)
set_target_properties(RTTR::Core_Lib PROPERTIES
IMPORTED_LOCATION "${install_dir}/lib/librttr_core.a"
INTERFACE_INCLUDE_DIRECTORIES "${install_dir}/include")

You might also like