cmake(.os .a)

 1 cmake_minimum_required(VERSION 3.10.1)
 2 project(s_v2C)
 3 
 4 
 5 #For the shared library:
 6 set ( PROJECT_LINK_LIBS lievent.so )
 7 link_directories( ./another )
 8 
 9 #For the static library:
10 #set ( PROJECT_LINK_LIBS libevent.a )
11 #link_directories(./another)
12 
13 
14 
15 set ( PROJECT_LINK_LIBS libevent-2.0.so )
16 link_directories( ./another )
17 
18 #Bring the headers, such head.h into the project
19 include_directories(include)
20 
21 
22 #Can manually add the sources using the set command as follows:
23 #set(SOURCES src/part2.cpp src/part1.c)
24 
25 #However, the file(GLOB...) allows for wildcard additions:
26 file(GLOB SOURCES "src/*.c")
27 
28 add_executable(s_v2 ${SOURCES})
29 target_link_libraries(s_v2 ${PROJECT_LINK_LIBS} )

 

上一篇:cmakelists编写样例


下一篇:cmakelist