From 3a81bc531d39e321abd7e45a47a693935f5b885e Mon Sep 17 00:00:00 2001 From: Ryan Desmond Date: Wed, 15 May 2019 14:20:18 -0400 Subject: [PATCH 1/6] Use conan_check instead of assuming conan for calls to conan info --- conan.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/conan.cmake b/conan.cmake index 1eae75ef..0f6a4108 100644 --- a/conan.cmake +++ b/conan.cmake @@ -348,10 +348,9 @@ function(conan_cmake_install) endif() endforeach() if(ARGUMENTS_CONAN_COMMAND) - set(conan_command ${ARGUMENTS_CONAN_COMMAND}) - else() - set(conan_command conan) + set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND}) endif() + conan_check() set(CONAN_OPTIONS "") if(ARGUMENTS_CONANFILE) set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE}) @@ -541,6 +540,8 @@ macro(conan_add_remote) # Example usage: # conan_add_remote(NAME bincrafters INDEX 1 # URL https://api.bintray.com/conan/bincrafters/public-conan) + conan_check() + set(oneValueArgs URL NAME INDEX) cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN}) From b38728c9f416ab09f38622d4eeb409bd4a3a10c5 Mon Sep 17 00:00:00 2001 From: Ryan Desmond Date: Wed, 15 May 2019 14:56:57 -0400 Subject: [PATCH 2/6] Make remote add a function to protect caller's scope --- conan.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/conan.cmake b/conan.cmake index 0f6a4108..3f444089 100644 --- a/conan.cmake +++ b/conan.cmake @@ -380,16 +380,16 @@ function(conan_cmake_install) set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS}) string (REPLACE ";" " " _conan_args "${conan_args}") - message(STATUS "Conan executing: ${conan_command} ${_conan_args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_conan_args}") if(ARGUMENTS_OUTPUT_QUIET) - execute_process(COMMAND ${conan_command} ${conan_args} + execute_process(COMMAND ${CONAN_CMD} ${conan_args} RESULT_VARIABLE return_code OUTPUT_VARIABLE conan_output ERROR_VARIABLE conan_output WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) else() - execute_process(COMMAND ${conan_command} ${conan_args} + execute_process(COMMAND ${CONAN_CMD} ${conan_args} RESULT_VARIABLE return_code WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif() @@ -534,7 +534,7 @@ macro(conan_check) endif() endmacro() -macro(conan_add_remote) +function(conan_add_remote) # Adds a remote # Arguments URL and NAME are required, INDEX is optional # Example usage: @@ -552,4 +552,4 @@ macro(conan_add_remote) message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL})") execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_URL} ${CONAN_INDEX_ARG} -f) -endmacro() +endfunction() From 22142784ae653d3b491ebd6f5fc4345576df51b4 Mon Sep 17 00:00:00 2001 From: Ryan Desmond Date: Fri, 31 May 2019 12:20:50 -0400 Subject: [PATCH 3/6] Changes from review --- conan.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conan.cmake b/conan.cmake index 3f444089..70bc321b 100644 --- a/conan.cmake +++ b/conan.cmake @@ -540,8 +540,6 @@ function(conan_add_remote) # Example usage: # conan_add_remote(NAME bincrafters INDEX 1 # URL https://api.bintray.com/conan/bincrafters/public-conan) - conan_check() - set(oneValueArgs URL NAME INDEX) cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN}) @@ -549,6 +547,7 @@ function(conan_add_remote) set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}") endif() + conan_check() message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL})") execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_URL} ${CONAN_INDEX_ARG} -f) From cfed1d610a73721d4b62e36e7c857e62476496f3 Mon Sep 17 00:00:00 2001 From: Ryan Desmond Date: Fri, 31 May 2019 12:32:32 -0400 Subject: [PATCH 4/6] Changes from review --- conan.cmake | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/conan.cmake b/conan.cmake index 70bc321b..9df6a8fb 100644 --- a/conan.cmake +++ b/conan.cmake @@ -350,7 +350,7 @@ function(conan_cmake_install) if(ARGUMENTS_CONAN_COMMAND) set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND}) endif() - conan_check() + conan_check(REQUIRED) set(CONAN_OPTIONS "") if(ARGUMENTS_CONANFILE) set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE}) @@ -508,7 +508,7 @@ macro(conan_check) # Arguments REQUIRED and VERSION are optional # Example usage: # conan_check(VERSION 1.0.0 REQUIRED) - message(STATUS "Conan: checking conan executable in path") + message(STATUS "Conan: checking conan executable") set(options REQUIRED) set(oneValueArgs VERSION) cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN}) @@ -536,18 +536,20 @@ endmacro() function(conan_add_remote) # Adds a remote - # Arguments URL and NAME are required, INDEX is optional + # Arguments URL and NAME are required, INDEX and COMMAND is optional # Example usage: # conan_add_remote(NAME bincrafters INDEX 1 # URL https://api.bintray.com/conan/bincrafters/public-conan) - set(oneValueArgs URL NAME INDEX) + set(oneValueArgs URL NAME INDEX COMMAND) cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN}) if(DEFINED CONAN_INDEX) set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}") endif() - - conan_check() + if(CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + endif() + conan_check(REQUIRED) message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL})") execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_URL} ${CONAN_INDEX_ARG} -f) From 41b74cdad5c40319fe33f23aa0c73ad25b8b91ca Mon Sep 17 00:00:00 2001 From: Ryan Desmond Date: Fri, 7 Jun 2019 10:54:11 -0400 Subject: [PATCH 5/6] Changes from review --- conan.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conan.cmake b/conan.cmake index 9df6a8fb..a1f45286 100644 --- a/conan.cmake +++ b/conan.cmake @@ -349,8 +349,9 @@ function(conan_cmake_install) endforeach() if(ARGUMENTS_CONAN_COMMAND) set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND}) + else() + conan_check(REQUIRED) endif() - conan_check(REQUIRED) set(CONAN_OPTIONS "") if(ARGUMENTS_CONANFILE) set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE}) @@ -548,8 +549,9 @@ function(conan_add_remote) endif() if(CONAN_COMMAND) set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) endif() - conan_check(REQUIRED) message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL})") execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_URL} ${CONAN_INDEX_ARG} -f) From 7dec021ff64f9d117fef07ddade6201bff3edda4 Mon Sep 17 00:00:00 2001 From: Ryan Desmond Date: Mon, 17 Jun 2019 17:00:53 -0400 Subject: [PATCH 6/6] Grammar in doc --- conan.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conan.cmake b/conan.cmake index a1f45286..bc379db6 100644 --- a/conan.cmake +++ b/conan.cmake @@ -537,7 +537,7 @@ endmacro() function(conan_add_remote) # Adds a remote - # Arguments URL and NAME are required, INDEX and COMMAND is optional + # Arguments URL and NAME are required, INDEX and COMMAND are optional # Example usage: # conan_add_remote(NAME bincrafters INDEX 1 # URL https://api.bintray.com/conan/bincrafters/public-conan)