void-packages/srcpkgs/tmines/patches/cmake.patch

42 lines
1.1 KiB
Diff

--- CMakeLists.txt
+++ CMakeLists.txt
@@ -58,6 +58,28 @@ add_library(iodevice_simulation src/iodevice_simulation.cpp)
find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIRS})
+include (CheckCSourceCompiles)
+
+check_c_source_compiles (
+ "#include <argp.h>
+ int main () {
+ int argc=1;
+ char *argv[]={\"test\"};
+ argp_parse(0,argc,argv,0,0,0);
+ return 0;
+ }" LIBC_HAS_ARGP
+)
+
+if (NOT LIBC_HAS_ARGP)
+ message(STATUS "libc does not have argp")
+ find_library (ARGP_LIB argp REQUIRED)
+ if (ARGP_LIB)
+ message(STATUS "Found libargp")
+ else(ARGP_LIB)
+ message(FATAL_ERROR "libargp required but not found")
+ endif(ARGP_LIB)
+endif(NOT LIBC_HAS_ARGP)
+
add_executable(tmines src/tmines.cpp)
add_subdirectory(doc)
@@ -68,6 +90,9 @@ target_link_libraries(tmines minefield)
target_link_libraries(tmines iodevice_curses)
target_link_libraries(tmines iodevice_simulation)
target_link_libraries(tmines ${CURSES_LIBRARIES})
+if (ARGP_LIB)
+ target_link_libraries (tmines ${ARGP_LIB})
+endif(ARGP_LIB)
install(TARGETS tmines DESTINATION bin)
# add manpage