Home | History | Annotate | Download | only in src
      1 set(EXE_NAME curl)
      2 
      3 if(USE_MANUAL)
      4   find_package(Perl REQUIRED)
      5   # Use the C locale to ensure that only ASCII characters appear in the
      6   # embedded text. NROFF and MANOPT are set in the parent CMakeLists.txt
      7   add_custom_command(
      8     OUTPUT tool_hugehelp.c
      9     COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_setup.h\"" > tool_hugehelp.c
     10     COMMAND ${CMAKE_COMMAND} -E echo "#ifndef HAVE_LIBZ" >> tool_hugehelp.c
     11     COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
     12             "${CURL_SOURCE_DIR}/docs/curl.1" |
     13             "${PERL}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl"
     14             "${CURL_SOURCE_DIR}/docs/MANUAL" >> tool_hugehelp.c
     15     COMMAND ${CMAKE_COMMAND} -E echo "#else" >> tool_hugehelp.c
     16     COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
     17             "${CURL_SOURCE_DIR}/docs/curl.1" |
     18             "${PERL}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c
     19             "${CURL_SOURCE_DIR}/docs/MANUAL" >> tool_hugehelp.c
     20     COMMAND ${CMAKE_COMMAND} -E echo "#endif /* HAVE_LIBZ */" >> tool_hugehelp.c
     21     DEPENDS
     22       "${CURL_SOURCE_DIR}/docs/MANUAL"
     23       "${CURL_SOURCE_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 add_executable(
     47   ${EXE_NAME}
     48   ${curl_SOURCES}
     49   )
     50 
     51 source_group("cURLX source files" FILES ${CURLX_CFILES})
     52 source_group("cURL source files" FILES ${CURL_CFILES})
     53 source_group("cURL header files" FILES ${CURL_HFILES})
     54 
     55 include_directories(
     56   ${CURL_SOURCE_DIR}/lib        # To be able to reach "curl_setup_once.h"
     57   ${CURL_BINARY_DIR}/lib        # To be able to reach "curl_config.h"
     58   ${CURL_BINARY_DIR}/include    # To be able to reach "curl/curlbuild.h"
     59   # This is needed as tool_hugehelp.c is generated in the binary dir
     60   ${CURL_SOURCE_DIR}/src        # To be able to reach "tool_hugehelp.h"
     61   )
     62 
     63 #Build cURL executable
     64 target_link_libraries( ${EXE_NAME} libcurl ${CURL_LIBS})
     65 
     66 ################################################################################
     67 
     68 #SET_TARGET_PROPERTIES(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah")
     69 #SET_TARGET_PROPERTIES(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah")
     70 #SET_TARGET_PROPERTIES(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah")
     71 
     72 # Add the postfix to the executable since it is not added automatically as for modules and shared libraries
     73 set_target_properties(${EXE_NAME} PROPERTIES
     74   DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
     75 
     76 #INCLUDE(ModuleInstall OPTIONAL)
     77 
     78 install(TARGETS ${EXE_NAME} DESTINATION bin)
     79