Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize cmake #53

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ project(bezier
LANGUAGES CXX
VERSION 0.3.2)

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
Expand All @@ -37,15 +30,23 @@ else()
endif()

target_include_directories(bezier PUBLIC
$<BUILD_INTERFACE:${Bezier_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(bezier PUBLIC Eigen3::Eigen)

set_target_properties(bezier PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(bezier PROPERTIES PUBLIC_HEADER "${Bezier_INC}")
set_target_properties(bezier PROPERTIES
VERSION ${PROJECT_VERSION}
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON
PUBLIC_HEADER "${Bezier_INC}"
)
target_compile_features(bezier PUBLIC cxx_std_17)

# install rules
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)