diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b5c69cac..c26001e7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,6 @@ set(EOSIO_CDT_VERSION_MIN "1.3") set(EOSIO_CDT_VERSION_SOFT_MAX "1.3") #set(EOSIO_CDT_VERSION_HARD_MAX "") -include(CheckVersion.txt) - find_package(eosio.cdt) ### Check the version of eosio.cdt diff --git a/CheckVersion.txt b/CheckVersion.txt deleted file mode 100644 index ffd285619..000000000 --- a/CheckVersion.txt +++ /dev/null @@ -1,90 +0,0 @@ -function(EXTRACT_MAJOR_MINOR_FROM_VERSION version success major minor) - string(REGEX REPLACE "^([0-9]+)\\..+$" "\\1" _major "${version}") - if("${_major}" STREQUAL "${version}") - set(${success} FALSE PARENT_SCOPE) - return() - endif() - - string(REGEX REPLACE "^[0-9]+\\.([0-9]+)(\\..*)?$" "\\1" _minor "${version}") - if("${_minor}" STREQUAL "${version}") - set(success FALSE PARENT_SCOPE) - return() - endif() - - set(${major} ${_major} PARENT_SCOPE) - set(${minor} ${_minor} PARENT_SCOPE) - set(${success} TRUE PARENT_SCOPE) -endfunction(EXTRACT_MAJOR_MINOR_FROM_VERSION) - -function(EOSIO_CHECK_VERSION output version hard_min soft_max hard_max) # optional 6th argument for error message - set(${output} "INVALID" PARENT_SCOPE) - - EXTRACT_MAJOR_MINOR_FROM_VERSION("${version}" success major minor) - if(NOT success) - if(${ARGC} GREATER 5) - set(${ARGV5} "version '${version}' is invalid" PARENT_SCOPE) - endif() - return() - endif() - - EXTRACT_MAJOR_MINOR_FROM_VERSION("${hard_min}" success hard_min_major hard_min_minor) - if(NOT success) - if(${ARGC} GREATER 5) - set(${ARGV5} "hard minimum version '${hard_min}' is invalid" PARENT_SCOPE) - endif() - return() - endif() - - if( "${major}.${minor}" VERSION_LESS "${hard_min_major}.${hard_min_minor}" ) - set(${output} "MISMATCH" PARENT_SCOPE) - if(${ARGC} GREATER 5) - set(${ARGV5} "version '${version}' does not meet hard minimum version requirement of ${hard_min_major}.${hard_min_minor}" PARENT_SCOPE) - endif() - return() - endif() - - if(NOT hard_max STREQUAL "") - EXTRACT_MAJOR_MINOR_FROM_VERSION("${hard_max}" success hard_max_major hard_max_minor) - if(NOT success) - if(${ARGC} GREATER 5) - set(${ARGV5} "hard maximum version '${hard_max}' is invalid" PARENT_SCOPE) - endif() - return() - endif() - - if( "${major}.${minor}" VERSION_GREATER "${hard_max_major}.${hard_max_minor}" ) - set(${output} "MISMATCH" PARENT_SCOPE) - if(${ARGC} GREATER 5) - set(${ARGV5} "version '${version}' does not meet hard maximum version requirement of ${hard_max_major}.${hard_max_minor}" PARENT_SCOPE) - endif() - return() - endif() - endif() - - EXTRACT_MAJOR_MINOR_FROM_VERSION("${soft_max}" success soft_max_major soft_max_minor) - if(NOT success) - set(${output} "MISMATCH" PARENT_SCOPE) - if(${ARGC} GREATER 5) - set(${ARGV5} "soft maximum version '${soft_max}' is invalid" PARENT_SCOPE) - endif() - return() - endif() - - if( ${major} GREATER ${soft_max_major} ) - set(${output} "MISMATCH" PARENT_SCOPE) - if(${ARGC} GREATER 5) - set(${ARGV5} "version '${version}' must have the same major version as the soft maximum version (${soft_max_major})" PARENT_SCOPE) - endif() - return() - endif() - - if( "${major}.${minor}" VERSION_GREATER "${soft_max_major}.${soft_max_minor}" ) - set(${output} "WARN" PARENT_SCOPE) - if(${ARGC} GREATER 5) - set(${ARGV5} "version '${version}' matches requirements but is greater than the soft maximum version of ${soft_max_major}.${soft_max_minor}" PARENT_SCOPE) - endif() - return() - endif() - - set(${output} "MATCH" PARENT_SCOPE) -endfunction(EOSIO_CHECK_VERSION) diff --git a/UnitTestsExternalProject.txt b/UnitTestsExternalProject.txt index 3da9f16f9..a22bff2d9 100644 --- a/UnitTestsExternalProject.txt +++ b/UnitTestsExternalProject.txt @@ -2,9 +2,13 @@ include(ExternalProject) find_package(Git REQUIRED) include(GNUInstallDirs) +string(REPLACE ";" "|" TEST_FRAMEWORK_PATH "${CMAKE_FRAMEWORK_PATH}") +string(REPLACE ";" "|" TEST_MODULE_PATH "${CMAKE_MODULE_PATH}") + ExternalProject_Add( contracts_unit_tests - CMAKE_ARGS -DCMAKE_BUILD_TYPE=${TEST_BUILD_TYPE} -DEOSIO_ROOT=${EOSIO_ROOT} + LIST_SEPARATOR | # Use the alternate list separator + CMAKE_ARGS -DCMAKE_BUILD_TYPE=${TEST_BUILD_TYPE} -DCMAKE_FRAMEWORK_PATH=${TEST_FRAMEWORK_PATH} -DCMAKE_MODULE_PATH=${TEST_MODULE_PATH} -DEOSIO_ROOT=${EOSIO_ROOT} SOURCE_DIR ${CMAKE_SOURCE_DIR}/tests BINARY_DIR ${CMAKE_BINARY_DIR}/tests BUILD_ALWAYS 1 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ef8603fbb..1e78a70f6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,17 +1,10 @@ cmake_minimum_required( VERSION 3.5 ) -set(EOSIO_VERSION_MIN "1.3") -set(EOSIO_VERSION_SOFT_MAX "1.3") +set(EOSIO_VERSION_MIN "1.4") +set(EOSIO_VERSION_SOFT_MAX "1.4") #set(EOSIO_VERSION_HARD_MAX "") -include(../CheckVersion.txt) - -if(EOSIO_ROOT STREQUAL "" OR NOT EOSIO_ROOT) - set(EOSIO_ROOT "/usr/local/eosio") -endif() - -list(APPEND CMAKE_MODULE_PATH ${EOSIO_ROOT}/lib/cmake) -include(EosioTester) +find_package(eosio) ### Check the version of eosio set(VERSION_MATCH_ERROR_MSG "")