chiark / gitweb /
Import curl_7.56.1.orig.tar.gz
[curl.git] / src / CMakeLists.txt
1 set(EXE_NAME curl)
2
3 if(USE_MANUAL)
4   # Use the C locale to ensure that only ASCII characters appear in the
5   # embedded text. NROFF and MANOPT are set in the parent CMakeLists.txt
6   add_custom_command(
7     OUTPUT tool_hugehelp.c
8     COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_setup.h\"" > tool_hugehelp.c
9     COMMAND ${CMAKE_COMMAND} -E echo "#ifndef HAVE_LIBZ" >> tool_hugehelp.c
10     COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
11             "${CURL_BINARY_DIR}/docs/curl.1" |
12             "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl"
13             "${CURL_SOURCE_DIR}/docs/MANUAL" >> tool_hugehelp.c
14     COMMAND ${CMAKE_COMMAND} -E echo "#else" >> tool_hugehelp.c
15     COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
16             "${CURL_BINARY_DIR}/docs/curl.1" |
17             "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c
18             "${CURL_SOURCE_DIR}/docs/MANUAL" >> tool_hugehelp.c
19     COMMAND ${CMAKE_COMMAND} -E echo "#endif /* HAVE_LIBZ */" >> tool_hugehelp.c
20     DEPENDS
21       "${CURL_SOURCE_DIR}/docs/MANUAL"
22       generate-curl.1
23       "${CURL_BINARY_DIR}/docs/curl.1"
24       "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl"
25       "${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
26     VERBATIM)
27 else()
28   add_custom_command(
29     OUTPUT tool_hugehelp.c
30     COMMAND ${CMAKE_COMMAND} -E echo "/* built-in manual is disabled, blank function */" > tool_hugehelp.c
31     COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_hugehelp.h\"" >> tool_hugehelp.c
32     COMMAND ${CMAKE_COMMAND} -E echo "void hugehelp(void) {}" >> tool_hugehelp.c
33     DEPENDS
34       "${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
35     VERBATIM)
36
37 endif()
38
39 transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
40 include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
41
42 if(MSVC)
43   list(APPEND CURL_SOURCE curl.rc)
44 endif()
45
46 # CURL_FILES comes from Makefile.inc
47 add_executable(
48   ${EXE_NAME}
49   ${CURL_FILES}
50   )
51
52 source_group("curlX source files" FILES ${CURLX_CFILES})
53 source_group("curl source files" FILES ${CURL_CFILES})
54 source_group("curl header files" FILES ${CURL_HFILES})
55
56 include_directories(
57   ${CURL_SOURCE_DIR}/lib        # To be able to reach "curl_setup_once.h"
58   ${CURL_BINARY_DIR}/lib        # To be able to reach "curl_config.h"
59   ${CURL_BINARY_DIR}/include    # To be able to reach "curl/curl.h"
60   # This is needed as tool_hugehelp.c is generated in the binary dir
61   ${CURL_SOURCE_DIR}/src        # To be able to reach "tool_hugehelp.h"
62   )
63
64 #Build curl executable
65 target_link_libraries( ${EXE_NAME} libcurl ${CURL_LIBS})
66
67 ################################################################################
68
69 #SET_TARGET_PROPERTIES(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah")
70 #SET_TARGET_PROPERTIES(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah")
71 #SET_TARGET_PROPERTIES(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah")
72
73 # Add the postfix to the executable since it is not added automatically as for modules and shared libraries
74 set_target_properties(${EXE_NAME} PROPERTIES
75   DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
76
77 #INCLUDE(ModuleInstall OPTIONAL)
78
79 install(TARGETS ${EXE_NAME} DESTINATION bin)