[CMake] CMake incorrectly passes linker flags to ar

Brad King brad.king at kitware.com
Mon Jan 11 12:48:39 EST 2016


On 01/11/2016 11:53 AM, Alan Burlison wrote:
> ISTR part of the issue at least was in the bowels of the CMake FindJNI 
> module, that makes extensive use of CMAKE_SYSTEM_PROCESSOR.

That is not representative of CMake in general.  If there is a better
way for FindJNI to get the information it needs then it would be great
to have needed changes contributed.

> The Hadoop CMakeLists.txt files don't use a PROJECT() command. The CMake 
> docs say if you don't do so then an implicit PROJECT() is added that 
> selects the C & C++ languages, is that done before processing any other 
> commands in CMakeLists.txt?

Yes, the implicit project() call is inserted on line zero of the top-level
CMakeLists.txt file.  This feature is meant to help people get started
with hello-world projects and is not meant for use by mature projects.
The top-level CMakeLists.txt file of a "real" project should start with

 cmake_minimum_required(VERSION ...)
 project(MyProject)

Flags affecting the target architecture are typically expected to be
provided by the user calling CMake, not by project code, and so will
be set before languages are enabled by this project() command.

-Brad



More information about the CMake mailing list