Skip to content

Commit daa46e4

Browse files
committed
- adjust find scripts to work when crosscompiling
1 parent dd8e9e1 commit daa46e4

File tree

7 files changed

+70
-12
lines changed

7 files changed

+70
-12
lines changed

CMakeModules/FindCROSSGUID.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2019 - 2022 by Pedro Mendes, Rector and Visitors of the
1+
# Copyright (C) 2019 - 2023 by Pedro Mendes, Rector and Visitors of the
22
# University of Virginia, University of Heidelberg, and University
33
# of Connecticut School of Medicine.
44
# All rights reserved.
@@ -27,6 +27,7 @@ find_package(crossguid CONFIG REQUIRED
2727
${${_PROJECT_DEPENDENCY_DIR}}/${CMAKE_INSTALL_LIBDIR}/cmake
2828
/usr/${CMAKE_INSTALL_LIBDIR}/cmake
2929
${CONAN_LIB_DIRS_CROSSGUID}/cmake
30+
CMAKE_FIND_ROOT_PATH_BOTH
3031
)
3132

3233
if (NOT CROSSGUID_FOUND)
@@ -44,6 +45,7 @@ if (NOT CROSSGUID_FOUND)
4445
/opt/csw/include # Blastwave
4546
/opt/include
4647
/usr/freeware/include
48+
CMAKE_FIND_ROOT_PATH_BOTH
4749
NO_DEFAULT_PATH)
4850

4951
if (NOT CROSSGUID_INCLUDE_DIR)
@@ -65,6 +67,7 @@ if (NOT CROSSGUID_FOUND)
6567
/opt/lib
6668
/usr/freeware/lib64
6769
${CONAN_LIB_DIRS_CROSSGUID}
70+
CMAKE_FIND_ROOT_PATH_BOTH
6871
NO_DEFAULT_PATH)
6972

7073
if (NOT CROSSGUID_LIBRARY)

