Sfoglia il codice sorgente

Globally set shared library versions from root CMakeLists.txt

By the way, set SOVERSION to version major. It also fixes wiringPiDev
shared library version not correctly set.
pull/269/head
Jonathan GUILLOT 2 mesi fa
parent
commit
26c45372ca
3 ha cambiato i file con 7 aggiunte e 8 eliminazioni
  1. +5
    -0
      CMakeLists.txt
  2. +1
    -1
      devLib/CMakeLists.txt
  3. +1
    -7
      wiringPi/CMakeLists.txt

+ 5
- 0
CMakeLists.txt Vedi File

@@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.10)
project(WiringPiLib)

# Read version from version.h
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version.h" WIRINGPI_VERSION)
string(REGEX REPLACE ".*VERSION \"([0-9]+.[0-9]+)\".*" "\\1" WIRINGPI_VERSION "${WIRINGPI_VERSION}")
string(REGEX REPLACE "([0-9]+)\..*" "\\1" WIRINGPI_SOVERSION "${WIRINGPI_VERSION}")

# Include subdirectories
add_subdirectory(devLib)
add_subdirectory(gpio)


+ 1
- 1
devLib/CMakeLists.txt Vedi File

@@ -28,7 +28,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat=2 -Winline -pipe")
add_library(wiringPiDev SHARED ${SRC})

# Set the library version
set_target_properties(wiringPiDev PROPERTIES VERSION ${VERSION} SOVERSION ${WIRINGPI_SONAME_SUFFIX})
set_target_properties(wiringPiDev PROPERTIES VERSION ${WIRINGPI_VERSION} SOVERSION ${WIRINGPI_SOVERSION})

# Install headers
install(FILES ${HEADERS} DESTINATION include)


+ 1
- 7
wiringPi/CMakeLists.txt Vedi File

@@ -44,18 +44,12 @@ set(HEADERS
)
# Compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat=2 -Winline -pipe -Wformat-security")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-soname,libwiringPi.so${WIRINGPI_SONAME_SUFFIX}")

# Read version from version.h
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../version.h" VERSION)
string(REGEX REPLACE ".*VERSION \"([0-9]+.[0-9]+)\".*" "\\1" VERSION "${VERSION}")

# Add the library target
add_library(wiringPi SHARED ${SRC})

# Set the library version
set(WIRINGPI_SONAME_SUFFIX "1")
set_target_properties(wiringPi PROPERTIES VERSION ${VERSION} SOVERSION ${WIRINGPI_SONAME_SUFFIX})
set_target_properties(wiringPi PROPERTIES VERSION ${WIRINGPI_VERSION} SOVERSION ${WIRINGPI_SOVERSION})
target_include_directories(wiringPi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

# Add -lm to link with the math library


Caricamento…
Annulla
Salva