You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2015/07/10 16:35:37 UTC

qpid-proton git commit: proton-c: fix C compiler detection with _ARG1/_ARG2

Repository: qpid-proton
Updated Branches:
  refs/heads/master 246007f48 -> ed8e0144a


proton-c: fix C compiler detection with _ARG1/_ARG2

The C compiler commandline in CMake is composed by the concatenation of
CMAKE_C_COMPILER + CMAKE_C_COMPILER_ARG1 + CMAKE_C_COMPILER_ARG2.

In most use cases the two additional argument variables are empty, thus
CMAKE_C_COMPILER can be used without any noticeable difference.

The Buildroot embedded Linux build system [0], however, optionally exploits the
CMAKE_C_COMPILER_ARG1 variable to speed up the cross-compilation of CMake-based
packages using ccache. It does so by setting [1]:

  CMAKE_C_COMPILER      = /path/to/ccache
  CMAKE_C_COMPILER_ARG1 = /path/to/cross-gcc

This works fine with other CMake-based packages, but proton-c's CMakeLists.txt
calls gcc to extract the compiler version. It does so by calling
"${CMAKE_C_COMPILER} -dumpversion", without honoring the two extra arguments.
Within Buildroot with ccache enabled, this means calling
"/path/to/ccache -dumpversion", which fails with the error:

  ccache: invalid option -- 'd'

Fix the compiler check by adding the two arguments.

[0] http://buildroot.net/
[1] http://git.buildroot.net/buildroot/tree/support/misc/toolchainfile.cmake.in?id=2015.05

Signed-off-by: Luca Ceresoli <lu...@lucaceresoli.net>

This closes #46


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ed8e0144
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ed8e0144
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ed8e0144

Branch: refs/heads/master
Commit: ed8e0144a4fccec6d5270198d2dc3aa3e9b22b4b
Parents: 246007f
Author: Luca Ceresoli <lu...@lucaceresoli.net>
Authored: Fri Jul 10 10:13:47 2015 +0200
Committer: Alan Conway <ac...@redhat.com>
Committed: Fri Jul 10 10:35:22 2015 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ed8e0144/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 93449a9..8c31a89 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -218,7 +218,7 @@ if (CMAKE_COMPILER_IS_GNUCC)
     set (COMPILE_LANGUAGE_FLAGS "-std=c99")
     set (COMPILE_PLATFORM_FLAGS "-std=gnu99")
 
-    execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION
+    execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} ${CMAKE_C_COMPILER_ARG2} -dumpversion OUTPUT_VARIABLE GCC_VERSION
       OUTPUT_STRIP_TRAILING_WHITESPACE)
     if (${GCC_VERSION} VERSION_LESS "4.3.0")
       # Only a concern if contibuting code back.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org