From 452cfe6759f265169fbc770ee31a55c3ce633d21 Mon Sep 17 00:00:00 2001 From: Matt Angus Date: Fri, 18 Oct 2024 17:09:26 +0100 Subject: [PATCH] Modernize cmake --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ae7c5d..6da65f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,10 +7,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -add_compile_options(-fPIC -O2) - find_package(Eigen3 REQUIRED) -include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR} include) set(Bezier_SRC ${PROJECT_SOURCE_DIR}/src/utils.cpp @@ -37,10 +34,13 @@ else() endif() target_include_directories(bezier PUBLIC - $ + $ $ ) +target_link_libraries(bezier PUBLIC Eigen3::Eigen) +set_property(TARGET bezier PROPERTY POSITION_INDEPENDENT_CODE ON) + set_target_properties(bezier PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties(bezier PROPERTIES PUBLIC_HEADER "${Bezier_INC}") @@ -49,3 +49,5 @@ install(TARGETS bezier EXPORT bezier-export DESTINATION "lib" PUBLIC_HEADER DESTINATION "include/Bezier") install(EXPORT bezier-export DESTINATION "lib/cmake/Bezier" FILE BezierConfig.cmake) + +add_library(bezier::bezier ALIAS bezier)