make: use eval function with templates
[netsniff-ng.git] / src / curvetun / CMakeLists.txt
blob54ba5665ef56b3645baf998ae899773e87d6032e
1 project(curvetun C)
3 set(BUILD_STRING "generic")
5 find_package(Threads)
6 include(nacl_path.cmake OPTIONAL)
7 find_package(LibNaCl)
8 include(Pod2Man)
10 if(NACL_FOUND AND CMAKE_THREAD_LIBS_INIT)
11   add_executable(
12     ${PROJECT_NAME}
13     ../xmalloc.c
14     ../xio.c
15     ../xutils.c
16     ../stun.c
17     ../mtrand.c
18     ../patricia.c
19     ../trie.c
20     ../hash.c
21     ../curve.c
22     ../ct_cpusched.c
23     ../ct_usermgmt.c
24     ../ct_servmgmt.c
25     ../ct_server.c
26     ../ct_client.c
27     ../curvetun.c
28   )
30   add_definitions(
31     -DPROGNAME_STRING="${PROJECT_NAME}"
32     -DVERSION_STRING="${VERSION}"
33     -DBUILD_STRING="${BUILD_STRING}"
34   )
36   include_directories(
37     ${NACL_INCLUDE_DIR}
38   )
40   target_link_libraries(
41     ${PROJECT_NAME}
42     ${NACL_LIBRARY}
43     ${CMAKE_THREAD_LIBS_INIT}
44   )
46   pod2man(
47     ${CMAKE_SOURCE_DIR}/../Documentation/Manpages/${PROJECT_NAME}.8
48     ${PROJECT_NAME} 8
49   )
51   install(
52     TARGETS ${PROJECT_NAME}
53     DESTINATION ${EXECUTABLE_INSTALL_PATH}
54   )
56   install(
57     FILES ../../Documentation/Curvetun
58     DESTINATION ${DOC_INSTALL_PATH}
59   )
60 else(NACL_FOUND AND CMAKE_THREAD_LIBS_INIT)
61   if(NOT NACL_FOUND)
62     message("NaCl was not found. Check if NACL_INCLUDE_DIR and NACL_LIB_DIR "
63             "are properly set in nacl_path.cmake. Skipping ${PROJECT_NAME} "
64             "build.")
65   endif(NOT NACL_FOUND)
67   if(NOT CMAKE_THREAD_LIBS_INIT)
68     message("libpthread is missing on target. Skipping ${PROJECT_NAME} build.")
69   endif(NOT CMAKE_THREAD_LIBS_INIT)
71 endif(NACL_FOUND AND CMAKE_THREAD_LIBS_INIT)