-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
41 lines (33 loc) · 1.13 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
cmake_minimum_required(VERSION 3.12)
project (apecss)
set(CMAKE_C_COMPILER /usr/bin/gcc)
include_directories($ENV{APECSS_DIR}/include)
FILE (GLOB_RECURSE myfiles ABSOLUTE $ENV{APECSS_DIR}/src/*.c)
set (mylibs m)
link_directories($ENV{USRLIB_DIR})
foreach(arg ${myincludes})
IF (arg MATCHES "-I")
STRING(REGEX REPLACE "-I" "" myinc ${arg})
message("Additional include: ${myinc}")
include_directories(${myinc})
ENDIF(arg MATCHES "-I")
endforeach(arg ${myincludes})
foreach(arg ${mylibs})
STRING(REGEX REPLACE "lib" "" myl1 ${arg})
STRING(REGEX REPLACE ".a$" "" myl2 ${myl1})
set(mylibs ${myl2} ${mylibs} ${myl2})
endforeach(arg ${mylibs})
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Optimization: No optimization specified.")
set(CMAKE_BUILD_TYPE Release)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Optimization: Debug")
set(CMAKE_C_FLAGS_DEBUG "-Wall -g")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
message(STATUS "Optimization: Release")
add_definitions(-DNDEBUG)
set(CMAKE_C_FLAGS_RELEASE "-Wall -Werror -O3")
endif()
add_library(apecss STATIC ${myfiles})
target_link_libraries(apecss ${mylibs})