From: hobbes1069 Date: Thu, 4 Sep 2014 20:57:24 +0000 (+0000) Subject: Update install configuration and export the codec2 cmake target. X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=5199493355fb8ae163c1d6ca4290dc15f7ef6e6e;p=freetel-svn-tracking.git Update install configuration and export the codec2 cmake target. git-svn-id: https://svn.code.sf.net/p/freetel/code@1827 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2/CMakeLists.txt b/codec2/CMakeLists.txt index 0969437b..2dea8cdc 100644 --- a/codec2/CMakeLists.txt +++ b/codec2/CMakeLists.txt @@ -5,9 +5,16 @@ # Please report questions, comments, problems, or patches to the freetel # mailing list: https://lists.sourceforge.net/lists/listinfo/freetel-codec2 # +project(codec2) cmake_minimum_required(VERSION 2.8) +include(GNUInstallDirs) +mark_as_advanced(CLEAR + CMAKE_INSTALL_BINDIR + CMAKE_INSTALL_INCLUDEDIR + CMAKE_INSTALL_LIBDIR +) # # Prevent in-source builds # If an in-source build is attempted, you will still need to clean up a few @@ -21,8 +28,6 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") "separate build directory and run cmake from there.") endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") -project(codec2) - # # Set project version information. This should probably be done via external @@ -44,6 +49,11 @@ message(STATUS "codec2 version: ${CODEC2_VERSION}") if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif(NOT CMAKE_BUILD_TYPE) + +# Set default C++ flags. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall") + message(STATUS "Build type is: " ${CMAKE_BUILD_TYPE}) message(STATUS "Compiler Flags: " ${CMAKE_CXX_FLAGS}) @@ -80,9 +90,6 @@ endif(MINGW) # message(WARNING "Subversion not found. Can not determine svn revision.") #endif(SUBVERSION_FOUND) -# Set default C++ flags. -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall") # # Default options diff --git a/codec2/src/CMakeLists.txt b/codec2/src/CMakeLists.txt index 1e956f25..29405ad5 100644 --- a/codec2/src/CMakeLists.txt +++ b/codec2/src/CMakeLists.txt @@ -198,7 +198,7 @@ set(CODEC2_PUBLIC_HEADERS ) install(FILES ${CODEC2_PUBLIC_HEADERS} - DESTINATION include/codec2 + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/codec2 ) add_executable(c2demo c2demo.c) @@ -237,8 +237,17 @@ target_link_libraries(fec_enc ${CMAKE_REQUIRED_LIBRARIES} codec2) add_executable(fec_dec fec_dec.c golay23.c) target_link_libraries(fec_dec ${CMAKE_REQUIRED_LIBRARIES} codec2) +install(TARGETS codec2 EXPORT codec2-config + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +install(EXPORT codec2-config + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/codec2 +) + install(TARGETS - codec2 c2demo c2demo c2enc @@ -251,7 +260,5 @@ install(TARGETS insert_errors fec_enc fec_dec - LIBRARY DESTINATION lib${LIB_SUFFIX} - ARCHIVE DESTINATION lib${LIB_SUFFIX} - RUNTIME DESTINATION bin + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )