pkg_check_modules() always reruns if only 2 arguments are passed
I have the following code:
pkg_check_modules(MAEMO maemo-version)
This code reruns everytime CMake is run because of this expression in FindPkgConfig.cmake:
OR NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0};${ARGN}")
The problem here is that if there are only 2 arguments passed to pkg_check_modules
, then _module0 will be set (to "MAEMO" in my case), and ARGN will be empty. When this is written to cache it will be stored as just "MAEMO" (i.e. no semicolon), so on the next run this doesn't match the expected value and the search is rerun.