diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7347e90..3da4ff9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,31 +1,50 @@
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
+# Define a project.
project(TEO_DEVELOPER_MANUAL LANGUAGES NONE)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+# Find dependencies
+find_package(YCM 0.8 REQUIRED)
-find_package(YARP REQUIRED)
-list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})
-include(YarpInstallationHelpers)
+# https://github.com/roboticslab-uc3m/questions-and-answers/issues/65
+find_package(YARP 3.0 QUIET)
+if(NOT YARP_FOUND)
+ find_package(YARP 2.3.70 REQUIRED)
+endif()
+
+# Set some useful variables - paths relative to the installation prefix.
yarp_configure_external_installation(teo-developer-manual)
+# Collect Markdown files. Globbing is evil, but we don't care. All we
+# need CMake here for is to support superbuild-like repos through YCM.
file(GLOB md ${CMAKE_SOURCE_DIR}/*.md)
-set(assets ${CMAKE_SOURCE_DIR}/assets)
-yarp_install(FILES ${md} DESTINATION ${TEO-DEVELOPER-MANUAL_CONTEXTS_INSTALL_DIR})
-yarp_install(DIRECTORY ${assets} DESTINATION ${TEO-DEVELOPER-MANUAL_CONTEXTS_INSTALL_DIR})
+# Install files, create a copy in the local build tree.
+yarp_install(FILES ${md}
+ DESTINATION ${TEO-DEVELOPER-MANUAL_CONTEXTS_INSTALL_DIR})
+yarp_install(DIRECTORY assets
+ DESTINATION ${TEO-DEVELOPER-MANUAL_CONTEXTS_INSTALL_DIR})
+
+# Store this package in the user registry.
+export(PACKAGE ${PROJECT_NAME})
+# Define CMAKE_INSTALL_
and CMAKE_INSTALL_FULL_ variables.
include(GNUInstallDirs)
+# Set installation path for CMake files.
if(WIN32 AND NOT CYGWIN)
set(_cmake_destination CMake)
else()
- set(_cmake_destination ${CMAKE_INSTALL_LIBDIR}/cmake/TEO_DEVELOPER_MANUAL)
+ set(_cmake_destination ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
endif()
-export(PACKAGE TEO_DEVELOPER_MANUAL)
+# Create dummy CMake configuration export file.
+file(WRITE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+ "# Dummy CMake configuration export file.")
-file(WRITE ${CMAKE_BINARY_DIR}/TEO_DEVELOPER_MANUALConfig.cmake "# Dummy CMake configuration export file.")
-install(FILES ${CMAKE_BINARY_DIR}/TEO_DEVELOPER_MANUALConfig.cmake DESTINATION ${_cmake_destination})
+# Install CMake configuration file.
+install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+ DESTINATION ${_cmake_destination})
+# Add uninstall rule.
include(AddUninstallTarget)
diff --git a/cmake/AddUninstallTarget.cmake b/cmake/AddUninstallTarget.cmake
deleted file mode 100644
index fefef2d..0000000
--- a/cmake/AddUninstallTarget.cmake
+++ /dev/null
@@ -1,70 +0,0 @@
-#.rst:
-# AddUninstallTarget
-# ------------------
-#
-# Add the "uninstall" target for your project::
-#
-# include(AddUninstallTarget)
-#
-#
-# will create a file cmake_uninstall.cmake in the build directory and add a
-# custom target uninstall that will remove the files installed by your package
-# (using install_manifest.txt)
-
-#=============================================================================
-# Copyright 2008-2013 Kitware, Inc.
-# Copyright 2013 Istituto Italiano di Tecnologia (IIT)
-# Authors: Daniele E. Domenichelli
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-
-if(DEFINED __ADD_UNINSTALL_TARGET_INCLUDED)
- return()
-endif()
-set(__ADD_UNINSTALL_TARGET_INCLUDED TRUE)
-
-
-set(_filename ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
-
-file(WRITE ${_filename}
-"if(NOT EXISTS \"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\")
- message(WARNING \"Cannot find install manifest: \\\"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\\\"\")
- return()
-endif()
-
-file(READ \"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\" files)
-string(STRIP \"\${files}\" files)
-string(REGEX REPLACE \"\\n\" \";\" files \"\${files}\")
-list(REVERSE files)
-foreach(file \${files})
- message(STATUS \"Uninstalling: \$ENV{DESTDIR}\${file}\")
- if(EXISTS \"\$ENV{DESTDIR}\${file}\")
- execute_process(
- COMMAND \${CMAKE_COMMAND} -E remove \"\$ENV{DESTDIR}\${file}\"
- OUTPUT_VARIABLE rm_out
- RESULT_VARIABLE rm_retval)
- if(NOT \"\${rm_retval}\" EQUAL 0)
- message(FATAL_ERROR \"Problem when removing \\\"\$ENV{DESTDIR}\${file}\\\"\")
- endif()
- else()
- message(STATUS \"File \\\"\$ENV{DESTDIR}\${file}\\\" does not exist.\")
- endif()
-endforeach(file)
-")
-
-if("${CMAKE_GENERATOR}" MATCHES "^(Visual Studio|Xcode)")
- set(_uninstall "UNINSTALL")
-else()
- set(_uninstall "uninstall")
-endif()
-add_custom_target(${_uninstall} COMMAND "${CMAKE_COMMAND}" -P "${_filename}")
-set_property(TARGET ${_uninstall} PROPERTY FOLDER "CMakePredefinedTargets")
diff --git a/cmake/Copyright.txt b/cmake/Copyright.txt
deleted file mode 100644
index b18e0aa..0000000
--- a/cmake/Copyright.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-YCM - Extra CMake Modules for YARP and friends
-Copyright 2013-2014 Istituto Italiano di Tecnologia (IIT)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-* Neither the names of Istituto Italiano di Tecnologia (IIT),
- nor the names of their contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-------------------------------------------------------------------------------
-
-The above copyright and license notice applies to distributions of
-YCM in source and binary form. Some source files contain additional
-notices of original copyright by their contributors; see each source
-for details. Third-party software packages supplied with YCM under
-compatible licenses provide their own copyright notices documented in
-corresponding subdirectories.
-
-------------------------------------------------------------------------------
-
-YCM is being developed by the iCub Facility, Istituto Italiano di
-Tecnologia.
-
-Additional support to YCM was received from the FP7 EU project
-WALK-MAN (http://walk-man.eu/)