Skip to content

Commit

Permalink
CMakeLists.txt: Fix .so version naming
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
  • Loading branch information
nekromant committed Aug 15, 2016
1 parent 5e2d110 commit 2a8a196
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,23 @@ add_library(${PROJECT_NAME} SHARED
${STLINK_HEADERS} # header files for ide projects generated by cmake
${STLINK_SOURCE})
target_link_libraries(${PROJECT_NAME} ${LIBUSB_LIBRARY})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${STLINK_PACKAGE_VERSION}
VERSION ${STLINK_PACKAGE_VERSION_MAJOR})

if (WIN32 OR MSYS OR MINGW)
set(STLINK_SHARED_VERSION
${STLINK_PACKAGE_VERSION_MAJOR}.${STLINK_PACKAGE_VERSION_MINOR}
else()
set(STLINK_SHARED_VERSION
${STLINK_PACKAGE_VERSION_MAJOR}.${STLINK_PACKAGE_VERSION_MINOR}.${STLINK_PACKAGE_VERSION_PATCH})
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${STLINK_PACKAGE_VERSION_MAJOR}
VERSION ${STLINK_SHARED_VERSION})

add_library(${PROJECT_NAME}static STATIC
${STLINK_HEADERS} # header files for ide projects generated by cmake
${STLINK_SOURCE})
target_link_libraries(${PROJECT_NAME}static ${LIBUSB_LIBRARY})
SET_TARGET_PROPERTIES(${PROJECT_NAME}static PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
set_target_properties(${PROJECT_NAME}static PROPERTIES OUTPUT_NAME ${PROJECT_NAME})

if (APPLE)
find_library(ObjC objc)
Expand Down Expand Up @@ -196,10 +205,10 @@ file(GLOB STLINK_HEADERS
"${CMAKE_SOURCE_DIR}/include/stlink/*.h"
)

INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/stlink.h
install(FILES ${CMAKE_SOURCE_DIR}/include/stlink.h
DESTINATION include/${CMAKE_LIBRARY_PATH}/stlink-${STLINK_PACKAGE_VERSION}/)

INSTALL(FILES ${STLINK_HEADERS}
install(FILES ${STLINK_HEADERS}
DESTINATION include/${CMAKE_LIBRARY_PATH}/stlink-${STLINK_PACKAGE_VERSION}/stlink)

if (NOT APPLE AND NOT WIN32)
Expand All @@ -220,12 +229,12 @@ if (NOT APPLE AND NOT WIN32)
"libusb-1.0"
)

CONFIGURE_FILE(
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
)

INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION lib/${CMAKE_LIBRARY_PATH}/pkgconfig/)
endif()

Expand Down

0 comments on commit 2a8a196

Please sign in to comment.