MantisBT - CMake
View Issue Details
0011123CMakeModulespublic2010-08-12 13:292010-11-09 22:57
rogerjames99 
Miguel Figueroa 
normalminorsometimes
closedfixed 
CMake-2-8 
CMake 2.8.3CMake 2.8.3 
0011123: Wrong directory order in wxWidgets_INCLUDE_DIRS
The CMake module FindwxWidgets.cmake sets up an a variable called wxWidgets_INCLUDE_DIRS which is intended to be used as the source of additional include directories to be searched by various build tools. The code that sets this up looks like this.

        # Set wxWidgets main include directory.
        IF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)
          SET(wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include)
        ELSE(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)
          DBG_MSG("wxWidgets_FOUND FALSE because WX_ROOT_DIR=${WX_ROOT_DIR} has no ${WX_ROOT_DIR}/include/wx/wx.h")
          SET(wxWidgets_FOUND FALSE)
        ENDIF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)

        # Set wxWidgets lib setup include directory.
        IF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
          LIST(APPEND wxWidgets_INCLUDE_DIRS
            ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION})
        ELSE(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
          DBG_MSG("WXWIDGET_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exists.")
          SET(wxWidgets_FOUND FALSE)
        ENDIF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)

This results in the configuration specific (unicode/non-unicode) include directories being placed after the generic include directory in the list. This needs to be the other way round and can cause "duplicate manifest resource" problems when linking applications on windows visual studio platforms. This is caused by the fact that the file "rcdefs.h" exists in both the configuration specific include dir and in the generic include dir. However the version of rcdefs.h in the generic include dir is only intended to be used if configuration specific ones are not found.

The gory details are that the generic rcdefs.h does not contain a definition for WX_MSC_FULL_VER which is used to stop wxWidgets trying to link in its own manifest resource when newer versions of the of the Microsoft Compiler that provide their own manifests are being used. A quick wxWidgets fix is to delete or rename rcdefs.h in the generic include dir.

I suggest that the two pieces of CMake code are swapped round and the SET and LIST commands modified as appropriate.

Having the include dirs in the current order may well cause other obscure problems as well.
Suggested fix (untested):

        # Set wxWidgets lib setup include directory.
        IF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
          SET(wxWidgets_INCLUDE_DIRS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}
        ELSE(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
          DBG_MSG("WXWIDGET_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exists.")
          SET(wxWidgets_FOUND FALSE)
        ENDIF(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)

        # Set wxWidgets main include directory.
        IF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)
          LIST(APPEND wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include)
        ELSE(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)
          DBG_MSG("wxWidgets_FOUND FALSE because WX_ROOT_DIR=${WX_ROOT_DIR} has no ${WX_ROOT_DIR}/include/wx/wx.h")
          SET(wxWidgets_FOUND FALSE)
        ENDIF(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)

No tags attached.
Issue History
2010-08-12 13:29rogerjames99New Issue
2010-08-29 02:23Kovarththanan RajaratnamCategoryCMake => Modules
2010-08-30 00:21Kovarththanan RajaratnamStatusnew => assigned
2010-08-30 00:21Kovarththanan RajaratnamAssigned To => Miguel Figueroa
2010-09-01 10:53Miguel FigueroaNote Added: 0022058
2010-09-01 10:53Miguel FigueroaStatusassigned => resolved
2010-09-01 10:53Miguel FigueroaFixed in Version => CMake 2.8.3
2010-09-01 10:53Miguel FigueroaResolutionopen => fixed
2010-09-10 00:12David ColeTarget Version => CMake 2.8.3
2010-11-09 22:57Philip LowmanStatusresolved => closed

Notes
(0022058)
Miguel Figueroa   
2010-09-01 10:53   
commit f46712ebe7b3fe60a02f5fc5cf08cc861287c42b
Author: Miguel A. Figueroa-Villanueva <miguelf@ieee.org>
Date: Wed Sep 1 10:40:01 2010 -0400

    BUG 0011123: Generic include dir should come after config specific one.