Parsodus/cmake/g3log-patch.patch

111 lines
4.1 KiB
Diff

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