Skip to content
Permalink
Browse files

Merge pull request #7131 from rouault/fix_linux_build_qca

QCAMacros.cmake: fix Linux build
  • Loading branch information
rouault committed Jun 1, 2018
2 parents dc9fb90 + 917a6e3 commit e4d5899bb2d07603c107e760672e47a824cbbe88
Showing with 25 additions and 10 deletions.
  1. +25 −10 cmake/QCAMacros.cmake
@@ -12,8 +12,9 @@

function(FIND_QCAOSSL_PLUGIN_CPP PLUGIN_REQUIRED)

FIND_PACKAGE(Qt5Core QUIET)
# requires Qt and QCA packages to be found
if(QT_INCLUDE_DIR AND QT_QTCORE_INCLUDE_DIR AND Qt5Core_LIBRARIES
if(Qt5Core_INCLUDE_DIRS AND Qt5Core_LIBRARIES
AND QCA_INCLUDE_DIR AND QCA_LIBRARY
AND NOT CMAKE_CROSSCOMPILING)

@@ -42,14 +43,28 @@ function(FIND_QCAOSSL_PLUGIN_CPP PLUGIN_REQUIRED)
get_target_property(_QtCore_path Qt5::Core LOCATION)
set(QCA_LINK_LIBRARIES "-DLINK_LIBRARIES:STRING=${_QtCore_path};${QCA_LIBRARY}")

try_run(RUN_RESULT COMPILE_RESULT
${CMAKE_BINARY_DIR} ${TESTCPP}
CMAKE_FLAGS "-DCMAKE_CXX_STANDARD=11"
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
"${QCA_INCLUDE_DIRECTORIES}"
"${QCA_LINK_LIBRARIES}"
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
)
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
# qtglobal.h with GCC doesn't like -fPIE added by CMAKE_POSITION_INDEPENDENT_CODE=ON
SET(CMAKE_CXX_FLAGS_BACKUP "${CMAKE_CXX_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
try_run(RUN_RESULT COMPILE_RESULT
${CMAKE_BINARY_DIR} ${TESTCPP}
CMAKE_FLAGS "-DCMAKE_CXX_STANDARD=11"
"${QCA_INCLUDE_DIRECTORIES}"
"${QCA_LINK_LIBRARIES}"
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BACKUP}")
ELSE()
try_run(RUN_RESULT COMPILE_RESULT
${CMAKE_BINARY_DIR} ${TESTCPP}
CMAKE_FLAGS "-DCMAKE_CXX_STANDARD=11"
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
"${QCA_INCLUDE_DIRECTORIES}"
"${QCA_LINK_LIBRARIES}"
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
)
ENDIF()

set(_msg "QCA OpenSSL plugin not found (run-time/unit-test dependency)")

@@ -92,7 +107,7 @@ function(FIND_QCATOOL TOOL_REQUIRED)
$ENV{OSGEO4W_ROOT}/bin
)
else()
find_program(QCATOOL_EXECUTABLE NAMES qcatool qcatool2 qcatool-qt5)
find_program(QCATOOL_EXECUTABLE NAMES qcatool-qt5 qcatool2 qcatool)
endif()

if(NOT QCATOOL_EXECUTABLE)

0 comments on commit e4d5899

Please sign in to comment.
You can’t perform that action at this time.