CMakeModules/FindLIBCOMBINE.cmake

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2019 - 2022 by Pedro Mendes, Rector and Visitors of the
1+
# Copyright (C) 2019 - 2023 by Pedro Mendes, Rector and Visitors of the
22
# University of Virginia, University of Heidelberg, and University
33
# of Connecticut School of Medicine.
44
# All rights reserved.
@@ -40,12 +40,16 @@ if (NOT ${LIBCOMBINE_LIBRARY_NAME}_FOUND)
4040
find_package(${LIBCOMBINE_LIBRARY_NAME} CONFIG QUIET
4141
CONFIGS ${LIBCOMBINE_LIBRARY_NAME}-config.cmake
4242
PATHS $ENV{LIBCOMBINE_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake
43+
$ENV{LIBCOMBINE_DIR}/lib/cmake
4344
${${_PROJECT_DEPENDENCY_DIR}}/${CMAKE_INSTALL_LIBDIR}/cmake
45+
${${_PROJECT_DEPENDENCY_DIR}}/lib/cmake
46+
${${_PROJECT_DEPENDENCY_DIR}}/lib64/cmake
4447
/usr/${CMAKE_INSTALL_LIBDIR}/cmake
4548
$ENV{LIBCOMBINE_DIR}/lib/cmake
4649
${${_PROJECT_DEPENDENCY_DIR}}/lib/cmake
4750
/usr/lib/cmake
4851
${CONAN_LIB_DIRS_LIBCOMBINE}/cmake
52+
CMAKE_FIND_ROOT_PATH_BOTH
4953
)
5054
endif()
5155

@@ -89,6 +93,21 @@ get_target_property(LIBCOMBINE_INTERFACE_LINK_LIBRARIES ${LIBCOMBINE_LIBRARY_NAM
8993
string(SUBSTRING "${library}" 0 ${index} DEPENDENT_NAME)
9094
message(VERBOSE "Looking for dependent library: ${DEPENDENT_NAME}")
9195
find_package(${DEPENDENT_NAME})
96+
if (NOT ${DEPENDENT_NAME}_FOUND)
97+
find_package(${DEPENDENT_NAME} CONFIG QUIET
98+
PATHS $ENV{LIBCOMBINE_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake
99+
$ENV{LIBCOMBINE_DIR}/lib/cmake
100+
${${_PROJECT_DEPENDENCY_DIR}}/${CMAKE_INSTALL_LIBDIR}/cmake
101+
${${_PROJECT_DEPENDENCY_DIR}}/lib/cmake
102+
${${_PROJECT_DEPENDENCY_DIR}}/lib64/cmake
103+
/usr/${CMAKE_INSTALL_LIBDIR}/cmake
104+
$ENV{LIBCOMBINE_DIR}/lib/cmake
105+
${${_PROJECT_DEPENDENCY_DIR}}/lib/cmake
106+
/usr/lib/cmake
107+
${CONAN_LIB_DIRS_LIBCOMBINE}/cmake
108+
CMAKE_FIND_ROOT_PATH_BOTH
109+
)
110+
endif()
92111
endif()
93112

94113
endforeach()
@@ -101,21 +120,27 @@ else()
101120
$ENV{LIBCOMBINE_DIR}
102121
${${_PROJECT_DEPENDENCY_DIR}}/include
103122
${${_PROJECT_DEPENDENCY_DIR}}
123+
124+
NO_DEFAULT_PATH)
125+
126+
if (NOT LIBCOMBINE_INCLUDE_DIR)
127+
find_path(LIBCOMBINE_INCLUDE_DIR combine/combinearchive.h
128+
$ENV{LIBCOMBINE_DIR}/include
129+
$ENV{LIBCOMBINE_DIR}
130+
${${_PROJECT_DEPENDENCY_DIR}}/include
131+
${${_PROJECT_DEPENDENCY_DIR}}
104132
~/Library/Frameworks
105133
/Library/Frameworks
106134
/sw/include # Fink
107135
/opt/local/include # MacPorts
108136
/opt/csw/include # Blastwave
109137
/opt/include
110138
/usr/freeware/include
111-
NO_DEFAULT_PATH)
112-
113-
if (NOT LIBCOMBINE_INCLUDE_DIR)
114-
message(FATAL_ERROR "LIBCOMBINE include dir not found not found!")
139+
CMAKE_FIND_ROOT_PATH_BOTH)
115140
endif (NOT LIBCOMBINE_INCLUDE_DIR)
116141

117142
if (NOT LIBCOMBINE_INCLUDE_DIR)
118-
find_path(LIBCOMBINE_INCLUDE_DIR combine/combinearchive.h)
143+
message(FATAL_ERROR "LIBCOMBINE include dir not found not found!")
119144
endif (NOT LIBCOMBINE_INCLUDE_DIR)
120145

121146
find_library(LIBCOMBINE_LIBRARY
@@ -133,11 +158,26 @@ else()
133158
/opt/csw/lib Blastwave
134159
/opt/lib
135160
/usr/freeware/lib64
161+
CMAKE_FIND_ROOT_PATH_BOTH
136162
NO_DEFAULT_PATH)
137163

138164
if (NOT LIBCOMBINE_LIBRARY)
139165
find_library(LIBCOMBINE_LIBRARY
140-
NAMES ${LIBCOMBINE_LIBRARY_NAME})
166+
NAMES ${LIBCOMBINE_LIBRARY_NAME}
167+
PATHS $ENV{LIBCOMBINE_DIR}/lib
168+
$ENV{LIBCOMBINE_DIR}
169+
${${_PROJECT_DEPENDENCY_DIR}}/${CMAKE_INSTALL_LIBDIR}
170+
${${_PROJECT_DEPENDENCY_DIR}}/lib
171+
${${_PROJECT_DEPENDENCY_DIR}}
172+
${CONAN_LIB_DIRS_LIBCOMBINE}
173+
~/Library/Frameworks
174+
/Library/Frameworks
175+
/sw/lib Fink
176+
/opt/local/lib MacPorts
177+
/opt/csw/lib Blastwave
178+
/opt/lib
179+
/usr/freeware/lib64
180+
CMAKE_FIND_ROOT_PATH_BOTH)
141181
endif (NOT LIBCOMBINE_LIBRARY)
142182
endif(${LIBCOMBINE_LIBRARY_NAME}_FOUND)
143183

CMakeModules/FindLIBSBML.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2019 - 2022 by Pedro Mendes, Rector and Visitors of the
1+
# Copyright (C) 2019 - 2023 by Pedro Mendes, Rector and Visitors of the
22
# University of Virginia, University of Heidelberg, and University
33
# of Connecticut School of Medicine.
44
# All rights reserved.
@@ -140,6 +140,7 @@ find_library(LIBSBML_LIBRARY
140140
/opt/csw/lib # Blastwave
141141
/opt/lib
142142
/usr/freeware/lib64
143+
CMAKE_FIND_ROOT_PATH_BOTH
143144
NO_DEFAULT_PATH)
144145

145146
if (NOT LIBSBML_LIBRARY)

CMakeModules/FindLIBSEDML.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2019 - 2022 by Pedro Mendes, Rector and Visitors of the
1+
# Copyright (C) 2019 - 2023 by Pedro Mendes, Rector and Visitors of the
22
# University of Virginia, University of Heidelberg, and University
33
# of Connecticut School of Medicine.
44
# All rights reserved.
@@ -129,6 +129,7 @@ find_library(LIBNUML_LIBRARY
129129
/opt/csw/lib # Blastwave
130130
/opt/lib
131131
/usr/freeware/lib64
132+
CMAKE_FIND_ROOT_PATH_BOTH
132133
NO_DEFAULT_PATH)
133134

134135
endif()

CMakeModules/FindLIBUUID.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2020 by Pedro Mendes, Rector and Visitors of the
1+
# Copyright (C) 2020 - 2023 by Pedro Mendes, Rector and Visitors of the
22
# University of Virginia, University of Heidelberg, and University
33
# of Connecticut School of Medicine.
44
# All rights reserved.
@@ -10,13 +10,24 @@ pkg_check_modules(PKG_LIBUUID QUIET uuid)
1010
set(LIBUUID_DEFINITIONS ${PKG_LIBUUID_CFLAGS_OTHER})
1111
set(LIBUUID_VERSION ${PKG_LIBUUID_VERSION})
1212

13+
string(TOUPPER ${PROJECT_NAME} _UPPER_PROJECT_NAME)
14+
set(_PROJECT_DEPENDENCY_DIR ${_UPPER_PROJECT_NAME}_DEPENDENCY_DIR)
15+
1316
find_path(LIBUUID_INCLUDE_DIR
1417
NAMES uuid/uuid.h
1518
HINTS ${PKG_LIBUUID_INCLUDE_DIRS} ${PKG_LIBUUID_INCLUDE_DIRS}/..
19+
${${_PROJECT_DEPENDENCY_DIR}}/${CMAKE_INSTALL_LIBDIR}
20+
${${_PROJECT_DEPENDENCY_DIR}}/lib
21+
${${_PROJECT_DEPENDENCY_DIR}}
22+
CMAKE_FIND_ROOT_PATH_BOTH
1623
)
1724
find_library(LIBUUID_LIBRARY
1825
NAMES uuid
1926
HINTS ${PKG_LIBUUID_LIBRARY_DIRS}
27+
${${_PROJECT_DEPENDENCY_DIR}}/${CMAKE_INSTALL_LIBDIR}
28+
${${_PROJECT_DEPENDENCY_DIR}}/lib
29+
${${_PROJECT_DEPENDENCY_DIR}}
30+
CMAKE_FIND_ROOT_PATH_BOTH
2031
)
2132

2233
include(FindPackageHandleStandardArgs)

CMakeModules/FindZIPPER.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ find_library(ZIPPER_LIBRARY
2929
$ENV{ZIPPER_DIR}/lib
3030
/usr/lib
3131
/usr/local/lib
32+
CMAKE_FIND_ROOT_PATH_BOTH
3233
DOC "The file name of the ZIPPER library."
3334
)
3435

CMakeModules/FindZLIB.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2022 by Pedro Mendes, Rector and Visitors of the
1+
# Copyright (C) 2022 - 2023 by Pedro Mendes, Rector and Visitors of the
22
# University of Virginia, University of Heidelberg, and University
33
# of Connecticut School of Medicine.
44
# All rights reserved.
@@ -59,6 +59,7 @@ if (NOT (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) OR NOT ZLIB_FOUND)
5959
/opt/csw/lib # Blastwave
6060
/opt/lib
6161
/usr/freeware/lib64
62+
CMAKE_FIND_ROOT_PATH_BOTH
6263
NO_DEFAULT_PATH)
6364

6465
if (NOT ZLIB_LIBRARY)

0 commit comments

Comments
 (0)