Allow wrapped build directory around OONF directory
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Wed, 9 May 2018 12:54:29 +0000 (14:54 +0200)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Wed, 9 May 2018 12:54:29 +0000 (14:54 +0200)
CMakeListsGlobal.cmake
cmake/get_version.cmake

index 794a3b2..c7101d8 100644 (file)
@@ -1,7 +1,8 @@
 # set path to source for apps
-SET(APP_DATA_C_IN ${CMAKE_CURRENT_SOURCE_DIR}/src/main/app_data.c.in)
-SET(MAIN_C ${CMAKE_CURRENT_SOURCE_DIR}/src/main/main.c)
+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_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 # add include directoy
-include_directories(include)
+include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
 include_directories(${PROJECT_BINARY_DIR})
index bd23d4d..5f32d6f 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/cmake
 IF(EXISTS "${CMAKE_SOURCE_DIR}/version.cmake")
   # preconfigured version data
-  FILE (COPY ${CMAKE_SOURCE_DIR}/version.cmake DESTINATION ${PROJECT_BINARY_DIR})
+  FILE (COPY ${VERSION_CMAKE_DIR}/version.cmake DESTINATION ${PROJECT_BINARY_DIR})
 ELSEIF(NOT OONF_LIB_GIT OR NOT OONF_VERSION)
   # look for git executable
   SET(found_git false) 
@@ -12,12 +12,12 @@ ELSEIF(NOT OONF_LIB_GIT OR NOT OONF_VERSION)
   IF(NOT ${found_git} STREQUAL "found_git-NOTFOUND")
     # get git description WITH dirty flag
     execute_process(COMMAND git describe --always --long --tags --dirty --match "v[0-9]*"
-      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+      WORKING_DIRECTORY ${VERSION_CMAKE_DIR}
       OUTPUT_VARIABLE LIB_GIT OUTPUT_STRIP_TRAILING_WHITESPACE)
 
     # get git description WITH dirty flag
     execute_process(COMMAND git describe --abbrev=0 --match "v[0-9]*"
-      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} RESULT_VARIABLE result
+      WORKING_DIRECTORY ${VERSION_CMAKE_DIR} RESULT_VARIABLE result
       OUTPUT_VARIABLE VERSION_TAG OUTPUT_STRIP_TRAILING_WHITESPACE)
 
     IF(NOT ${result} STREQUAL "0")
@@ -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_SOURCE_DIR}/cmake/files/version.cmake.in ${PROJECT_BINARY_DIR}/version.cmake)
+  configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/files/version.cmake.in ${PROJECT_BINARY_DIR}/version.cmake)
 ENDIF()