From 332c939cfc4498d88581943b9e7e1ddfcc2f829c Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 21 Dec 2012 11:23:14 -0700 Subject: [PATCH] add an option to not build the template Change-Id: Ia85fc9dfbd191ac66cfff2d7b7c815620d800afe --- share/template/CMakeLists.txt | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/share/template/CMakeLists.txt b/share/template/CMakeLists.txt index b205633cf5..a4ace20c75 100644 --- a/share/template/CMakeLists.txt +++ b/share/template/CMakeLists.txt @@ -43,12 +43,23 @@ add_custom_command(OUTPUT gromacs DEPENDS ${GROMACS_HEADERS}) add_custom_target(gromacs_include_links DEPENDS gromacs) -add_executable(template template.c) -remove_definitions( -DHAVE_CONFIG_H ) -add_definitions("${PKG_CFLAGS}") -target_link_libraries(template gmx) -include_directories("${CMAKE_CURRENT_BINARY_DIR}") -add_dependencies(template gromacs_include_links) +option(GMX_BUILD_TEMPLATE "Build gromacs template program" ON) +mark_as_advanced(GMX_BUILD_TEMPLATE) +# GMX_PREFER_STATIC_OPENMP=yes is a special case to build binaries +# to distribute and as the template is not installed it can be +# ignored. +# The template is build in a user-like environment, hence we use +# flags from PKG_CFLAGS. Again GMX_PREFER_STATIC_OPENMP=yes would +# need special link flags (OpenMP_LINKER_FLAGS), which are not +# very user-like. +if (GMX_BUILD_TEMPLATE AND NOT GMX_PREFER_STATIC_OPENMP) + add_executable(template template.c) + remove_definitions( -DHAVE_CONFIG_H ) + add_definitions("${PKG_CFLAGS}") + target_link_libraries(template gmx) + include_directories("${CMAKE_CURRENT_BINARY_DIR}") + add_dependencies(template gromacs_include_links) +endif() install(FILES README template.c Makefile.pkg DESTINATION ${DATA_INSTALL_DIR}/template -- 2.11.4.GIT