1#*************************************************************************** 2# _ _ ____ _ 3# Project ___| | | | _ \| | 4# / __| | | | |_) | | 5# | (__| |_| | _ <| |___ 6# \___|\___/|_| \_\_____| 7# 8# Copyright (C) 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.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# SPDX-License-Identifier: curl 22# 23########################################################################### 24set(TARGET_LABEL_PREFIX "Test server ") 25 26if(MSVC) 27 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4306") 28endif() 29 30function(SETUP_EXECUTABLE TEST_NAME) # ARGN are the files in the test 31 add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${ARGN}) 32 add_dependencies(testdeps ${TEST_NAME}) 33 string(TOUPPER ${TEST_NAME} UPPER_TEST_NAME) 34 35 include_directories( 36 ${CURL_SOURCE_DIR}/lib # To be able to reach "curl_setup_once.h" 37 ${CURL_BINARY_DIR}/lib # To be able to reach "curl_config.h" 38 ${CURL_BINARY_DIR}/include # To be able to reach "curl/curl.h" 39 ${CURL_SOURCE_DIR}/src # To be able to reach "tool_xattr.h" 40 ) 41 if(USE_ARES) 42 include_directories(${CARES_INCLUDE_DIR}) 43 endif() 44 45 target_link_libraries(${TEST_NAME} ${CURL_LIBS}) 46 47 # Test servers simply are standalone programs that do not use libcurl 48 # library. For convenience and to ease portability of these servers, 49 # some source code files from the libcurl subdirectory are also used 50 # to build the servers. In order to achieve proper linkage of these 51 # files on Win32 targets it is necessary to build the test servers 52 # with CURL_STATICLIB defined, independently of how libcurl is built. 53 set_target_properties(${TEST_NAME} PROPERTIES 54 COMPILE_DEFINITIONS CURL_STATICLIB) # ${UPPER_TEST_NAME} 55 set_target_properties(${TEST_NAME} PROPERTIES 56 PROJECT_LABEL "${TARGET_LABEL_PREFIX}${TEST_NAME}") 57endfunction() 58 59 60transform_makefile_inc("Makefile.inc" 61 "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") 62include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake) 63 64foreach(EXECUTABLE_NAME ${noinst_PROGRAMS}) 65 setup_executable(${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_SOURCES}) 66endforeach() 67 68 69# SET(useful 70# getpart.c getpart.h 71# ${CURL_SOURCE_DIR}/lib/strequal.c 72# ${CURL_SOURCE_DIR}/lib/base64.c 73# ${CURL_SOURCE_DIR}/lib/mprintf.c 74# ${CURL_SOURCE_DIR}/lib/memdebug.c 75# ${CURL_SOURCE_DIR}/lib/timeval.c 76# ) 77 78# SETUP_EXECUTABLE(sws sws.c util.c util.h ${useful}) 79# SETUP_EXECUTABLE(resolve resolve.c util.c util.h ${useful}) 80# SETUP_EXECUTABLE(sockfilt sockfilt.c util.c util.h ${useful} ${CURL_SOURCE_DIR}/lib/inet_pton.c) 81# SETUP_EXECUTABLE(getpart testpart.c ${useful}) 82# SETUP_EXECUTABLE(tftpd tftpd.c util.c util.h ${useful} tftp.h) 83