Browse Source

* Updated project structure

master
bergmann 4 years ago
parent
commit
b12bdd9598
7 changed files with 54 additions and 35 deletions
  1. +10
    -4
      CMakeLists.txt
  2. +28
    -0
      cmake/cppmp-const.cmake
  3. +5
    -0
      cmake/cppmp-options.cmake
  4. +3
    -21
      cmake/cppmp-var.cmake
  5. +1
    -1
      cmake/modules
  6. +7
    -4
      src/CMakeLists.txt
  7. +0
    -5
      test/CMakeLists.txt

+ 10
- 4
CMakeLists.txt View File

@@ -20,19 +20,25 @@ EndIf ( )

# Project #########################################################################################

Include ( CTest )
Include ( GNUInstallDirs )
Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppmp-options.cmake )
Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppmp-const.cmake )
Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppmp-var.cmake )
Project ( cppmp
DESCRIPTION "A simple library"
Project ( ${CPPMP_PROJECT_NAME}
DESCRIPTION "${CPPMP_PROJECT_DESCRIPTION}"
VERSION "${CPPMP_VERSION}" )
Include ( CTest )
Include ( GNUInstallDirs )

# Subdirectories
Add_SubDirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/src )
Add_SubDirectory ( ${CMAKE_CURRENT_SOURCE_DIR}/test )

# Install
If ( NOT CPPMP_HAS_EXPORT
OR NOT CPPMP_INSTALL_PACKAGE )
Return ( )
EndIf ( )

