Skip to content

Commit 292739f

Browse files
authored
make find build dir more generally
1 parent 349e365 commit 292739f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Tools/CMake/Conan.cmake

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,23 @@ if(USE_CONAN)
5858
-s build_type=${CMAKE_BUILD_TYPE}
5959
-c tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}
6060
-s compiler.runtime=${CONAN_COMPILER_RUNTIME} --build=missing
61-
#--test-missing
61+
--test-missing
6262
)
6363
else()
6464
message(CHECK_FAIL "build freexl failed")
6565
endif()
6666
endif()
6767

68+
# find conan_toolchain.cmake generated in local
69+
file(GLOB_RECURSE CONAN_TOOLCHAIN_PATH ${freexl_SOURCE_DIR}/freexl/test_package/build/*/generators/conan_toolchain.cmake)
70+
list(GET CONAN_TOOLCHAIN_PATH 0 CONAN_TOOLCHAIN_PATH)
71+
if (EXISTS ${CONAN_TOOLCHAIN_PATH})
72+
get_filename_component(CONAN_TOOLCHAIN_PATH_DIR ${CONAN_TOOLCHAIN_PATH} DIRECTORY)
73+
message(STATUS "freexl conan toolchain directory: ${CONAN_TOOLCHAIN_PATH_DIR}")
74+
else ()
75+
message(FATAL_ERROR "freexl conan toolchain not found!")
76+
endif ()
77+
6878
elseif(APPLE)
6979

7080
set(CONAN_RESULT_FILE "conanbuild.sh")
@@ -104,7 +114,7 @@ if(USE_CONAN)
104114
endif()
105115

106116
include(${CMAKE_BINARY_DIR}/_conan_build/conan_toolchain.cmake)
107-
include(${freexl_SOURCE_DIR}/freexl/test_package/build/msvc-194-x86_64-17-${CMAKE_BUILD_TYPE}/generators/conan_toolchain.cmake)
117+
include(${CONAN_TOOLCHAIN_PATH})
108118

109119
endif()
110120

0 commit comments

Comments
 (0)