[CMake] IF(TARGET var) fails on cmake 2.6.0

Marcel Loose loose at astron.nl
Wed Jul 7 07:45:47 EDT 2010


Hi all,

Today I stumbled upon the following problem.
On a somewhat older machine we have cmake 2.6-patch 0 installed. 
Up till now I had done my development on a machine running cmake
2.6-patch 2, and everything was working fine, also with newer versions
of cmake (2.6-patch 4, 2.8.1, etc).

With cmake 2.6-patch 0, however, I get the following error:

CMake Error at CMake/LofarPackage.cmake:83
(if):                            
  if had incorrect arguments: NOT TARGET ${_pkg} (Unknown
arguments         

specified).                                                             
 
Call Stack (most recent call
first):                                        
  CMakeLists.txt:31
(lofar_add_package)                                     

It seems that support for IF(TARGET var) was added in one of the patch
releases. Now I don't want to debate whether adding new features to
patch releases is good or bad practice. 

My pragmatic question is: is there a different way to check whether a
target has already been defined, or not. If not, should I change my
cmake_minimum_required() line to read VERSION 2.6.2?

Best regards,
Marcel Loose.




More information about the CMake mailing list