Move included cmake files into CMakeListsGlobal to allow inclusion in wrapper projects
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Mon, 14 May 2018 06:45:14 +0000 (08:45 +0200)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Mon, 14 May 2018 07:17:46 +0000 (09:17 +0200)
CMakeLists.txt
CMakeListsGlobal.cmake
cmake/get_version.cmake

index 1e6c0fd..697b31b 100644 (file)
@@ -1,6 +1,18 @@
-project (OONF C)
 cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
 
+###########################
+#### API configuration ####
+###########################
+
+# set cached variables
+#include (./cmake/lib_config.cmake)
+
+# include compiler flags
+#include (./cmake/cc_flags.cmake)
+
+# include global variables
+include (./CMakeListsGlobal.cmake)
+
 ########################################################
 #### Set a default build type if none was specified ####
 ########################################################
@@ -13,27 +25,14 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
     "MinSizeRel" "RelWithDebInfo")
 endif()
 
-###########################
-#### API configuration ####
-###########################
-
-# set cached variables
-include (./cmake/lib_config.cmake)
-
-# include compiler flags
-include (./cmake/cc_flags.cmake)
-
-# include global variables
-include (./CMakeListsGlobal.cmake)
-
 ########################################
 #### get repository tag and version ####
 ########################################
 
-include (cmake/get_version.cmake)
-IF(EXISTS "${PROJECT_BINARY_DIR}/version.cmake")
-  include (${PROJECT_BINARY_DIR}/version.cmake)
-ENDIF()
+#include (cmake/get_version.cmake)
+#IF(EXISTS "${PROJECT_BINARY_DIR}/version.cmake")
+#  include (${PROJECT_BINARY_DIR}/version.cmake)
+#ENDIF()
 
 ########################
 #### Doxygen target ####
index c7101d8..2134c3d 100644 (file)
@@ -1,8 +1,41 @@
-# set path to source for apps
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+if(POLICY CMP0048)
+  cmake_policy(SET CMP0048 NEW)
+endif()
+
+project (OONF C)
+
+#####################################
+#### set path to source for apps ####
+#####################################
+
 SET(APP_DATA_C_IN ${CMAKE_CURRENT_LIST_DIR}/src/main/app_data.c.in)
 SET(MAIN_C ${CMAKE_CURRENT_LIST_DIR}/src/main/main.c)
+SET(VERSION_CMAKE_IN ${CMAKE_CURRENT_LIST_DIR}/cmake/files/version.cmake.in)
 SET(VERSION_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
 
-# add include directoy
+#################################
+#### add include directories ####
+#################################
+
 include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
-include_directories(${PROJECT_BINARY_DIR})
+include_directories(${CMAKE_BINARY_DIR})
+
+###########################
+#### API configuration ####
+###########################
+
+# set cached variables
+include (${CMAKE_CURRENT_LIST_DIR}/cmake/lib_config.cmake)
+
+# include compiler flags
+include (${CMAKE_CURRENT_LIST_DIR}/cmake/cc_flags.cmake)
+
+########################################
+#### get repository tag and version ####
+########################################
+
+include (${CMAKE_CURRENT_LIST_DIR}/cmake/get_version.cmake)
+IF(EXISTS "${CMAKE_BINARY_DIR}/version.cmake")
+  include (${CMAKE_BINARY_DIR}/version.cmake)
+ENDIF()
index 5f32d6f..d0c21f8 100644 (file)
@@ -29,5 +29,5 @@ ELSEIF(NOT OONF_LIB_GIT OR NOT OONF_VERSION)
   ENDIF()
   
   message ("Git commit: ${LIB_GIT}, Git version: ${VERSION}")
-  configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/files/version.cmake.in ${PROJECT_BINARY_DIR}/version.cmake)
+  configure_file (${VERSION_CMAKE_IN} ${PROJECT_BINARY_DIR}/version.cmake)
 ENDIF()