[CMake] How do I select a different lib based on the configuration of the consuming project?
Benjamin Lindley
benjameslindley at gmail.com
Fri Jul 8 17:57:39 EDT 2011
I made a library named Zik. I compiled it in both release and debug
mode in Visual Studio, then installed it like this:
Zik
|--source
|--build
+--distribution
|--include
+--bin
+--Visual Studio 10
|--Zik.lib (release version)
+--Zik_d.lib (debug version)
My question is, how do I edit my Find script so that it selects the
right version of the library based on the configuration of the project
that wants to use the library?
Here is my find script so far:
#################################################################
# - Find Zik
# Find the Zik includes and library.
# Once done this will define
#
# Zik_INCLUDE_DIRS - where to Zik include directory
# Zik_LIBRARIES - List of libraries when using Zik.
# Zik_FOUND - True if Zik found.
FIND_PATH(Zik_INCLUDE_DIR Zik/Window.h
HINTS
C:/Users/Cold/Dev/C++/Library/Zik/distribution/include
)
FIND_LIBRARY(Zik_LIBRARY
NAMES
${Zik_NAMES}
HINTS
C:/Users/Cold/Dev/C++/Library/Zik/distribution/bin/${CMAKE_GENERATOR}
)
SET(Zik_INCLUDE_DIRS ${Zik_INCLUDE_DIR})
SET(Zik_LIBRARIES ${Zik_LIBRARY})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Zik DEFAULT_MESSAGE
Zik_INCLUDE_DIR Zik_LIBRARY)
MARK_AS_ADVANCED(Zik_LIBRARY Zik_INCLUDE_DIR)
#################################################################
More information about the CMake
mailing list