Fix test build with GMX_BUILD_MDRUN_ONLY
authorTeemu Murtola <teemu.murtola@gmail.com>
Wed, 4 Dec 2013 18:23:26 +0000 (20:23 +0200)
committerTeemu Murtola <teemu.murtola@gmail.com>
Wed, 4 Dec 2013 18:26:25 +0000 (20:26 +0200)
Removed the tests from such builds to resolve CMake errors.
The tests cannot in any case be run without non-mdrun code.
Got broken in I8072355.

Also moved the object library for gmx view such that it doesn't get
unnecessary built with GMX_BUILD_MDRUN_ONLY.

Change-Id: I52c19d695680f5bd94deaae712d2d10e3364dfa6

src/programs/CMakeLists.txt

index 9272d4777bc24bc2ce4841fe31cb12a1d85e5855..d3f57884c080de48279f393db170ba317b7a685d 100644 (file)
@@ -38,13 +38,6 @@ file(GLOB MDRUN_SOURCES mdrun/*.c mdrun/*.cpp)
 # make an "object library" that we can re-use for multiple targets
 add_library(mdrun_objlib OBJECT ${MDRUN_SOURCES})
 
-if(GMX_X11)
-    file(GLOB VIEW_SOURCES view/*.cpp)
-else()
-    file(GLOB VIEW_SOURCES view/view.cpp)
-endif()
-add_library(view_objlib OBJECT ${VIEW_SOURCES})
-
 if(GMX_FAHCORE)
     # The lack of a real source file here alongside the object library
     # may break some generators, according to CMake documentation. If
@@ -62,7 +55,13 @@ else()
     file(GLOB GMX_GENERAL_SOURCES gmx/*.c gmx/*.cpp)
     file(GLOB GMX_MAIN_SOURCES gmx/gmx.cpp gmx/legacymodules.cpp)
     list(REMOVE_ITEM GMX_GENERAL_SOURCES ${GMX_MAIN_SOURCES})
+    if(GMX_X11)
+        file(GLOB VIEW_SOURCES view/*.cpp)
+    else()
+        file(GLOB VIEW_SOURCES view/view.cpp)
+    endif()
     add_library(gmx_objlib OBJECT ${GMX_GENERAL_SOURCES})
+    add_library(view_objlib OBJECT ${VIEW_SOURCES})
     add_executable(gmx
         ${GMX_MAIN_SOURCES}
         $<TARGET_OBJECTS:gmx_objlib>
@@ -101,8 +100,8 @@ else()
     if (GMX_SYMLINK_OLD_BINARY_NAMES)
         install(SCRIPT ${CREATE_LINKS_SCRIPT} COMPONENT links)
     endif ()
-endif()
 
-if(BUILD_TESTING)
-    add_subdirectory(mdrun/tests)
-endif(BUILD_TESTING)
+    if(BUILD_TESTING)
+        add_subdirectory(mdrun/tests)
+    endif(BUILD_TESTING)
+endif()