1- set (EXEC_NAME "test_${PROJECT_NAME} " )
2-
31#########################
42# Dependencies download #
53#########################
@@ -119,6 +117,45 @@ endmacro(test_wrapper)
119117
120118configure_file (config_for_tests.h.in "${PROJECT_BINARY_DIR} /src/config_for_tests.h" @ONLY )
121119
120+ #######################
121+ # Download dir target #
122+ #######################
123+
124+ set (DOWNLOAD_DIR_LIB "test_${PROJECT_NAME} _download_dir" )
125+
126+ set (Header_Files
127+ "${CMAKE_BINARY_DIR} /gen/gen_acquire_common_defs.h"
128+ "${CMAKE_BINARY_DIR} /gen/gen_acquire_net_common.h"
129+ )
130+ source_group ("${DOWNLOAD_DIR_LIB} Header Files" FILES "${Header_Files} " )
131+
132+ set (Source_Files
133+ "${CMAKE_BINARY_DIR} /gen/gen_acquire_net_common.c" )
134+ source_group ("${DOWNLOAD_DIR_LIB} Source Files" FILES "${Source_Files} " )
135+
136+ add_library ("${DOWNLOAD_DIR_LIB} " SHARED "${Header_Files} " "${Source_Files} " )
137+
138+ target_link_libraries ("${DOWNLOAD_DIR_LIB} " PRIVATE "${PROJECT_NAME} " )
139+
140+ target_include_directories (
141+ "${DOWNLOAD_DIR_LIB} "
142+ PRIVATE
143+ "$<BUILD_INTERFACE :${CMAKE_SOURCE_DIR} /tests >"
144+ "$<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR} >"
145+ "$<BUILD_INTERFACE :${CMAKE_BINARY_DIR} /gen >"
146+ )
147+ if (WIN32 )
148+ target_compile_definitions (
149+ "${DOWNLOAD_DIR_LIB} "
150+ PRIVATE
151+ "_${TARGET_ARCH} _"
152+ )
153+ endif ()
154+
155+ ####
156+
157+ set (EXEC_NAME "test_${PROJECT_NAME} " )
158+
122159set (Header_Files
123160 "test_handle.h"
124161 "test_checksum.h"
@@ -133,18 +170,23 @@ set(Header_Files
133170)
134171source_group ("Header Files" FILES "${Header_Files} " )
135172
136- set (Source_Files "test.c" "${CMAKE_SOURCE_DIR} /acquire/cli/cli.c" )
173+ set (Source_Files
174+ "${CMAKE_BINARY_DIR} /gen/gen_acquire_string_extras.c"
175+ "test.c"
176+ "${CMAKE_SOURCE_DIR} /acquire/cli/cli.c" )
137177source_group ("Source Files" FILES "${Source_Files} " )
138178
139179if (MSVC )
140180 set_source_files_properties ("test_string_extras.c"
141- PROPERTIES COMPILE_DEFINITIONS "LIBACQUIRE_IMPLEMENTATION=1;STRCASESTR_IMPL=1;STRNCASECMP_IMPL=1" )
181+ PROPERTIES COMPILE_DEFINITIONS "LIBACQUIRE_IMPLEMENTATION=0;STRCASESTR_IMPL=0;STRNCASECMP_IMPL=0" )
182+ set_source_files_properties ("${CMAKE_BINARY_DIR} /gen/gen_acquire_string_extras.c"
183+ PROPERTIES COMPILE_DEFINITIONS "LIBACQUIRE_IMPLEMENTATION=1;STRCASESTR_IMPL=1;STRNCASECMP_IMPL=0;STRNSTR_IMPL=1;STRERRORLEN_IMPL=1" )
142184else ()
143- set_source_files_properties ("test.c"
144- PROPERTIES COMPILE_DEFINITIONS "LIBACQUIRE_DOWNLOAD_DIR_IMPL=1" )
145185 set_source_files_properties ("test_string_extras.c"
146186 PROPERTIES COMPILE_DEFINITIONS "LIBACQUIRE_IMPLEMENTATION=1" )
147187endif ()
188+ #set_source_files_properties("test.c"
189+ # PROPERTIES COMPILE_DEFINITIONS "LIBACQUIRE_DOWNLOAD_DIR_IMPL=1")
148190
149191add_executable ("${EXEC_NAME} " "${Header_Files} " "${Source_Files} " )
150192target_compile_definitions ("${EXEC_NAME} " PUBLIC "_${TARGET_ARCH} _" )
@@ -156,11 +198,12 @@ target_link_libraries(
156198 PRIVATE
157199 "${PROJECT_NAME} "
158200 "${PROJECT_NAME} _compiler_flags"
201+ "${DOWNLOAD_DIR_LIB} "
159202)
160203
161204if (LIBACQUIRE_USE_MY_LIBFETCH)
162205 target_link_libraries (${EXEC_NAME} PRIVATE freebsd_libfetch )
163- endif ()
206+ endif (LIBACQUIRE_USE_MY_LIBFETCH )
164207
165208if (LIBACQUIRE_USE_MINIZ)
166209 find_package (kubazip CONFIG REQUIRED )
0 commit comments