Skip to content

Commit

Permalink
Improving CONFIG test (#235)
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Mahesheka <[email protected]>
  • Loading branch information
harshmahesheka authored Apr 14, 2022
1 parent ad1d37b commit a6c7b94
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions examples/use_config_ifp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/")
set(ignition-find_config_DIR "${CMAKE_SOURCE_DIR}/")
#ign_find_package(ignition-find_config) will search for Findignition-find_config.cmake before ignition-find_configConfig.cmake
ign_find_package(ignition-find_config)
if(CONFIG_TEST MATCHES "The package was found using MODULE mode")
message(STATUS "The package was found using MODULE mode")
else()
message(SEND_ERROR "Couldn't find correct package in MODULE mode.\nign_find_package CONFIG test failed")
endif()
#After CONFIG arguemnt ign_find_package will skip MODULE mode and search for ignition-find_configConfig.cmake directly
ign_find_package(ignition-find_config CONFIG)
if(CONFIG_TEST MATCHES "The package was found using CONFIG mode")
message(STATUS "The package was found using CONFIG mode")
else()
message(SEND_ERROR "Couldn't find correct package in CONFIG mode.\nign_find_package CONFIG test failed")
endif()
ign_configure_project()
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()
2 changes: 1 addition & 1 deletion examples/use_config_ifp/Findignition-find_config.cmake
Original file line number Diff line number Diff line change
@@ -1 +1 @@
message(STATUS "The package was found using MODULE mode")
set(CONFIG_TEST "The package was found using MODULE mode")
2 changes: 1 addition & 1 deletion examples/use_config_ifp/ignition-find_configConfig.cmake
Original file line number Diff line number Diff line change
@@ -1 +1 @@
message(STATUS "The package was found using CONFIG mode")
set(CONFIG_TEST "The package was found using CONFIG mode")

0 comments on commit a6c7b94

Please sign in to comment.