-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
43 lines (32 loc) · 1.22 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
cmake_minimum_required(VERSION 2.8)
project(perfcomponent_plugin)
option(BACKEND_SCOREP "Build plugin using scorep(ON) or vampirtrace(OFF)" ON)
set(SCOREP_FOUND false)
set(PLUGIN_SOURCE perfc.c)
if(BACKEND_SCOREP)
include(common/FindScorep.cmake)
if(SCOREP_FOUND)
include_directories(${SCOREP_INCLUDE_DIRS})
add_definitions("-DSCOREP")
else()
message("Score-P was not found, falling back to VampirTrace!")
endif()
endif()
if(NOT SCOREP_FOUND OR NOT BACKEND_SCOREP)
include(common/FindVampirTrace.cmake)
if(VT_FOUND)
include_directories(${VT_INCLUDE_DIRS})
add_definitions("-DVT")
else()
message(SEND_ERROR "Found neither Score-P nor VampirTrace backend!")
endif()
endif()
#additional c flags
set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=c11")
#debugging c flags
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DHAVE_DEBUG -O0 -Wstrict-prototypes -Wall -Wundef -Wno-long-long -Wsign-compare -Wcomment -pedantic -finline-functions -fno-strict-aliasing")
#release c flags
set(CMAKE_C_FLAGS_RELEASE "-Os")
add_library(${PROJECT_NAME} SHARED ${PLUGIN_SOURCE})
target_link_libraries(${PROJECT_NAME} pthread m)
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib)