1set(EXE_NAME curl)
2
3# First try to locate hugehelp.c to see if it has already been created
4# TODO Find the file WITHOUT adding a cache entry!!! Or else the user can delete the file after the script was first run, and the script won't notice it has gone.
5find_file(HUGEHELP_C_FILE hugehelp.c PATHS . NO_DEFAULT_PATH)
6if (NOT HUGEHELP_C_FILE)
7  message(STATUS "Warning: hugehelp.c file was not generated before. Generating an 'empty' file...")
8  file(WRITE hugehelp.c "/* built-in manual is disabled, blank function */\n#include \"hugehelp.h\"\nvoid hugehelp(void) {}\n\n")
9endif()
10
11transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
12include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
13
14if(MSVC)
15  list(APPEND CURL_SOURCE curl.rc)
16endif()
17
18add_executable(
19  ${EXE_NAME}
20  ${curl_SOURCES}
21  )
22
23source_group("cURLX source files" FILES ${CURLX_ONES})
24source_group("cURL source files" FILES ${CURL_CFILES})
25source_group("cURL header files" FILES ${CURL_HFILES})
26
27include_directories(
28  ${CURL_SOURCE_DIR}/lib                # To be able to reach "setup_once.h"
29  ${CURL_BINARY_DIR}/lib                # To be able to reach "curl_config.h"
30  ${CURL_BINARY_DIR}/include    # To be able to reach "curl/curlbuild.h"
31  )
32
33
34# Setup dependencies
35setup_curl_dependencies(${EXE_NAME})
36target_link_libraries( ${EXE_NAME} libcurl )
37
38
39################################################################################
40
41#SET_TARGET_PROPERTIES(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah")
42#SET_TARGET_PROPERTIES(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah")
43#SET_TARGET_PROPERTIES(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah")
44
45# Add the postfix to the executable since it is not added automatically as for modules and shared libraries
46set_target_properties(${EXE_NAME} PROPERTIES
47  DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
48
49if(MSVC)
50  if(NOT BUILD_RELEASE_DEBUG_DIRS)
51    # Ugly workaround to remove the "/debug" or "/release" in each output
52    set_target_properties(${EXE_NAME} PROPERTIES PREFIX "../")
53  endif()
54endif()
55
56#INCLUDE(ModuleInstall OPTIONAL)
57
58install(TARGETS ${EXE_NAME} DESTINATION bin)
59