diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt
index e3afc6ce48d003d2b34d541f00d21b4ca9695b0d..338339780bc57c0fac491fc7c8ff8cbe0142336c 100644
--- a/src/examples/CMakeLists.txt
+++ b/src/examples/CMakeLists.txt
@@ -2,7 +2,10 @@
 ADD_EXECUTABLE(testasterx1 testasterx1.cpp)
 
 # edit the following line to add the necessary libraries
-TARGET_LINK_LIBRARIES(testasterx1 asterx1_gps asterx1_process)
+IF(gpstk_LIBRARY)
+  TARGET_LINK_LIBRARIES(testasterx1 asterx1_process)
+ENDIF(gpstk_LIBRARY)
+TARGET_LINK_LIBRARIES(testasterx1 asterx1_gps)
 
 #fast building
 # ADD_EXECUTABLE(testasterx1 testasterx1.cpp ../asterx1.cpp)