Objective-C compililation support with cmake and C++11
author    Benjamin Piwowarski <benja...@bpiwowar.net>
    Sun, 9 Mar 2014 07:29:27 +0000 (08:29 +0100)
committer    Benjamin Piwowarski <bpiwo...@lyx.org>
    Fri, 21 Mar 2014 01:18:09 +0000 (02:18 +0100)
commit    f115a12bf6c83de566e551dbed7735f894327017
tree    e963b5ca7d55ee52466580068f84d7c71c7776ec    tree | snapshot
parent    e83606c98a3ba2b1bdc5134e37f0f841d1b9a222  commit | diff
Objective-C compililation support with cmake and C++11

This fixes an issue whe compiling with C++11 flags on: The
objective-C clang compiler produces an error. This patch waits
avoid including specific C++ flags and uses LYX_CPP_SPECIFIC_FLAGS
to store the confliciting flags (for the moment, just C++11).

Isn't the attached patch much nicer than

http://git.lyx.org/?p=lyx.git;a=commitdiff;h=f115a12bf6c83de566e551dbed7735f894327017

The previous commit is postponing to add the --std=gnucxx11 compiler option in a fragile way until all objective c files were processed. Instead, can't it be done like this, and only override the option for the few objective-c files ?

Vincent



>From db9fedd14e3000a907eb1276493d410c850d7c96 Mon Sep 17 00:00:00 2001
From: Vincent van Ravesteijn <v...@lyx.org>
Date: Fri, 18 Apr 2014 15:59:56 +0200
Subject: [PATCH] cmake: Objective-C compilation support with clang and C++11

This fixes an issue when compiling with C++11 flags on: the
objective-C clang compiler produces an error. This patch set
the -std option to ansi for the Objective-C sources.
---
 src/support/CMakeLists.txt |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt
index ba0dfdc..1ca9926 100644
--- a/src/support/CMakeLists.txt
+++ b/src/support/CMakeLists.txt
@@ -22,6 +22,11 @@ file(GLOB support_mythes_headers 
${TOP_SRC_DIR}/src/support/mythes/*.hxx)
 file(GLOB support_linkback_sources ${TOP_SRC_DIR}/src/support/linkback/*.m*)
 file(GLOB support_linkback_headers ${TOP_SRC_DIR}/src/support/linkback/*.h)
 
+set_source_files_properties(${support_linkback_sources} 
+       ${TOP_SRC_DIR}/src/support/AppleSpeller.m
+       ${TOP_SRC_DIR}/src/support/AppleScript.m
+               PROPERTIES COMPILE_FLAGS "-ansi")
+
 list(REMOVE_ITEM support_sources
        ${TOP_SRC_DIR}/src/support/os_win32.cpp
        ${TOP_SRC_DIR}/src/support/os_unix.cpp
-- 
1.7.10.4

Reply via email to