インストール: ECM (Extra CMake Modules) | モダンなCMakeに必要な追加モジュール
CMakeでビルドしようとすると,以下のエラーが出ることがある。
CMake Error at CMakeLists.txt:8 (find_package): Could not find a package configuration file provided by "ECM" (requested version 1.4.0) with any of the following names: ECMConfig.cmake ecm-config.cmake Add the installation prefix of "ECM" to CMAKE_PREFIX_PATH or set "ECM_DIR" to a directory containing one of the above files. If "ECM" provides a separate development package or SDK, be sure it has been installed.
これはECM (Extra CMake Modules) というCMakeのモジュールが不足していることが原因だ。最近のCMakeを使ったプロジェクト (fcitxなど) では,ECMを採用していることが増えている。そこで,ECMをインストールする。
項目 | 説明 |
---|---|
配布元 | |
リポジトリー | |
手順 | |
依存情報 | |
依存先 (必須) | |
依存先 (任意) |
|
依存元 |
sh -eux <<-"EOT"
PKG=extra-cmake-modules VER=5.56.0 TAG=v$VER PKG_VER=$PKG${VER:+-$VER}
LOCAL=~/.local J=$(grep -cs '^processor' /proc/cpuinfo || echo 2)
mkdir -p "$LOCAL/src"
cd "$LOCAL/src"
if command -v git >/dev/null; then
[ -e $PKG ] || git clone --depth 1 git://anongit.kde.org/extra-cmake-modules.git $PKG
cd $PKG
git fetch --depth 1 origin tag $TAG
git checkout -f $TAG
git clean -dfX
# autoreconf -i
else
[ -e $PKG_VER ] || wget -O $PKG_VER.tar.gz https://github.com/KDE/extra-cmake-modules/archive/v$VER.tar.gz
tar -xf $PKG_VER.*
cd $PKG_VER
fi
make -kj $J distclean clean || :
cmake -DCMAKE_INSTALL_PREFIX="$LOCAL/stow/$PKG_VER" .
# ctest -j $J
make -j $J
make -j $J install
cd "$LOCAL/stow"
echo $PKG${VER:+-}[0-9]* | xargs -n 1 stow --ignore=dir -D
stow --ignore=dir $PKG_VER
EOT
日付 | バージョン | OS | 依存関係 |
---|---|---|---|
2018-04-29 | 5.44.0-rc1 | Ubuntu 16.04 | |
2019-03-27 | 5.56.0 | Ubuntu 18.04 | GNU Make 4.2.1, GCC 7.4.0, CMake 3.10.2 |
なお,v5.56.0, 5.55.0, 5.44.0などではctestで以下の2項目が失敗する。
The following tests FAILED: 10 - KDEInstallDirsTest.relative_or_absolute_usr (Failed) 11 - KDEInstallDirsTest.relative_or_absolute_qt (Failed) Errors while running CTest
ctest -v
でエラー内容の詳細を確認して判明したが,これらの2項目はディレクトリーが空になっており,テストが実行できず,make cleanに失敗しているのが原因だった。
test 10 Start 10: KDEInstallDirsTest.relative_or_absolute_usr 10: Test command: /usr/bin/ctest "--build-and-test" "/home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute" "/home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute_usr" "--build-two-config" "--build-generator" "Unix Makefiles" "--build-makeprogram" "/home/senooken/.local/bin/make" "--build-project" "relative_or_absolute_usr" "--build-options" "-DCMAKE_INSTALL_PREFIX=/usr" "-DKDE_INSTALL_USE_QT_SYS_PATHS=FALSE" "-DAUTOSTARTDIR_should_be_absolute=TRUE" "-DCONFDIR_should_be_absolute=TRUE" "-DSYSCONFDIR_should_be_absolute=TRUE" "--test-command" "dummy" 10: Test timeout computed to be: 9.99988e+06 10: Internal cmake changing into directory: /home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute_usr 10: ======== CMake output ====== 10: Configuring 10: Configuring done 10: Generating 10: Generating done 10: Build files have been written to: /home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute 10: Configuring 10: Configuring done 10: Generating 10: Generating done 10: Build files have been written to: /home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute 10: ======== End CMake output ====== 10: Change Dir: /home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute_usr 10: 10: Run Clean Command:"/home/senooken/.local/bin/make" "clean" 10: make: *** No rule to make target 'clean'. Stop. 10: 10: Run Build Command:"/home/senooken/.local/bin/make" 10: make: *** No targets specified and no makefile found. Stop. 10/49 Test #10: KDEInstallDirsTest.relative_or_absolute_usr ...........***Failed 0.08 sec test 11 Start 11: KDEInstallDirsTest.relative_or_absolute_qt 11: Test command: /usr/bin/ctest "--build-and-test" "/home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute" "/home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute_qt" "--build-two-config" "--build-generator" "Unix Makefiles" "--build-makeprogram" "/home/senooken/.local/bin/make" "--build-project" "relative_or_absolute_qt" "--build-options" "-DKDE_INSTALL_USE_QT_SYS_PATHS=TRUE" "-DPLUGINDIR_should_be_absolute=TRUE" "-DQMLDIR_should_be_absolute=TRUE" "-DQTQCHDIR_should_be_absolute=TRUE" "-DQTPLUGINDIR_should_be_absolute=TRUE" "-DQTQUICKIMPORTSDIR_should_be_absolute=TRUE" "--test-command" "dummy" 11: Test timeout computed to be: 9.99988e+06 11: Internal cmake changing into directory: /home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute_qt 11: ======== CMake output ====== 11: Configuring 11: Configuring done 11: Generating 11: Generating done 11: Build files have been written to: /home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute 11: Configuring 11: Configuring done 11: Generating 11: Generating done 11: Build files have been written to: /home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute 11: ======== End CMake output ====== 11: Change Dir: /home/senooken/.local/src/extra-cmake-modules/tests/KDEInstallDirsTest/relative_or_absolute_qt 11: 11: Run Clean Command:"/home/senooken/.local/bin/make" "clean" 11: make: *** No rule to make target 'clean'. Stop. 11: 11: Run Build Command:"/home/senooken/.local/bin/make" 11: make: *** No targets specified and no makefile found. Stop. 11/49 Test #11: KDEInstallDirsTest.relative_or_absolute_qt ............***Failed 0.13 sec
あまり,推奨はしないが,ctestでテストを実行しないでインストールすることも考えられるだろう。
おそらく,テストに必要なQt関係の依存関係が不十分のためのエラーだと思われる。Qtを自前でインストールしたら,再挑戦する。
必要に応じて,cmake実行時に以下のようにオプションで必要な機能を無効にして制御する。
cmake -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_TESTING=OFF .
“インストール: ECM (Extra CMake Modules) | モダンなCMakeに必要な追加モジュール” に対して1件のコメントがあります。