diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2021-06-06 17:10:10 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2021-06-06 17:10:10 +0200 |
commit | 537994756d80178bdaf25e96968f34d2e144797f (patch) | |
tree | a093dfc43a8487c5866808e74e7250a6818cf6e0 /src/mock/CMakeLists.txt | |
parent | df1df2929646abd77955b80e3ded3574ac005179 (diff) | |
download | polecat-537994756d80178bdaf25e96968f34d2e144797f.tar.gz polecat-537994756d80178bdaf25e96968f34d2e144797f.zip |
fix win env, add proper mocking code to test implementation
Diffstat (limited to 'src/mock/CMakeLists.txt')
-rw-r--r-- | src/mock/CMakeLists.txt | 40 |
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}) |