test(relative-paths): Added tests for #116

main
Anthony Printup 1 year ago
parent 08204d9847
commit 4362b3547f
No known key found for this signature in database
GPG Key ID: C8CB17EEA5183BD0

@ -0,0 +1,24 @@
[project]
name = "relative-paths"
[target.test-library]
type = "static"
sources = ["src/library-code.cpp"]
cmake-after = """
set(TEST_LIBRARY_TARGET_NAME ${CMKR_TARGET})
set(LIBRARIES_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/libs")
add_custom_command(
TARGET ${CMKR_TARGET} POST_BUILD
COMMAND mkdir "${LIBRARIES_OUTPUT_DIRECTORY}"
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${CMKR_TARGET}>" "${LIBRARIES_OUTPUT_DIRECTORY}/test-library-file.lib"
VERBATIM
)
"""
[target.example]
type = "executable"
sources = ["src/main.cpp"]
link-libraries = ["libs/test-library-file.lib"]
cmake-after = """
add_dependencies(${CMKR_TARGET} ${TEST_LIBRARY_TARGET_NAME})
"""

@ -0,0 +1,6 @@
// Created by Anthony Printup on 9/18/2023.
#include <cstdio>
extern "C" void library_function() {
std::puts("Hello from library_function!");
}

@ -0,0 +1,8 @@
// Created by Anthony Printup on 9/18/2023.
#include <cstdio>
extern "C" void library_function();
int main() {
puts("Hello from cmkr(relative-paths)!");
library_function();
}
Loading…
Cancel
Save