Skip to content

Commit

Permalink
fix #700 (#701)
Browse files Browse the repository at this point in the history
* first try to fix #700
Use CMAKE_INSTALL_PREFIX for install paths

* check IS_DIRECTORY LIB_INSTALL_DIR
* fix incorrect VAR usage in condition
* changed debian/rules according to @bluca patch
  • Loading branch information
slyshykO authored and xor-gate committed Apr 16, 2018
1 parent d76e3c7 commit 8893533
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
18 changes: 11 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ project(stlink C)
set(PROJECT_DESCRIPTION "Open source version of the STMicroelectronics Stlink Tools")
set(STLINK_UDEV_RULES_DIR "/etc/udev/rules.d" CACHE PATH "Udev rules directory")
set(STLINK_MODPROBED_DIR "/etc/modprobe.d" CACHE PATH "modprobe.d directory")
set(LIB_INSTALL_DIR "lib" CACHE PATH "Main library directory")

if(IS_DIRECTORY CMAKE_LIBRARY_PATH)
if( IS_DIRECTORY ${LIB_INSTALL_DIR})
set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR} CACHE PATH "Main library directory")
set(STLINK_LIBRARY_PATH "${LIB_INSTALL_DIR}")
else()
set(CMAKE_LIBRARY_PATH "lib")
set(LIB_INSTALL_DIR "lib" CACHE PATH "Main library directory")
set(STLINK_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}" )
endif()

if (WIN32)
set(STLINK_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} CACHE PATH "Target lib directory")
if( IS_DIRECTORY ${INCLUDE_INSTALL_DIR})
set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR} CACHE PATH "Main include directory")
set(STLINK_INCLUDE_PATH "${INCLUDE_INSTALL_DIR}" )
else()
set(STLINK_LIBRARY_PATH "${LIB_INSTALL_DIR}/${CMAKE_LIBRARY_PATH}" CACHE PATH "Target lib directory")
endif(WIN32)
set(INCLUDE_INSTALL_DIR "include" CACHE PATH "Main include directory")
set(STLINK_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}")
endif()

option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF)

Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all

override_dh_auto_configure:
dh_auto_configure -- \
-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \
-DLIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
-DSTLINK_UDEV_RULES_DIR='/lib/udev/rules.d'
4 changes: 2 additions & 2 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ file(GLOB STLINK_HEADERS
"${CMAKE_BINARY_DIR}/include/stlink/*.h"
)
install(FILES ${CMAKE_SOURCE_DIR}/include/stlink.h
DESTINATION include/${CMAKE_LIBRARY_PATH}
DESTINATION ${STLINK_INCLUDE_PATH}
)
install(FILES ${STLINK_HEADERS}
DESTINATION include/${CMAKE_LIBRARY_PATH}/stlink
DESTINATION ${STLINK_INCLUDE_PATH}/stlink
)

0 comments on commit 8893533

Please sign in to comment.