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 0899229
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 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 Expand Up @@ -273,6 +282,6 @@ if (APPLE)
set(CPACK_GENERATOR "ZIP")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/dist/osx")
set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_BINARY_DIR}/dist/osx")
endif ()
endif()
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
include (CPack)

0 comments on commit 0899229

Please sign in to comment.