-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
62 lines (48 loc) · 1.72 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
set(LIBNAME "milkAtmosphereModel")
message("")
message(" SRCNAME = ${SRCNAME} -> LIBNAME = ${LIBNAME}")
# list source files (.c) other than modulename.c
set(SOURCEFILES
AirMixture_ria.c
AtmosphereModel_build_stdAtmModel.c
AtmosphereModel_Create_from_CONF.c
AtmosphereModel_H2O_Saturation.c
AtmosphereModel_RefractionPath.c
AtmosphereModel_save_stdAtmModel.c
AtmosphereModel_stdAtmModel_ria.c
nrlmsise-00.c
nrlmsise-00_data.c
nrlmsise-00_test.c
)
# list include files (.h) that should be installed on system
set(INCLUDEFILES
AtmosphereModel_Create_from_CONF.h
)
# list scripts that should be installed on system
set(SCRIPTFILES
)
set(LINKLIBS
CLIcore
)
# DEFAULT SETTINGS
# Do not change unless needed
# =====================================================================
# SRCNAME is current directory (last subdir)
set(NAME0 "${CMAKE_CURRENT_SOURCE_DIR}")
string(REPLACE "/" " " NAME1 ${NAME0})
string(REGEX MATCH "[a-zA-Z0-9_]+$" SRCNAME "${NAME0}")
message(" SRCNAME = ${SRCNAME}")
# LIBNAME constructed by removing spaces
#string(REPLACE "_" "" LIBNAME "${PROJECT_NAME}${SRCNAME}")
#message(" LIBNAME = ${LIBNAME}")
project(lib_${LIBNAME}_project)
# Library can be compiled from multiple source files
# Convention: the main souce file is named <libname>.c
#
add_library(${LIBNAME} SHARED ${SRCNAME}.c ${SOURCEFILES})
target_include_directories(${LIBNAME} PUBLIC ${PROJECT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${LIBNAME} PRIVATE ${LINKLIBS})
install(TARGETS ${LIBNAME} DESTINATION lib)
install(FILES ${SRCNAME}.h ${INCLUDEFILES} DESTINATION include/${SRCNAME})
install(FILES ${INCLUDEFILES} DESTINATION include/${SRCNAME})
install(PROGRAMS ${SCRIPTFILES} DESTINATION bin)