Skip to content

Commit

Permalink
Modernize cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
mattangus committed Oct 17, 2024
1 parent d4db0e2 commit 0b4d976
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/bezier.cpp
Expand All @@ -34,11 +31,15 @@ else()
add_library(bezier STATIC ${Bezier_SRC})
endif()


target_include_directories(bezier PUBLIC
$<BUILD_INTERFACE:${Bezier_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

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}")

Expand All @@ -47,3 +48,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)

0 comments on commit 0b4d976

Please sign in to comment.