THRIFT-5109 Misc Cmake build improvements
Patch: Mario Emmenlauer

This closes #2017
This closes #2018
This closes #2019

- build/cmake/DefineInstallationPaths.cmake: fixed the library path
- build/cmake/ThriftMacros.cmake: do not enforce debug suffix 'd'
- lib/java/CMakeLists.txt: allow to override JAVA_INSTALL_DIR
diff --git a/lib/java/CMakeLists.txt b/lib/java/CMakeLists.txt
index a67845a..28158c0 100644
--- a/lib/java/CMakeLists.txt
+++ b/lib/java/CMakeLists.txt
@@ -29,11 +29,12 @@
     add_custom_target(thrift_aar ALL DEPENDS ${THRIFT_AAR})
 
 else()
-
-    if(IS_ABSOLUTE "${LIB_INSTALL_DIR}")
-        set(JAVA_INSTALL_DIR "${LIB_INSTALL_DIR}/java")
-    else()
-        set(JAVA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/java")
+    if(NOT JAVA_INSTALL_DIR)
+        if(IS_ABSOLUTE "${LIB_INSTALL_DIR}")
+            set(JAVA_INSTALL_DIR "${LIB_INSTALL_DIR}/java")
+        else()
+            set(JAVA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/java")
+        endif()
     endif()
 
     if(IS_ABSOLUTE "${DOC_INSTALL_DIR}")