  ENDIF(BUILD_SHARED_LIBS)
  
 -INSTALL(TARGETS libyasm
-+IF(NOT INSTALL_YASM_ONLY)
-+
 +INSTALL(TARGETS libyasm EXPORT ${targetsFile}
      RUNTIME DESTINATION bin
      LIBRARY DESTINATION lib
      ARCHIVE DESTINATION lib
-@@ -76,5 +79,7 @@ INSTALL(FILES
++    ${OPT_INSTALL}
+     )
+ 
+ INSTALL(FILES
+@@ -76,5 +78,6 @@ INSTALL(FILES
      symrec.h
      valparam.h
      value.h
 -    DESTINATION include/libyasm
 +    DESTINATION include${verDir}/libyasm
++    ${OPT_INSTALL}
      )
-+
-+ENDIF(INSTALL_YASM_ONLY)
+diff --git a/modules/preprocs/nasm/CMakeLists.txt b/modules/preprocs/nasm/CMakeLists.txt
+index e10a9dd..28bbce6 100644
+--- a/modules/preprocs/nasm/CMakeLists.txt
++++ b/modules/preprocs/nasm/CMakeLists.txt
+@@ -1,9 +1,8 @@
+ add_executable(genversion preprocs/nasm/genversion.c)
+-get_target_property(_tmp_GENVERSION_EXE genversion LOCATION)
+ add_custom_command(
+     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.mac
+-    COMMAND ${_tmp_GENVERSION_EXE} ${CMAKE_CURRENT_BINARY_DIR}/version.mac
+-    DEPENDS ${_tmp_GENVERSION_EXE}
++    COMMAND genversion ${CMAKE_CURRENT_BINARY_DIR}/version.mac
++    DEPENDS genversion
+     )
+ 
+ YASM_GENMACRO(

 ADD_SUBDIRECTORY(modules)
 ADD_SUBDIRECTORY(frontends)
 
+IF(NOT INSTALL_YASM_ONLY)
+
+INSTALL(EXPORT ${targetsFile} DESTINATION bin/cmake)
+
 INSTALL(FILES
     libyasm.h
     ${CMAKE_BINARY_DIR}/libyasm-stdint.h
-    DESTINATION include
+    DESTINATION include${verDir}
     )
+
+ENDIF(INSTALL_YASM_ONLY)
diff --git a/frontends/tasm/CMakeLists.txt b/frontends/tasm/CMakeLists.txt
index e275ab8..7d27511 100644
--- a/frontends/tasm/CMakeLists.txt
+++ b/frontends/tasm/CMakeLists.txt
@@ -30,8 +30,12 @@ ELSE(BUILD_SHARED_LIBS)
     TARGET_LINK_LIBRARIES(ytasm yasmstd libyasm)
 ENDIF(BUILD_SHARED_LIBS)
 

+
+INSTALL(TARGETS yasm EXPORT ${targetsFile} RUNTIME DESTINATION bin)
diff --git a/libyasm/CMakeLists.txt b/libyasm/CMakeLists.txt
index bd9b7b2..979e8c0 100644
--- a/libyasm/CMakeLists.txt
+++ b/libyasm/CMakeLists.txt
@@ -38,14 +38,16 @@ IF(BUILD_SHARED_LIBS)
         )
 ELSE(BUILD_SHARED_LIBS)
     SET_TARGET_PROPERTIES(libyasm PROPERTIES
