This repository has been archived by the owner on Aug 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
46 lines (38 loc) · 1.6 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
cmake_minimum_required(VERSION 2.8)
project(CVESVP)
if(TARGET CVESVP)
return()
endif()
if(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
endif()
file(GLOB_RECURSE SRC_SOURCES "src/*.c")
add_library(CVESVP STATIC ${SRC_SOURCES})
set_target_properties(CVESVP PROPERTIES
C_STANDARD 99
POSITION_INDEPENDENT_CODE ON
)
target_include_directories(CVESVP PRIVATE "src")
target_link_libraries(CVESVP m)
add_subdirectory(external/RUtil2)
add_subdirectory(external/RFNL)
add_subdirectory(external/CVEDSP2)
target_link_libraries(CVESVP RUtil2 RFNL CVEDSP2)
# Arrange header files for external use
add_custom_command(TARGET CVESVP POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "include/CVESVP")
add_custom_command(TARGET CVESVP POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/Include/CVESVP.h" "include/CVESVP.h")
file(GLOB_RECURSE SRC_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src" "src/*.h")
foreach(SRC_HEADER ${SRC_HEADERS})
add_custom_command(TARGET CVESVP POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/${SRC_HEADER}" "include/CVESVP/${SRC_HEADER}")
endforeach()
target_include_directories(CVESVP INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/include")
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") # Test subproject
include(CTest)
#add_subdirectory(test)
endif()
# Workaround for CMake version older than 3.1
# Remove this and set the minimum required version to 3.1
# when we make sure everyone is having CMake 3.1
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")