Skip to content

Commit

Permalink
Merge pull request #7131 from rouault/fix_linux_build_qca
Browse files Browse the repository at this point in the history
QCAMacros.cmake: fix Linux build
  • Loading branch information
rouault authored Jun 1, 2018
2 parents dc9fb90 + 917a6e3 commit e4d5899
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions cmake/QCAMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)")

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e4d5899

Please sign in to comment.