rttr.CMakeLists.txt 972 Bytes
Newer Older
Nicolas Carion's avatar
Nicolas Carion committed
1 2
include(ExternalProject)
ExternalProject_Add(rttr_project
Vincent Pinon's avatar
Vincent Pinon committed
3
    PREFIX rttr
4 5 6
    URL https://github.com/rttrorg/rttr/archive/v0.9.6.tar.gz
    UPDATE_COMMAND ""
    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DBUILD_EXAMPLES=OFF -DBUILD_DOCUMENTATION=OFF -DBUILD_UNIT_TESTS=OFF -DBUILD_PACKAGE=OFF -DBUILD_STATIC=ON
Nicolas Carion's avatar
Nicolas Carion committed
7
)
Nicolas Carion's avatar
Nicolas Carion committed
8

9 10
ExternalProject_Get_Property(rttr_project install_dir)
file(MAKE_DIRECTORY "${install_dir}/include")
Vincent Pinon's avatar
Vincent Pinon committed
11
file(MAKE_DIRECTORY "${install_dir}/lib")
Nicolas Carion's avatar
Nicolas Carion committed
12 13 14 15 16 17 18 19 20

add_custom_target(rttr_copy
    COMMAND ${CMAKE_COMMAND} -E copy ${install_dir}/lib*/*.a ${install_dir}/lib
)

add_dependencies(rttr_copy rttr_project)

add_library(rttr_core STATIC IMPORTED)
add_dependencies(rttr_core rttr_copy)
Vincent Pinon's avatar
Vincent Pinon committed
21 22
#file(TOUCH "${install_dir}/lib/librttr_core.a")
execute_process(COMMAND touch "${install_dir}/lib/librttr_core.a")
23 24 25
set_target_properties(rttr_core PROPERTIES
    IMPORTED_LOCATION "${install_dir}/lib/librttr_core.a"
    INTERFACE_INCLUDE_DIRECTORIES "${install_dir}/include")