| 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" >> tool_hugehelp.c |
| 13 |
COMMAND ${CMAKE_COMMAND} -E echo "#else" >> tool_hugehelp.c |
| 14 |
COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT} |
| 15 |
"${CURL_BINARY_DIR}/docs/curl.1" | |
| 16 |
"${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c >> tool_hugehelp.c |
| 17 |
COMMAND ${CMAKE_COMMAND} -E echo "#endif /* HAVE_LIBZ */" >> tool_hugehelp.c |
| 18 |
DEPENDS |
| 19 |
generate-curl.1 |
| 20 |
"${CURL_BINARY_DIR}/docs/curl.1" |
| 21 |
"${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" |
| 22 |
"${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h" |
| 23 |
VERBATIM) |
| 24 |
else() |
| 25 |
add_custom_command( |
| 26 |
OUTPUT tool_hugehelp.c |
| 27 |
COMMAND ${CMAKE_COMMAND} -E echo "/* built-in manual is disabled, blank function */" > tool_hugehelp.c |
| 28 |
COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_hugehelp.h\"" >> tool_hugehelp.c |
| 29 |
COMMAND ${CMAKE_COMMAND} -E echo "void hugehelp(void) {}" >> tool_hugehelp.c |
| 30 |
DEPENDS |
| 31 |
"${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h" |
| 32 |
VERBATIM) |
| 33 |
|
| 34 |
endif() |
| 35 |
|
| 36 |
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") |
| 37 |
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake) |
| 38 |
|
| 39 |
if(MSVC) |
| 40 |
list(APPEND CURL_FILES curl.rc) |
| 41 |
endif() |
| 42 |
|
| 43 |
# CURL_FILES comes from Makefile.inc |
| 44 |
add_executable( |
| 45 |
${EXE_NAME} |
| 46 |
${CURL_FILES} |
| 47 |
) |
| 48 |
|
| 49 |
if(CURL_HAS_LTO) |
| 50 |
set_target_properties(${EXE_NAME} PROPERTIES |
| 51 |
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE |
| 52 |
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE) |
| 53 |
endif() |
| 54 |
|
| 55 |
source_group("curlX source files" FILES ${CURLX_CFILES}) |
| 56 |
source_group("curl source files" FILES ${CURL_CFILES}) |
| 57 |
source_group("curl header files" FILES ${CURL_HFILES}) |
| 58 |
|
| 59 |
include_directories( |
| 60 |
${CURL_SOURCE_DIR}/lib # To be able to reach "curl_setup_once.h" |
| 61 |
${CURL_BINARY_DIR}/lib # To be able to reach "curl_config.h" |
| 62 |
${CURL_BINARY_DIR}/include # To be able to reach "curl/curl.h" |
| 63 |
# This is needed as tool_hugehelp.c is generated in the binary dir |
| 64 |
${CURL_SOURCE_DIR}/src # To be able to reach "tool_hugehelp.h" |
| 65 |
) |
| 66 |
|
| 67 |
#Build curl executable |
| 68 |
target_link_libraries(${EXE_NAME} libcurl ${CURL_LIBS}) |
| 69 |
|
| 70 |
################################################################################ |
| 71 |
|
| 72 |
#SET_TARGET_PROPERTIES(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah") |
| 73 |
#SET_TARGET_PROPERTIES(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah") |
| 74 |
#SET_TARGET_PROPERTIES(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah") |
| 75 |
|
| 76 |
#INCLUDE(ModuleInstall OPTIONAL) |
| 77 |
|
| 78 |
install(TARGETS ${EXE_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 79 |
export(TARGETS ${EXE_NAME} |
| 80 |
APPEND FILE ${PROJECT_BINARY_DIR}/curl-target.cmake |
| 81 |
NAMESPACE CURL:: |
| 82 |
) |