Annotation of embedaddon/curl/lib/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(LIB_NAME libcurl)
                     23: 
                     24: if(BUILD_SHARED_LIBS)
                     25:   set(CURL_STATICLIB NO)
                     26: else()
                     27:   set(CURL_STATICLIB YES)
                     28: endif()
                     29: 
                     30: # Use:
                     31: # * CURL_STATICLIB
                     32: configure_file(curl_config.h.cmake
                     33:   ${CMAKE_CURRENT_BINARY_DIR}/curl_config.h)
                     34: 
                     35: transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
                     36: include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
                     37: 
                     38: list(APPEND HHEADERS
                     39:   ${CMAKE_CURRENT_BINARY_DIR}/curl_config.h
                     40:   )
                     41: 
                     42: if(MSVC)
                     43:   list(APPEND CSOURCES libcurl.rc)
                     44: endif()
                     45: 
                     46: # SET(CSOURCES
                     47: # #  memdebug.c -not used
                     48: # # nwlib.c - Not used
                     49: # # strtok.c - specify later
                     50: # # strtoofft.c - specify later
                     51: # )
                     52: 
                     53: # # if we have Kerberos 4, right now this is never on
                     54: # #OPTION(CURL_KRB4 "Use Kerberos 4" OFF)
                     55: # IF(CURL_KRB4)
                     56: # SET(CSOURCES ${CSOURCES}
                     57: # krb4.c
                     58: # security.c
                     59: # )
                     60: # ENDIF(CURL_KRB4)
                     61: 
                     62: # #OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF)
                     63: # MARK_AS_ADVANCED(CURL_MALLOC_DEBUG)
                     64: # IF(CURL_MALLOC_DEBUG)
                     65: # SET(CSOURCES ${CSOURCES}
                     66: # memdebug.c
                     67: # )
                     68: # ENDIF(CURL_MALLOC_DEBUG)
                     69: 
                     70: # # only build compat strtoofft if we need to
                     71: # IF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
                     72: # SET(CSOURCES ${CSOURCES}
                     73: # strtoofft.c
                     74: # )
                     75: # ENDIF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
                     76: 
                     77: 
                     78: # The rest of the build
                     79: 
                     80: include_directories(${CMAKE_CURRENT_BINARY_DIR}/../include)
                     81: include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
                     82: include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
                     83: include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
                     84: include_directories(${CMAKE_CURRENT_SOURCE_DIR})
                     85: include_directories(${CMAKE_CURRENT_BINARY_DIR})
                     86: if(USE_ARES)
                     87:   include_directories(${CARES_INCLUDE_DIR})
                     88: endif()
                     89: 
                     90: add_library(
                     91:   ${LIB_NAME}
                     92:   ${HHEADERS} ${CSOURCES}
                     93:   )
                     94: 
                     95: add_library(
                     96:   ${PROJECT_NAME}::${LIB_NAME}
                     97:   ALIAS ${LIB_NAME}
                     98:   )
                     99: 
                    100: if(MSVC AND NOT BUILD_SHARED_LIBS)
                    101:   set_target_properties(${LIB_NAME} PROPERTIES STATIC_LIBRARY_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
                    102: endif()
                    103: 
                    104: if(NOT BUILD_SHARED_LIBS)
                    105:     set_target_properties(${LIB_NAME} PROPERTIES INTERFACE_COMPILE_DEFINITIONS CURL_STATICLIB)
                    106: endif()
                    107: 
                    108: target_link_libraries(${LIB_NAME} ${CURL_LIBS})
                    109: 
                    110: if(WIN32)
                    111:   add_definitions(-D_USRDLL)
                    112: endif()
                    113: 
                    114: set_target_properties(${LIB_NAME} PROPERTIES COMPILE_DEFINITIONS BUILDING_LIBCURL)
                    115: 
                    116: if(HIDES_CURL_PRIVATE_SYMBOLS)
                    117:   set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS")
                    118:   set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_FLAGS ${CURL_CFLAG_SYMBOLS_HIDE})
                    119: endif()
                    120: 
                    121: # Remove the "lib" prefix since the library is already named "libcurl".
                    122: set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
                    123: set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "")
                    124: 
                    125: if(CURL_HAS_LTO)
                    126:   set_target_properties(${LIB_NAME} PROPERTIES
                    127:     INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
                    128:     INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
                    129: endif()
                    130: 
                    131: if(WIN32)
                    132:   if(BUILD_SHARED_LIBS)
                    133:     # Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib"
                    134:     set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib")
                    135:   endif()
                    136: endif()
                    137: 
                    138: target_include_directories(${LIB_NAME} INTERFACE
                    139:   $<INSTALL_INTERFACE:include>
                    140:   $<BUILD_INTERFACE:${CURL_SOURCE_DIR}/include>)
                    141: 
                    142: install(TARGETS ${LIB_NAME}
                    143:   EXPORT ${TARGETS_EXPORT_NAME}
                    144:   ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
                    145:   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
                    146:   RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
                    147: )
                    148: 
                    149: export(TARGETS ${LIB_NAME}
                    150:        APPEND FILE ${PROJECT_BINARY_DIR}/libcurl-target.cmake
                    151:        NAMESPACE ${PROJECT_NAME}::
                    152: )

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