commit f97d1846cfd9dc83df5661283ed969767540197c
parent 86395d904619f0eca3ba9c6bd73e93f8fcc03aaa
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 7 Mar 2016 14:45:20 +0100
Add a dependency to the LibYAML devel
Add a LibYAML cmake module and use it to look for the LibYAML devel.
Diffstat:
2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -34,6 +34,10 @@ set(SCHIFF_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src/)
################################################################################
# Check dependencies
################################################################################
+get_filename_component(_current_source_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
+set(LibYAML_DIR ${_current_source_dir}/)
+
+find_package(LibYAML REQUIRED)
find_package(RCMake 0.2 REQUIRED)
find_package(RSys 0.3 REQUIRED)
find_package(Star3D 0.3 REQUIRED)
@@ -45,6 +49,7 @@ if(MSVC)
endif()
include_directories(
+ ${LibYAML_INCLUDE_DIR}
${RSys_INCLUDE_DIR}
${Star3D_INCLUDE_DIR}
${StarSchiff_INCLUDE_DIR}
@@ -89,7 +94,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()
add_executable(schiff ${SCHIFF_FILES_SRC} ${SCHIFF_FILES_INC})
-target_link_libraries(schiff RSys Star3D StarSchiff StarSP ${MATH_LIB})
+target_link_libraries(schiff LibYAML RSys Star3D StarSchiff StarSP ${MATH_LIB})
if(MSVC)
target_link_libraries(schiff MuslGetopt)
endif()
diff --git a/cmake/LibYAMLConfig.cmake b/cmake/LibYAMLConfig.cmake
@@ -0,0 +1,57 @@
+# Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com)
+#
+# This software is governed by the CeCILL license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/or redistribute the software under the terms of the CeCILL
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# In this respect, the user's attention is drawn to the risks associated
+# with loading, using, modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean that it is complicated to manipulate, and that also
+# therefore means that it is reserved for developers and experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or
+# data to be ensured and, more generally, to use and operate it in the
+# same conditions as regards security.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL license and that you accept its terms.
+
+cmake_minimum_required(VERSION 2.8)
+
+# Try to find the LibYAML devel. Once done this will define:
+# - LibYAML_FOUND: system has LibYAML
+# - LibYAML_INCLUDE_DIR: the include directory
+# - LibYAML: Link this to use LibYAML
+
+find_path(LibYAML_INCLUDE_DIR yaml.h)
+unset(LibYAML_LIBRARY CACHE)
+unset(LibYAML_LIBRARY_DEBUG CACHE)
+unset(LibYAML_LIBRARY_RELWITHDEBINFO CACHE)
+unset(LibYAML_LIBRARY_MINSIZEREL CACHE)
+find_library(LibYAML_LIBRARY yaml DOC "Path to library yaml.")
+
+# Create the imported library target
+if(CMAKE_HOST_WIN32)
+ set(_property IMPORTED_IMPLIB)
+else(CMAKE_HOST_WIN32)
+ set(_property IMPORTED_LOCATION)
+endif(CMAKE_HOST_WIN32)
+add_library(LibYAML SHARED IMPORTED)
+set_target_properties(LibYAML PROPERTIES ${_property} ${LibYAML_LIBRARY})
+
+# Check the package
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibYAML DEFAULT_MSG
+ LibYAML_INCLUDE_DIR
+ LibYAML_LIBRARY)
+