Polish the mgcxx CMake setup + fix gtest LIBDIR
This commit is contained in:
parent
c6e591b432
commit
8e6068551b
@ -35,14 +35,16 @@ endfunction(import_header_library)
|
||||
|
||||
function(import_library name type location include_dir)
|
||||
add_library(${name} ${type} IMPORTED GLOBAL)
|
||||
if(${ARGN})
|
||||
# https://cmake.org/cmake/help/latest/command/function.html#arguments
|
||||
if(ARGN)
|
||||
# Optional argument is the name of the external project that we need to
|
||||
# depend on.
|
||||
add_dependencies(${name} ${ARGN0})
|
||||
message(STATUS "ADDED DEPENDENCY TO ${ARGN0}")
|
||||
list(GET ARGN 0 dependency_name)
|
||||
add_dependencies(${name} ${dependency_name})
|
||||
message(STATUS "ADDED DEPENDENCY ${name} -> ${dependency_name}")
|
||||
else()
|
||||
add_dependencies(${name} ${name}-proj)
|
||||
message(STATUS "ADDED DEPENDENCY TO ${name}-proj")
|
||||
message(STATUS "ADDED DEPENDENCY ${name} -> ${name}-proj")
|
||||
endif()
|
||||
set_property(TARGET ${name} PROPERTY IMPORTED_LOCATION ${location})
|
||||
# We need to create the include directory first in order to be able to add it
|
||||
@ -149,7 +151,8 @@ mark_as_advanced(RC_ENABLE_GTEST RC_ENABLE_GMOCK)
|
||||
add_subdirectory(rapidcheck EXCLUDE_FROM_ALL)
|
||||
|
||||
# setup google test
|
||||
add_external_project(gtest SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
|
||||
add_external_project(gtest SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_LIBDIR=lib)
|
||||
set(GTEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/include
|
||||
CACHE PATH "Path to gtest and gmock include directory" FORCE)
|
||||
set(GMOCK_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/googletest/lib/libgmock.a
|
||||
@ -314,9 +317,3 @@ add_external_project(mgcxx
|
||||
mark_as_advanced(MGCXX_INCLUDE_DIR TANTIVY_TEXT_SEARCH_LIBRARY MGCXX_TEXT_SEARCH_LIBRARY)
|
||||
import_library(tantivy_text_search STATIC ${TANTIVY_TEXT_SEARCH_LIBRARY} ${MGCXX_INCLUDE_DIR} mgcxx-proj)
|
||||
import_library(mgcxx_text_search STATIC ${MGCXX_TEXT_SEARCH_LIBRARY} ${MGCXX_INCLUDE_DIR} mgcxx-proj)
|
||||
# TODO(gitbuda): import_library is wrong -> fix it and remove the below two lines.
|
||||
add_dependencies(tantivy_text_search mgcxx-proj)
|
||||
add_dependencies(mgcxx_text_search mgcxx-proj)
|
||||
# TODO(gitbuda): Consider adding below two lines to the import_library -> that might break other libraries.
|
||||
# set_target_properties(tantivy_text_search PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
# set_target_properties(mgcxx_text_search PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
|
Loading…
Reference in New Issue
Block a user