Skip to content

Commit

Permalink
CMakeLists.txt: Clean up remaining stuff in CMakeLists.txt
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 26, 2016
1 parent 0899229 commit 4c181ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ endif()
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${STLINK_PACKAGE_VERSION_MAJOR}
VERSION ${STLINK_SHARED_VERSION})

add_library(${PROJECT_NAME}static STATIC
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})
target_link_libraries(${PROJECT_NAME}-static ${LIBUSB_LIBRARY})
set_target_properties(${PROJECT_NAME}-static PROPERTIES OUTPUT_NAME ${PROJECT_NAME})

if (APPLE)
find_library(ObjC objc)
Expand All @@ -195,7 +195,7 @@ else ()
target_link_libraries(st-util ${PROJECT_NAME})
endif ()

install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}static st-flash st-util st-info
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}-static st-flash st-util st-info
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib/${CMAKE_LIBRARY_PATH}
LIBRARY DESTINATION lib/${CMAKE_LIBRARY_PATH}
Expand Down
27 changes: 16 additions & 11 deletions doc/app-example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Warning: This example assumes that you are building on a host
# with pkg-config available (e.g. linux). The logic required to
# build under windows/mingw and/or mac was intentionally omitted
# to keep this CMakeLists as small as possible

PROJECT(st-hello)
SET(PROJECT_VERSION 0.1)
SET(SRCS main.c)
cmake_minimum_required(VERSION 2.8)

FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(STLINK REQUIRED stlink)
project(st-hello)
set(PROJECT_VERSION 0.1)
set(SRCS main.c)

SET(CMAKE_C_FLAGS " ${STLINK_CFLAGS_OTHER} -Wall -Werror")
find_package(PkgConfig)
pkg_check_modules(STLINK REQUIRED stlink)

INCLUDE_DIRECTORIES(
set(CMAKE_C_FLAGS " ${STLINK_CFLAGS_OTHER} -Wall -Werror")

include_directories(
${STLINK_INCLUDE_DIRS}
)

ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
add_executable(${PROJECT_NAME} ${SRCS})

TARGET_LINK_LIBRARIES(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}
${STLINK_LIBRARIES}
)

INSTALL(TARGETS ${PROJECT_NAME}
install(TARGETS ${PROJECT_NAME}
DESTINATION bin)

0 comments on commit 4c181ab

Please sign in to comment.