aboutsummaryrefslogtreecommitdiff
path: root/src/mock/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/mock/CMakeLists.txt')
-rw-r--r--src/mock/CMakeLists.txt40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/mock/CMakeLists.txt b/src/mock/CMakeLists.txt
index 8b48c04..a45d88e 100644
--- a/src/mock/CMakeLists.txt
+++ b/src/mock/CMakeLists.txt
@@ -1,20 +1,48 @@
-SET(CURL_SOURCES
+add_subdirectory(wine)
+
+
+set(WINE_JSON_INFILE "${CMAKE_CURRENT_SOURCE_DIR}/runners/wine.json")
+set(WINE_JSON_OUTFILE "${CMAKE_CURRENT_BINARY_DIR}/wine_json")
+
+
+add_custom_command(
+ OUTPUT ${WINE_JSON_OUTFILE}.c ${WINE_JSON_OUTFILE}.h
+ COMMAND ${CMAKE_COMMAND}
+ "-Dbin_in=${WINE_JSON_INFILE}"
+ -P ${CMAKE_SOURCE_DIR}/cmake/FileEmbed.cmake
+)
+
+add_custom_target(wine_json ALL DEPENDS ${WINE_JSON_OUTFILE}.c ${WINE_JSON_OUTFILE}.h)
+
+set(WINE_MOCK
+ ${WINE_TAR_OUT}.c
+ ${WINE_TAR_OUT}.h
+)
+
+file(TOUCH ${WINE_MOCK})
+
+SET(MOCK_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/libcurl.c
+ ${WINE_MOCK}
+ ${WINE_JSON_OUTFILE}.c
+ ${WINE_JSON_OUTFILE}.h
)
-add_library(mockcurl STATIC ${CURL_SOURCES})
-target_compile_options(mockcurl PUBLIC ${CFLAGS})
-target_include_directories(mockcurl PUBLIC ${LIBCURL_INCLUDE_DIRS})
+add_library(mock STATIC ${MOCK_SOURCES})
+target_compile_options(mock PUBLIC ${CFLAGS})
+target_include_directories(mock PUBLIC ${LIBCURL_INCLUDE_DIRS})
+add_dependencies(mock wine_tar wine_json)
+target_include_directories(mock PRIVATE ${WINE_TAR_DIR} ${CMAKE_CURRENT_BINARY_DIR})
set(NAME ${CMAKE_PROJECT_NAME}_mock)
add_executable(${NAME} ${SOURCES})
target_link_libraries(${NAME} LINK_PUBLIC ${JSONC_LIBRARIES})
target_link_libraries(${NAME} LINK_PUBLIC ${LIBARCHIVE_LIBRARIES})
-target_link_libraries(${NAME} LINK_PUBLIC mockcurl)
+target_link_libraries(${NAME} LINK_PUBLIC mock)
target_include_directories(${NAME} PUBLIC ${JSONC_INCLUDE_DIRS})
target_include_directories(${NAME} PUBLIC ${LIBARCHIVE_INCLUDE_DIRS})
target_include_directories(${NAME} PUBLIC ${LIBCURL_INCLUDE_DIRS})
-target_compile_options(${NAME} PUBLIC ${CFLAGS}) \ No newline at end of file
+target_compile_options(${NAME} PUBLIC ${CFLAGS})