From 7f5a8283aff3c01db70f98f1e474698aa9b95462 Mon Sep 17 00:00:00 2001 From: Martin Errenst Date: Sun, 27 Aug 2017 17:05:39 +0200 Subject: [PATCH] add some comments --- CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33973c7..e53ab82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,22 @@ cmake_minimum_required(VERSION 3.7.2) project (dump-build-information) -add_executable(dummy dummy.cpp ) -set_target_properties(dummy PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS} -frecord-gcc-switches) + +# set build type to Release by default set(CMAKE_BUILD_TYPE Release) +# stuff for dummy parameter extraction +add_executable(dummy dummy.cpp) +set_target_properties(dummy PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS} -frecord-gcc-switches) +# put all the information into one header file add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/buildinformation.h COMMAND echo \"\#define USED_FLAGS \\\"\"`readelf -p .GCC.command.line ${CMAKE_CURRENT_BINARY_DIR}/dummy | grep -v -e dummy -e "-frecord-gcc-switches" | grep -e \"\\[.*\\]\" | cut -d\\] -f2- | tr -d \"\\n\"`\\\" >> ${CMAKE_CURRENT_BINARY_DIR}/buildinformation.h COMMAND echo \"\#define GIT_VERSION \\\"\"`git describe --dirty --always --tags`\\\" >> ${CMAKE_CURRENT_BINARY_DIR}/buildinformation.h COMMAND echo \"\#define USED_COMPILER \\\"\"`${CMAKE_C_COMPILER} --version | head -n1`\\\" >> ${CMAKE_CURRENT_BINARY_DIR}/buildinformation.h DEPENDS dummy ) +# add the build folder to the includes include_directories("${CMAKE_CURRENT_BINARY_DIR}") -add_executable(dump-build-information main.cpp ${CMAKE_CURRENT_BINARY_DIR}/buildinformation.h ) + +# build the "real" target +add_executable(dump-build-information main.cpp ${CMAKE_CURRENT_BINARY_DIR}/buildinformation.h)