Prevent g3log recompilation
This commit is contained in:
parent
bd45f47c47
commit
c8d826c857
|
@ -46,10 +46,22 @@ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|||
find_package(G3LOG QUIET)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
|
||||
if(NOT G3LOG_FOUND)
|
||||
ExternalProject_Add(ext-g3log
|
||||
GIT_REPOSITORY https://github.com/KjellKod/g3log
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
find_program(GIT_COMMAND git)
|
||||
if (${GIT_COMMAND} STREQUAL "GIT_COMMAND-NOTFOUND")
|
||||
ExternalProject_Add(ext-g3log
|
||||
GIT_REPOSITORY https://github.com/KjellKod/g3log
|
||||
CMAKE_ARGS -DADD_FATAL_EXAMPLE=OFF
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
else()
|
||||
ExternalProject_Add(ext-g3log
|
||||
GIT_REPOSITORY https://github.com/KjellKod/g3log
|
||||
CMAKE_ARGS -DADD_FATAL_EXAMPLE=OFF
|
||||
PATCH_COMMAND "${GIT_COMMAND}" apply < "${CMAKE_CURRENT_SOURCE_DIR}/cmake/g3log-patch.patch"
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
ExternalProject_Get_Property(ext-g3log source_dir binary_dir)
|
||||
set(G3LOG_INCLUDE_DIR "${source_dir}/src")
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
From bfe561d7eb564146811b97f7769b04373229b725 Mon Sep 17 00:00:00 2001
|
||||
From: Robin Jadoul <robin.jadoul@gmail.com>
|
||||
Date: Fri, 27 Jan 2017 17:10:17 +0100
|
||||
Subject: [PATCH] Patch
|
||||
|
||||
---
|
||||
Build.cmake | 27 ++++--------------------
|
||||
CPackLists.txt | 2 +-
|
||||
GenerateMacroDefinitionsFile.cmake | 42 +++++++++++++++++++++-----------------
|
||||
3 files changed, 28 insertions(+), 43 deletions(-)
|
||||
|
||||
diff --git a/Build.cmake b/Build.cmake
|
||||
index f266a62..9f851af 100644
|
||||
--- a/Build.cmake
|
||||
+++ b/Build.cmake
|
||||
@@ -94,27 +95,7 @@ ENDIF()
|
||||
add_library(g3logger ${SRC_FILES})
|
||||
set_target_properties(g3logger PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
- OUTPUT_NAME g3logger
|
||||
- CLEAN_DIRECT_OUTPUT 1)
|
||||
+ OUTPUT_NAME g3logger)
|
||||
target_link_libraries(g3logger ${PLATFORM_LINK_LIBRIES})
|
||||
SET(G3LOG_LIBRARY g3logger)
|
||||
|
||||
-if(ADD_BUILD_WIN_SHARED OR NOT(MSVC OR MINGW))
|
||||
- IF(NOT(CMAKE_VERSION LESS 3.4) AND MSVC)
|
||||
- set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
- ENDIF()
|
||||
- add_library(g3logger_shared SHARED ${SRC_FILES})
|
||||
- set_target_properties(g3logger_shared PROPERTIES
|
||||
- LINKER_LANGUAGE CXX
|
||||
- OUTPUT_NAME g3logger
|
||||
- CLEAN_DIRECT_OUTPUT 1)
|
||||
- IF(APPLE)
|
||||
- set_target_properties(g3logger_shared PROPERTIES MACOSX_RPATH TRUE)
|
||||
- ENDIF(APPLE)
|
||||
- target_link_libraries(g3logger_shared ${PLATFORM_LINK_LIBRIES})
|
||||
-
|
||||
- SET(G3LOG_SHARED_LIBRARY g3logger_shared)
|
||||
-endif()
|
||||
-
|
||||
-
|
||||
-
|
||||
diff --git a/CPackLists.txt b/CPackLists.txt
|
||||
index d5286d5..7f18528 100644
|
||||
--- a/CPackLists.txt
|
||||
+++ b/CPackLists.txt
|
||||
@@ -21,7 +21,7 @@
|
||||
SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output dir for libraries")
|
||||
SET(CMAKE_INSTALL_HEADERDIR include CACHE PATH "Output dir for headers")
|
||||
|
||||
- INSTALL( TARGETS g3logger g3logger_shared
|
||||
+ INSTALL( TARGETS g3logger
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
COMPONENT libraries)
|
||||
diff --git a/GenerateMacroDefinitionsFile.cmake b/GenerateMacroDefinitionsFile.cmake
|
||||
index c17b1f7..90a0143 100644
|
||||
--- a/GenerateMacroDefinitionsFile.cmake
|
||||
+++ b/GenerateMacroDefinitionsFile.cmake
|
||||
@@ -19,22 +19,26 @@
|
||||
|
||||
|
||||
|
||||
-MESSAGE("COMPILE_DEFINITIONS: ${G3_DEFINITIONS}")
|
||||
-MESSAGE("End of COMPILE_DEFINITIONS")
|
||||
-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 ${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 *************************")
|
||||
+
|
||||
+SET(GENERATED_G3_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/src/g3log/generated_definitions.hpp)
|
||||
+if (EXISTS "${GENERATED_G3_DEFINITIONS}")
|
||||
+else()
|
||||
+ MESSAGE("COMPILE_DEFINITIONS: ${G3_DEFINITIONS}")
|
||||
+ MESSAGE("End of COMPILE_DEFINITIONS")
|
||||
+ 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 ${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 *************************")
|
||||
+endif()
|
||||
--
|
||||
2.7.4
|
||||
|
Loading…
Reference in New Issue