diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index fb9b9cd5e..9816ed1f5 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6.4) +cmake_minimum_required(VERSION 3.1.0) project(cryptoauth) # Various Options for Build @@ -85,6 +85,8 @@ endif() add_library(cryptoauth ${CRYPTOAUTH_SRC} ${ATCACERT_DEF_SRC}) +set_property(TARGET cryptoauth PROPERTY C_STANDARD 99) + if(ATCA_PRINTF) add_definitions(-DATCAPRINTF) endif(ATCA_PRINTF) @@ -106,7 +108,7 @@ if(LINUX) add_definitions(-DATCA_USE_SHARED_MUTEX) if(HAS_LIBUSB AND ATCA_HAL_KIT_HID) target_link_libraries(cryptoauth usb-1.0) -elseif(HAS_UDEV AND ATCA_HAL_KIT_HID) +elseif(HAS_LIBUDEV AND ATCA_HAL_KIT_HID) target_link_libraries(cryptoauth udev) endif() target_link_libraries(cryptoauth rt) diff --git a/python/setup.py b/python/setup.py index c093ec64f..f757fec92 100644 --- a/python/setup.py +++ b/python/setup.py @@ -147,7 +147,7 @@ def build_extension(self, ext): try: subprocess.check_output(['cmake', cmakelist_path] + cmake_args, cwd=os.path.abspath(self.build_temp), stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - msg = e.output.decode('ascii') + msg = e.output.decode('utf-8') if 'usb' in msg: msg += '\n\n USB libraries or headers were not located. If USB support is\n' \ ' not required it can be disabled by setting the environment\n' \ @@ -156,13 +156,16 @@ def build_extension(self, ext): ' $ export CRYPTOAUTHLIB_NOUSB=True\n\n' \ ' Run setup.py clean before trying install again or use the pip \n' \ ' option --no-cache-dir\n' - raise Exception(msg) + raise RuntimeError(msg) # Build the library try: subprocess.check_output(['cmake', '--build', '.'] + build_args, cwd=os.path.abspath(self.build_temp), stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - raise Exception(e.output.decode('ascii')) + if sys.version_info[0] <= 2: + raise RuntimeError(e.output) # Python 2 doesn't handle unicode exceptions + else: + raise RuntimeError(e.output.decode('utf-8')) class CryptoAuthCommandInstall(install):