2012-10-03 14 views
6

के साथ CLang के साथ संकलित बूस्ट ढूँढना मैंने rubenvb के क्लांग बिल्ड का उपयोग कर विंडोज पर बूस्ट 1.51.0 संकलित किया है। बजना साथसीएमके

bootstrap mingw 
... compiling b2 using mingw... 

और फिर मैंने संकलित पुस्तकालयों: मैं वास्तव में का उपयोग कर b2 MinGW संकलित

b2 toolset=clang stage --stagedir=. --build-type=complete --with-regex ... 

वैसे, भले ही मैं निर्दिष्ट --build-type=complete lib निर्देशिका में कोई DLLs देखते हैं, लेकिन मैंने पढ़ा है कहीं कहीं भी क्लांग को विंडोज़ पर जोड़ने के साथ समस्या है ताकि यह कारण हो। वैसे भी स्थिर पुस्तकालय मेरे लिए ठीक हैं। अगर मैं कमांड लाइन सब कुछ काम करता है से बजना के साथ कुछ संकलन

libboost_regex-clang31-1_51.lib 
libboost_regex-clang31-d-1_51.lib 
libboost_regex-clang31-mt-1_51.lib 
libboost_regex-clang31-mt-d-1_51.lib 
libboost_regex-clang31-mt-s-1_51.lib 
libboost_regex-clang31-mt-sd-1_51.lib 
libboost_regex-clang31-s-1_51.lib 
libboost_regex-clang31-sd-1_51.lib 

अब,: मैं %BOOST_ROOT%\lib में इन फ़ाइलों को मिला है। समस्या तब दिखाती है जब मैं सीएमके को बूस्ट पुस्तकालयों को खोजने की कोशिश करता हूं: यह बस उन्हें नहीं मिला। MinGW (और एक MinGW बूस्ट की संकलित संस्करण) यह काम करता है का उपयोग कर इसे बिल्डिंग

cmake_minimum_required (VERSION 2.8) 
project(ccc) 

# Setting/unsetting this does not change anything. 
set(Boost_USE_STATIC_LIBS ON) 

find_package(Boost COMPONENTS regex REQUIRED) 

include_directories(${Boost_INCLUDE_DIR}) 
link_directories(${Boost_LIBRARY_DIRS}) 

add_executable(ccc main.cpp) 

target_link_libraries(ccc 
    ${Boost_REGEX_LIBRARY} 
    ) 

: मैं इस CMakeFiles.txt साथ की कोशिश की। अगर मैं (setted होने CC=clang, CXX=clang++ और BOOST_ROOT=C:/misc/boost/clang-1_51_0 के बाद) बजना के साथ प्रयास करें यदि ऐसा नहीं होता:

D:\Desktop\ppp>cmake -G "MinGW Makefiles" ..\ccc 
-- The C compiler identification is Clang 3.1.0 
-- The CXX compiler identification is Clang 3.1.0 
-- Check for working C compiler: C:/misc/clang/bin/clang.exe 
-- Check for working C compiler: C:/misc/clang/bin/clang.exe -- works 
-- Detecting C compiler ABI info 
-- Detecting C compiler ABI info - done 
-- Check for working CXX compiler: C:/misc/clang/bin/clang++.exe 
-- Check for working CXX compiler: C:/misc/clang/bin/clang++.exe -- works 
-- Detecting CXX compiler ABI info 
-- Detecting CXX compiler ABI info - done 
CMake Error at C:/misc/cmake/share/cmake-2.8/Modules/FindBoost.cmake:1191 (message): 
    Unable to find the requested Boost libraries. 

    Boost version: 1.51.0 

    Boost include path: C:/misc/boost/clang-1_51_0 

    The following Boost libraries could not be found: 

      boost_regex 

    No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the 
    directory containing Boost libraries or BOOST_ROOT to the location of 
    Boost. 
Call Stack (most recent call first): 
    CMakeLists.txt:5 (find_package) 


CMake Error: The following variables are used in this project, but they are set to NOTFOUND. 
Please set them or make sure they are set and tested correctly in the CMake files: 
Boost_REGEX_LIBRARY (ADVANCED) 
    linked by target "ccc" in directory D:/Desktop/ccc 

-- Configuring incomplete, errors occurred! 

हालांकि, अगर मैं मैन्युअल रूप से संकलन इसे फिर से काम करता है:

clang++ main.cpp -I%BOOST_ROOT% -L%BOOST_ROOT%\lib -llibboost_regex-clang31-1_51 
...Ok, and the executable works 

मैन्युअल की स्थापना BOOST_LIBRARYDIR या तो काम नहीं करता है । न तो बैकस्लैश \ का उपयोग करता है।

उत्तर

5

फ़ाइल के अंदर देख रहे हैं "सी: /misc/cmake/share/cmake-2.8/Modules/FindBoost.cmake" आप बूस्ट से संबंधित सभी चरों की एक सूची पा सकते हैं जिसका आप उपयोग कर सकते हैं। एक आप की जरूरत Boost_COMPILER (Boost_DETAILED_FAILURE_MSG भी समस्याओं का निदान करने के लिए उपयोगी हो सकता है) है:

# Boost_COMPILER    Set this to the compiler suffix used by Boost 
#        (e.g. "-gcc43") if FindBoost has problems finding 
#        the proper Boost installation 
+1

'-clang31' * और *' Boost_USE_STATIC_RUNTIME' को 'TRUE' समस्या को हल करने के लिए किया था' Boost_COMPILER' स्थापना। धन्यवाद। – Claudio