forked from devernay/cminpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (62 loc) · 2.68 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
70
71
72
73
74
# The name of our project is "CMINPACK". CMakeLists files in this project can
# refer to the root source directory of the project as ${CMINPACK_SOURCE_DIR} and
# to the root binary directory of the project as ${CMINPACK_BINARY_DIR}.
cmake_minimum_required (VERSION 2.6)
project (CMINPACK)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
include(${PROJECT_SOURCE_DIR}/cmake/cminpack_utils.cmake)
# Set version and OS-specific settings
set(CMINPACK_VERSION 1.3.4 CACHE STRING "CMinpack version")
set(CMINPACK_SOVERSION 1 CACHE STRING "CMinpack API version")
DISSECT_VERSION()
GET_OS_INFO()
# Add an "uninstall" target
CONFIGURE_FILE ("${PROJECT_SOURCE_DIR}/cmake/uninstall_target.cmake.in"
"${PROJECT_BINARY_DIR}/uninstall_target.cmake" IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET (uninstall "${CMAKE_COMMAND}" -P
"${PROJECT_BINARY_DIR}/uninstall_target.cmake")
enable_testing()
if (OS_LINUX)
option (USE_FPIC "Use the -fPIC compiler flag." ON)
else (OS_LINUX)
option (USE_FPIC "Use the -fPIC compiler flag." OFF)
endif (OS_LINUX)
option (BUILD_SHARED_LIBS "Build shared libraries instead of static." OFF)
if (BUILD_SHARED_LIBS)
message (STATUS "Building shared libraries.")
else ()
message (STATUS "Building static libraries.")
set(CMAKE_RELEASE_POSTFIX _s)
set(CMAKE_RELWITHDEBINFO_POSTFIX _s)
set(CMAKE_DEBUG_POSTFIX _s)
set(CMAKE_MINSIZEREL_POSTFIX _s)
if(WIN32)
add_definitions(-DCMINPACK_NO_DLL)
endif(WIN32)
endif ()
#set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/../build)
add_subdirectory (cmake)
add_subdirectory (examples)
set (cminpack_srcs
cminpack.h cminpackP.h
chkder.c enorm.c hybrd1.c hybrj.c lmdif1.c lmstr1.c qrfac.c r1updt.c
dogleg.c fdjac1.c hybrd.c lmder1.c lmdif.c lmstr.c qrsolv.c rwupdt.c
dpmpar.c fdjac2.c hybrj1.c lmder.c lmpar.c qform.c r1mpyq.c covar.c covar1.c
minpack.h
chkder_.c enorm_.c hybrd1_.c hybrj_.c lmdif1_.c lmstr1_.c qrfac_.c r1updt_.c
dogleg_.c fdjac1_.c hybrd_.c lmder1_.c lmdif_.c lmstr_.c qrsolv_.c rwupdt_.c
dpmpar_.c fdjac2_.c hybrj1_.c lmder_.c lmpar_.c qform_.c r1mpyq_.c covar_.c
)
set (cminpack_hdrs
cminpack.h minpack.h)
add_library (cminpack ${cminpack_srcs})
install (TARGETS cminpack
LIBRARY DESTINATION ${CMINPACK_LIB_INSTALL_DIR} COMPONENT library
ARCHIVE DESTINATION ${CMINPACK_LIB_INSTALL_DIR} COMPONENT library
RUNTIME DESTINATION bin COMPONENT library)
install (FILES ${cminpack_hdrs} DESTINATION ${CMINPACK_INCLUDE_INSTALL_DIR}
COMPONENT cminpack_hdrs)
if (USE_FPIC AND NOT BUILD_SHARED_LIBS)
set_target_properties (cminpack PROPERTIES COMPILE_FLAGS -fPIC)
endif ()
set_target_properties(cminpack PROPERTIES VERSION ${CMINPACK_VERSION} SOVERSION ${CMINPACK_SOVERSION})