-
Notifications
You must be signed in to change notification settings - Fork 205
/
Copy pathCMakeLists.txt
69 lines (55 loc) · 2 KB
/
CMakeLists.txt
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
if(FAST_BUILD)
if (BUILD_CXX)
# create highs binary using library without pic
add_executable(highs-bin)
# Configure the config windows version file
if(MSVC)
string(REPLACE "." "," PROJECT_RC_VERSION "${PROJECT_VERSION}")
configure_file(${HIGHS_SOURCE_DIR}/version.rc.in
"${HIGHS_BINARY_DIR}/version.rc" @ONLY)
set(win_version_file ${HIGHS_BINARY_DIR}/version.rc)
else()
set(win_version_file)
endif()
target_sources(highs-bin PRIVATE RunHighs.cpp HighsRuntimeOptions.h ${win_version_file})
target_include_directories(highs-bin PRIVATE
$<BUILD_INTERFACE:${HIGHS_SOURCE_DIR}/app>
)
if(UNIX)
target_compile_options(highs-bin PUBLIC "-Wno-unused-variable")
target_compile_options(highs-bin PUBLIC "-Wno-unused-const-variable")
endif()
set_target_properties(highs-bin
PROPERTIES OUTPUT_NAME highs)
target_link_libraries(highs-bin highs)
if(APPLE)
set_target_properties(highs-bin PROPERTIES INSTALL_RPATH
"@loader_path/../${CMAKE_INSTALL_LIBDIR};@loader_path")
elseif (UNIX)
set_target_properties(highs-bin PROPERTIES INSTALL_RPATH
"$ORIGIN:$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
endif()
# install the binary
install(TARGETS highs-bin EXPORT highs-targets
RUNTIME)
endif()
else()
# create highs binary using library without pic
add_executable(highs)
target_sources(highs PRIVATE RunHighs.cpp)
if(UNIX)
target_compile_options(highs PUBLIC "-Wno-unused-variable")
target_compile_options(highs PUBLIC "-Wno-unused-const-variable")
endif()
target_link_libraries(highs libhighs)
if(EMSCRIPTEN AND EMSCRIPTEN_HTML)
set(CMAKE_EXECUTABLE_SUFFIX ".html")
set_target_properties(highs PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/highs_webdemo_shell.html)
endif()
target_include_directories(highs PRIVATE
$<BUILD_INTERFACE:${HIGHS_SOURCE_DIR}/app>
)
# install the binary
install(TARGETS highs EXPORT highs-targets
RUNTIME)
endif()