Set CMake module search path at a better time
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 18 Dec 2012 23:20:04 +0000 (00:20 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 4 Jan 2013 12:26:04 +0000 (13:26 +0100)
This needs to be set before project() in order that
toolchain files for cross compilling can use the same
search path. Otherwise, the users has to specify
fully-qualified toolchain files.

Refs #1064

Change-Id: I1f1fb4803c9f0dd2b95d236da1c1858c5ea382f9

CMakeLists.txt

index 9a39d3e8e1a3b98799d6dee9fa65425290e58526..0251e1048849676bc575a1965d3eee71910c0dee 100644 (file)
@@ -40,6 +40,10 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
 set(CPACK_COMPONENT_GROUP_TOOLS_DESCRIPTION "All GROMACS executable tools")
 set(CPACK_COMPONENT_GROUP_MDRUN_DESCRIPTION "GROMACS executable for running simulations")
 
+# CMake modules/macros are in a subdirectory to keep this file cleaner
+# This needs to be set before project() in order to pick up toolchain files
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Platform)
+
 project(Gromacs C)
 include(Dart)
 mark_as_advanced(DART_ROOT)
@@ -81,9 +85,6 @@ endif()
 # provide backward compatibility of software written against the Gromacs API.
 set(API_VERSION ${NUM_VERSION})
 
-# Cmake modules/macros are in a subdirectory to keep this file cleaner
-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-
 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND UNIX)
 set(CMAKE_INSTALL_PREFIX "/usr/local/gromacs" CACHE STRING "Installation prefix (installation will need write permissions here)" FORCE)
 endif()