This is the current state of my cross-project checklist and my cmake changes. I'll fill it in later.
[ ] TODO get rid of #include <ambit/settings.h> in tests -- they didn't help.
[ ] update old files
[x] copy over xhost.cmake that has new compilers. import it instead of one-liner. adapt if C, not CXX.
[ ] expand safeguards to new build types, RelWithDebInfo, and MinSizeRel
[x] update cmake min version to 3.16
[ ] replace SameMajorVersion with now-available SameMinorVersion if appropriate
[ ] remove any ${PN} in main project CMake as they tend to get clobbered in/after find_package
[ ] any new project-specific options, prepend in project-case, like ambit_ENABLE_PYTHON. does not apply to e.g., BUILD_TESTING, BUILD_SHARED_LIBS
[ ] Python
[ ] if still on old NumPy/pb11 Py detection, switch to approx. find_package(Python 3.7 COMPONENTS Interpreter Development NumPy REQUIRED)
[x] update any set(Python_ADDITIONAL_VERSIONS
[x] update cmake_minimum_required(VERSION 3.16) for Py detection
[ ] update any PYTHON_EXECUTABLE to Python_EXECUTABLE
[ ] remove any old FindPythonLibsNew.cmake
[ ] if any pybind11 target, remove PREFIX/SUFFIX from properties
[ ] psi4: update the call in external/
[x] add option(_INSTALL_CMAKEDIR) to make Config.cmake location editable with variable, incl any subprojects like TargetLAPACK.
[ ] recipe: specify in bld.bat as -D <project>_INSTALL_CMAKEDIR="Library\share\cmake\<project>" ^ if CMAKE_INSTALL_PREFIX="%PREFIX%"
[ ] psi4: add the call in external/ (CMAKE_ARGS and _DIR and any TargetLAPACK, etc.)
[x] modernize target install/export
[x] for install(TARGETS), use full runtime/arch/lib DESTINATIONs so Windows can work
[x] for install(TARGETS), consider a descriptive EXPORT so not repeating targets filename
[x] for install(EXPORT), use descriptive EXPORT and lang or type names to Targets files
[ ] make properties target-centered, particularly for FetchContent usage. target and find_package(<package>) should provide same info.
[ ] define export_properties variable and append it to all base targets (e.g., static and shared always-built libs)
[ ] set the version on the target. use casing like in the config file, probaly project(CheMPS2) --> CheMPS2_VERSION
[ ] set all other properties that were project-specific vars in the config (like Libint_MAX_AM_ERI) on the target
[ ] check through find_package() that targets are fully loaded (--log-level verbose and extra stuff in Config.cmake can help)
[ ] define aliases matching imported targets, add_library(ambit::ambit ALIAS ambit-shared). Favor shared if both can be built together.
[ ] rename any CMAKE_SOURCE_DIR/CMAKE_BINARY_DIR to PROJECT_SOURCE_DIR/PROJECT_BINARY_DIR
[ ] check fetch_content works
[ ] modernize Config.cmake.in
[ ] kill off all PN with something like set(amb ambit) # NameSpace. PN gets overwritten a lot, so let's specialize it.
[x] remove find_header, find_file, find_library find_exe reminicent of Find.cmake rather than Config.cmake
[x] read find_project variables off target, rather than setting from file_header/lib/exe results
[ ] if any Find files installed, add list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
[ ] check components with check_required_components(<project>) (probably already present)
[ ] NEVER load exported Targets.cmake before all components confirmed found and all dependencies confirmed found
[ ] run a find_project() to check that vars match target (same as 4th bullet prev. section)
[ ] check that all dependencies are handled (sometimes outsourced to psi4, like BLAS for dkh)
[ ] add TargetLAPACK if using BLAS/LAPACK
[ ] copy over new FindTargetLAPACK, FindTargetHDF5 as needed. modify if only use BLAS
[ ] install the Find files with the Config
[ ] in config file, add any find_dependency that we were leaving for psi4 before
[ ] UNRESOLVED handling lib/pylib
[ ] YES, do have an ENABLE_PYTHON (or better, _ENABLE_PYTHON) so library can be built alone
[ ] PROBABLY, do have a project(pyproject) so python can be built alone after detecting project
[ ] UNKNOWN, do have a ambit_PYMOD variable attached to the target and Config?
[ ] UNKNOWN, same Config.cmake file for C++ and Py, where latter optional and detected with COMPONENTS Python? It's easy enough to have the targets exported to Targets-Python.cmake so same file can manage.
[ ] particular for this project (ambit)
[x] updated Threads linking - not much tested, but it seems the done thing
[ ] made tests optionally installable, like the option promised
[x] added some ifdef includes for Windows (I copied blocks from other repos, so there might be lines that aren't strictly needed)
This is the current state of my cross-project checklist and my cmake changes. I'll fill it in later.
[ ] TODO get rid of
#include <ambit/settings.h>
in tests -- they didn't help.[ ] update old files
${PN}
in main project CMake as they tend to get clobbered in/afterfind_package
[ ] Python
set(Python_ADDITIONAL_VERSIONS
cmake_minimum_required(VERSION 3.16)
for Py detection[x] add option(_INSTALL_CMAKEDIR) to make Config.cmake location editable with variable, incl any subprojects like TargetLAPACK.
-D <project>_INSTALL_CMAKEDIR="Library\share\cmake\<project>" ^
ifCMAKE_INSTALL_PREFIX="%PREFIX%"
[x] modernize target install/export
[ ] make properties target-centered, particularly for FetchContent usage. target and
find_package(<package>)
should provide same info.project(CheMPS2)
--> CheMPS2_VERSIONadd_library(ambit::ambit ALIAS ambit-shared)
. Favor shared if both can be built together.[ ] modernizeConfig.cmake.in
set(amb ambit) # NameSpace
. PN gets overwritten a lot, so let's specialize it.list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
check_required_components(<project>)
(probably already present)[ ] check that all dependencies are handled (sometimes outsourced to psi4, like BLAS for dkh)
find_dependency
that we were leaving for psi4 before[ ] UNRESOLVED handling lib/pylib
COMPONENTS Python
? It's easy enough to have the targets exported to Targets-Python.cmake so same file can manage.[ ] particular for this project (ambit)