diff --git a/cmake/FindIgnOGRE2.cmake b/cmake/FindIgnOGRE2.cmake index b94166aa..2d626db8 100644 --- a/cmake/FindIgnOGRE2.cmake +++ b/cmake/FindIgnOGRE2.cmake @@ -42,7 +42,7 @@ # Example usage: # # ign_find_package(IgnOGRE2 -# VERSION 2.1.0 +# VERSION 2.2.0 # COMPONENTS HlmsPbs HlmsUnlit Overlay) # sanity check @@ -53,6 +53,9 @@ if (${IgnOGRE2_FIND_VERSION_MAJOR}) endif() endif() +message(STATUS "-- Finding OGRE 2.${IgnOGRE2_FIND_VERSION_MINOR}") +set(OGRE2_INSTALL_PATH "OGRE-2.${IgnOGRE2_FIND_VERSION_MINOR}") + macro(append_library VAR LIB) if(EXISTS "${LIB}") list(APPEND ${VAR} ${LIB}) @@ -92,12 +95,13 @@ endmacro() if (NOT WIN32) set(PKG_CONFIG_PATH_ORIGINAL $ENV{PKG_CONFIG_PATH}) - # Note: OGRE2 installed from debs is named OGRE-2.1 while the version - # installed from source does not have the 2.1 suffix + # Note: OGRE2 installed from debs is named OGRE-2.2 while the version + # installed from source does not have the 2.2 suffix # look for OGRE2 installed from debs - ign_pkg_check_modules_quiet(OGRE2 "OGRE-2.1" NO_CMAKE_ENVIRONMENT_PATH QUIET) + ign_pkg_check_modules_quiet(OGRE2 ${OGRE2_INSTALL_PATH} NO_CMAKE_ENVIRONMENT_PATH QUIET) + if (OGRE2_FOUND) - set(IGN_PKG_NAME "OGRE-2.1") + set(IGN_PKG_NAME ${OGRE2_INSTALL_PATH}) else() # look for OGRE2 installed from source set(PKG_CONFIG_PATH_TMP ${PKG_CONFIG_PATH_ORIGINAL}) diff --git a/examples/find_ogre2/README.md b/examples/find_ogre2/README.md new file mode 100644 index 00000000..344a6b6c --- /dev/null +++ b/examples/find_ogre2/README.md @@ -0,0 +1,53 @@ +A quick demonstration of searching for Ogre 2.1 vs 2.2 via ign-cmake. + +To test with both versions installed: + +## Ogre 2.1 + +``` +cd ogre-2.1 +mkdir build +cd build +cmake .. +``` + +### Expected output + +``` +-- Looking for IgnOGRE2 - found + +-- OGRE2_FOUND: TRUE +-- OGRE2_LIBRARIES: /usr/lib/x86_64-linux-gnu/OGRE-2.1/libOgreMain.soIgnOGRE2-HlmsPbs::IgnOGRE2-HlmsPbsIgnOGRE2-HlmsUnlit::IgnOGRE2-HlmsUnlitIgnOGRE2-Overlay::IgnOGRE2-Overlay +-- OGRE2_INCLUDE_DIRS: /usr/include/OGRE-2.1/usr/include/OGRE-2.1/RenderSystems/GL3Plus +-- OGRE2_VERSION: 2.1.0 +-- OGRE2_VERSION_MAJOR: 2 +-- OGRE2_VERSION_MINOR: 1 +-- OGRE2_VERSION_PATCH: 0 +-- OGRE2_RESOURCE_PATH: /usr/lib/x86_64-linux-gnu/OGRE-2.1/OGRE +``` + +## Ogre 2.2 + +``` +cd ogre-2.2 +mkdir build +cd build +cmake .. +``` + +### Expected output + + +``` +-- Looking for IgnOGRE2 - found + +-- OGRE2_FOUND: TRUE +-- OGRE2_LIBRARIES: /usr/lib/x86_64-linux-gnu/OGRE-2.2/libOgreMain.soIgnOGRE2-HlmsPbs::IgnOGRE2-HlmsPbsIgnOGRE2-HlmsUnlit::IgnOGRE2-HlmsUnlitIgnOGRE2-Overlay::IgnOGRE2-Overlay +-- OGRE2_INCLUDE_DIRS: /usr/include/OGRE-2.2/usr/include/OGRE-2.2/RenderSystems/GL3Plus +-- OGRE2_VERSION: 2.2.6 +-- OGRE2_VERSION_MAJOR: 2 +-- OGRE2_VERSION_MINOR: 2 +-- OGRE2_VERSION_PATCH: 6 +-- OGRE2_RESOURCE_PATH: /usr/lib/x86_64-linux-gnu/OGRE-2.2/OGRE +``` + diff --git a/examples/find_ogre2/ogre-2.1/CMakeLists.txt b/examples/find_ogre2/ogre-2.1/CMakeLists.txt new file mode 100644 index 00000000..7b381d58 --- /dev/null +++ b/examples/find_ogre2/ogre-2.1/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +project(ignition-ogre-2.1 VERSION 0.1.0) + +find_package(ignition-cmake2 REQUIRED) + +message(STATUS "Finding OGRE 2.1") + +ign_find_package(IgnOGRE2 VERSION 2.1.0 + COMPONENTS HlmsPbs HlmsUnlit Overlay) + +message(STATUS "OGRE2_FOUND: " ${OGRE2_FOUND}) +message(STATUS "OGRE2_LIBRARIES: " ${OGRE2_LIBRARIES}) +message(STATUS "OGRE2_INCLUDE_DIRS: " ${OGRE2_INCLUDE_DIRS}) +message(STATUS "OGRE2_VERSION: " ${OGRE2_VERSION}) +message(STATUS "OGRE2_VERSION_MAJOR: " ${OGRE2_VERSION_MAJOR}) +message(STATUS "OGRE2_VERSION_MINOR: " ${OGRE2_VERSION_MINOR}) +message(STATUS "OGRE2_VERSION_PATCH: " ${OGRE2_VERSION_PATCH}) +message(STATUS "OGRE2_RESOURCE_PATH: " ${OGRE2_RESOURCE_PATH}) diff --git a/examples/find_ogre2/ogre-2.2/CMakeLists.txt b/examples/find_ogre2/ogre-2.2/CMakeLists.txt new file mode 100644 index 00000000..4f4366b7 --- /dev/null +++ b/examples/find_ogre2/ogre-2.2/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +project(ignition-ogre-2.2 VERSION 0.1.0) + +find_package(ignition-cmake2 REQUIRED) + +message(STATUS "Finding OGRE 2.2") + +ign_find_package(IgnOGRE2 VERSION 2.2.0 + COMPONENTS HlmsPbs HlmsUnlit Overlay) + +message(STATUS "OGRE2_FOUND: " ${OGRE2_FOUND}) +message(STATUS "OGRE2_LIBRARIES: " ${OGRE2_LIBRARIES}) +message(STATUS "OGRE2_INCLUDE_DIRS: " ${OGRE2_INCLUDE_DIRS}) +message(STATUS "OGRE2_VERSION: " ${OGRE2_VERSION}) +message(STATUS "OGRE2_VERSION_MAJOR: " ${OGRE2_VERSION_MAJOR}) +message(STATUS "OGRE2_VERSION_MINOR: " ${OGRE2_VERSION_MINOR}) +message(STATUS "OGRE2_VERSION_PATCH: " ${OGRE2_VERSION_PATCH}) +message(STATUS "OGRE2_RESOURCE_PATH: " ${OGRE2_RESOURCE_PATH})