Hi Brad:
I am trying to conform to your strong advice that for the top-level
CMakeLists.txt file, the cmake_minimum_required(...) command should
come before the project(...) command.
However, I have just encountered a problem with that approach where
I want to specify a different minimum version for Linux compared
to other platforms. The only way you can detect Linux that I
am aware of is with the test
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
but it turns out for some reason that CMAKE_SYSTEM_NAME is not defined before
the project
command is executed.
To break this "chicken and egg" issue, I have tried the following:
# First call to project so that CMAKE_SYSTEM_NAME is defined
project(plplot NONE)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
else(CMAKE_SYSTEM_NAME STREQUAL "Linux")
cmake_minimum_required(VERSION 3.2.2 FATAL_ERROR)
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# "Real" call to project
project(plplot C)
This double call of project (with the first one enabling no languages)
appears to work without any obvious complaints, but can you forsee any
problems with this approach, i.e., is this the way you would recommend
to choose minimum versions depending on platform?
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake