# Find BWAPI (C++ library https://github.com/bwapi/bwapi/releases) # Input variable: BWAPI_PATH # Output variables: # Windows: # BWAPI_INCLUDE_DIRS # BWAPI_LIBRARIES: # BWAPI_LIB_DEBUG // BWAPId.lib # BWAPI_LIB_RELEASE // BWAPI.lib # BWAPI_DLLS: # BWAPI_DLL_DEBUG // BWAPId.dll # BWAPI_DLL_RELEASE // BWAPI.dll # BWAPI_CLIENT_LIBRARIES # BWAPI_CLIENT_LIB_DEBUG // BWAPIClientd.lib # BWAPI_CLIENT_LIB_RELEASE // BWAPIClient.lib # Linux: # BWAPI_INCLUDE_DIRS # BWAPI_DLL // libBWAPILIB.so # BWAPI_CLIENT_LIB // libBWAPIClient.a find_path(BWAPI_INCLUDE_DIRS NAMES BWAPI.h PATHS ${BWAPI_PATH}/include) if (UNIX) # find libBWAPIClient.a find_library(BWAPI_CLIENT_LIB NAMES BWAPIClient PATHS ${BWAPI_PATH}/lib) # find libBWAPILIB.so find_library(BWAPI_DLL NAMES BWAPILIB PATHS ${BWAPI_PATH}/lib) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(BWAPI DEFAULT_MSG BWAPI_DLL BWAPI_CLIENT_LIB BWAPI_INCLUDE_DIRS ) add_library(BWAPI SHARED IMPORTED) set_property(TARGET BWAPI PROPERTY IMPORTED_LOCATION ${BWAPI_DLL}) add_library(BWAPIClient STATIC IMPORTED) set_property(TARGET BWAPIClient PROPERTY IMPORTED_LOCATION ${BWAPI_CLIENT_LIB}) else() set(old_prefixes ${CMAKE_FIND_LIBRARY_PREFIXES}) set(old_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_PREFIXES "") set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") # find BWAPI .lib find_library(BWAPI_LIB_DEBUG NAMES BWAPId PATHS ${BWAPI_PATH}/lib) find_library(BWAPI_LIB_RELEASE NAMES BWAPI PATHS ${BWAPI_PATH}/lib) set(BWAPI_LIBRARIES ${BWAPI_LIB_DEBUG} ${BWAPI_LIB_RELEASE}) # find BWAPIClient .lib find_library(BWAPI_CLIENT_LIB_DEBUG NAMES BWAPIClientd PATHS ${BWAPI_PATH}/lib) find_library(BWAPI_CLIENT_LIB_RELEASE NAMES BWAPIClient PATHS ${BWAPI_PATH}/lib) set(BWAPI_CLIENT_LIBRARIES ${BWAPI_LIB_DEBUG} ${BWAPI_LIB_RELEASE}) set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll") #find BWAPI .dll find_library(BWAPI_DLL_DEBUG NAMES BWAPId PATHS ${BWAPI_PATH}/Starcraft/bwapi-data/) find_library(BWAPI_DLL_RELEASE NAMES BWAPI PATHS ${BWAPI_PATH}/Starcraft/bwapi-data/) set(BWAPI_DLLS ${BWAPI_DLL_DEBUG} ${BWAPI_DLL_RELEASE}) set(CMAKE_FIND_LIBRARY_PREFIXES ${old_prefixes}) set(CMAKE_FIND_LIBRARY_SUFFIXES ${old_suffixes}) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(BWAPI DEFAULT_MSG BWAPI_LIBRARIES BWAPI_DLLS BWAPI_CLIENT_LIBRARIES BWAPI_INCLUDE_DIRS ) add_library(BWAPI STATIC IMPORTED) set_property(TARGET BWAPI PROPERTY IMPORTED_LOCATION ${BWAPI_LIB_RELEASE}) set_property(TARGET BWAPI PROPERTY IMPORTED_LOCATION_DEBUG ${BWAPI_LIB_DEBUG}) add_library(BWAPIClient STATIC IMPORTED) set_property(TARGET BWAPIClient PROPERTY IMPORTED_LOCATION ${BWAPI_CLIENT_LIB_RELEASE}) set_property(TARGET BWAPIClient PROPERTY IMPORTED_LOCATION_DEBUG ${BWAPI_CLIENT_LIB_DEBUG}) endif(UNIX)