diff --git a/.travis.sh b/.travis.sh index 3bab4c5..2c98a6e 100755 --- a/.travis.sh +++ b/.travis.sh @@ -33,7 +33,7 @@ elif [ "$TRAVIS_OS_NAME" == "linux" ]; then mkdir -p build/Debug && cd build/Debug echo "-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install" cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install $DIR - make && make package && cd - + make && cd - echo "--> Building Release..." mkdir -p build/Release && cd build/Release @@ -48,7 +48,7 @@ elif [ "$TRAVIS_OS_NAME" == "osx" ]; then mkdir -p build/Debug && cd build/Debug echo "-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install" cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install $DIR - make && make package && cd - + make && cd - echo "--> Building Release..." mkdir -p build/Release && cd build/Release @@ -61,7 +61,7 @@ else # local test-build mkdir -p build/Debug && cd build/Debug echo "-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install" cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install ../../ - make && make package && cd - + make && cd - echo "--> Building Release..." mkdir -p build/Release && cd build/Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 1526f31..8b3210d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,14 +18,6 @@ project(stlink C) set(PROJECT_DESCRIPTION "Open source version of the STMicroelectronics ST-LINK Tools") include(GNUInstallDirs) # Define GNU standard installation directories -set(STLINK_UDEV_RULES_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/udev/rules.d" CACHE PATH "udev rules directory") -option(STLINK_INSTALL_UDEV_RULES "Install udev rules files" ON) - -set(STLINK_MODPROBED_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/modprobe.d" CACHE PATH "modprobe.d directory") -option(STLINK_INSTALL_MODPROBE_CONF "Install modprobe conf files" ON) - -option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF) - ## Determine project version include(${CMAKE_MODULE_PATH}/get_version.cmake) @@ -271,21 +263,33 @@ else () target_link_libraries(st-util ${STLINK_LIB_SHARED} ${SSP_LIB}) endif () -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - if (STLINK_INSTALL_MODPROBE_CONF) - install(FILES etc/modprobe.d/stlink_v1.conf DESTINATION ${STLINK_MODPROBED_DIR}/) - endif () - if (STLINK_INSTALL_UDEV_RULES) - file(GLOB RULES_FILES etc/udev/rules.d/*.rules) - install(FILES ${RULES_FILES} DESTINATION ${STLINK_UDEV_RULES_DIR}/) - endif () -endif () - install(TARGETS st-flash DESTINATION bin) install(TARGETS st-info DESTINATION bin) install(TARGETS st-util DESTINATION bin) +### +# udev and modprobe.d configuration +### + +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + ## modprobe.d rules + set(STLINK_MODPROBED_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/modprobe.d" CACHE PATH "modprobe.d directory") + option(STLINK_INSTALL_MODPROBE_CONF "Install modprobe conf files" ON) + if (STLINK_INSTALL_MODPROBE_CONF) + install(FILES ${CMAKE_SOURCE_DIR}/etc/modprobe.d/stlink_v1.conf DESTINATION ${STLINK_MODPROBED_DIR}/) + endif () + + ## udev rules + set(STLINK_UDEV_RULES_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/udev/rules.d" CACHE PATH "udev rules directory") + option(STLINK_INSTALL_UDEV_RULES "Install udev rules files" ON) + if (STLINK_INSTALL_UDEV_RULES) + file(GLOB RULES_FILES ${CMAKE_SOURCE_DIR}/etc/udev/rules.d/*.rules) + install(FILES ${RULES_FILES} DESTINATION ${STLINK_UDEV_RULES_DIR}/) + endif () +endif () + + ### # Additional build tasks ### @@ -297,9 +301,11 @@ add_subdirectory(include) # contains subordinate CMakeLists for version config a add_subdirectory(src/stlink-gui) # contains subordinate CMakeLists to build GUI add_subdirectory(tests) # contains subordinate CMakeLists to build test executables -add_subdirectory(doc/man) # contains subordinate CMakeLists to generate manpages add_subdirectory(cmake/packaging) # contains subordinate CMakeLists to build packages +option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF) +add_subdirectory(doc/man) # contains subordinate CMakeLists to generate manpages + ### # Uninstall target diff --git a/Makefile b/Makefile index 3f46d29..53b0ddc 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ build/Debug: build/Release: @mkdir -p $@ - @cd $@ && cmake -DCMAKE_BUILD_TYPE=Release $(CMAKEFLAGS) -Wno-dev ../../ + @cd $@ && cmake -DCMAKE_BUILD_TYPE=Release $(CMAKEFLAGS) ../../ clean: @echo "[CLEAN]" diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt index 221c84d..3646654 100644 --- a/doc/man/CMakeLists.txt +++ b/doc/man/CMakeLists.txt @@ -30,7 +30,7 @@ foreach (manpage ${MANPAGES}) endif () if (f AND NOT WIN32) - install(FILES ${f} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1) + install(FILES ${f} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) unset(f) endif () endforeach ()