Skip to content

Commit

Permalink
CMake: add version information to the library (google#161)
Browse files Browse the repository at this point in the history
On Linux systems, libraries need to be installed with attached version
information so other packages can depend on specific versions and make
sure they don't compile against a version they're not compatible with

This change installs libs2.so.0.10.0 with appropriate
symlinks as libs2.so.0 and libs2.so.

Do note that for new future versions, the version in CMakeLists.txt will have
to be updated as well.
  • Loading branch information
PureTryOut authored Dec 14, 2020
1 parent fccae08 commit c69344a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.12)

project(s2-geometry)
project(s2-geometry
VERSION 0.10.0)

include(CMakeDependentOption)
include(CheckCXXCompilerFlag)
Expand Down Expand Up @@ -214,6 +215,11 @@ target_link_libraries(
# target_link_libraries(<target_name> s2)
target_include_directories(s2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)

# Add version information to the target
set_target_properties(s2 PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION})

# We don't need to install all headers, only those
# transitively included by s2 headers we are exporting.
install(FILES src/s2/_fp_contract_off.h
Expand Down

0 comments on commit c69344a

Please sign in to comment.