Include ( CMakePackageConfigHelpers )
Write_Basic_Package_Version_File ( "${CMAKE_CURRENT_BINARY_DIR}/cmake/cppmp-config-version.cmake"
VERSION ${CPPMP_VERSION}


+ 28
- 0
cmake/cppmp-const.cmake View File

@@ -0,0 +1,28 @@
# This file contains constant variables that are fixed to this project

# Version
Set ( CPPMP_VERSION_MAJOR 1 )
Set ( CPPMP_VERSION_MINOR 0 )
Set ( CPPMP_VERSION_PATCH 0 )
Set ( CPPMP_VERSION_BUILD 0 )
Set ( CPPMP_VERSION_HASH "" )
Set ( CPPMP_VERSION_BEHIND 0 )
Set ( CPPMP_VERSION_DIRTY 0 )

# Names
Set ( CPPMP_PROJECT_NAME "cppmp" )
Set ( CPPMP_PROJECT_DESCRIPTION "Meta programming library" )

# Include generated variables for further usage
Include ( ${CMAKE_CURRENT_LIST_DIR}/cppmp-var.cmake )

# Install directories
Set ( CPPMP_INSTALL_DIR_INCLUDE "${CMAKE_INSTALL_INCLUDEDIR}/${CPPMP_NAME}" )
Set ( CPPMP_INSTALL_DIR_LIB "${CMAKE_INSTALL_LIBDIR}" )
Set ( CPPMP_INSTALL_DIR_SHARE "${CMAKE_INSTALL_DATAROOTDIR}/${CPPMP_NAME}" )

# C Standard
Set ( CMAKE_C_STANDARD 11 )
Set ( CMAKE_CXX_STANDARD 17 )
Set ( CMAKE_C_STANDARD_REQUIRED ON )
Set ( CMAKE_CXX_STANDARD_REQUIRED ON )

+ 5
- 0
cmake/cppmp-options.cmake View File

@@ -1,6 +1,11 @@
# This file contains options that can be passed to the cmake command

Option ( CPPMP_INSTALL_HEADER
"Install headers of cppmp."
ON )
Option ( CPPMP_INSTALL_PACKAGE
"Install the cmake package of cppmp."
ON )
Option ( CPPMP_USE_GIT_VERSION
"Read the git tags to get the version of cppmp"
ON )

+ 3
- 21
cmake/cppmp-var.cmake View File

@@ -1,11 +1,4 @@
# Version
Set ( CPPMP_VERSION_MAJOR 1 )
Set ( CPPMP_VERSION_MINOR 0 )
Set ( CPPMP_VERSION_PATCH 0 )
Set ( CPPMP_VERSION_BUILD 0 )
Set ( CPPMP_VERSION_HASH "" )
Set ( CPPMP_VERSION_BEHIND 0 )
Set ( CPPMP_VERSION_DIRTY 0 )
# This file contains generated variables that are needed for the project

# Git Version
If ( CPPMP_USE_GIT_VERSION )
@@ -26,19 +19,8 @@ EndIf ( )
Set ( CPPMP_VERSION_SHORT "${CPPMP_VERSION_MAJOR}.${CPPMP_VERSION_MINOR}" )
Set ( CPPMP_VERSION "${CPPMP_VERSION_SHORT}.${CPPMP_VERSION_PATCH}.${CPPMP_VERSION_BUILD}" )
Set ( CPPMP_VERSION_COMPLETE "${CPPMP_VERSION}" )
Set ( CPPMP_NAME "cppmp-${CPPMP_VERSION_SHORT}" )
Set ( CPPMP_OUTPUTNAME "cppmp" )
Set ( CPPMP_NAME "${CPPMP_PROJECT_NAME}-${CPPMP_VERSION_SHORT}" )
Set ( CPPMP_OUTPUTNAME "${CPPMP_PROJECT_NAME}" )
If ( CPPMP_VERSION_BEHIND )
Set ( CPPMP_VERSION_COMPLETE "${CPPMP_VERSION_COMPLETE}+${CPPMP_VERSION_BEHIND}" )
EndIf ( )

# Install directories
Set ( CPPMP_INSTALL_DIR_INCLUDE "include/${CPPMP_NAME}" )
Set ( CPPMP_INSTALL_DIR_LIB "lib" )
Set ( CPPMP_INSTALL_DIR_SHARE "share/${CPPMP_NAME}" )

# C Standard
Set ( CMAKE_C_STANDARD 11 )
Set ( CMAKE_CXX_STANDARD 17 )
Set ( CMAKE_C_STANDARD_REQUIRED ON )
Set ( CMAKE_CXX_STANDARD_REQUIRED ON )

+ 1
- 1
cmake/modules

@@ -1 +1 @@
Subproject commit 4953cd4cc849afdfa02a6057b5a2011fb62e91a6
Subproject commit ebbae4fbb42d671331b4c6e9d1d142f41dcacc1b

+ 7
- 4
src/CMakeLists.txt View File

@@ -15,13 +15,16 @@ Target_Include_Directories ( cppmp

# Install #########################################################################################

Set ( CPPMP_HAS_EXPORT False PARENT_SCOPE )

# Header
If ( CPPMP_INSTALL_HEADER )
Set ( CPPMP_HAS_EXPORT True PARENT_SCOPE )
Install ( FILES ${CPPMP_INCLUDE_DIR}/cppmp.h
DESTINATION ${CPPMP_INSTALL_DIR_INCLUDE} )
DESTINATION ${CPPMP_INSTALL_DIR_INCLUDE} )
Install ( DIRECTORY ${CPPMP_INCLUDE_DIR}/cppmp
DESTINATION ${CPPMP_INSTALL_DIR_INCLUDE} )
DESTINATION ${CPPMP_INSTALL_DIR_INCLUDE} )
Install ( TARGETS cppmp
EXPORT cppmp
DESTINATION ${CPPMP_INSTALL_DIR_INCLUDE} )
EXPORT cppmp
DESTINATION ${CPPMP_INSTALL_DIR_INCLUDE} )
EndIf ( )

+ 0
- 5
test/CMakeLists.txt View File

@@ -43,11 +43,6 @@ ForEach ( FILE IN LISTS CPPMP_TEST_SOURCE_FILES )
Pedantic_Apply_Flags_Target ( ${TEST_NAME} ALL )
EndIf ( )

# optimization
If ( HAS_COTIRE )
Cotire ( ${TEST_NAME} )
EndIf ( )

# test
If ( HAS_CMAKE_TESTS )
Add_CMake_Test ( NAME ${TEST_NAME} TARGET ${TEST_NAME} )


Loading…
Cancel
Save