1
0
Fork 0
forked from lthn/blockchain
blockchain/cmake/ConanProfileSetup.cmake

38 lines
No EOL
1.1 KiB
CMake

set(CONAN_HOME "${CMAKE_SOURCE_DIR}/build/sdk")
set(DEFAULT_PROFILE "${CONAN_HOME}/profiles/default")
if(WIN32)
set(CONAN_EXECUTABLE "${CMAKE_SOURCE_DIR}/build/bin/conan.exe")
else()
set(CONAN_EXECUTABLE "${CMAKE_SOURCE_DIR}/build/bin/conan")
endif()
if(NOT EXISTS "${DEFAULT_PROFILE}")
message(STATUS "Conan default profile not found. Detecting a new one...")
set(ENV{CONAN_HOME} "${CONAN_HOME}")
execute_process(
COMMAND "${CONAN_EXECUTABLE}" profile detect --name=default --force
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE return_code
)
unset(ENV{CONAN_HOME})
if(NOT return_code EQUAL 0)
message(FATAL_ERROR "Conan profile detection failed with exit code: ${return_code}")
endif()
endif()
message(STATUS "Appending custom settings to Conan default profile...")
set(CUSTOM_SETTINGS "
compiler.cppstd=17
")
#if(WIN32)
# message(STATUS "Windows detected. Appending static runtime setting.")
# string(APPEND CUSTOM_SETTINGS "
#compiler.runtime=static
#")
#endif()
file(APPEND "${DEFAULT_PROFILE}" "${CUSTOM_SETTINGS}")
message(STATUS "Conan profile setup is complete.")