2012-03-15 8 views
2

FindBoostに関する質問があります。私はHPC(redhat)上の1.49倍のブースト・コンポーネントからブースト・コンポーネントを選択しようとしています。これはすでにデフォルトブースト1.47がプリインストールされています。 私は排他的に私を使用したいと思いますし、キャッシュ変数、内部キャッシュ変数、環境変数BOOST_ROOTをset(ENV {BOOST_ROOT})を使用して使用しようとしていますが、何も問題ありません。 BOOST_ROOTが正しく設定されている(1.49.0バージョンを指している)が、FindBoostによって生成されたライブラリパスには何も影響しないように見える。それらはすべて1.47.0バージョンのライブラリを指している。 私はこれしようとしている:あなたは私を助けることができる場合、私は非常に感謝BOOST_ROOTを使用しているにもかかわらず、インストールされているBoostディストリビューションが見つかりません

# I give a chance to the user to set BOOST_PATH to the local boost distribution before calling FindBoost 
if(NOT DEFINED BOOST_PATH) 
    message(STATUS " Set BOOST_PATH to a specific Boost distribution if needed.") 
    set(BOOST_PATH "Default" CACHE PATH "Set the path to a specific Boost distribution if not default.") 

# On the second pass, I use BOOST_PATH to initialize BOOST_ROOT, hoping that FindBoost will use it to find my local version. 
else( NOT DEFINED BOOST_PATH) 
    if(NOT (BOOST_PATH MATCHES "Default")) 
     set(BOOST_ROOT ${BOOST_PATH} CACHE PATH "path to the preferred boost distribution.") 
    endif(NOT (BOOST_PATH MATCHES "Default")) 

    # I test to make sure the path in BOOST_ROOT is what I expect: it is on the console, as well as in the cache 
    message("BOOST_ROOT = ${BOOST_ROOT}") 

    set(Boost_USE_MULTITHREADED  ON) 
    set(Boost_USE_STATIC_LIBS  ON) 
    set(Boost_ADDITIONAL_VERSIONS "1.42" "1.42.0" 
          "1.43" "1.43.0" 
          "1.44" "1.44.0" 
          "1.45" "1.45.0" 
          "1.46" "1.46.0" "1.46.1" 
          "1.47" "1.47.0" 
          "1.48" "1.48.0" 
          "1.49" "1.49.0" 
          ${BOOST_ADDITIONAL_VERSION} 
    ) 
    set(Boost_DEBUG     TRUE) # Debugging info output for FindBoost 
    set(Boost_DETAILED_FAILURE_MSG TRUE) # Set to FALSE by default 


    # I invoke FindBoost here, but although BOOST_ROOT points to my local boost, all the paths of the 3 components points to the installed debug/release variants, not to my local distribution. 
    find_package(Boost COMPONENTS date_time filesystem system program_options) 

# unimportant code 
[...] 

endif( NOT DEFINED BOOST_PATH) 

を。事前にどうもありがとうございました。

ニコラス

+0

おそらく、1.49が最初になるようにBOOST_ADDITIONAL_VERSIONSを並べ替えますか? –

+0

そして、Boost_ADDITIONAL_VERSIONSをBOOST_ADDITIONAL_VERSIONの値に設定します(注: 'なし')。 –

+0

@Andre:あなたが提案したように1.49.0が最初になるようにバージョンを並べ替えました。しかし、それは心配です:Boostの最新バージョンだけが使用されます。誰かが古いバージョンを使用する正当な理由がある場合はどうなりますか?とにかく、それは今働く。あなたの提案に感謝します! – nchaumont

答えて

4

FindBoost.cmakeの新しいバージョン(CMakeのの2.8.x)でスクリプトがブーストを探している検索パスに影響を与えるように設定することができる変数です。

それはBoost_NO_SYSTEM_PATHSと呼ばれ、それがTRUEに設定されている場合、システムの場所にインストールされたライブラリを見ていません。

私は、2つのBoostインストールのライブラリがfind_package()スクリプトで混在しているため、私のプロジェクトのいくつかでこれを行う必要がありました。

+0

チップをありがとう! – nchaumont

関連する問題