Skip to content

Commit 92204df

Browse files
iii-ivitalybuka
authored andcommitted
Fix CI
Commit 918dafe ("Fix building on Fedora") introduced usage of CMAKE_INSTALL_LIBDIR in order to predict where gtest and libprotobuf will put their libraries. Unfortunately, the value of this variable depends on the value of CMAKE_INSTALL_PREFIX, specifically, whether it points to /usr. CI uses precisely -DCMAKE_INSTALL_PREFIX=/usr and was therefore broken by this change. In order to fix CI and keep Fedora working, just ask gtest and libprotobuf to put their libraries into "lib".
1 parent 918dafe commit 92204df

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

cmake/external/googletest.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
include(GNUInstallDirs)
16-
1715
set(GTEST_TARGET external.googletest)
1816
set(GTEST_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_TARGET})
1917

@@ -27,12 +25,12 @@ set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
2725
foreach(lib IN LISTS GTEST_BOTH_LIBRARIES)
2826
if (MSVC)
2927
if (CMAKE_BUILD_TYPE MATCHES Debug)
30-
set(LIB_PATH ${GTEST_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/${lib}d.lib)
28+
set(LIB_PATH ${GTEST_INSTALL_DIR}/lib/${lib}d.lib)
3129
else()
32-
set(LIB_PATH ${GTEST_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/${lib}.lib)
30+
set(LIB_PATH ${GTEST_INSTALL_DIR}/lib/${lib}.lib)
3331
endif()
3432
else()
35-
set(LIB_PATH ${GTEST_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/lib${lib}.a)
33+
set(LIB_PATH ${GTEST_INSTALL_DIR}/lib/lib${lib}.a)
3634
endif()
3735
list(APPEND GTEST_BUILD_BYPRODUCTS ${LIB_PATH})
3836

@@ -52,5 +50,6 @@ ExternalProject_Add(${GTEST_TARGET}
5250
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
5351
CMAKE_ARGS ${CMAKE_ARGS}
5452
-DCMAKE_INSTALL_PREFIX=${GTEST_INSTALL_DIR}
53+
-DCMAKE_INSTALL_LIBDIR=lib
5554
BUILD_BYPRODUCTS ${GTEST_BUILD_BYPRODUCTS}
5655
)

cmake/external/protobuf.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
include(GNUInstallDirs)
16-
1715
# We only need protobuf_generate_cpp from FindProtobuf, and we are going to
1816
# override the rest with ExternalProject version.
1917
include (FindProtobuf)
@@ -33,9 +31,9 @@ ENDIF()
3331

3432
foreach(lib ${PROTOBUF_LIBRARIES})
3533
if (MSVC)
36-
set(LIB_PATH ${PROTOBUF_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/lib${lib}.lib)
34+
set(LIB_PATH ${PROTOBUF_INSTALL_DIR}/lib/lib${lib}.lib)
3735
else()
38-
set(LIB_PATH ${PROTOBUF_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/lib${lib}.a)
36+
set(LIB_PATH ${PROTOBUF_INSTALL_DIR}/lib/lib${lib}.a)
3937
endif()
4038
list(APPEND PROTOBUF_BUILD_BYPRODUCTS ${LIB_PATH})
4139

@@ -70,6 +68,7 @@ ExternalProject_Add(${PROTOBUF_TARGET}
7068
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${PROTOBUF_INSTALL_DIR}/src/${PROTOBUF_TARGET}/cmake
7169
-G${CMAKE_GENERATOR}
7270
-DCMAKE_INSTALL_PREFIX=${PROTOBUF_INSTALL_DIR}
71+
-DCMAKE_INSTALL_LIBDIR=lib
7372
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
7473
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
7574
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}

0 commit comments

Comments
 (0)