kopia lustrzana https://github.com/stlink-org/stlink
check if app's need for libssp.
rodzic
6dac7a3f88
commit
784fdde0ae
|
@ -57,6 +57,15 @@ if (STLINK_HAVE_UNISTD_H)
|
|||
add_definitions(-DSTLINK_HAVE_UNISTD_H)
|
||||
endif()
|
||||
|
||||
include(CheckLibraryExists)
|
||||
CHECK_LIBRARY_EXISTS(ssp __stack_chk_fail "" _stack_chk_fail_exists)
|
||||
|
||||
if(_stack_chk_fail_exists)
|
||||
set(SSP_LIB ssp)
|
||||
else()
|
||||
set(SSP_LIB "")
|
||||
endif()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "")
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
endif()
|
||||
|
@ -135,13 +144,13 @@ if (APPLE)
|
|||
find_library(ObjC objc)
|
||||
find_library(CoreFoundation CoreFoundation)
|
||||
find_library(IOKit IOKit)
|
||||
target_link_libraries(${STLINK_LIB_SHARED} ${CoreFoundation} ${IOKit} ${ObjC})
|
||||
target_link_libraries(${STLINK_LIB_SHARED} ${CoreFoundation} ${IOKit} ${ObjC} ${SSP_LIB})
|
||||
endif()
|
||||
|
||||
if (WIN32 OR MSYS OR MINGW)
|
||||
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} wsock32 ws2_32)
|
||||
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} wsock32 ws2_32 ${SSP_LIB})
|
||||
else()
|
||||
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY})
|
||||
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} ${SSP_LIB})
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -164,13 +173,13 @@ if (APPLE)
|
|||
find_library(ObjC objc)
|
||||
find_library(CoreFoundation CoreFoundation)
|
||||
find_library(IOKit IOKit)
|
||||
target_link_libraries(${STLINK_LIB_STATIC} ${CoreFoundation} ${IOKit} ${ObjC})
|
||||
target_link_libraries(${STLINK_LIB_STATIC} ${CoreFoundation} ${IOKit} ${ObjC} ${SSP_LIB})
|
||||
endif()
|
||||
|
||||
if (WIN32 OR MSYS OR MINGW)
|
||||
target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} wsock32 ws2_32)
|
||||
target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} wsock32 ws2_32 ${SSP_LIB})
|
||||
else()
|
||||
target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY})
|
||||
target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} ${SSP_LIB})
|
||||
endif()
|
||||
|
||||
set_target_properties(${STLINK_LIB_STATIC} PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
|
||||
|
@ -186,16 +195,16 @@ endif()
|
|||
###
|
||||
add_executable(st-flash src/tools/flash.c src/tools/flash_opts.c)
|
||||
if (WIN32 OR APPLE)
|
||||
target_link_libraries(st-flash ${STLINK_LIB_STATIC})
|
||||
target_link_libraries(st-flash ${STLINK_LIB_STATIC} ${SSP_LIB})
|
||||
else()
|
||||
target_link_libraries(st-flash ${STLINK_LIB_SHARED})
|
||||
target_link_libraries(st-flash ${STLINK_LIB_SHARED} ${SSP_LIB})
|
||||
endif()
|
||||
|
||||
add_executable(st-info src/tools/info.c)
|
||||
if (WIN32 OR APPLE)
|
||||
target_link_libraries(st-info ${STLINK_LIB_STATIC})
|
||||
target_link_libraries(st-info ${STLINK_LIB_STATIC} ${SSP_LIB})
|
||||
else()
|
||||
target_link_libraries(st-info ${STLINK_LIB_SHARED})
|
||||
target_link_libraries(st-info ${STLINK_LIB_SHARED} ${SSP_LIB})
|
||||
endif()
|
||||
|
||||
install(TARGETS st-flash st-info
|
||||
|
|
|
@ -14,9 +14,9 @@ endif()
|
|||
add_executable(st-util ${STUTIL_SOURCE})
|
||||
|
||||
if (WIN32 OR APPLE)
|
||||
target_link_libraries(st-util ${STLINK_LIB_STATIC})
|
||||
target_link_libraries(st-util ${STLINK_LIB_STATIC} ${SSP_LIB})
|
||||
else()
|
||||
target_link_libraries(st-util ${STLINK_LIB_SHARED})
|
||||
target_link_libraries(st-util ${STLINK_LIB_SHARED} ${SSP_LIB})
|
||||
endif()
|
||||
|
||||
install(TARGETS st-util
|
||||
|
|
|
@ -10,13 +10,13 @@ include_directories(SYSTEM ${gtk_INCLUDE_DIRS})
|
|||
add_executable(stlink-gui-local ${GUI_SOURCES})
|
||||
set_target_properties(stlink-gui-local PROPERTIES
|
||||
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
target_link_libraries(stlink-gui-local ${STLINK_LIB_STATIC} ${gtk_LDFLAGS})
|
||||
target_link_libraries(stlink-gui-local ${STLINK_LIB_STATIC} ${gtk_LDFLAGS} ${SSP_LIB})
|
||||
|
||||
|
||||
add_executable(stlink-gui ${GUI_SOURCES})
|
||||
set_target_properties(stlink-gui PROPERTIES
|
||||
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_INSTALL_PREFIX}/${INSTALLED_UI_DIR}")
|
||||
target_link_libraries(stlink-gui ${STLINK_LIB_STATIC} ${gtk_LDFLAGS})
|
||||
target_link_libraries(stlink-gui ${STLINK_LIB_STATIC} ${gtk_LDFLAGS} ${SSP_LIB})
|
||||
|
||||
install(TARGETS stlink-gui
|
||||
RUNTIME DESTINATION bin)
|
||||
|
|
|
@ -6,10 +6,10 @@ set(TESTS
|
|||
foreach(test ${TESTS})
|
||||
add_executable(${test} ${test}.c)
|
||||
add_dependencies(${test} ${STLINK_LIB_STATIC})
|
||||
target_link_libraries(${test} ${STLINK_LIB_STATIC})
|
||||
target_link_libraries(${test} ${STLINK_LIB_STATIC} ${SSP_LIB})
|
||||
add_test(${test} ${CMAKE_CURRENT_BINARY_DIR}/${test})
|
||||
endforeach()
|
||||
|
||||
add_executable(flash flash.c "${CMAKE_SOURCE_DIR}/src/tools/flash_opts.c")
|
||||
target_link_libraries(flash ${STLINK_LIB_STATIC})
|
||||
target_link_libraries(flash ${STLINK_LIB_STATIC} ${SSP_LIB})
|
||||
add_test(flash ${CMAKE_CURRENT_BINARY_DIR}/flash)
|
||||
|
|
Ładowanie…
Reference in New Issue