Skip to content

Commit

Permalink
Working Static and Dynamic artifacts, as per changes described on Sta…
Browse files Browse the repository at this point in the history
…ckOverflow.
  • Loading branch information
George Constantine authored and George Constantine committed Jul 13, 2021
1 parent 95c1b3e commit 0d0c7a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ link_directories(./lib/ ./bin)

add_executable(main-dynamic main.c)
add_dependencies(main-dynamic testlib)
target_link_libraries(main-dynamic libtestlib.a uuid -static)
target_link_libraries(main-dynamic libtestlib.a uuid)

link_libraries("-static")

add_executable(main-static main.c)
target_link_libraries(main-static PUBLIC "-static" libtestlib.a uuid)
target_link_libraries(main-static -static libtestlib.a uuid)
add_dependencies(main-static testlib)
#target_link_libraries(main-static libtestlib.a uuid -static)
set_target_properties(main-static PROPERTIES
LINK_SEARCH_START_STATIC ON
LINK_SEARCH_END_STATIC ON
)
3 changes: 2 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ cmake_minimum_required(VERSION 3.13)

project(testlibrary VERSION 1.0 DESCRIPTION "Static target issue - Library" LANGUAGES C)

add_library(testlib lib.c)
add_library(testlib STATIC lib.c)
target_link_libraries(testlib uuid)

0 comments on commit 0d0c7a9

Please sign in to comment.