diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index c4df05efc..6cba30b3d 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 @@ -79,6 +79,8 @@ endif() add_library(cryptoauth ${CRYPTOAUTH_SRC} ${ATCACERT_DEF_SRC}) +set_property(TARGET cryptoauth PROPERTY C_STANDARD 99) + # Add Remaining Sources depending on target library type if(ATCA_PKCS11) set_target_properties(cryptoauth PROPERTIES OUTPUT_NAME "ateccx08pkcs11") @@ -104,7 +106,7 @@ endif() if(LINUX) 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):