[CMake] Specifying compilers?

Jason T. Slack-Moehrle slackmoehrle at gmail.com
Wed Aug 22 19:04:49 EDT 2012


Hello,

I am trying to use come C++v11 features and am trying to get the
compiling to work.

The error:
[jtsm at server]$ ./build.sh
-- The C compiler identification is Clang 4.0.0
-- The CXX compiler identification is Clang 4.0.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found OpenGL: /System/Library/Frameworks/OpenGL.framework
-- Found GLUT: -framework GLUT
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jtsm/Dropbox/Projects/All-Stars
Scanning dependencies of target All-Stars
[100%] Building CXX object CMakeFiles/All-Stars.dir/main.cpp.o
/Users/jtsm/Dropbox/Projects/All-Stars/main.cpp:4:10: fatal error:
'thread' file not found
#include <thread>
         ^
1 error generated.
make[2]: *** [CMakeFiles/All-Stars.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/All-Stars.dir/all] Error 2
make: *** [all] Error 2

[jtsm at server ]$ clang -v
Apple clang version 4.0 (tags/Apple/clang-421.10.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.0.0
Thread model: posix
[jtsm at server ]$ clang++ -v
Apple clang version 4.0 (tags/Apple/clang-421.10.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.0.0
Thread model: posix

in my 'build.sh' I have:

#/bin/bash

CC=clang CXX=clang++ cmake .

make


in my CMakeList.txt:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)

SET( TEST_VERSION "0.1+devel" )
SET( PROJECT_NAME "All-Stars" )

SET( CMAKE_INCLUDE_CURRENT_DIR TRUE )

SET( CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++" )

PROJECT( ${PROJECT_NAME} )

find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})

find_package(GLUT REQUIRED)
include_directories(${GLUT_INCLUDE_DIR})

SET( CORE_SOURCE_FILES "main.cpp" )

SET( CORE_SOURCE_HEADERS "" )

add_executable( ${PROJECT_NAME} ${CORE_SOURCE_FILES} )

target_link_libraries( ${PROJECT_NAME} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES})

Can anyone shed some light on what I am doing wrong?

-Jason


More information about the CMake mailing list