Blob Blame History Raw
From e5b7ede37a9c89b0ec69ee2be7c219a79e836fe1 Mon Sep 17 00:00:00 2001
From: Hrvoje Senjan <hrvoje.senjan@gmail.com>
Date: Tue, 26 May 2015 20:43:05 +0200
Subject: [PATCH 3/5] Fix build with Qt >= 5.4.2

Or with commit 3eca75d cherry picked. Qt will now require using
-fPIC flag for it's consumers. For cmake Qt5Core exports the flag in
it's public interface, but since visibility try_compile test
does not link against any lib, we need to pass collected CMAKE_CXX_FLAGS
(which have gathered -fPIC flag at that phase)

This, for now only resolves the issue with gcc builds.
Other compilers will need to be checked.

REVIEW: 123874
---
 cmake/FindPhononInternal.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmake/FindPhononInternal.cmake b/cmake/FindPhononInternal.cmake
index 44862b5..1d98f27 100644
--- a/cmake/FindPhononInternal.cmake
+++ b/cmake/FindPhononInternal.cmake
@@ -409,7 +409,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
       file(WRITE "${_source_file}" "${_source}")
       set(_include_dirs "-DINCLUDE_DIRECTORIES:STRING=${QT_INCLUDES}")
 
-      try_compile(_compile_result ${CMAKE_BINARY_DIR} ${_source_file} CMAKE_FLAGS "${_include_dirs}" OUTPUT_VARIABLE _compile_output_var)
+      try_compile(_compile_result ${CMAKE_BINARY_DIR} ${_source_file} CMAKE_FLAGS "${CMAKE_CXX_FLAGS} ${_include_dirs}" OUTPUT_VARIABLE _compile_output_var)
 
       if(NOT _compile_result)
          message("${_compile_output_var}")
-- 
1.9.3