mirror of
https://github.com/triqs/dft_tools
synced 2025-01-03 10:05:49 +01:00
[cmake] Prefer the use of PROJECT_NAME in most CMakeLists.txt files
This commit is contained in:
parent
96b305fe8e
commit
fbe3f2fa0a
@ -30,7 +30,7 @@ endif()
|
|||||||
|
|
||||||
# ############
|
# ############
|
||||||
# Define Project
|
# Define Project
|
||||||
project(APP4TRIQS VERSION 3.0.0 LANGUAGES C CXX)
|
project(app4triqs VERSION 3.0.0 LANGUAGES C CXX)
|
||||||
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
|
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
|
||||||
|
|
||||||
# ############
|
# ############
|
||||||
@ -56,7 +56,7 @@ endif()
|
|||||||
if(NOT IS_SUBPROJECT)
|
if(NOT IS_SUBPROJECT)
|
||||||
message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------")
|
message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------")
|
||||||
endif()
|
endif()
|
||||||
set(APP4TRIQS_BINARY_DIR ${PROJECT_BINARY_DIR} CACHE STRING "Binary directory of the APP4TRIQS Project")
|
set(${PROJECT_NAME}_BINARY_DIR ${PROJECT_BINARY_DIR} CACHE STRING "Binary directory of the ${PROJECT_NAME} Project")
|
||||||
|
|
||||||
|
|
||||||
# ############
|
# ############
|
||||||
@ -99,8 +99,8 @@ add_compile_options(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Create an Interface target for compiler warnings
|
# Create an Interface target for compiler warnings
|
||||||
add_library(app4triqs_warnings INTERFACE)
|
add_library(${PROJECT_NAME}_warnings INTERFACE)
|
||||||
target_compile_options(app4triqs_warnings
|
target_compile_options(${PROJECT_NAME}_warnings
|
||||||
INTERFACE
|
INTERFACE
|
||||||
-Wall
|
-Wall
|
||||||
-Wextra
|
-Wextra
|
||||||
@ -120,8 +120,8 @@ target_compile_options(app4triqs_warnings
|
|||||||
# Find / Build dependencies
|
# Find / Build dependencies
|
||||||
add_subdirectory(deps)
|
add_subdirectory(deps)
|
||||||
|
|
||||||
# Build and install the app4triqs library
|
# Build and install the library
|
||||||
add_subdirectory(c++/app4triqs)
|
add_subdirectory(c++/${PROJECT_NAME})
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
if(Build_Tests)
|
if(Build_Tests)
|
||||||
@ -130,7 +130,7 @@ endif()
|
|||||||
|
|
||||||
# Python
|
# Python
|
||||||
if(PythonSupport)
|
if(PythonSupport)
|
||||||
add_subdirectory(python/app4triqs)
|
add_subdirectory(python/${PROJECT_NAME})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Docs
|
# Docs
|
||||||
@ -149,10 +149,10 @@ if(BUILD_DEBIAN_PACKAGE AND NOT IS_SUBPROJECT)
|
|||||||
if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||||
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be /usr for packaging")
|
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be /usr for packaging")
|
||||||
endif()
|
endif()
|
||||||
set(CPACK_PACKAGE_NAME app4triqs)
|
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
|
||||||
set(CPACK_GENERATOR "DEB")
|
set(CPACK_GENERATOR "DEB")
|
||||||
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
||||||
set(CPACK_PACKAGE_CONTACT "https://github.com/TRIQS/app4triqs")
|
set(CPACK_PACKAGE_CONTACT "https://github.com/TRIQS/${PROJECT_NAME}")
|
||||||
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CMAKE_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CMAKE_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 3.0)")
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 3.0)")
|
||||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
file(GLOB_RECURSE sources *.cpp)
|
file(GLOB_RECURSE sources *.cpp)
|
||||||
add_library(app4triqs_c ${sources})
|
add_library(${PROJECT_NAME}_c ${sources})
|
||||||
add_library(app4triqs::app4triqs_c ALIAS app4triqs_c)
|
add_library(${PROJECT_NAME}::${PROJECT_NAME}_c ALIAS ${PROJECT_NAME}_c)
|
||||||
|
|
||||||
# Link against triqs and enable warnings
|
# Link against triqs and enable warnings
|
||||||
target_link_libraries(app4triqs_c PUBLIC triqs PRIVATE $<BUILD_INTERFACE:app4triqs_warnings>)
|
target_link_libraries(${PROJECT_NAME}_c PUBLIC triqs PRIVATE $<BUILD_INTERFACE:${PROJECT_NAME}_warnings>)
|
||||||
|
|
||||||
# Configure target and compilation
|
# Configure target and compilation
|
||||||
set_property(TARGET app4triqs_c PROPERTY POSITION_INDEPENDENT_CODE ON)
|
set_property(TARGET ${PROJECT_NAME}_c PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
target_include_directories(app4triqs_c PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/c++>)
|
target_compile_features(${PROJECT_NAME}_c PUBLIC cxx_std_17) # CAUTION! Does not seem to work with extract_flags.cmake ..
|
||||||
target_include_directories(app4triqs_c SYSTEM INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
|
target_include_directories(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/c++>)
|
||||||
target_compile_definitions(app4triqs_c PUBLIC
|
target_include_directories(${PROJECT_NAME}_c SYSTEM INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
|
||||||
|
target_compile_definitions(${PROJECT_NAME}_c PUBLIC
|
||||||
APP4TRIQS_GIT_HASH=${PROJECT_GIT_HASH}
|
APP4TRIQS_GIT_HASH=${PROJECT_GIT_HASH}
|
||||||
TRIQS_GIT_HASH=${TRIQS_GIT_HASH}
|
TRIQS_GIT_HASH=${TRIQS_GIT_HASH}
|
||||||
$<$<CONFIG:Debug>:APP4TRIQS_DEBUG>
|
$<$<CONFIG:Debug>:APP4TRIQS_DEBUG>
|
||||||
@ -18,7 +19,7 @@ target_compile_definitions(app4triqs_c PUBLIC
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Install library and headers
|
# Install library and headers
|
||||||
install(TARGETS app4triqs_c EXPORT app4triqs-targets DESTINATION lib)
|
install(TARGETS ${PROJECT_NAME}_c EXPORT ${PROJECT_NAME}-targets DESTINATION lib)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h")
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h")
|
||||||
|
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ if(ANALYZE_SOURCES)
|
|||||||
# Run clang-tidy if found
|
# Run clang-tidy if found
|
||||||
if(CLANG_TIDY_EXECUTABLE)
|
if(CLANG_TIDY_EXECUTABLE)
|
||||||
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXECUTABLE}")
|
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXECUTABLE}")
|
||||||
set_target_properties(app4triqs_c PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
|
set_target_properties(${PROJECT_NAME}_c PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "clang-tidy not found in $PATH. Please consider installing clang-tidy for additional checks!")
|
message(STATUS "clang-tidy not found in $PATH. Please consider installing clang-tidy for additional checks!")
|
||||||
endif()
|
endif()
|
||||||
@ -43,7 +44,7 @@ if(ANALYZE_SOURCES)
|
|||||||
if(CPPCHECK_EXECUTABLE)
|
if(CPPCHECK_EXECUTABLE)
|
||||||
message(STATUS "cppcheck found: ${CPPCHECK_EXECUTABLE}")
|
message(STATUS "cppcheck found: ${CPPCHECK_EXECUTABLE}")
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET app4triqs_c
|
TARGET ${PROJECT_NAME}_c
|
||||||
COMMAND ${CPPCHECK_EXECUTABLE}
|
COMMAND ${CPPCHECK_EXECUTABLE}
|
||||||
--enable=warning,style,performance,portability
|
--enable=warning,style,performance,portability
|
||||||
--std=c++17
|
--std=c++17
|
||||||
@ -71,11 +72,11 @@ if(ASAN)
|
|||||||
if(NOT TARGET asan)
|
if(NOT TARGET asan)
|
||||||
find_package(sanitizer REQUIRED "asan")
|
find_package(sanitizer REQUIRED "asan")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(app4triqs_c PUBLIC $<BUILD_INTERFACE:asan>)
|
target_link_libraries(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:asan>)
|
||||||
endif()
|
endif()
|
||||||
if(UBSAN)
|
if(UBSAN)
|
||||||
if(NOT TARGET ubsan)
|
if(NOT TARGET ubsan)
|
||||||
find_package(sanitizer REQUIRED "ubsan")
|
find_package(sanitizer REQUIRED "ubsan")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(app4triqs_c PUBLIC $<BUILD_INTERFACE:ubsan>)
|
target_link_libraries(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:ubsan>)
|
||||||
endif()
|
endif()
|
||||||
|
@ -6,8 +6,8 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
add_custom_target(${PROJECT_NAME}_docs_cpp2rst)
|
add_custom_target(${PROJECT_NAME}_docs_cpp2rst)
|
||||||
include(${PROJECT_SOURCE_DIR}/share/cmake/extract_flags.cmake)
|
include(${PROJECT_SOURCE_DIR}/share/cmake/extract_flags.cmake)
|
||||||
extract_flags(app4triqs_c BUILD_INTERFACE)
|
extract_flags(${PROJECT_NAME}_c BUILD_INTERFACE)
|
||||||
separate_arguments(app4triqs_c_CXXFLAGS)
|
separate_arguments(${PROJECT_NAME}_c_CXXFLAGS)
|
||||||
macro(generate_docs header_file)
|
macro(generate_docs header_file)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${PROJECT_NAME}_docs_cpp2rst
|
TARGET ${PROJECT_NAME}_docs_cpp2rst
|
||||||
@ -16,14 +16,14 @@ macro(generate_docs header_file)
|
|||||||
PYTHONPATH=${CPP2PY_BINARY_DIR}:$ENV{PYTHONPATH}
|
PYTHONPATH=${CPP2PY_BINARY_DIR}:$ENV{PYTHONPATH}
|
||||||
${CPP2PY_BINARY_DIR}/bin/c++2rst
|
${CPP2PY_BINARY_DIR}/bin/c++2rst
|
||||||
${header_file}
|
${header_file}
|
||||||
-N app4triqs
|
-N ${PROJECT_NAME}
|
||||||
--output_directory ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated
|
--output_directory ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated
|
||||||
-I${PROJECT_SOURCE_DIR}/c++
|
-I${PROJECT_SOURCE_DIR}/c++
|
||||||
--cxxflags="${app4triqs_c_CXXFLAGS}"
|
--cxxflags="${${PROJECT_NAME}_c_CXXFLAGS}"
|
||||||
)
|
)
|
||||||
endmacro(generate_docs)
|
endmacro(generate_docs)
|
||||||
|
|
||||||
generate_docs(${PROJECT_SOURCE_DIR}/c++/app4triqs/app4triqs.hpp)
|
generate_docs(${PROJECT_SOURCE_DIR}/c++/${PROJECT_NAME}/${PROJECT_NAME}.hpp)
|
||||||
|
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
# Build & Run the C++ doc examples and capture the output
|
# Build & Run the C++ doc examples and capture the output
|
||||||
@ -73,7 +73,7 @@ endif()
|
|||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# Install
|
# Install
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ COMPONENT documentation DESTINATION share/doc/app4triqs
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ COMPONENT documentation DESTINATION share/doc/${PROJECT_NAME}
|
||||||
FILES_MATCHING
|
FILES_MATCHING
|
||||||
REGEX "\\.(html|pdf|png|gif|jpg|svg|js|xsl|css|py|txt|inv|bib)$"
|
REGEX "\\.(html|pdf|png|gif|jpg|svg|js|xsl|css|py|txt|inv|bib)$"
|
||||||
PATTERN "_*"
|
PATTERN "_*"
|
||||||
|
@ -20,25 +20,26 @@ extensions = ['sphinx.ext.autodoc',
|
|||||||
|
|
||||||
source_suffix = '.rst'
|
source_suffix = '.rst'
|
||||||
|
|
||||||
project = 'APP4TRIQS - An example triqs application'
|
project = '@PROJECT_NAME@'
|
||||||
copyright = '2017-2018 N. Wentzell, O. Parcollet 2018-2019 The Simons Foundation, authors: N. Wentzell, D. Simons, H. Strand, O. Parcollet'
|
|
||||||
version = '@PROJECT_VERSION@'
|
version = '@PROJECT_VERSION@'
|
||||||
|
|
||||||
|
copyright = '2017-2018 N. Wentzell, O. Parcollet 2018-2019 The Simons Foundation, authors: N. Wentzell, D. Simons, H. Strand, O. Parcollet'
|
||||||
|
|
||||||
mathjax_path = "https://raw.githubusercontent.com/mathjax/MathJax/2.7.8/MathJax.js"
|
mathjax_path = "https://raw.githubusercontent.com/mathjax/MathJax/2.7.8/MathJax.js"
|
||||||
templates_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_templates']
|
templates_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_templates']
|
||||||
|
|
||||||
html_theme = 'triqs'
|
html_theme = 'triqs'
|
||||||
html_theme_path = ['@CMAKE_CURRENT_SOURCE_DIR@/themes']
|
html_theme_path = ['@CMAKE_CURRENT_SOURCE_DIR@/themes']
|
||||||
html_show_sphinx = False
|
html_show_sphinx = False
|
||||||
html_context = {'header_title': 'app4triqs',
|
html_context = {'header_title': '@PROJECT_NAME@',
|
||||||
'header_subtitle': 'An example application using cpp2py and <a class="triqs" style="font-size: 12px" href="https://triqs.github.io">TRIQS</a>',
|
'header_subtitle': 'An example application using cpp2py and <a class="triqs" style="font-size: 12px" href="https://triqs.github.io">TRIQS</a>',
|
||||||
'header_links': [['Install', 'install'],
|
'header_links': [['Install', 'install'],
|
||||||
['Documentation', 'documentation'],
|
['Documentation', 'documentation'],
|
||||||
['Issues', 'issues'],
|
['Issues', 'issues'],
|
||||||
['About app4triqs', 'about']]}
|
['About @PROJECT_NAME@', 'about']]}
|
||||||
html_static_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_static']
|
html_static_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_static']
|
||||||
html_sidebars = {'index': ['sideb.html', 'searchbox.html']}
|
html_sidebars = {'index': ['sideb.html', 'searchbox.html']}
|
||||||
|
|
||||||
htmlhelp_basename = 'APP4TRIQSdoc'
|
htmlhelp_basename = '@PROJECT_NAME@doc'
|
||||||
|
|
||||||
intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)}
|
intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)}
|
||||||
|
@ -13,11 +13,11 @@ endforeach()
|
|||||||
foreach(gen ${wrap_generators})
|
foreach(gen ${wrap_generators})
|
||||||
string(REPLACE "_desc.py" "" module_name ${gen})
|
string(REPLACE "_desc.py" "" module_name ${gen})
|
||||||
add_cpp2py_module(${module_name})
|
add_cpp2py_module(${module_name})
|
||||||
target_link_libraries(${module_name} app4triqs_c)
|
target_link_libraries(${module_name} ${PROJECT_NAME}_c)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Install python modules to proper location
|
# Install python modules to proper location
|
||||||
set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/app4triqs)
|
set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/${PROJECT_NAME})
|
||||||
get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST)
|
get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST)
|
||||||
install(TARGETS ${CPP2PY_MODULES_LIST} DESTINATION ${PYTHON_LIB_DEST})
|
install(TARGETS ${CPP2PY_MODULES_LIST} DESTINATION ${PYTHON_LIB_DEST})
|
||||||
install(FILES ${python_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST})
|
install(FILES ${python_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST})
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
|
|
||||||
version = "@PROJECT_VERSION@"
|
version = "@PROJECT_VERSION@"
|
||||||
triqs_hash = "@TRIQS_GIT_HASH@"
|
triqs_hash = "@TRIQS_GIT_HASH@"
|
||||||
app4triqs_hash = "@PROJECT_GIT_HASH@"
|
@PROJECT_NAME@_hash = "@PROJECT_GIT_HASH@"
|
||||||
|
|
||||||
def show_version():
|
def show_version():
|
||||||
print("\nYou are using app4triqs version %s\n"%version)
|
print("\nYou are using @PROJECT_NAME@ version %s\n"%version)
|
||||||
|
|
||||||
def show_git_hash():
|
def show_git_hash():
|
||||||
print("\nYou are using app4triqs git hash %s based on triqs git hash %s\n"%(app4triqs_hash, triqs_hash))
|
print("\nYou are using @PROJECT_NAME@ git hash %s based on triqs git hash %s\n"%("@PROJECT_GIT_HASH@", triqs_hash))
|
||||||
|
@ -7,20 +7,20 @@ if(NOT CMAKE_INSTALL_PREFIX STREQUAL TRIQS_ROOT AND NOT IS_SUBPROJECT)
|
|||||||
set(MODFILE_PYTHON_PATH "prepend-path PYTHONPATH $root/${CPP2PY_PYTHON_LIB_DEST_ROOT}")
|
set(MODFILE_PYTHON_PATH "prepend-path PYTHONPATH $root/${CPP2PY_PYTHON_LIB_DEST_ROOT}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(app4triqs.modulefile.in app4triqs.modulefile @ONLY)
|
configure_file(${PROJECT_NAME}.modulefile.in ${PROJECT_NAME}.modulefile @ONLY)
|
||||||
configure_file(app4triqsvars.sh.in app4triqsvars.sh @ONLY)
|
configure_file(${PROJECT_NAME}vars.sh.in ${PROJECT_NAME}vars.sh @ONLY)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/app4triqs.modulefile
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.modulefile
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/app4triqsvars.sh
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}vars.sh
|
||||||
DESTINATION share
|
DESTINATION share
|
||||||
)
|
)
|
||||||
|
|
||||||
message(STATUS "***************************************************************")
|
message(STATUS "***************************************************************")
|
||||||
message(STATUS "* Custom install Location. Use: ")
|
message(STATUS "* Custom install Location. Use: ")
|
||||||
message(STATUS "* ")
|
message(STATUS "* ")
|
||||||
message(STATUS "* source ${CMAKE_INSTALL_PREFIX}/share/app4triqsvars.sh ")
|
message(STATUS "* source ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}vars.sh ")
|
||||||
message(STATUS "* ")
|
message(STATUS "* ")
|
||||||
message(STATUS "* to set up the environment variables ")
|
message(STATUS "* to set up the environment variables ")
|
||||||
message(STATUS "***************************************************************")
|
message(STATUS "***************************************************************")
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#%Module1.0
|
#%Module1.0
|
||||||
#
|
#
|
||||||
# To be installed as ${MODULEPATH}/app4triqs/@PROJECT_VERSION@
|
# To be installed as ${MODULEPATH}/@PROJECT_NAME@/@PROJECT_VERSION@
|
||||||
|
|
||||||
set name app4triqs
|
set name @PROJECT_NAME@
|
||||||
set version @PROJECT_VERSION@
|
set version @PROJECT_VERSION@
|
||||||
set root @CMAKE_INSTALL_PREFIX@
|
set root @CMAKE_INSTALL_PREFIX@
|
||||||
set git_hash @PROJECT_GIT_HASH@
|
set git_hash @PROJECT_GIT_HASH@
|
||||||
|
|
||||||
set url "https://github.com/TRIQS/app4triqs"
|
set url "https://github.com/TRIQS/@PROJECT_NAME@"
|
||||||
set description "An example application using cpp2py and triqs."
|
set description "An example application using cpp2py and triqs."
|
||||||
|
|
||||||
module-whatis "$description"
|
module-whatis "$description"
|
||||||
@ -24,12 +24,12 @@ proc ModulesHelp { } {
|
|||||||
# is installed under a different name in your setup.
|
# is installed under a different name in your setup.
|
||||||
prereq triqs/@TRIQS_VERSION@
|
prereq triqs/@TRIQS_VERSION@
|
||||||
|
|
||||||
# Only one version of app4triqs can be loaded at a time
|
# Only one version of @PROJECT_NAME@ can be loaded at a time
|
||||||
conflict $name
|
conflict $name
|
||||||
|
|
||||||
setenv APP4TRIQS_ROOT $root
|
setenv @PROJECT_NAME@_ROOT $root
|
||||||
setenv APP4TRIQS_VERSION $version
|
setenv @PROJECT_NAME@_VERSION $version
|
||||||
setenv APP4TRIQS_GIT_HASH $git_hash
|
setenv @PROJECT_NAME@_GIT_HASH $git_hash
|
||||||
|
|
||||||
prepend-path PATH $root/bin
|
prepend-path PATH $root/bin
|
||||||
prepend-path CPLUS_INCLUDE_PATH $root/include
|
prepend-path CPLUS_INCLUDE_PATH $root/include
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Source this in your environment.
|
# Source this in your environment.
|
||||||
|
|
||||||
export APP4TRIQS_ROOT=@CMAKE_INSTALL_PREFIX@
|
export @PROJECT_NAME@_ROOT=@CMAKE_INSTALL_PREFIX@
|
||||||
|
|
||||||
export CPLUS_INCLUDE_PATH=@CMAKE_INSTALL_PREFIX@/include:$CPLUS_INCLUDE_PATH
|
export CPLUS_INCLUDE_PATH=@CMAKE_INSTALL_PREFIX@/include:$CPLUS_INCLUDE_PATH
|
||||||
export PATH=@CMAKE_INSTALL_PREFIX@/bin:$PATH
|
export PATH=@CMAKE_INSTALL_PREFIX@/bin:$PATH
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
configure_file(app4triqs-config.cmake.in app4triqs-config.cmake @ONLY)
|
configure_file(${PROJECT_NAME}-config.cmake.in ${PROJECT_NAME}-config.cmake @ONLY)
|
||||||
configure_file(app4triqs-config-version.cmake.in app4triqs-config-version.cmake @ONLY)
|
configure_file(${PROJECT_NAME}-config-version.cmake.in ${PROJECT_NAME}-config-version.cmake @ONLY)
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/app4triqs-config.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/app4triqs-config-version.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
|
||||||
DESTINATION lib/cmake/app4triqs
|
DESTINATION lib/cmake/${PROJECT_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(EXPORT app4triqs-targets NAMESPACE app4triqs:: DESTINATION lib/cmake/app4triqs)
|
install(EXPORT ${PROJECT_NAME}-targets NAMESPACE ${PROJECT_NAME}:: DESTINATION lib/cmake/${PROJECT_NAME})
|
||||||
|
@ -3,30 +3,30 @@
|
|||||||
# and reestablish the exported CMake Targets
|
# and reestablish the exported CMake Targets
|
||||||
|
|
||||||
# Multiple inclusion guard
|
# Multiple inclusion guard
|
||||||
if(NOT APP4TRIQS_FOUND)
|
if(NOT @PROJECT_NAME@_FOUND)
|
||||||
set(APP4TRIQS_FOUND TRUE)
|
set(@PROJECT_NAME@_FOUND TRUE)
|
||||||
set_property(GLOBAL PROPERTY APP4TRIQS_FOUND TRUE)
|
set_property(GLOBAL PROPERTY @PROJECT_NAME@_FOUND TRUE)
|
||||||
|
|
||||||
# version
|
# version
|
||||||
set(APP4TRIQS_VERSION @PROJECT_VERSION@ CACHE STRING "APP4TRIQS version")
|
set(@PROJECT_NAME@_VERSION @PROJECT_VERSION@ CACHE STRING "@PROJECT_NAME@ version")
|
||||||
set(APP4TRIQS_GIT_HASH @PROJECT_GIT_HASH@ CACHE STRING "APP4TRIQS git hash")
|
set(@PROJECT_NAME@_GIT_HASH @PROJECT_GIT_HASH@ CACHE STRING "@PROJECT_NAME@ git hash")
|
||||||
|
|
||||||
# Root of the installation
|
# Root of the installation
|
||||||
set(APP4TRIQS_ROOT @CMAKE_INSTALL_PREFIX@ CACHE STRING "APP4TRIQS root directory")
|
set(@PROJECT_NAME@_ROOT @CMAKE_INSTALL_PREFIX@ CACHE STRING "@PROJECT_NAME@ root directory")
|
||||||
|
|
||||||
## Find the target dependencies
|
## Find the target dependencies
|
||||||
#include(CMakeFindDependencyMacro)
|
#include(CMakeFindDependencyMacro)
|
||||||
#find_dependency(... HINTS @CMAKE_INSTALL_PREFIX@)
|
#find_dependency(... HINTS @CMAKE_INSTALL_PREFIX@)
|
||||||
|
|
||||||
# Include the exported targets of this project
|
# Include the exported targets of this project
|
||||||
include(@CMAKE_INSTALL_PREFIX@/lib/cmake/app4triqs/app4triqs-targets.cmake)
|
include(@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/@PROJECT_NAME@-targets.cmake)
|
||||||
|
|
||||||
message(STATUS "Found app4triqs-config.cmake with version @PROJECT_VERSION@, hash = @PROJECT_GIT_HASH@")
|
message(STATUS "Found @PROJECT_NAME@-config.cmake with version @PROJECT_VERSION@, hash = @PROJECT_GIT_HASH@")
|
||||||
|
|
||||||
# Was the Project built with Documentation?
|
# Was the Project built with Documentation?
|
||||||
set(APP4TRIQS_WITH_DOCUMENTATION @Build_Documentation@ CACHE BOOL "Was app4triqs build with documentation?")
|
set(@PROJECT_NAME@_WITH_DOCUMENTATION @Build_Documentation@ CACHE BOOL "Was @PROJECT_NAME@ build with documentation?")
|
||||||
|
|
||||||
# Was the Project built with PythonSupport?
|
# Was the Project built with PythonSupport?
|
||||||
set(APP4TRIQS_WITH_PYTHON_SUPPORT @PythonSupport@ CACHE BOOL "Was app4triqs build with python support?")
|
set(@PROJECT_NAME@_WITH_PYTHON_SUPPORT @PythonSupport@ CACHE BOOL "Was @PROJECT_NAME@ build with python support?")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -11,7 +11,7 @@ foreach(test ${all_tests})
|
|||||||
get_filename_component(test_name ${test} NAME_WE)
|
get_filename_component(test_name ${test} NAME_WE)
|
||||||
get_filename_component(test_dir ${test} DIRECTORY)
|
get_filename_component(test_dir ${test} DIRECTORY)
|
||||||
add_executable(${test_name} ${test})
|
add_executable(${test_name} ${test})
|
||||||
target_link_libraries(${test_name} app4triqs_c gtest_main app4triqs_warnings)
|
target_link_libraries(${test_name} ${PROJECT_NAME}_c gtest_main ${PROJECT_NAME}_warnings)
|
||||||
set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
||||||
add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
||||||
# Run clang-tidy if found
|
# Run clang-tidy if found
|
||||||
|
Loading…
Reference in New Issue
Block a user