Skip to content

Commit

Permalink
Non-working static cmake with lib
Browse files Browse the repository at this point in the history
  • Loading branch information
George Constantine authored and George Constantine committed Jul 12, 2021
1 parent 6f3a138 commit 95c1b3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
15 changes: 9 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ cmake_minimum_required(VERSION 3.13)

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

add_subdirectory(lib)

add_subdirectory(lib ./bin)
link_directories(./lib/ ./bin)

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

link_libraries("-static")

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

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

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

0 comments on commit 95c1b3e

Please sign in to comment.