Skip to content

Commit c69344a

Browse files
authored
CMake: add version information to the library (google#161)
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.
1 parent fccae08 commit c69344a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cmake_minimum_required(VERSION 3.12)
22

3-
project(s2-geometry)
3+
project(s2-geometry
4+
VERSION 0.10.0)
45

56
include(CMakeDependentOption)
67
include(CheckCXXCompilerFlag)
@@ -214,6 +215,11 @@ target_link_libraries(
214215
# target_link_libraries(<target_name> s2)
215216
target_include_directories(s2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
216217

218+
# Add version information to the target
219+
set_target_properties(s2 PROPERTIES
220+
SOVERSION ${PROJECT_VERSION_MAJOR}
221+
VERSION ${PROJECT_VERSION})
222+
217223
# We don't need to install all headers, only those
218224
# transitively included by s2 headers we are exporting.
219225
install(FILES src/s2/_fp_contract_off.h

0 commit comments

Comments
 (0)