-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
52 lines (33 loc) · 1.17 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
# list source files (.c) other than modulename.c
set(SOURCEFILES
speckle_dispersion_fit.c
)
# list include files (.h) that should be installed on system
set(INCLUDEFILES
)
# list scripts that should be installed on system
set(SCRIPTFILES
)
# 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)
include_directories ("${PROJECT_SOURCE_DIR}/src")
include_directories ("${PROJECT_SOURCE_DIR}/..")
# Library can be compiled from multiple source files
# Convention: the main souce file is named <libname>.c
#
add_library(${LIBNAME} SHARED ${SRCNAME}.c ${SOURCEFILES})
install(TARGETS ${LIBNAME} DESTINATION lib)
install(FILES ${SRCNAME}.h ${INCLUDEFILES} DESTINATION include/${SRCNAME})
install(PROGRAMS
${SCRIPTFILES}
DESTINATION bin)