Skip to content

Commit

Permalink
check IS_DIRECTORY LIB_INSTALL_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
slyshykO committed Mar 30, 2018
1 parent ea9d12d commit eaa83e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
18 changes: 16 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +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")
set(STLINK_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}" CACHE PATH "Target lib directory")

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}" CACHE PATH "Target lib directory")
else()
set(LIB_INSTALL_DIR "lib" CACHE PATH "Main library directory")
set(STLINK_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}" CACHE PATH "Target lib directory")
endif()

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}" CACHE PATH "Target include directory")
else()
set(INCLUDE_INSTALL_DIR "include" CACHE PATH "Main include directory")
set(STLINK_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" CACHE PATH "Target include directory")
endif()

option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF)

Expand Down
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 ${CMAKE_INSTALL_PREFIX}/include
DESTINATION ${STLINK_INCLUDE_PATH}
)
install(FILES ${STLINK_HEADERS}
DESTINATION include/${CMAKE_INSTALL_PREFIX}/include/stlink
DESTINATION ${STLINK_INCLUDE_PATH}/stlink
)

0 comments on commit eaa83e9

Please sign in to comment.