CMakeLists.txt 1.06 KB
cmake_minimum_required(VERSION 2.8)
project(AD9915-library)

option(AD9915_DEBUG "Activate debug build" ON)

# CFLAGS
set(CMAKE_C_FLAGS                 "-O2")
set(CMAKE_C_FLAGS_DEBUG           "-Wall -Wextra -g")

# Depends (memo, currently nothing here)
#set(CMAKE_MODULE_PATH
#	${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules")
#find_package(FFTW REQUIRED)

# Include GNUInstallDirs
include(GNUInstallDirs)

# Include header
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

# Create library dynamic
add_library(ad9915 SHARED
	src/ad9915.c
	src/ddsFreq.c
	src/spi.c
)

if (AD9915_DEBUG)
	message(STATUS "Debug enable")
    set(CMAKE_BUILD_TYPE Debug)
endif()

set_target_properties(ad9915
	PROPERTIES SOVERSION 1.0
)

# Rules for install
install(TARGETS ad9915
	EXPORT ad9915Config
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
	DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ad9915
	FILES_MATCHING
	PATTERN "*.h"
	PATTERN ".swp" EXCLUDE
)
install(
	EXPORT ad9915Config
	DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ad9915"
)