Cross-compiling: Version readout fixed (#189)

* Cross-comoiling: Version readout fixed
Test.cmake: Path handling consistent

* ".x" syntax in variable checking removed

* Use G3LOG_DEBUG also in linux-specific code

* Fixed error when linux and shared library is on

* Fixed linux/windows shared lib handling: FATAL_ERROR for wrong cmake
version and no message in linux
This commit is contained in:
Andreas Schönle 2017-05-17 22:24:11 +02:00 committed by Kjell Hedström
parent 769feca4d0
commit ac37076327
4 changed files with 10 additions and 14 deletions

View File

@ -107,10 +107,12 @@ ENDIF()
SET(G3LOG_LIBRARY g3logger)
IF( G3_SHARED_LIB )
IF(NOT(CMAKE_VERSION LESS 3.4))
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
ELSE()
message( FATAL "Need CMake version >=3.4 to build shared windows library!" )
IF( WIN32 )
IF(NOT(CMAKE_VERSION LESS 3.4))
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
ELSE()
message( FATAL_ERROR "Need CMake version >=3.4 to build shared windows library!" )
ENDIF()
ENDIF()
ADD_LIBRARY(${G3LOG_LIBRARY} SHARED ${SRC_FILES})
ELSE()

View File

@ -71,8 +71,8 @@ endif()
SET(MAJOR_VERSION 1)
IF (${VERSION}.x STREQUAL ".x")
IF (MSVC)
IF ( NOT VERSION )
IF ( "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows" )
message("windows: Extracting git software version")
execute_process(COMMAND powershell "(git rev-list --branches HEAD | Measure-Object -line).Lines" OUTPUT_VARIABLE GIT_VERSION WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
ELSE()

View File

@ -74,7 +74,7 @@
add_library(tester_sharedlib SHARED ${DIR_UNIT_TEST}/tester_sharedlib.h ${DIR_UNIT_TEST}/tester_sharedlib.cpp)
target_link_libraries(tester_sharedlib ${G3LOG_LIBRARY})
add_executable(test_dynamic_loaded_shared_lib ../test_main/test_main.cpp ${DIR_UNIT_TEST}/test_linux_dynamic_loaded_sharedlib.cpp)
add_executable(test_dynamic_loaded_shared_lib ${g3log_SOURCE_DIR}/test_main/test_main.cpp ${DIR_UNIT_TEST}/test_linux_dynamic_loaded_sharedlib.cpp)
set_target_properties(test_dynamic_loaded_shared_lib PROPERTIES COMPILE_DEFINITIONS "GTEST_HAS_TR1_TUPLE=0")
set_target_properties(test_dynamic_loaded_shared_lib PROPERTIES COMPILE_DEFINITIONS "GTEST_HAS_RTTI=0")
target_link_libraries(test_dynamic_loaded_shared_lib ${G3LOG_LIBRARY} -ldl gtest_170_lib )

View File

@ -11,12 +11,6 @@
#include <g3log/logworker.hpp>
#include "tester_sharedlib.h"
#if (defined(CHANGE_G3LOG_DEBUG_TO_DBUG))
#define DEBUG_NAME DBUG
#else
#define DEBUG_NAME DEBUG
#endif
struct RuntimeLoadedLib : public SomeLibrary {
RuntimeLoadedLib() {
@ -25,7 +19,7 @@ struct RuntimeLoadedLib : public SomeLibrary {
}
~RuntimeLoadedLib() {
LOG(DEBUG_NAME) << "Library destroyed";
LOG(G3LOG_DEBUG) << "Library destroyed";
}
void action() {