Am Freitag 18 Dezember 2009 19:34:12 schrieb Eric LaFranchi: > > use > > project(test NONE) > > to not enable any language. Then CMAKE_SYSTEM_NAME should be defined. > > OTOH, you may want to think again about your approach of doing things. > > It makes it impossible to change compilers on a platform without > > changing the CMakeList.txt file. What exactly is your use-case for the > > above stuff? > > > > HS > > We build on multiple platforms and some of the platforms have more than > one C/C++ compiler installed. In the CMakeLists.txt we set the compiler > and flags for each platform by switching on the platform based on > CMAKE_SYSTEM_NAME. Can you suggest other mechanisms for doing this type > of operation?
You have several options: 1. before calling cmake, include a set of environment variables that are recognized by cmake to configure for that toolchain. This can be the same name on each architecture, e.g.: export CC=cc1 export CPPFLAGS=-DFOO_X export CFLAGS=-cc1flag_a bash$ source /some/path/default-toolchain.sh bash$ cmake ../myproject 2. use a toolchain specific wrapper for cmake. Like for (1), this script can have the same name on each platform, e.g. #!/bin/sh exec cmake -DCMAKE_C_COMPILER=cc1 "$@" 3. a combination of (1) and (2) The good thing: (1) is already the default use case of cmake when using MSVC7/8/9/10. Additionally, keeping this information out of the CMakeLists.txt scales better, especially when you want to use different compilers for one platform. The flags to make the software compile for a specific compiler or platform still belongs to the CMakeLists.txt, though. HS _______________________________________________ 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