2020-03-23 09:44:29 -04:00
|
|
|
#***************************************************************************
|
|
|
|
# _ _ ____ _
|
|
|
|
# Project ___| | | | _ \| |
|
|
|
|
# / __| | | | |_) | |
|
|
|
|
# | (__| |_| | _ <| |___
|
|
|
|
# \___|\___/|_| \_\_____|
|
|
|
|
#
|
|
|
|
# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
|
|
#
|
|
|
|
# This software is licensed as described in the file COPYING, which
|
|
|
|
# you should have received as part of this distribution. The terms
|
2020-11-04 08:02:01 -05:00
|
|
|
# are also available at https://curl.se/docs/copyright.html.
|
2020-03-23 09:44:29 -04:00
|
|
|
#
|
|
|
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
# copies of the Software, and permit persons to whom the Software is
|
|
|
|
# furnished to do so, under the terms of the COPYING file.
|
|
|
|
#
|
|
|
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
# KIND, either express or implied.
|
|
|
|
#
|
|
|
|
###########################################################################
|
2009-06-09 13:29:16 -04:00
|
|
|
set(EXE_NAME curl)
|
2009-04-06 16:44:01 -04:00
|
|
|
|
2014-10-12 05:27:07 -04:00
|
|
|
if(USE_MANUAL)
|
|
|
|
# Use the C locale to ensure that only ASCII characters appear in the
|
|
|
|
# embedded text. NROFF and MANOPT are set in the parent CMakeLists.txt
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT tool_hugehelp.c
|
2014-12-23 16:05:57 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_setup.h\"" > tool_hugehelp.c
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "#ifndef HAVE_LIBZ" >> tool_hugehelp.c
|
2014-10-12 05:27:07 -04:00
|
|
|
COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
|
2017-02-25 08:40:24 -05:00
|
|
|
"${CURL_BINARY_DIR}/docs/curl.1" |
|
2019-02-19 04:02:27 -05:00
|
|
|
"${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" >> tool_hugehelp.c
|
2014-12-23 16:05:57 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "#else" >> tool_hugehelp.c
|
2014-10-12 05:27:07 -04:00
|
|
|
COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
|
2017-02-25 08:40:24 -05:00
|
|
|
"${CURL_BINARY_DIR}/docs/curl.1" |
|
2019-02-19 04:02:27 -05:00
|
|
|
"${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c >> tool_hugehelp.c
|
2014-12-23 16:05:57 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "#endif /* HAVE_LIBZ */" >> tool_hugehelp.c
|
2014-10-12 05:27:07 -04:00
|
|
|
DEPENDS
|
2017-02-25 08:40:24 -05:00
|
|
|
generate-curl.1
|
|
|
|
"${CURL_BINARY_DIR}/docs/curl.1"
|
2014-10-12 05:27:07 -04:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
|
|
|
|
VERBATIM)
|
|
|
|
else()
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT tool_hugehelp.c
|
2014-12-23 16:05:57 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "/* built-in manual is disabled, blank function */" > tool_hugehelp.c
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_hugehelp.h\"" >> tool_hugehelp.c
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "void hugehelp(void) {}" >> tool_hugehelp.c
|
2014-10-12 05:27:07 -04:00
|
|
|
DEPENDS
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
|
|
|
|
VERBATIM)
|
2014-12-23 16:05:57 -05:00
|
|
|
|
2009-06-09 13:29:16 -04:00
|
|
|
endif()
|
2009-04-06 16:44:01 -04:00
|
|
|
|
2009-06-09 13:29:16 -04:00
|
|
|
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
|
|
|
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
|
2009-04-06 16:44:01 -04:00
|
|
|
|
2009-06-09 13:29:16 -04:00
|
|
|
if(MSVC)
|
2017-11-10 05:58:10 -05:00
|
|
|
list(APPEND CURL_FILES curl.rc)
|
2009-06-09 13:29:16 -04:00
|
|
|
endif()
|
2009-04-06 16:44:01 -04:00
|
|
|
|
2015-12-23 06:07:50 -05:00
|
|
|
# CURL_FILES comes from Makefile.inc
|
2009-06-09 13:29:16 -04:00
|
|
|
add_executable(
|
|
|
|
${EXE_NAME}
|
2015-12-23 06:07:50 -05:00
|
|
|
${CURL_FILES}
|
2009-06-09 13:29:16 -04:00
|
|
|
)
|
2009-04-06 16:44:01 -04:00
|
|
|
|
2020-04-09 16:42:22 -04:00
|
|
|
add_executable(
|
|
|
|
${PROJECT_NAME}::${EXE_NAME}
|
|
|
|
ALIAS ${EXE_NAME}
|
|
|
|
)
|
|
|
|
|
2020-01-09 06:10:55 -05:00
|
|
|
if(CURL_HAS_LTO)
|
|
|
|
set_target_properties(${EXE_NAME} PROPERTIES
|
|
|
|
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
|
|
|
|
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
|
|
|
|
endif()
|
|
|
|
|
2020-08-22 04:04:29 -04:00
|
|
|
if(ENABLE_UNICODE AND MINGW)
|
|
|
|
target_link_libraries(${EXE_NAME} -municode)
|
|
|
|
# GCC doesn't know about wmain
|
|
|
|
set_source_files_properties(tool_main.c PROPERTIES COMPILE_FLAGS "-Wno-missing-prototypes -Wno-missing-declarations")
|
|
|
|
endif()
|
|
|
|
|
2016-11-07 04:36:23 -05:00
|
|
|
source_group("curlX source files" FILES ${CURLX_CFILES})
|
|
|
|
source_group("curl source files" FILES ${CURL_CFILES})
|
|
|
|
source_group("curl header files" FILES ${CURL_HFILES})
|
2009-04-06 16:44:01 -04:00
|
|
|
|
2009-06-09 13:29:16 -04:00
|
|
|
include_directories(
|
2013-01-06 13:06:49 -05:00
|
|
|
${CURL_SOURCE_DIR}/lib # To be able to reach "curl_setup_once.h"
|
|
|
|
${CURL_BINARY_DIR}/lib # To be able to reach "curl_config.h"
|
2017-05-22 03:05:10 -04:00
|
|
|
${CURL_BINARY_DIR}/include # To be able to reach "curl/curl.h"
|
2014-10-12 05:27:07 -04:00
|
|
|
# This is needed as tool_hugehelp.c is generated in the binary dir
|
|
|
|
${CURL_SOURCE_DIR}/src # To be able to reach "tool_hugehelp.h"
|
2009-06-09 13:29:16 -04:00
|
|
|
)
|
2009-04-06 16:44:01 -04:00
|
|
|
|
2016-11-07 04:36:23 -05:00
|
|
|
#Build curl executable
|
2018-07-17 02:36:59 -04:00
|
|
|
target_link_libraries(${EXE_NAME} libcurl ${CURL_LIBS})
|
2009-04-06 16:44:01 -04:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
#SET_TARGET_PROPERTIES(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah")
|
|
|
|
#SET_TARGET_PROPERTIES(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah")
|
|
|
|
#SET_TARGET_PROPERTIES(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah")
|
|
|
|
|
|
|
|
#INCLUDE(ModuleInstall OPTIONAL)
|
2011-04-27 16:05:07 -04:00
|
|
|
|
2018-07-17 19:31:51 -04:00
|
|
|
install(TARGETS ${EXE_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2017-09-10 10:56:16 -04:00
|
|
|
export(TARGETS ${EXE_NAME}
|
|
|
|
APPEND FILE ${PROJECT_BINARY_DIR}/curl-target.cmake
|
2020-04-09 16:42:22 -04:00
|
|
|
NAMESPACE ${PROJECT_NAME}::
|
2017-09-10 10:56:16 -04:00
|
|
|
)
|