diff options
author | John Levon <john.levon@nutanix.com> | 2020-11-27 12:31:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-27 12:31:03 +0000 |
commit | 40ac852fec651f54a4be8905ab8bb6b25ddb64e2 (patch) | |
tree | f66bf7497ae04fdb95ae41c4d79ac7efe24933a7 | |
parent | 7df3de2f9d2a8fcfd6bb24ddbfc5aa20e237f464 (diff) | |
download | libvfio-user-40ac852fec651f54a4be8905ab8bb6b25ddb64e2.zip libvfio-user-40ac852fec651f54a4be8905ab8bb6b25ddb64e2.tar.gz libvfio-user-40ac852fec651f54a4be8905ab8bb6b25ddb64e2.tar.bz2 |
fix test build (#132)
Some cmake versions don't handle backslashes well; use more specific facilities
to add the compile and link flags.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
-rw-r--r-- | test/CMakeLists.txt | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a6c8735..7844a91 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,12 +26,6 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUNIT_TEST \ - -Wno-implicit-function-declaration \ - -Wl,--wrap=_dma_controller_do_remove_region \ - -Wl,--wrap=dma_controller_add_region \ - -Wl,--wrap=dma_map_region") - add_executable(unit-tests unit-tests.c mocks.c ../lib/muser_ctx.c ../lib/dma.c @@ -40,6 +34,18 @@ add_executable(unit-tests unit-tests.c mocks.c ../lib/tran_sock.c ../lib/cap.c ../lib/irq.c) -target_link_libraries(unit-tests cmocka json-c) + +target_link_libraries(unit-tests PUBLIC cmocka json-c) + +target_compile_definitions(unit-tests PUBLIC UNIT_TEST) + +target_compile_options(unit-tests PUBLIC "-Wno-implicit-function-declaration") + +# No "target_link_options" in cmake2 +target_link_libraries(unit-tests PUBLIC + "-Wl,--wrap=_dma_controller_do_remove_region") +target_link_libraries(unit-tests PUBLIC "-Wl,--wrap=dma_controller_add_region") +target_link_libraries(unit-tests PUBLIC "-Wl,--wrap=dma_map_region") + enable_testing() add_test(NAME unit-tests COMMAND unit-tests) |