プロジェクト

全般

プロフィール

CMakeのprojectの第2引数についての調査

#4132 の対応をして頂いたが、Linux環境でのPython RTCは、OpenRTMConfig.cmakeを見つけることができずcmakeが通らないことの調査

  • Windows環境ならば、C++, Python のどちらのRTCでも問題なくcmakeが通る
  • Linux環境でもC++ならばcmakeは通る
原因は、CMakeLists.txtでのproject文の第2引数の定義だった。
RTCBuilderではPython言語が指定された場合には第2引数としてNONEを定義している。
  • C++で「cxx_test」プロジェクトを生成した場合 : project(cxx_test)
  • Pythonで「py_test」プロジェクトを生成した場合 : project(py_test NONE)

NONEの指定が入っていると、OpenRTMConfig.cmakeを見つけることができない。


簡単なCMakeLists.txtを用意して動作確認した結果を下記に示す。

cxx_test/
  CMakeLists.txt
  build

py_test/
  CMakeLists.txt
  build
  • cxx_test/CMakeLists.txt
    cmake_minimum_required(VERSION 3.0.2)
    
    project(cxx_test) ←★NONEなし
    
    find_package(OpenRTM)
    set(RTM_VER ${OPENRTM_VERSION})
    set(RTM_SHORT_VER ${OPENRTM_VERSION_MAJOR}${OPENRTM_VERSION_MINOR}${OPENRTM_VERSION_PATCH})
    
  • py_test/CMakeLists.txt
    cmake_minimum_required(VERSION 3.0.2)
    
    project(py_test NONE) ←★NONEあり
    
    find_package(OpenRTM)
    set(RTM_VER ${OPENRTM_VERSION})
    set(RTM_SHORT_VER ${OPENRTM_VERSION_MAJOR}${OPENRTM_VERSION_MINOR}${OPENRTM_VERSION_PATCH})
    

cmakeに「-DCMAKE_FIND_DEBUG_MODE=1」オプションを付けて実行すると分かる。

  • cxx_test・・・OK!
    $ cmake .. -DCMAKE_FIND_DEBUG_MODE=1
    Checking prefix [/usr/local/]
    Checking file [/usr/local/OpenRTMConfig.cmake]
    Checking file [/usr/local/openrtm-config.cmake]
    Checking prefix [/usr/]
    Checking file [/usr/OpenRTMConfig.cmake]
    Checking file [/usr/openrtm-config.cmake]
    Checking file [/usr/lib/x86_64-linux-gnu/openrtm-1.2/OpenRTMConfig.cmake]
    Checking file [/usr/lib/x86_64-linux-gnu/openrtm-1.2/openrtm-config.cmake]
    Checking file [/usr/share/openrtm-1.2/OpenRTMConfig.cmake]
    Checking file [/usr/share/openrtm-1.2/openrtm-config.cmake]
    Checking file [/usr/lib/x86_64-linux-gnu/openrtm-1.2/cmake/OpenRTMConfig.cmake]
    -- OpenRTMConfig.cmake found.
    -- Configrued by configuration mode.
    -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
    -- Checking for module 'omniORB4'
    --   Found omniORB4, version 4.1.6
    -- OpenRTM-aist configuration done
    -- Configuring done
    -- Generating done
    
  • py_test・・・NG! OpenRTMConfig.cmakeを見つけることができない。
    $ cmake .. -DCMAKE_FIND_DEBUG_MODE=1
    Checking prefix [/usr/local/]
    Checking file [/usr/local/OpenRTMConfig.cmake]
    Checking file [/usr/local/openrtm-config.cmake]
    Checking prefix [/usr/]
    Checking file [/usr/OpenRTMConfig.cmake]
    Checking file [/usr/openrtm-config.cmake]
    Checking file [/usr/share/openrtm-1.2/OpenRTMConfig.cmake]
    Checking file [/usr/share/openrtm-1.2/openrtm-config.cmake]
    Checking prefix [/]
    Checking file [/OpenRTMConfig.cmake]
    Checking file [/openrtm-config.cmake]
    Checking prefix [/usr/games/]
    Checking file [/usr/games/OpenRTMConfig.cmake]
    Checking file [/usr/games/openrtm-config.cmake]
    Checking prefix [/usr/local/games/]
    Checking file [/usr/local/games/OpenRTMConfig.cmake]
    Checking file [/usr/local/games/openrtm-config.cmake]
    Checking prefix [/snap/]
    Checking file [/snap/OpenRTMConfig.cmake]
    Checking file [/snap/openrtm-config.cmake]
    CMake Warning at CMakeLists.txt:12 (find_package):
      By not providing "FindOpenRTM.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "OpenRTM", but
      CMake did not find one.
    
      Could not find a package configuration file provided by "OpenRTM" with any
      of the following names:
    
        OpenRTMConfig.cmake
        openrtm-config.cmake
    
      Add the installation prefix of "OpenRTM" to CMAKE_PREFIX_PATH or set
      "OpenRTM_DIR" to a directory containing one of the above files.  If
      "OpenRTM" provides a separate development package or SDK, be sure it has
      been installed.
    
    -- Configuring done
    -- Generating done