[CMake] Multiple PROJECT() statements

Phil Smith phil at voltage.com
Mon Nov 9 15:52:08 EST 2009


I'm working with a CMakeLists.txt file I didn't create, so this may be a dumb question, but that won't stop me from asking it!

We're using a System z cross-compiler called Dignus. I have it all working, but when we merged back into the SVN trunk, the PROJECT() statement became an issue.

CMake is invoked thus:
	cmake -DCMAKE_TOOLCHAIN_FILE:string=".\zosport.cmake" -G"Unix Makefiles" .\

zosport.cmake contains (among other things):
	SET(CMAKE_SYSTEM_NAME "IBM_ZOS")

Through some MESSAGE() statements, I've convinced myself that zosport.cmake gets loaded by the PROJECT() statement. BUT I need to customize the PROJECT() statement based on the environment. What I have now is:
	
	project(vtk-core C)
	if(CMAKE_SYSTEM_NAME STREQUAL "IBM_ZOS")
	   project(vtk-core C ASM_DIGNUS)
	endif()

This seems to work OK, but I wasn't sure if it was evil for some reason, or if there was a preferred approach.

...phsiii



More information about the CMake mailing list