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 # 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/curlbuild.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)
     80