  ADD_SUBDIRECTORY(modules)
  ADD_SUBDIRECTORY(frontends)
  
-+IF(NOT INSTALL_YASM_ONLY)
-+
-+INSTALL(EXPORT ${targetsFile} DESTINATION bin/cmake)
++INSTALL(EXPORT ${targetsFile} DESTINATION bin/cmake ${OPT_INSTALL})
 +
  INSTALL(FILES
      libyasm.h
      ${CMAKE_BINARY_DIR}/libyasm-stdint.h
 -    DESTINATION include
-+    DESTINATION include${verDir}
++    DESTINATION include${verDir} ${OPT_INSTALL}
      )
-+
-+ENDIF(INSTALL_YASM_ONLY)
+diff --git a/cmake/modules/YasmMacros.cmake b/cmake/modules/YasmMacros.cmake
+index ab1be00..db61eea 100644
+--- a/cmake/modules/YasmMacros.cmake
++++ b/cmake/modules/YasmMacros.cmake
+@@ -58,31 +58,28 @@ macro (YASM_ADD_MODULE _module_NAME)
+ endmacro (YASM_ADD_MODULE)
+ 
+ macro (YASM_GENPERF _in_NAME _out_NAME)
+-    get_target_property(_tmp_GENPERF_EXE genperf LOCATION)
+     add_custom_command(
+         OUTPUT ${_out_NAME}
+-        COMMAND ${_tmp_GENPERF_EXE} ${_in_NAME} ${_out_NAME}
+-        DEPENDS ${_tmp_GENPERF_EXE}
++        COMMAND genperf ${_in_NAME} ${_out_NAME}
++        DEPENDS genperf
+         MAIN_DEPENDENCY ${_in_NAME}
+         )
+ endmacro (YASM_GENPERF)
+ 
+ macro (YASM_RE2C _in_NAME _out_NAME)
+-    get_target_property(_tmp_RE2C_EXE re2c LOCATION)
+     add_custom_command(
+         OUTPUT ${_out_NAME}
+-        COMMAND ${_tmp_RE2C_EXE} ${ARGN} -o ${_out_NAME} ${_in_NAME}
+-        DEPENDS ${_tmp_RE2C_EXE}
++        COMMAND re2c ${ARGN} -o ${_out_NAME} ${_in_NAME}
++        DEPENDS re2c
+         MAIN_DEPENDENCY ${_in_NAME}
+         )
+ endmacro (YASM_RE2C)
+ 
+ macro (YASM_GENMACRO _in_NAME _out_NAME _var_NAME)
+-    get_target_property(_tmp_GENMACRO_EXE genmacro LOCATION)
+     add_custom_command(
+         OUTPUT ${_out_NAME}
+-        COMMAND ${_tmp_GENMACRO_EXE} ${_out_NAME} ${_var_NAME} ${_in_NAME}
+-        DEPENDS ${_tmp_GENMACRO_EXE}
++        COMMAND genmacro ${_out_NAME} ${_var_NAME} ${_in_NAME}
++        DEPENDS genmacro
+         MAIN_DEPENDENCY ${_in_NAME}
+         )
+ endmacro (YASM_GENMACRO)
 diff --git a/frontends/tasm/CMakeLists.txt b/frontends/tasm/CMakeLists.txt
-index e275ab8..7d27511 100644
+index e275ab8..03e9c8a 100644
 --- a/frontends/tasm/CMakeLists.txt
 +++ b/frontends/tasm/CMakeLists.txt
-@@ -30,8 +30,12 @@ ELSE(BUILD_SHARED_LIBS)
+@@ -30,8 +30,10 @@ ELSE(BUILD_SHARED_LIBS)
      TARGET_LINK_LIBRARIES(ytasm yasmstd libyasm)
  ENDIF(BUILD_SHARED_LIBS)
  

     )
 
-INSTALL(TARGETS ytasm RUNTIME DESTINATION bin)
+IF(NOT INSTALL_YASM_ONLY)
+INSTALL(TARGETS ytasm EXPORT ${targetsFile} RUNTIME DESTINATION bin)
+ENDIF(INSTALL_YASM_ONLY)
diff --git a/frontends/vsyasm/CMakeLists.txt b/frontends/vsyasm/CMakeLists.txt
index 6815b18..46f9edf 100644
--- a/frontends/vsyasm/CMakeLists.txt
+++ b/frontends/vsyasm/CMakeLists.txt
@@ -34,4 +34,8 @@ SET_SOURCE_FILES_PROPERTIES(vsyasm.c PROPERTIES
     OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/license.c
     )
 
-INSTALL(TARGETS vsyasm RUNTIME DESTINATION bin)
+SET_TARGET_PROPERTIES(vsyasm PROPERTIES OUTPUT_NAME vsyasm${ver})
+
+IF(NOT INSTALL_YASM_ONLY)
+INSTALL(TARGETS vsyasm EXPORT ${targetsFile} RUNTIME DESTINATION bin)
+ENDIF(INSTALL_YASM_ONLY)
diff --git a/frontends/yasm/CMakeLists.txt b/frontends/yasm/CMakeLists.txt
index b11d7f8..cf51fea 100644
--- a/frontends/yasm/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8df871c..4fe9da9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,13 +35,28 @@ INCLUDE_DIRECTORIES(AFTER ${CMAKE_BINARY_DIR} ${yasm_SOURCE_DIR})
 
 INCLUDE(ConfigureChecks.cmake)
 
+OPTION(INSTALL_YASM_ONLY "Only install the yasm executable" OFF)
+IF(INSTALL_YASM_ONLY)
+  SET(OPT_INSTALL EXCLUDE_FROM_ALL)
+ELSE()
+  SET(OPT_INSTALL)
+ENDIF()
+
+IF(DEFINED YASM_VER)
+  SET(ver _${YASM_VER})
