Annotation of embedaddon/curl/src/CMakeLists.txt, revision 1.1.1.1

1.1       misho       1: #***************************************************************************
                      2: #                                  _   _ ____  _
                      3: #  Project                     ___| | | |  _ \| |
                      4: #                             / __| | | | |_) | |
                      5: #                            | (__| |_| |  _ <| |___
                      6: #                             \___|\___/|_| \_\_____|
                      7: #
                      8: # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
                      9: #
                     10: # This software is licensed as described in the file COPYING, which
                     11: # you should have received as part of this distribution. The terms
                     12: # are also available at https://curl.haxx.se/docs/copyright.html.
                     13: #
                     14: # You may opt to use, copy, modify, merge, publish, distribute and/or sell
                     15: # copies of the Software, and permit persons to whom the Software is
                     16: # furnished to do so, under the terms of the COPYING file.
                     17: #
                     18: # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
                     19: # KIND, either express or implied.
                     20: #
                     21: ###########################################################################
                     22: set(EXE_NAME curl)
                     23: 
                     24: if(USE_MANUAL)
                     25:   # Use the C locale to ensure that only ASCII characters appear in the
                     26:   # embedded text. NROFF and MANOPT are set in the parent CMakeLists.txt
                     27:   add_custom_command(
                     28:     OUTPUT tool_hugehelp.c
                     29:     COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_setup.h\"" > tool_hugehelp.c
                     30:     COMMAND ${CMAKE_COMMAND} -E echo "#ifndef HAVE_LIBZ" >> tool_hugehelp.c
                     31:     COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
                     32:             "${CURL_BINARY_DIR}/docs/curl.1" |
                     33:             "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" >> tool_hugehelp.c
                     34:     COMMAND ${CMAKE_COMMAND} -E echo "#else" >> tool_hugehelp.c
                     35:     COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
                     36:             "${CURL_BINARY_DIR}/docs/curl.1" |
                     37:             "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c >> tool_hugehelp.c
                     38:     COMMAND ${CMAKE_COMMAND} -E echo "#endif /* HAVE_LIBZ */" >> tool_hugehelp.c
                     39:     DEPENDS
                     40:       generate-curl.1
                     41:       "${CURL_BINARY_DIR}/docs/curl.1"
                     42:       "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl"
                     43:       "${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
                     44:     VERBATIM)
                     45: else()
                     46:   add_custom_command(
                     47:     OUTPUT tool_hugehelp.c
                     48:     COMMAND ${CMAKE_COMMAND} -E echo "/* built-in manual is disabled, blank function */" > tool_hugehelp.c
                     49:     COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_hugehelp.h\"" >> tool_hugehelp.c
                     50:     COMMAND ${CMAKE_COMMAND} -E echo "void hugehelp(void) {}" >> tool_hugehelp.c
                     51:     DEPENDS
                     52:       "${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
                     53:     VERBATIM)
                     54: 
                     55: endif()
                     56: 
                     57: transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
                     58: include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
                     59: 
                     60: if(MSVC)
                     61:   list(APPEND CURL_FILES curl.rc)
                     62: endif()
                     63: 
                     64: # CURL_FILES comes from Makefile.inc
                     65: add_executable(
                     66:   ${EXE_NAME}
                     67:   ${CURL_FILES}
                     68:   )
                     69: 
                     70: add_executable(
                     71:   ${PROJECT_NAME}::${EXE_NAME}
                     72:   ALIAS ${EXE_NAME}
                     73:   )
                     74: 
                     75: if(CURL_HAS_LTO)
                     76:   set_target_properties(${EXE_NAME} PROPERTIES
                     77:     INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
                     78:     INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
                     79: endif()
                     80: 
                     81: source_group("curlX source files" FILES ${CURLX_CFILES})
                     82: source_group("curl source files" FILES ${CURL_CFILES})
                     83: source_group("curl header files" FILES ${CURL_HFILES})
                     84: 
                     85: include_directories(
                     86:   ${CURL_SOURCE_DIR}/lib        # To be able to reach "curl_setup_once.h"
                     87:   ${CURL_BINARY_DIR}/lib        # To be able to reach "curl_config.h"
                     88:   ${CURL_BINARY_DIR}/include    # To be able to reach "curl/curl.h"
                     89:   # This is needed as tool_hugehelp.c is generated in the binary dir
                     90:   ${CURL_SOURCE_DIR}/src        # To be able to reach "tool_hugehelp.h"
                     91:   )
                     92: 
                     93: #Build curl executable
                     94: target_link_libraries(${EXE_NAME} libcurl ${CURL_LIBS})
                     95: 
                     96: ################################################################################
                     97: 
                     98: #SET_TARGET_PROPERTIES(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah")
                     99: #SET_TARGET_PROPERTIES(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah")
                    100: #SET_TARGET_PROPERTIES(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah")
                    101: 
                    102: #INCLUDE(ModuleInstall OPTIONAL)
                    103: 
                    104: install(TARGETS ${EXE_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
                    105: export(TARGETS ${EXE_NAME}
                    106:        APPEND FILE ${PROJECT_BINARY_DIR}/curl-target.cmake
                    107:        NAMESPACE ${PROJECT_NAME}::
                    108: )

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>