-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
44 lines (41 loc) · 1.32 KB
/
CMakeLists.txt
File metadata and controls
44 lines (41 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Define a list of target names
set(CPP_EXAMPLES
example_expcone
example_lp
example_powcone
example_genpowcone
example_qp
example_socp
example_sdp
example_json
example_print_stream
example_callback
example_faer
example_pardiso_mkl
)
# Define an executable target for each example
foreach(EXAMPLE_NAME ${CPP_EXAMPLES})
add_executable("cpp_${EXAMPLE_NAME}" ${EXAMPLE_NAME}.cpp)
target_compile_features("cpp_${EXAMPLE_NAME}" PRIVATE cxx_std_14) # Eigen requires at least c++14 support
# Link to clarabel built from the Rust wrapper
target_link_libraries("cpp_${EXAMPLE_NAME}" PRIVATE libclarabel_c_shared)
# On Windows, copy the shared library and debug symbols to the output directory for targets that link to it
if(WIN32)
add_custom_command(
TARGET "cpp_${EXAMPLE_NAME}"
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CLARABEL_C_OUTPUT_DIR}/clarabel_c.dll
"$<TARGET_FILE_DIR:cpp_${EXAMPLE_NAME}>"
)
add_custom_command(
TARGET "cpp_${EXAMPLE_NAME}"
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CLARABEL_C_OUTPUT_DIR}/clarabel_c.pdb
"$<TARGET_FILE_DIR:cpp_${EXAMPLE_NAME}>"
)
endif()
# Link to Eigen
target_link_libraries("cpp_${EXAMPLE_NAME}" PRIVATE Eigen3::Eigen)
endforeach(EXAMPLE_NAME)