Re: [CMake] if(ON) not considered true?

2019-01-26 Thread Bruce Stephens
The behaviour's controlled by CMP0012. (The documentation for if() doesn't seem as helpful as it could be. It does seem to suggest that ON, TRUE, etc., ought to be true, without mentioning CMP0012.) On Sat, 26 Jan 2019 at 17:22, frodak17 wrote: > > $ cmake --version > cmake version 3.13.2 > > $ c

Re: [CMake] if(ON) not considered true?

2019-01-26 Thread frodak17
$ cmake --version cmake version 3.13.2 $ cmake -S src -B testON ON is ON -- Configuring done -- Generating done -- Build files have been written to:... $ cat src/CMakeLists.txt cmake_minimum_required(VERSION 3.12) project(sample C) if(ON) message("ON is ON") endif() What version are you usin

[CMake] if(ON) not considered true?

2019-01-26 Thread Mario Emmenlauer
Dear All, I'm plagued by an issue that I do not understand. An if-statement (in a package configuration file) evaluates ON to false: IF(ON) ...some code here ENDIF() The part inside IF is *not* executed. Replacing ON by TRUE does not help, only replacing it by 1 helps. Is this correct beha