| 1 |
cmake_minimum_required(VERSION 3.12...3.15) |
| 2 |
|
| 3 |
cmake_policy(SET CMP0025 NEW) |
| 4 |
set(CMAKE_CXX_STANDARD 20) |
| 5 |
|
| 6 |
project(OCL_TEST_EXAMPLE) |
| 7 |
|
| 8 |
# install targets in root of the build dir, using $<0:> generator expression to force it from not being overwritten |
| 9 |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>) |
| 10 |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>) |
| 11 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>) |
| 12 |
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) |
| 13 |
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) |
| 14 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/$<0:>) |
| 15 |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/$<0:>) |
| 16 |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/$<0:>) |
| 17 |
endforeach() |
| 18 |
|
| 19 |
find_package(OpenCAMLib REQUIRED) |
| 20 |
|
| 21 |
set(EXAMPLE_SRC |
| 22 |
${PROJECT_SOURCE_DIR}/test_example.cpp |
| 23 |
) |
| 24 |
|
| 25 |
add_executable( |
| 26 |
test_example |
| 27 |
${EXAMPLE_SRC} |
| 28 |
) |
| 29 |
|
| 30 |
target_link_libraries( |
| 31 |
test_example |
| 32 |
OpenCAMLib::ocl |
| 33 |
) |
| 34 |
|
| 35 |
if(WIN32) |
| 36 |
add_custom_command(TARGET test_example POST_BUILD |
| 37 |
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:test_example> $<TARGET_FILE_DIR:test_example> |
| 38 |
COMMAND_EXPAND_LISTS |
| 39 |
) |
| 40 |
endif() |