Skip to content

Commit

Permalink
add LIBBASE122_USE_CONFIG_FILE option to testconsumer
Browse files Browse the repository at this point in the history
Intended to test config file
  • Loading branch information
kevinAlbs committed Jan 4, 2024
1 parent 2be5f07 commit 0319711
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions test/testconsumer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
cmake_minimum_required(VERSION 3.23)
project(libbase122 LANGUAGES C)
add_executable(testconsumer testconsumer.c)
if (NOT DEFINED LIBBASE122_INSTALL_PATH)
message(FATAL_ERROR "LIBBASE122_INSTALL_PATH not defined. Define with install path to libbase122.")
endif ()

if (NOT DEFINED LIBBASE122_USE_SHARED)
message(FATAL_ERROR "LIBBASE122_USE_SHARED not defined. Define to TRUE or FALSE.")
endif ()

if (WIN32)
if (LIBBASE122_USE_CONFIG_FILE)
message (STATUS "Trying to find libbase122 with CMake config file...")
find_package (Base122 REQUIRED)
if (LIBBASE122_USE_SHARED)
target_link_libraries (testconsumer base122::shared)
else ()
target_link_libraries (testconsumer base122::static)
endif () # LIBBASE122_USE_SHARED
elseif (WIN32)
if (NOT DEFINED LIBBASE122_INSTALL_PATH)
message(FATAL_ERROR "LIBBASE122_INSTALL_PATH not defined. Define with install path to libbase122.")
endif ()

message (STATUS "Trying to find libbase122 at path ${LIBBASE122_INSTALL_PATH}")
# Convert a Windows path (e.g. C:\foo\bar) to a CMake path (e.g. C:/foo/bar)
file(TO_CMAKE_PATH "${LIBBASE122_INSTALL_PATH}" LIBBASE122_INSTALL_PATH)
message(STATUS "${LIBBASE122_INSTALL_PATH}")
Expand Down

0 comments on commit 0319711

Please sign in to comment.