CMakeLists.txt: fix Windows/MSVC lib search when only Debug versions of libs are found.

This commit is contained in:
Stinkfist0
2017-05-11 23:30:17 +03:00
committed by Thomas Krijnen
parent 68b432f6c0
commit 1b9a28d799
+26 -9
View File
@@ -189,9 +189,12 @@ ELSE()
ENDIF() ENDIF()
# Use the found libTKernel as a template for all other OCC libraries # Use the found libTKernel as a template for all other OCC libraries
# TODO Extract this into macro/function
foreach(lib ${OPENCASCADE_LIBRARY_NAMES}) foreach(lib ${OPENCASCADE_LIBRARY_NAMES})
string(REPLACE TKernel "${lib}" lib_path "${libTKernel}") # Make sure we'll handle the Windows/MSVC debug postfix convetion too.
list(APPEND OPENCASCADE_LIBRARIES "${lib_path}") string(REPLACE TKerneld "${lib}" lib_path "${libTKernel}")
string(REPLACE TKernel "${lib}" lib_path "${lib_path}")
list(APPEND OPENCASCADE_LIBRARIES "${lib_path}")
endforeach() endforeach()
if(MSVC) if(MSVC)
@@ -251,7 +254,13 @@ IF(COLLADA_SUPPORT)
GET_FILENAME_COMPONENT(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_FRAMEWORK_LIB} PATH) GET_FILENAME_COMPONENT(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_FRAMEWORK_LIB} PATH)
ENDIF() ENDIF()
FIND_LIBRARY(OpenCOLLADAFramework NAMES OpenCOLLADAFramework PATHS ${OPENCOLLADA_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(OpenCOLLADAFramework NAMES OpenCOLLADAFramework OpenCOLLADAFrameworkd PATHS ${OPENCOLLADA_LIBRARY_DIR} NO_DEFAULT_PATH)
if (OpenCOLLADAFramework)
message(STATUS "OpenCOLLADA library files found")
else()
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA libraries. "
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
endif()
SET(OPENCOLLADA_LIBRARY_DIR "${OPENCOLLADA_LIBRARY_DIR}" CACHE FILEPATH "OpenCOLLADA library files") SET(OPENCOLLADA_LIBRARY_DIR "${OPENCOLLADA_LIBRARY_DIR}" CACHE FILEPATH "OpenCOLLADA library files")
@@ -268,24 +277,31 @@ IF(COLLADA_SUPPORT)
# Use the found OpenCOLLADAFramework as a template for all other OpenCOLLADA libraries # Use the found OpenCOLLADAFramework as a template for all other OpenCOLLADA libraries
foreach(lib ${OPENCOLLADA_LIBRARY_NAMES}) foreach(lib ${OPENCOLLADA_LIBRARY_NAMES})
string(REPLACE OpenCOLLADAFramework "${lib}" lib_path "${OpenCOLLADAFramework}") # Make sure we'll handle the Windows/MSVC debug postfix convetion too.
list(APPEND OPENCOLLADA_LIBRARIES "${lib_path}") string(REPLACE OpenCOLLADAFrameworkd "${lib}" lib_path "${OpenCOLLADAFramework}")
string(REPLACE OpenCOLLADAFramework "${lib}" lib_path "${lib_path}")
list(APPEND OPENCOLLADA_LIBRARIES "${lib_path}")
endforeach() endforeach()
if("${PCRE_LIBRARY_DIR}" STREQUAL "") if("${PCRE_LIBRARY_DIR}" STREQUAL "")
if(WIN32) if(WIN32)
find_library(pcre_library NAMES pcre PATHS ${OPENCOLLADA_LIBRARY_DIR} NO_DEFAULT_PATH) find_library(pcre_library NAMES pcre pcred PATHS ${OPENCOLLADA_LIBRARY_DIR} NO_DEFAULT_PATH)
else() else()
find_library(pcre_library NAMES pcre PATHS ${OPENCOLLADA_LIBRARY_DIR}) find_library(pcre_library NAMES pcre PATHS ${OPENCOLLADA_LIBRARY_DIR})
endif() endif()
GET_FILENAME_COMPONENT(PCRE_LIBRARY_DIR ${pcre_library} PATH) GET_FILENAME_COMPONENT(PCRE_LIBRARY_DIR ${pcre_library} PATH)
else() else()
find_library(pcre_library NAMES pcre PATHS ${PCRE_LIBRARY_DIR} NO_DEFAULT_PATH) find_library(pcre_library NAMES pcre pcred PATHS ${PCRE_LIBRARY_DIR} NO_DEFAULT_PATH)
endif() endif()
if (pcre_library) if (pcre_library)
SET(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_LIBRARY_DIR} ${PCRE_LIBRARY_DIR}) SET(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_LIBRARY_DIR} ${PCRE_LIBRARY_DIR})
list(APPEND OPENCOLLADA_LIBRARIES "${pcre_library}") if (MSVC)
# Add release lib regardless whether release or debug found. Debug version will be appended below.
list(APPEND OPENCOLLADA_LIBRARIES "${PCRE_LIBRARY_DIR}/pcre.lib")
else()
list(APPEND OPENCOLLADA_LIBRARIES "${pcre_library}")
endif()
else() else()
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find PCRE. " message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find PCRE. "
"Disable COLLADA_SUPPORT or fix PCRE_LIBRARY_DIR path to proceed.") "Disable COLLADA_SUPPORT or fix PCRE_LIBRARY_DIR path to proceed.")
@@ -295,7 +311,8 @@ IF(COLLADA_SUPPORT)
add_debug_variants(OPENCOLLADA_LIBRARIES "${OPENCOLLADA_LIBRARIES}" d) add_debug_variants(OPENCOLLADA_LIBRARIES "${OPENCOLLADA_LIBRARIES}" d)
ENDIF() ENDIF()
ELSE() ELSE()
MESSAGE(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA. Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.") message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA headers. "
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
ENDIF() ENDIF()
ENDIF() ENDIF()