[CMake] CMake, VS, Nsight Tegra, NDK, mixed C/C++ - applies C++ options to C source

Scott Eberline seberline at telltalegames.com
Thu Dec 15 20:36:52 EST 2016


I suspect that if the first source in a target is C++, every source in
that targets gets CMAKE_CXX_FLAGS, otherwise CMAKE_C_FLAGS. So for
now, mixing C and C++ sources in the same target is broken.

I worked around this issue by putting C sources in their own static
library, and linking that into the main shared library.

Florent, thanks for the response and especially the links. We use the
VS generator for some platforms, Ninja for Android and a couple
others. I'm tasked with improving our edit-build-debug workflow by
specifically migrating to Visual Studio for Android. We have a
modified taka-no-me toolchain file, but current employees don't know
its exact provenance so getting/merging updates is problematic. I
thought the stock toolchain file provided by the latest NDK would give
us the best results, at least until Kitware/CMake,
Microsoft/CMake/VCMDDAndroid, Nsight Tegra VS Edition and the NDK work
out their differences.


On Wed, Dec 14, 2016 at 7:57 PM, Florent Castelli
<florent.castelli at gmail.com> wrote:
> I'm pretty sure that the toolchain bundled with the NDK, made by Google,
> hasn't been tested with other generators than Ninja or possibly Make.
> Also, there are some known bugs with it, including the one related to
> CMAKE_CXX_STANDARD (see
> https://code.google.com/p/android/issues/detail?id=227915 and
> https://github.com/android-ndk/ndk/issues/222 ).
>
> I'd recommend using other generators if you want to use this toolchain or
> maybe try the Android support released with CMake 3.7.1 instead, though I
> have no idea if it's supposed to work with the Visual Studio generators
> either!
>
> /Florent


More information about the CMake mailing list