[cmake-developers] [CMake 0014646]: Test for TARGET return TRUE if it exists rather than if it has been built or imported.

Mantis Bug Tracker mantis at public.kitware.com
Thu Dec 12 23:29:30 EST 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14646 
====================================================================== 
Reported By:                hobbes1069
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14646
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-12-12 23:29 EST
Last Modified:              2013-12-12 23:29 EST
====================================================================== 
Summary:                    Test for TARGET return TRUE if it exists rather than
if it has been built or imported.
Description: 
I believe this is a regression from 2.8.11. I had this working although there
have been changes to the cmake configuration so it's impossible to be sure.

I have a project that uses wxWidgets. Because wxWidgets uses a custom script to
generate linker and include flags it must be built before my project can even be
configured. I worked around this by adding a bootstrap option that will download
and build static libraries of wxWidgets, then cmake/make is run again after the
needed configuration script is available.

Ever since updating to 2.8.12 (currently 2.8.12.1), cmake skips the
configuration and build of wxWidgets.

Additional Information: 
Here is a summarized version of the logic in my cmake configuration but also
includes some debug info I added to verify the problem:
if(BOOTSTRAP_WXWIDGETS)
    message(STATUS "Adding wxWidgets build target...")
    include(cmake/BuildWxWidgets.cmake)
    if(TARGET wxWidgets)
        message(STATUS "wxWidgets target exists.")
    endif()
endif(BOOTSTRAP_WXWIDGETS)

The externalproject target is added in BuildWxWidgets.cmake. Per the
documentation "if(TARGET wxWidgets)" should only test TRUE once the target is
built but the cmake output includes output indicating it's testing TRUE once the
target is added.

For reference, here is the contents of BuildWxWidgets.cmake:
set(WXWIDGETS_TARBALL "wxWidgets-2.9.4")

include(ExternalProject)
ExternalProject_Add(wxWidgets
    URL http://downloads.sourceforge.net/wxwindows/${WXWIDGETS_TARBALL}.tar.bz2
    BUILD_IN_SOURCE 1
    INSTALL_DIR external/dist
    CONFIGURE_COMMAND ./configure --disable-shared
--prefix=${CMAKE_BINARY_DIR}/external/dist
    BUILD_COMMAND $(MAKE)
    INSTALL_COMMAND $(MAKE) install
)
set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config")
set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc")
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-12-12 23:29 hobbes1069     New Issue                                    
======================================================================




More information about the cmake-developers mailing list