Browse Source

* refactored cmake files

master
bergmann 6 years ago
parent
commit
3574d2181e
3 changed files with 28 additions and 13 deletions
  1. +6
    -1
      cmake/options.cmake
  2. +16
    -4
      src/CMakeLists.txt
  3. +6
    -8
      test/CMakeLists.txt

+ 6
- 1
cmake/options.cmake View File

@@ -1 +1,6 @@
Option ( CPPUTILS_BUILD_SHARED "Build cpputils shared library" OFF )
Option ( CPPUTILS_BUILD_SHARED
"Build cpputils shared library"
ON )
Option ( CPPUTILS_INSTALL_DEV_FILES
"Install development files of cpputils"
ON )

+ 16
- 4
src/CMakeLists.txt View File

@@ -13,13 +13,25 @@ Set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PEDANTIC_CXX

# Project: cpputils ###############################################################################

# Build
Project ( cpputils VERSION 1.0.0.0 LANGUAGES CXX )
Set ( CPPUTILS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include )
File ( GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp )
Add_Library ( cpputils ${SOURCE_FILES} )
Target_Include_Directories (
cpputils
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
)
Target_Include_Directories ( cpputils
PUBLIC ${CPPUTILS_INCLUDE_DIR} )

# Install
If ( BUILD_SHARED_LIBS OR CPPUTILS_INSTALL_DEV_FILES )
Install ( TARGETS cpputils DESTINATION lib )
EndIf ( )

If ( CPPUTILS_INSTALL_DEV_FILES )
Install ( DIRECTORY ${CPPUTILS_INCLUDE_DIR}/cpputils DESTINATION include )
Install ( DIRECTORY ${CPPUTILS_INCLUDE_DIR}/nlohmann DESTINATION include )
EndIf ( )

# Optimize
If ( __COTIRE_INCLUDED )
Cotire ( cpputils )
EndIf ( )


+ 6
- 8
test/CMakeLists.txt View File

@@ -15,14 +15,12 @@ Set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PEDANTIC_CXX
Project ( test_cpputils )
File ( GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp )
Add_Executable ( test_cpputils EXCLUDE_FROM_ALL ${SOURCE_FILES} )
Target_Link_Libraries (
test_cpputils
cpputils
gtest
gmock
gmock_main
pthread
)
Target_Link_Libraries ( test_cpputils
cpputils
gtest
gmock
gmock_main
pthread )
If ( __COTIRE_INCLUDED )
Cotire ( test_cpputils )
EndIf ( )


Loading…
Cancel
Save