iutest
iutest copied to clipboard
cmake: FindIutest
まあincludeするだけのライブラリだけれども、
# - Try to find iutest include dirs
#
# Usage of this module as follows:
#
# find_package(IUTEST)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# IUTEST_ROOT_DIR Set this variable to the root installation of
# iutest if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# IUTEST_FOUND System has iutest, include dirs found
# IUTEST_INCLUDE_DIR The iutest include directories.
find_path(IUTEST_ROOT_DIR
NAMES include/iutest.hpp
)
find_path(IUTEST_INCLUDE_DIR
NAMES iutest.hpp
HINTS ${IUTEST_ROOT_DIR}/include
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(IUTEST DEFAULT_MSG
IUTEST_INCLUDE_DIR
)
のようなスクリプトがあると使いやすいと思うんですが、どうでしょうか?
とりあえず追加してみたのですが、やり方間違えたらご指摘ください
このIssue立ててから気がついたのですが、<foo>-config.cmake
を作ってFIndXXX.cmake
を作るなみたいなWarningが出ますね。私にはどうすればいいのかさっぱりですが。
CMake Error at CMakeLists.txt:34 (find_package):
By not providing "FindIUTEST.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "IUTEST", but
CMake did not find one.
Could not find a package configuration file provided by "IUTEST" with any
of the following names:
IUTESTConfig.cmake
iutest-config.cmake
Add the installation prefix of "IUTEST" to CMAKE_PREFIX_PATH or set
"IUTEST_DIR" to a directory containing one of the above files. If "IUTEST"
provides a separate development package or SDK, be sure it has been
installed.
真剣に向き合うときが来たようだ
やっぱりxxx-config.cmakeを生成させるようにしなければならないか。
お手軽な xxx-config.cmake の作成方法 https://qiita.com/osamu0329/items/134de918c0ffa7f0557b
[CMake] ライブラリを自動的に探すFind
今気づいたんですが、iutestはヘッダーのみで、かつこのプロジェクトのライブラリですよね? find_packageを使わず、Microsoft/GSLのようにadd_libraryを使えばいいような気が…
add_library(IUTEST INTERFACE)
target_include_directories(IUTEST
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
)
なるほど。INTERFACE ってのがあるんですね。 やってみます 👍