Updated for removing temporary cmake files with "make clean-cmake-files"

This commit is contained in:
Kjell Hedstrom 2015-07-16 00:27:17 -06:00
parent 78103cb415
commit 94db9bb4db
4 changed files with 40 additions and 17 deletions

2
.gitignore vendored
View File

@ -6,5 +6,5 @@ nbproject/*
build_clang
build_travis
gtest-1.7.0
definitions.hpp
generated_definitions.hpp
*~

View File

@ -53,6 +53,12 @@ set(CMAKE_BUILD_TYPE Release)
project (g3log)
MESSAGE("Run 'make clean-cmake-files' to purge your build directory of CMake generated cache files")
add_custom_target(clean-cmake-files
COMMAND ${CMAKE_COMMAND} -P ${g3log_SOURCE_DIR}/CleanAll.cmake
)
# Detect 64 or 32 bit

13
CleanAll.cmake Normal file
View File

@ -0,0 +1,13 @@
set(cmake_generated ${CMAKE_BINARY_DIR}/CMakeCache.txt
${CMAKE_BINARY_DIR}/cmake_install.cmake
${CMAKE_BINARY_DIR}/Makefile
${CMAKE_BINARY_DIR}/CMakeFiles
)
foreach(file ${cmake_generated})
if (EXISTS ${file})
MESSAGE("Removing: ${file}")
file(REMOVE_RECURSE ${file})
endif()
endforeach(file)

View File

@ -1,28 +1,32 @@
# Prerequisite : Options.cmake should run first
SET(HEADER "/** ==========================================================================
* Original code made by Robert Engeln. Given as a PUBLIC DOMAIN dedication for
* the benefit of g3log. It was originally published at:
* http://code-freeze.blogspot.com/2012/01/generating-stack-traces-from-c.html
* 2014-2015: adapted for g3log by Kjell Hedstrom (KjellKod).
*
* This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
*
* For more information see g3log/LICENSE or refer refer to http://unlicense.org
* ============================================================================*/")
* 2015 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
* with no warranties. This code is yours to share, use and modify with no
* strings attached and no restrictions or obligations.
*
* For more information see g3log/LICENSE or refer refer to http://unlicense.org
* ============================================================================*/")
MESSAGE("COMPILE_DEFINITIONS: ${G3_DEFINITIONS}")
MESSAGE("End of COMPILE_DEFINITIONS")
FILE(WRITE g3log/definitions.hpp "// AUTO GENERATED MACRO DEFINITIONS FOR G3LOG\n\n")
FILE(APPEND g3log/definitions.hpp ${HEADER}"\n")
FILE(APPEND g3log/definitions.hpp "#pragma once\n\n")
SET(GENERATED_G3_DEFINITIONS src/g3log/generated_definitions.hpp)
file(REMOVE ${GENERATED_G3_DEFINITIONS} )
FILE(WRITE ${GENERATED_G3_DEFINITIONS} "// AUTO GENERATED MACRO DEFINITIONS FOR G3LOG\n\n")
FILE(APPEND ${GENERATED_G3_DEFINITIONS} ${HEADER}"\n")
FILE(APPEND ${GENERATED_G3_DEFINITIONS} "#pragma once\n\n")
FILE(APPEND ${GENERATED_G3_DEFINITIONS} "// CMake induced definitions below. See g3log/Options.cmake for details.\n\n")
FOREACH(definition ${G3_DEFINITIONS} )
FILE(APPEND g3log/definitions.hpp "#define ${definition}\n")
FILE(APPEND ${GENERATED_G3_DEFINITIONS} "#define ${definition}\n")
ENDFOREACH(definition)
MESSAGE("Generated ${GENERATED_G3_DEFINITIONS}")
file(READ ${GENERATED_G3_DEFINITIONS} generated_content)
MESSAGE("******************** START *************************")
MESSAGE(${generated_content})
MESSAGE("******************** END *************************")