[cmake-developers] [CMake 0012918]: CMake wrongly generates x64 VC10 project files when Boost default stage folder is used for x32

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 30 00:53:12 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=12918 
====================================================================== 
Reported By:                TTAN
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12918
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2012-01-30 00:53 EST
Last Modified:              2012-01-30 00:53 EST
====================================================================== 
Summary:                    CMake wrongly generates x64 VC10 project files when
Boost default stage folder is used for x32
Description: 
I've got two builds of boost libraries for x32 and x64, being staged into \stage
and \vc10x64_stage respectively.

with this command for the attached CMakeLists.txt below:
cmake ../.. -G"Visual Studio 10 Win64"
it correctly find the \vc10x64_stage folder, e.g.:

-- Check for working C compiler using: Visual Studio 10 Win64
-- Check for working C compiler using: Visual Studio 10 Win64 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10 Win64
-- Check for working CXX compiler using: Visual Studio 10 Win64 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Using 64bit compiler
-- Using 64bit Boost libs at X:/ttan/open-source/boost/trunk/vc10x64_stage/lib
for host&machine exes
-- Boost version: 1.49.0
-- Found the following Boost libraries:
--   system
--   date_time
--   thread
-- Using 64bit Boost libs at X:/ttan/open-source/boost/trunk/vc10x64_stage/lib
for test executables
-- Using 64bit Boost libs at X:/ttan/open-source/boost/trunk/vc10x64_stage/lib
for pyhostlink lib
-- Boost version: 1.49.0
-- Found the following Boost libraries:
--   system
--   date_time
--   thread
--   python
-- Found PythonLibs: C:/Python27/libs/python27.lib
-- Configuring done
-- Generating done
-- Build files have been written to: D:/H/src/build

but fails to write into element <AdditionalDependencies> in the .vcxproj files,
which actually refer to the libs under /stage.

Renaming /stage to something else solves the problem 




Steps to Reproduce: 
- get a copy of boost library
- get it built and staged into folder /stage with VC10 x32,  (to save time just
pick one libray, say filesystem)
- get it built and staged into folder /vc10x64_stage with VC10 x64, (to save
time just pick one libray, say filesystem)
- modify the attached CMakelists.txt to point to teh boost folder
- run cmake -G"Visual Studio 10 Win64" under VC10 x64 command Prompt console
- check the  <AdditionalDependencies> tags in the generated vcxproj file, where
 the boost.system lib file is wrongly set to the one in /stage  not
/vc10x64_stage 



 

Additional Information: 
CMakelists.txt for test:

set(bitness 32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  set(bitness 64)
endif()

# compiler options
if(CMAKE_COMPILER_IS_GNUCXX)
  #add_definitions(-std=gnu++0x -time -o2 -wall -w -wshadow -wpointer-arith
-wcast-qual -winline -werror)
  add_definitions(-std=gnu++0x -time -O2 -DBOOST_LIB_DIAGNOSTIC)
  #add_definitions(-std=gnu++0x -shared -O2 -o pyhostlink.so  pyhostlink.cpp
-lboost_python -I/usr/include/python2.7)
endif()
if(MSVC)
    #add_definitions(/EHsc /O2 /bigobj /Bt /MP1 /wd4003 /DBOOST_LIB_DIAGNOSTIC)
    add_definitions(/EHsc /O2 /bigobj /Bt /MP1 /wd4003 /DBOOST_LIB_DIAGNOSTIC
/DBOOST_PYTHON_STATIC_LIB)
endif()

# finding boost
if(WIN32)   # Operating System =  Windows, including Cygwin
    set(my_boost_root "X:/ttan/open-source/boost/trunk")
    set(BOOST_ROOT ${my_boost_root})  
    
    # visual C++
    if(MSVC)
        # lib for vc++ x32
        if(bitness EQUAL 32)
            set(my_stage_root stage)
        endif()
        
        # lib for vc++ x64 
        if(bitness EQUAL 64)
            set(my_stage_root vc10x64_stage)
        endif()    
    endif(MSVC)
    
    # compiler is a variant of g++
    if(MINGW)         
        # lib for gcc x32
        if(bitness EQUAL 32)
            set(my_stage_root gcc_stage)
        endif()
        
        # lib for gcc x64 
        if(bitness EQUAL 64)
            set(my_stage_root gccx64_stage)
        endif()
    endif(MINGW)

    set(Boost_LIBRARY_DIR "${my_boost_root}/${my_stage_root}/lib")
    message(STATUS "Using ${bitness}bit Boost libs at ${Boost_LIBRARY_DIR} for
pyhostlink lib")
endif(WIN32)

if(UNIX) # Operating System = all UNIX-like OS's, including Apple OS X and
Cygwin.
  set(Boost_INCLUDE_DIR /usr/local/include)
  set(Boost_LIBRARY_DIR /usr/local/lib)
  #set(Boost_ADDITIONAL_VERSIONS "1.48" "1.48.0")

  find_package(Threads) #for pthread
endif(UNIX)

# setting Boost usage
set(Boost_USE_STATIC_LIBS        ON)
set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME     OFF)
find_package(Boost COMPONENTS system date_time thread python REQUIRED)

# seeting python usage
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
link_directories(${PYTHON_LIBRARIES})

if(Boost_FOUND)
  # setup boost dependencies
  include_directories(${Boost_INCLUDE_DIR})
  link_directories(${Boost_LIBRARY_DIR})

  set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)  

  # build machine 
  set(MACHINE_SRC_LIST pyhostlink.cpp)
  set(hostlink_lib_name pyhostlink)
  add_library(${hostlink_lib_name} SHARED ${MACHINE_SRC_LIST})
  set_target_properties(${hostlink_lib_name} PROPERTIES PREFIX "")
  if(MSVC)
   set_target_properties(${hostlink_lib_name} PROPERTIES OUTPUT_NAME
"${hostlink_lib_name}.pyd")   
  endif(MSVC)
  target_link_libraries(${hostlink_lib_name} ${Boost_LIBRARIES}
${PYTHON_LIBRARIES})  
  #install(TARGETS ${machine_exe_name}  ${host_exe_name}
  #  RUNTIME DESTINATION bin
  #  LIBRARY DESTINATION lib
  #  ARCHIVE DESTINATION lib
  #)
endif()


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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-01-30 00:53 TTAN           New Issue                                    
======================================================================




More information about the cmake-developers mailing list