diff --git a/setup.py b/setup.py
index 3611f4474c55c2970d599653b3d7f6fce4077fbe..0599db0b32448f541400907ac379c39057bed146 100644
--- a/setup.py
+++ b/setup.py
@@ -38,14 +38,13 @@ vf_gpu_cmake_args = [
 ]
 
 
-class CommandMixin(object):
+class CommandMixin:
     user_options = [
         ('GPU', None, 'compile pyfluids with GPU backend'),
     ]
 
     def initialize_options(self):
         super().initialize_options()
-        # Initialize options
         self.GPU = False
 
     def finalize_options(self):
@@ -53,7 +52,8 @@ class CommandMixin(object):
 
     def run(self):
         global GPU
-        GPU = self.GPU # will be 1 or None
+        GPU = self.GPU
+        super().run()
 
 class InstallCommand(CommandMixin, install):
     user_options = getattr(install, 'user_options', []) + CommandMixin.user_options
@@ -67,8 +67,11 @@ class CMakeExtension(Extension):
         self.sourcedir = os.path.abspath(sourcedir)
 
 
-class CMakeBuild(build_ext):
+class CMakeBuild(CommandMixin, build_ext):
+    user_options = getattr(build_ext, 'user_options', []) + CommandMixin.user_options
+
     def run(self):
+        super().run()
         try:
             out = subprocess.check_output(['cmake', '--version'])
         except OSError: