SET(CMAKE_C_COMPILER "clang") SET(CMAKE_CXX_COMPILER "clang++")
Those really will have no effect. If you want to use Clang, then set the CC and CXX environment variables BEFORE running cmake for the first time. By the time CMake gets to those lines the C and C++ compilers are already set and can not be changed. ___________________________________________________________ Mike Jackson Principal Software Engineer BlueQuartz Software Dayton, Ohio [email protected] www.bluequartz.net On Aug 15, 2012, at 5:52 PM, Jason T. Slack-Moehrle wrote: > Hi Benjamin, > > I modified my CMakeLists.txt file a bit: > > PROJECT(Test) > > SET(TEST_VERSION 0.1+devel) > SET(PROJECT_NAME test) > CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) > SET(CMAKE_INCLUDE_CURRENT_DIR TRUE) > > SET(CMAKE_C_COMPILER "clang") > SET(CMAKE_CXX_COMPILER "clang++") > > SET(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++") > > IF(APPLE) > find_package(OpenGL REQUIRED) > include_directories(${OPENGL_INCLUDE_DIR}) > > INCLUDE_DIRECTORIES ( /System/Library/Frameworks ) > FIND_LIBRARY(COCOA_LIBRARY Cocoa) > FIND_LIBRARY(GLUT_LIBRARY GLUT ) > FIND_LIBRARY(OpenGL_LIBRARY OpenGL ) > MARK_AS_ADVANCED (COCOA_LIBRARY > GLUT_LIBRARY > OpenGL_LIBRARY) > SET(EXTRA_LIBS ${COCOA_LIBRARY} ${GLUT_LIBRARY} ${OpenGL_LIBRARY}) > ENDIF (APPLE) > #target_link_libraries(Test ${EXTRA_LIBS}) > > add_executable(Test main.cpp) > >> for OpenGL, better use the shipped find module (see "cmake --help-module >> FindOpenGL"): >> >> find_package(OpenGL REQUIRED) >> include_directories(${OPENGL_INCLUDE_DIR}) >> [...] >> target_link_libraries(Test ${OPENGL_LIBRARIES}) > > I get errors: > > $ make > Scanning dependencies of target Test > [100%] Building CXX object CMakeFiles/Test.dir/main.cpp.o > Linking CXX executable Test > Undefined symbols for architecture x86_64: > "_glClear", referenced from: > display() in main.cpp.o > "_glViewport", referenced from: > reshape(int, int) in main.cpp.o > "_glutCreateWindow", referenced from: > _main in main.cpp.o > "_glutDisplayFunc", referenced from: > _main in main.cpp.o > "_glutIdleFunc", referenced from: > _main in main.cpp.o > "_glutInit", referenced from: > _main in main.cpp.o > "_glutInitDisplayMode", referenced from: > _main in main.cpp.o > "_glutInitWindowSize", referenced from: > _main in main.cpp.o > "_glutMainLoop", referenced from: > _main in main.cpp.o > "_glutPostRedisplay", referenced from: > idle() in main.cpp.o > "_glutReshapeFunc", referenced from: > _main in main.cpp.o > "_glutSwapBuffers", referenced from: > display() in main.cpp.o > ld: symbol(s) not found for architecture x86_64 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > make[2]: *** [Test] Error 1 > make[1]: *** [CMakeFiles/Test.dir/all] Error 2 > make: *** [all] Error 2 > >> Furthermore, I suggest using an out-of-source build. I cannot answer your >> other question. On my Linux system I do not get these error messages. > > Can you tell me what you mean by 'out-of-source build"? > > -Jason > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
