Skip to content

Commit 802d7be

Browse files
committed
fix
1 parent e0aa3c7 commit 802d7be

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

cpp-terminal/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
include(GNUInstallDirs)
2-
32
add_subdirectory(private)
43

54
set(CPP_TERMINAL_PUBLIC_HEADERS

cpp-terminal/private/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
2-
find_package(Threads)
2+
find_package(Threads REQUIRED MODULE)
33

44
# configure version information
55
configure_file(version.cpp.in version.cpp)

examples/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,20 @@ target_compile_options(
88
)
99
add_library(Warnings::Examples ALIAS ExamplesWarnings)
1010

11+
find_package(Threads MODULE REQUIRED)
12+
1113
# Create an example
1214
function(cppterminal_example)
13-
cmake_parse_arguments(ARG "WIN32" "SOURCE" "" ${ARGN})
15+
cmake_parse_arguments(ARG "WIN32" "SOURCE" "LIBRARIES" ${ARGN})
1416
if(ARG_WIN32)
1517
add_executable("${ARG_SOURCE}" WIN32 "${ARG_SOURCE}.cpp")
1618
else()
1719
add_executable("${ARG_SOURCE}" "${ARG_SOURCE}.cpp")
1820
endif()
1921
target_link_libraries("${ARG_SOURCE}" PRIVATE cpp-terminal::cpp-terminal Warnings::Warnings Warnings::Examples)
22+
if(DEFINED ARG_LIBRARIES)
23+
target_link_libraries("${ARG_SOURCE}" PRIVATE "${ARG_LIBRARIES}")
24+
endif()
2025
if(CPPTERMINAL_ENABLE_INSTALL)
2126
install(TARGETS "${ARG_SOURCE}" RUNTIME DESTINATION bin/examples)
2227
endif()
@@ -27,7 +32,7 @@ cppterminal_example(SOURCE cin_cooked)
2732
cppterminal_example(SOURCE cin_raw)
2833
cppterminal_example(SOURCE colors)
2934
cppterminal_example(SOURCE cout)
30-
cppterminal_example(SOURCE events)
35+
cppterminal_example(SOURCE events LIBRARIES Threads::Threads)
3136
cppterminal_example(SOURCE keys)
3237
cppterminal_example(SOURCE kilo)
3338
cppterminal_example(SOURCE menu)

0 commit comments

Comments
 (0)