-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
62 lines (42 loc) · 1.28 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
cmake_minimum_required(VERSION 3.5)
set (CMAKE_CXX_STANDARD 11)
option(USE_STATIC "Static build" OFF)
option(USE_CLANG "Build with Clang" OFF)
if(USE_CLANG)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_C_COMPILER clang)
message("+ Build with Clang++")
endif(USE_CLANG)
project (logfilegen VERSION 3.0.3 LANGUAGES CXX)
add_definitions(-DVERSION_NUMBER="\\"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}\\"")
set(SOURCES
utl.cpp
params.cpp
pairfile.cpp
macro.cpp
vars.cpp
tpl.cpp
logrot.cpp
cycle.cpp
main.cpp
)
add_executable (logfilegen ${SOURCES})
#set(CMAKE_EXE_LINKER_FLAGS "-pthread -lpthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -O3 ")
#if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1.0)
# target_link_libraries(logfilegen -lstdc++fs)
#endif()
if(USE_STATIC)
message("+ static build")
if(!USE_CLANG)
target_link_libraries(logfilegen -static -static-libstdc++ -static-libgcc)
else()
set(CMAKE_EXE_LINKER_FLAGS "-static")
# target_link_libraries(logfilegen -static -static-libc++)
endif()
endif()
if(WIN32)
target_link_libraries(logfilegen -lws2_32)
endif()
install (TARGETS logfilegen DESTINATION bin)