tewarfel / wrapitk

Automatically exported from code.google.com/p/wrapitk
0 stars 0 forks source link

CMake config files don't follow CMake rules #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In a project that needs WrapITK,  add

find_package(WrapITK REQUIRED)
find_package(WrapITK REQUIRED)

2. Run CMake as per usual

What is the expected output? 

No output except expected CMake messages.

What do you see instead?

A CMake configuration error message saying that the same custom target has been 
created twice by WrapITKConfig.cmake.

2 things should happen when a project creates the CMake files that allows other 
CMake-built programs to find and use their library/headers.

1. A <package-name>Config.cmake file should be installed with libraries, 
headers, etc.
2. A Use<package-name>.cmake file should also be installed " "

The normal idiom in CMake is then

find_package(<package_name> REQUIRED)
if(<package_name>_FOUND)
include(${<package_name>_USE_FILE})
endif()

Instead, WrapITK just has a config file; it includes  all the commands that 
should be in the UseWrapITK.cmake.

Furthermore, the WrapITKConfig.cmake file is not idempotent -- it doesn't check 
if it has already been included, and adds the same custom targets more than 
once.

What version of the product are you using? On what operating system?

This is the WrapITK version that comes in the Insight 3.20 library.  I found 
the problem on OS X 10.6 but the problem is platform-independent.

Please provide any additional information below.

Original issue reported on code.google.com by chaircru...@gmail.com on 22 Sep 2010 at 5:57