brucelane / android-cmake

Automatically exported from code.google.com/p/android-cmake
0 stars 0 forks source link

try_compile fix causes new issues #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Thank you guys for your efforts developing this toolchain file, and thanks for 
your recent update supporting ndk r7.  With the update, I was able to make a 
KiwiViewer build using ndk-r7b, which includes a build of vtk, ves, and curl, 
and links with gnustl and glesv2.

I did run into a problem with try_compile though.  Here is a simple 
CMakeLists.txt that demonstrates the problem:

cmake_minimum_required(VERSION 2.8.6)
project(MyTest)

include(TestForSTDNamespace)

if (NOT CMAKE_STD_NAMESPACE)
  message(FATAL_ERROR "Failed to find STD namespace")
endif()

This fails for me when using the android toolchain file. If you look at 
CMakeFiles/CMakeError.log in the build directory, you'll see that the try 
compile command invokes the compiler without the required system include 
directories:

/path/to/android-ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-
x86/bin/arm-linux-androideabi-g++    
--sysroot=/source/android/android-ndk-r7b/platforms/android-8/arch-arm 
-fsigned-char -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fPIC -Wno-psabi 
-frtti -fexceptions     -o 
CMakeFiles/cmTryCompileExec.dir/TestForSTDNamespace.cxx.o -c 
/opt/local/share/cmake-2.8/Modules/TestForSTDNamespace.cxx
/opt/local/share/cmake-2.8/Modules/TestForSTDNamespace.cxx:1:16: error: list: 
No such file or directory
/opt/local/share/cmake-2.8/Modules/TestForSTDNamespace.cxx: In function 'int 
main(int, char**)':
/opt/local/share/cmake-2.8/Modules/TestForSTDNamespace.cxx:4: error: 'list' is 
not a member of 'std'

If I remove the try_compile fix from the toolchain file then everything works 
for me.  I removed the lines:

if( PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
 # all needed flags and variables are already inherited from the parent project
 return()
endif()

Original issue reported on code.google.com by pat.mar...@kitware.com on 4 Mar 2012 at 4:49

GoogleCodeExporter commented 8 years ago
Workaround was needed for Android x86.
Better solution is committed. Now your sample successfully detects STD 
namespace.

Original comment by andrey.k...@itseez.com on 4 Mar 2012 at 8:32