Always build template program
authorChristoph Junghans <junghans@votca.org>
Sun, 25 Nov 2012 21:31:21 +0000 (14:31 -0700)
committerChristoph Junghans <junghans@votca.org>
Thu, 13 Dec 2012 21:12:16 +0000 (14:12 -0700)
* make sure template is not broken
* gromacs dir contains copy of headers
* fixed warnings in template.c
* don't use config.h as it not installed
* use PKG_CFLAGS to emulate user environment

Change-Id: Ib8a3a5a9717727721d26ae4afbb69633e319d978

share/template/CMakeLists.txt
share/template/template.c

index e426784be0b302316b5e446994873966aabfeab3..b205633cf5fc4eb7d4aed9fb464541d78238120d 100644 (file)
@@ -37,6 +37,19 @@ install(FILES CMakeLists.txt.template
         RENAME CMakeLists.txt
         COMPONENT development)
 
+file(GLOB_RECURSE GROMACS_HEADERS ${CMAKE_SOURCE_DIR}/include *.h)
+add_custom_command(OUTPUT gromacs
+    COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/include 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)
+
 install(FILES README template.c Makefile.pkg
         DESTINATION ${DATA_INSTALL_DIR}/template
         COMPONENT development)
index 5a6450219055c3bc3cf6942d3111cb79d27b7b59..decd7dad65657042dc3da4d66a49b15c5ed61f15 100644 (file)
@@ -34,8 +34,8 @@
 #include <gromacs/pbc.h>
 #include <gromacs/smalloc.h>
 #include <gromacs/statutil.h>
-#include <gromacs/vec.h>
 #include <gromacs/xvgr.h>
+#include <gromacs/gmx_fatal.h>
 
 #include <gromacs/nbsearch.h>
 #include <gromacs/trajana.h>