[cmake-developers] [CMake 0014961]: CMake doesn't warn about function redefinition

Mantis Bug Tracker mantis at public.kitware.com
Thu Jun 5 16:58:14 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14961 
====================================================================== 
Reported By:                vitaut
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14961
Category:                   (No Category)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-06-05 16:58 EDT
Last Modified:              2014-06-05 16:58 EDT
====================================================================== 
Summary:                    CMake doesn't warn about function redefinition
Description: 
CMake doesn't prevent or produce a warning/error when redefining functions which
is very error prone. For example introducing a conflicting function definition
in a subproject can easily break the build of the main project.

Steps to Reproduce: 
Consider the following test project:

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
function(test)
  message("parent")
endfunction()
add_subdirectory(sub)
test()

sub/CMakeLists.txt:

function(test)
  message("sub")
endfunction()

Running cmake prints "sub" which means that the test function defined in
sub/CMakeLists.txt is used and not in CMakeLists.txt. No warnings or error
message is produced.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-06-05 16:58 vitaut         New Issue                                    
======================================================================



More information about the cmake-developers mailing list