diff --git a/CMakeLists.txt b/CMakeLists.txt
index 95259b7de65af3eec563d1e8fcdebd32d69d6c37..e95dde841bd6fca6a0dafb15e00c3cadd776b48f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,7 +132,7 @@ set(px4_required_config
 	config_module_list
 	)
 foreach(conf ${px4_required_config})
-	if(NOT DEFINED ${conf})
+	if(NOT DEFINED conf)
 		message(FATAL_ERROR "cmake/${config_module} must define ${conf}")
 	endif()
 endforeach()
@@ -160,14 +160,14 @@ list(GET config_args 2 LABEL)
 message(STATUS "TARGET: OS(${OS})-BOARD(${BOARD})-LABEL(${LABEL})")
 
 #=============================================================================
-# cmake modules
+# programs
 #
-enable_testing()
+find_package(PythonInterp REQUIRED)
 
 #=============================================================================
-# programs
+# cmake modules
 #
-find_package(PythonInterp REQUIRED)
+enable_testing()
 
 #=============================================================================
 # check required toolchain variables
diff --git a/Makefile b/Makefile
index 99c273f2d641553a3c2603e5934d8d2eb47698e7..b2f38a7d47085b443915ca55bd84900dbd7b61f3 100644
--- a/Makefile
+++ b/Makefile
@@ -91,4 +91,8 @@ all: px4fmu-v2_default
 clean:
 	rm -rf build_*/
 
-.PHONY: clean
+# targets handled by cmake
+test: ;
+upload: ;
+
+.PHONY: clean test upload
diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake
index 13e05eb7a2ae60159344d791300d8bff22c60492..8de25ab868963b16997851e21ec3a7563569dc08 100644
--- a/cmake/nuttx/px4_impl_nuttx.cmake
+++ b/cmake/nuttx/px4_impl_nuttx.cmake
@@ -86,10 +86,10 @@ function(px4_nuttx_add_firmware)
 	#TODO handle param_xml
 	if(PARAM_XML)
 		add_custom_command(OUTPUT ${OUT}
-			COMMAND ${process_params}
+			COMMAND ${PYTHON_EXECUTABLE} ${process_params}
 				--src-path ${CMAKE_SOURCE_DIR}/src
 				--board CONFIG_ARCH_BOARD_${BOARD} --xml
-			COMMAND ${process_airframes}
+			COMMAND ${PYTHON_EXECUTABLE} ${process_airframes}
 				-a ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common/init.d
 				--board CONFIG_ARCH_BOARD_${BOARD} --xml
 			COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin
@@ -97,10 +97,9 @@ function(px4_nuttx_add_firmware)
 				--prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype
 				--git_identity ${CMAKE_SOURCE_DIR}
 				--parameter_xml parameters.xml
-				--airframe_xml airframe.xml
+				--airframe_xml airframes.xml
 				--image ${EXE}.bin > ${OUT}
 			DEPENDS ${EXE}
-			WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
 			)
 	else()
 		add_custom_command(OUTPUT ${OUT}
@@ -110,7 +109,6 @@ function(px4_nuttx_add_firmware)
 				--git_identity ${CMAKE_SOURCE_DIR}
 				--image ${EXE}.bin > ${OUT}
 			DEPENDS ${EXE}
-			WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
 			)
 	endif()
 endfunction()