Simplify CMake scripts
authorJeff Preshing <filter-github@preshing.com>
Tue, 9 Feb 2016 00:46:59 +0000 (19:46 -0500)
committerJeff Preshing <filter-github@preshing.com>
Tue, 9 Feb 2016 00:46:59 +0000 (19:46 -0500)
Delete FindTurf.cmake as it was more complicated than necessary.

CMakeLists.txt
cmake/modules/FindTurf.cmake [deleted file]
samples/AddSample.cmake

index be8526d..93cf495 100644 (file)
@@ -29,7 +29,8 @@ set(JUNCTION_ALL_DLLS "")
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
 
 # Add turf targets and import its macros since we use them below
-find_package(Turf REQUIRED)
+get_filename_component(outerPath "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
+set(TURF_ROOT "${outerPath}/turf" CACHE STRING "Path to Turf")
 include("${TURF_ROOT}/cmake/Macros.cmake")
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
     # If this is the root project, apply build settings here so that
diff --git a/cmake/modules/FindTurf.cmake b/cmake/modules/FindTurf.cmake
deleted file mode 100644 (file)
index d9a684a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#----------------------------------------------
-# This find module locates the Turf *source*.
-#
-# Later, it might find binary packages too.
-#
-# Sets:
-#    TURF_FOUND
-#    TURF_ROOT - the root folder, containing CMakeLists.txt
-#    TURF_INCLUDE_DIRS - pass to include_directories()
-#----------------------------------------------
-
-if(TURF_ROOT)
-    get_filename_component(fullPath "${TURF_ROOT}" ABSOLUTE)
-    if(EXISTS "${fullPath}/cmake/turf_config.h.in")
-        set(TURF_FOUND TRUE)
-    endif()
-else()
-    find_path(TURF_ROOT "cmake/turf_config.h.in" PATHS
-        "${CMAKE_CURRENT_SOURCE_DIR}/../turf"
-        "${CMAKE_SOURCE_DIR}/../turf"
-        "${CMAKE_CURRENT_LIST_DIR}/../../../turf")
-    if(TURF_ROOT)
-        set(TURF_FOUND TRUE)
-    endif()
-endif()
-
-if(NOT TURF_FOUND)
-    message("Can't find Turf!")
-    if(Turf_FIND_REQUIRED)
-        message(FATAL_ERROR "Missing required package Turf")
-    endif()
-endif()
index 1083977..7a11c3a 100644 (file)
@@ -5,8 +5,8 @@
 # Were we included from the root listfile?
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
     # Yes, it's the root.
-    list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake/modules")
-    find_package(Turf REQUIRED)
+    get_filename_component(outerPath "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
+    set(TURF_ROOT "${outerPath}/turf" CACHE STRING "Path to Turf")
     include("${TURF_ROOT}/cmake/Macros.cmake")
     ApplyTurfBuildSettings()
     add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/.." junction)