-
Notifications
You must be signed in to change notification settings - Fork 245
/
ma27.cmake
28 lines (24 loc) · 1.08 KB
/
ma27.cmake
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
include(ExternalProject)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# Needed for cross-compiling
set(HOST_FLAG "--host=${COMPILER_PREFIX}")
endif()
ExternalProject_Add(
ma27_project
PREFIX "${PROJECT_BINARY_DIR}/external/ma27/"
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND sh "${EXTERNAL_SRC_DIR}/coinhsl/configure" "--prefix=${PROJECT_BINARY_DIR}/external/ma27/" "${HOST_FLAG}" "CC=${CMAKE_C_COMPILER}" "CFLAGS=-O2 -fPIC" "FCFLAGS=-O2 -fPIC"
SOURCE_DIR "${PROJECT_SOURCE_DIR}/external/coinhsl"
BUILD_COMMAND make clean all
INSTALL_COMMAND make install
# LOG_CONFIGURE 1 # suppress output
# LOG_BUILD 1
)
ExternalProject_Add_Step(ma27_project rename_library
COMMAND mv ${PROJECT_BINARY_DIR}/external/ma27/lib/libcoinhsl.a ${PROJECT_BINARY_DIR}/external/ma27/lib/libma27.a
DEPENDEES install
)
add_library(ma27 STATIC IMPORTED GLOBAL)
add_dependencies(ma27 ma27_project)
set_property(TARGET ma27 PROPERTY IMPORTED_LOCATION "${PROJECT_BINARY_DIR}/external/ma27/lib/libma27.a")
install(FILES "${PROJECT_BINARY_DIR}/external/ma27/lib/libma27.a" DESTINATION lib)