-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
conflict with gflags already exists #251
Comments
Should it be a |
Take a look at CMake's |
have you solved the problem yet |
This solves the problem |
Using
# Build gflags as an external project.
set(GFLAGS_INSTALL_DIR ${CMAKE_BINARY_DIR}/libs/gflags)
set(GFLAGS_INCLUDE_DIR ${GFLAGS_INSTALL_DIR}/include)
set(GFLAGS_LIB_DIR ${GFLAGS_INSTALL_DIR}/lib)
ExternalProject_Add(gflags_external_project
SOURCE_DIR ${CMAKE_SOURCE_DIR}/libs/gflags
PREFIX ${GFLAGS_INSTALL_DIR}
INSTALL_DIR ${GFLAGS_INSTALL_DIR}
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${EXTERNAL_PROJECT_CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX:PATH=${GFLAGS_INSTALL_DIR}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
)
include_directories(BEFORE SYSTEM ${GFLAGS_INCLUDE_DIR})
link_directories(${GFLAGS_LIB_DIR}) # Build glog as an external project.
set(GLOG_INSTALL_DIR ${CMAKE_BINARY_DIR}/libs/glog)
set(GLOG_INCLUDE_DIR ${GLOG_INSTALL_DIR}/include)
set(GLOG_LIB_DIR ${GLOG_INSTALL_DIR}/lib)
ExternalProject_Add(glog_external_project
SOURCE_DIR ${CMAKE_SOURCE_DIR}/libs/glog
PREFIX ${GLOG_INSTALL_DIR}
INSTALL_DIR ${GLOG_INSTALL_DIR}
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${EXTERNAL_PROJECT_CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX:PATH=${GLOG_INSTALL_DIR}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
DEPENDS gflags_external_project
)
include_directories(BEFORE SYSTEM ${GLOG_INCLUDE_DIR})
link_directories(${GLOG_LIB_DIR})
add_dependencies(my_program
gflags_external_project
glog_external_project
)
target_link_libraries(my_program pthread gflags glog) As taken from the fuchsia/cobalt project. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a project which depends on both
gflags
andglog
. I include them in my CMakeLists.txt file as below.this comes an error:
are there any solution?
BR
The text was updated successfully, but these errors were encountered: