Skip to content

Commit

Permalink
CMake: infrastructure for shared sources #1121
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Nov 17, 2020
1 parent 1f77571 commit e6e4f46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND qrcodegen)
endif()
find_library(LIBRT rt)

# objects directly included into target objects (i.e. not exported by library)
file(GLOB SHAREDSRCS CONFIGURE_DEPENDS src/shared/*.c)

# libnotcurses (core shared library, core static library)
file(GLOB NCSRCS CONFIGURE_DEPENDS src/lib/*.c src/lib/*.cpp)
file(GLOB NCSRCS CONFIGURE_DEPENDS src/lib/*.c src/lib/*.cpp ${SHAREDSRCS})
add_library(notcurses SHARED ${NCSRCS})
if(${USE_STATIC})
add_library(notcurses-static STATIC ${NCSRCS})
Expand Down Expand Up @@ -360,7 +363,7 @@ install(FILES ${NCPP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ncpp)
install(FILES ${NCPP_INTERNAL_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ncpp/internal)

# notcurses-demo
file(GLOB DEMOSRCS CONFIGURE_DEPENDS src/demo/*.c)
file(GLOB DEMOSRCS CONFIGURE_DEPENDS src/demo/*.c ${SHAREDSRCS})
add_executable(notcurses-demo ${DEMOSRCS})
target_compile_definitions(notcurses-demo
PRIVATE
Expand Down Expand Up @@ -388,7 +391,7 @@ if(USE_POC)
file(GLOB POCSRCS CONFIGURE_DEPENDS src/poc/*.c src/poc/*.cpp)
foreach(f ${POCSRCS})
get_filename_component(fe "${f}" NAME_WE)
add_executable(${fe} ${f})
add_executable(${fe} ${f} ${SHAREDSRCS})
target_include_directories(${fe}
PRIVATE include "${TERMINFO_INCLUDE_DIRS}"
"${PROJECT_BINARY_DIR}/include"
Expand Down
1 change: 1 addition & 0 deletions src/shared/clock.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "version.h"

0 comments on commit e6e4f46

Please sign in to comment.