cmakelinkershared-librariesstatic-libraries

Cmake : How the dynamic linker locates dynamic libraries when loading an executable?


I'm trying to understand how to build C++ project with CMake. I'm not familiar with C++. I'm working on mac Os X and i'd like share the app on Linux too.

This is my project directory architecture. You can find here on github

This is my project directory architecture.

I'have done a program with static and shared library to see how it works. I read about shared and static libraries ,here on stackoverflow , and Cmake stuffs 1 & 2

Initialy i was merging all sources in an executable. It was working well. But the goal of a shared is not to be packaged, isn't it ? It should be access by location.Or when i move my lib and bin under install build. The program was still working. Great but i doubt it should be working as this. I mean if i move my shared libray, the program should be not working no more.

So instead of doing ,

#ADD_EXECUTABLE(ChimericGenomeMaker "${SOURCES_MAIN}" "${SOURCES_STATIC}" "${SOURCES_SHARED}")

I'm trying to use TARGET_LINK_LIBRARIES and maybe (LINK_DIRECTORIES):

TARGET_LINK_LIBRARIES(ChimericGenomeMaker "calculMean" ) TARGET_LINK_LIBRARIES(ChimericGenomeMaker "calculSum" )

But it's not working.

 ./install/bin/ChimericGenomeMaker 4
 dyld: Library not loaded: libcalculMean.dylib
 Referenced from:  /Users/JP/Desktop/ChimericGenomeMaker/./install/bin/ChimericGenomeMaker
  Reason: image not found
   Trace/BPT trap: 5

Using otool -L , tell me what is following :

./install/bin/ChimericGenomeMaker:
    libcalculMean.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

So ok there is a problem of location of my dylib... And is my first idea (which merge all executables anyway the library they came from) is wrong thinking ? What is the good "framework" ?

And last question, anyway shared or static library, if i moved my lib directory, does the program will continue to run correctly ?

Thanks.

This is my CmakeLists.txt [UPDATED]

#cmake -G "Eclipse CDT4 - Unix Makefiles" ..
#SET (CMAKE_CXX_COMPILER "/usr/bin/g++")

IF (${APPLE})
  MESSAGE(STATUS "WELCOME TO APPLE")
ENDIF()

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(ChimericGenomeMaker)

SET (ChimericGenomeMaker_VERSION_MAJOR 1)
SET (ChimericGenomeMaker_VERSION_MINOR 0)

#used by makefile users in order to install software at non-default location
#make DESTDIR=/home/john install --> prepended with the DESTDIR value
SET(CMAKE_INSTALL_PREFIX install)

#SET(CMAKE_SKIP_BUILD_RPATH true )
#Can manually add the sources using the set command as follows:
FILE(GLOB SOURCES_MAIN "src/main/*.cpp")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include/main")

#Generate the shared library from the sources
FILE(GLOB SOURCES_SHARED "src/shared/*.cpp")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include/shared")
ADD_LIBRARY(calculMean SHARED "${SOURCES_SHARED}")
INSTALL(TARGETS calculMean DESTINATION "lib/shared")
#MACOSX_RPATH is not specified for the following targets calcuMean

#Generate the static library from the sources
FILE(GLOB SOURCES_STATIC "src/static/*.cpp")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include/static")
ADD_LIBRARY(calculSum STATIC "${SOURCES_STATIC}")
INSTALL(TARGETS calculSum DESTINATION "lib/static")

# Use, i.e. don't skip the full RPATH for the build tree
# SET(CMAKE_SKIP_BUILD_RPATH  FALSE)

# When building, don't use the install RPATH already (but later on when installing)
#SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 

#SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/shared")

# add the automatically determined parts of the RPATH which point to directories outside the build tree to the install RPATH
#SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# the RPATH to be used when installing, but only if it's not a system directory
#LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib/shared"  isSystemDir)
# IF("${isSystemDir}" STREQUAL "-1")
#    SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/shared")
# ENDIF("${isSystemDir}" STREQUAL "-1")

#Build a stand alone program
ADD_EXECUTABLE(ChimericGenomeMaker "${SOURCES_SHARED}" "${SOURCES_MAIN}"  )# "${SOURCES_STATIC}" 
#TARGET_LINK_LIBRARIES(ChimericGenomeMaker calculMean) 
TARGET_LINK_LIBRARIES(ChimericGenomeMaker calculSum)

INSTALL(TARGETS ChimericGenomeMaker DESTINATION bin)

ADD_CUSTOM_COMMAND(TARGET calculMean
                   POST_BUILD
                   COMMAND "${CMAKE_SOURCE_DIR}/bash/post-build.sh" "HELLO YOU!"
                   WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
                   COMMENT "Post-build is Running" VERBATIM
)

OUTPUT OF CMAKE :

    ./build.sh
-- Custom Bash Cleaning
-- Old Install Directory Deleted with sucess
-- WELCOME TO APPLE
-- The C compiler identification is AppleClang 6.1.0.6020053
-- The CXX compiler identification is AppleClang 6.1.0.6020053
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- INSTALL_NAME_DIR:         
-- CMAKE_BINARY_DIR:         /Users/JP/Desktop/ChimericGenomeMaker/build
-- CMAKE_CURRENT_BINARY_DIR: /Users/JP/Desktop/ChimericGenomeMaker/build
-- CMAKE_SOURCE_DIR:         /Users/JP/Desktop/ChimericGenomeMaker
-- CMAKE_CURRENT_SOURCE_DIR: /Users/JP/Desktop/ChimericGenomeMaker
-- PROJECT_BINARY_DIR: /Users/JP/Desktop/ChimericGenomeMaker/build
-- PROJECT_SOURCE_DIR: /Users/JP/Desktop/ChimericGenomeMaker
-- EXECUTABLE_OUTPUT_PATH: 
-- LIBRARY_OUTPUT_PATH:     
-- CMAKE_MODULE_PATH: 
-- CMAKE_COMMAND: /usr/local/Cellar/cmake/3.2.1/bin/cmake
-- CMAKE_ROOT: /usr/local/Cellar/cmake/3.2.1/share/cmake
-- CMAKE_CURRENT_LIST_FILE: /Users/JP/Desktop/ChimericGenomeMaker/CMakeLists.txt
-- CMAKE_CURRENT_LIST_LINE: 122
-- CMAKE_INCLUDE_PATH: 
-- CMAKE_LIBRARY_PATH: 
-- CMAKE_SYSTEM: Darwin-14.4.0
-- CMAKE_SYSTEM_NAME: Darwin
-- CMAKE_SYSTEM_VERSION: 14.4.0
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- UNIX: 1
-- WIN32: 
-- APPLE: 1
-- MINGW: 
-- CYGWIN: 
-- BORLAND: 
-- MSVC: 
-- MSVC_IDE: 
-- MSVC60: 
-- MSVC70: 
-- MSVC71: 
-- MSVC80: 
-- CMAKE_COMPILER_2005: 
-- CMAKE_SKIP_RULE_DEPENDENCY: 
-- CMAKE_SKIP_INSTALL_ALL_DEPENDENCY: 
-- CMAKE_SKIP_RPATH: NO
-- CMAKE_VERBOSE_MAKEFILE: FALSE
-- CMAKE_SUPPRESS_REGENERATION: 
-- CMAKE_C_FLAGS: 
-- CMAKE_CXX_FLAGS: 
-- CMAKE_BUILD_TYPE: 
-- BUILD_SHARED_LIBS: 
-- CMAKE_C_COMPILER: /Library/Developer/CommandLineTools/usr/bin/cc
-- CMAKE_CXX_COMPILER: /Library/Developer/CommandLineTools/usr/bin/c++
-- CMAKE_COMPILER_IS_GNUCC: 
-- CMAKE_COMPILER_IS_GNUCXX : 
-- CMAKE_AR: /Library/Developer/CommandLineTools/usr/bin/ar
-- CMAKE_RANLIB: /Library/Developer/CommandLineTools/usr/bin/ranlib
-- DESKTOP : 
-- PATH : /Users/JP/.jenv/shims:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   calculMean

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/JP/Desktop/ChimericGenomeMaker/build
Scanning dependencies of target calculSum
[ 20%] Building CXX object CMakeFiles/calculSum.dir/src/static/calc_sum.cpp.o
Linking CXX static library libcalculSum.a
[ 20%] Built target calculSum
Scanning dependencies of target ChimericGenomeMaker
[ 40%] Building CXX object CMakeFiles/ChimericGenomeMaker.dir/src/shared/calc_mean.cpp.o
[ 60%] Building CXX object CMakeFiles/ChimericGenomeMaker.dir/src/main/foo.cpp.o
[ 80%] Building CXX object CMakeFiles/ChimericGenomeMaker.dir/src/main/main.cpp.o
Linking CXX executable ChimericGenomeMaker
[ 80%] Built target ChimericGenomeMaker
Scanning dependencies of target calculMean
[100%] Building CXX object CMakeFiles/calculMean.dir/src/shared/calc_mean.cpp.o
Linking CXX shared library libcalculMean.dylib
Post-build is Running
POST-BUILD SCRIPT
HELLO YOU!
[100%] Built target calculMean
[ 20%] Built target calculSum
[ 80%] Built target ChimericGenomeMaker
[100%] Built target calculMean
Install the project...
-- Install configuration: ""
-- Installing: /Users/JP/Desktop/ChimericGenomeMaker/build/install/lib/shared/libcalculMean.dylib
-- Installing: /Users/JP/Desktop/ChimericGenomeMaker/build/install/lib/static/libcalculSum.a
-- Installing: /Users/JP/Desktop/ChimericGenomeMaker/build/install/bin/ChimericGenomeMaker
m1-p19-gen:ChimericGenomeMaker JP$ 

Solution

  • Finally I succeed to make it. Now if i move my dynamic library from my shared directory : my executable will not work anymore.This is the behavior that was normally expectable.

    I don't need to merge all sources files in one executable. (that was the first solution, it worked, but i believe it was not clean)

    ADD_EXECUTABLE(ChimericGenomeMaker "${SOURCES_SHARED}" "${SOURCES_MAIN}""${SOURCES_STATIC}" )

    I add only main source to my executable and i link target library :

    ADD_EXECUTABLE(ChimericGenomeMaker "${SOURCES_MAIN}")
    TARGET_LINK_LIBRARIES(ChimericGenomeMaker calculMean)
    TARGET_LINK_LIBRARIES(ChimericGenomeMaker calculSum)

    I played with @rpath @executable_path :

    set(CMAKE_INSTALL_NAME_DIR "@rpath")

    set(CMAKE_INSTALL_RPATH "@executable_path/..${CMAKE_INSTALL_PREFIX}/lib/shared")

    My new CmakeLists.txt is now ans it works under mac OSX :

    #cmake -G "Eclipse CDT4 - Unix Makefiles" ..
    #SET (CMAKE_CXX_COMPILER "/usr/bin/g++")
    #Alternatively, you could configure a script for executing the program which then dynamically adjusts PATH (Windows), 
    #LD_LIBRARY_PATH (Linux) or DYLD_LIBRARY_PATH (Mac) before executing your binary. 
    #These environment variables are used to resolve shared libraries at runtime
    
    IF (${APPLE})
        MESSAGE(STATUS "WELCOME TO APPLE")
    
        set(CMAKE_MACOSX_RPATH ON)
        set(CMAKE_SKIP_BUILD_RPATH FALSE)
        set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
        set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
        set(CMAKE_INSTALL_NAME_DIR "@rpath")
        set(CMAKE_INSTALL_RPATH "@executable_path/..${CMAKE_INSTALL_PREFIX}/lib/shared")
    
    ENDIF()
    
    CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
    PROJECT(ChimericGenomeMaker)
    
    SET (ChimericGenomeMaker_VERSION_MAJOR 1)
    SET (ChimericGenomeMaker_VERSION_MINOR 0)
    
    #used by makefile users in order to install software at non-default location
    #make DESTDIR=/home/john install --> prepended with the DESTDIR value
    SET(CMAKE_INSTALL_PREFIX install)
    
    #SET(CMAKE_SKIP_BUILD_RPATH true )
    #Can manually add the sources using the set command as follows:
    FILE(GLOB SOURCES_MAIN "src/main/*.cpp")
    INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include/main")
    
    
    #Generate the static library from the sources
    FILE(GLOB SOURCES_STATIC "src/static/*.cpp")
    INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include/static")
    ADD_LIBRARY(calculSum STATIC "${SOURCES_STATIC}")
    INSTALL(TARGETS calculSum DESTINATION "lib/static")
    
    #Generate the shared library from the sources
    FILE(GLOB SOURCES_SHARED "src/shared/*.cpp")
    INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include/shared")
    ADD_LIBRARY(calculMean SHARED "${SOURCES_SHARED}")
    #MACOSX_RPATH is now specified for the following targets calcuMean
    #SET_TARGET_PROPERTIES(calculMean PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/shared")
    INSTALL(TARGETS calculMean DESTINATION "lib/shared")
    #MACOSX_RPATH is not specified for the following targets calcuMean
    
    #Build a stand alone program
    ADD_EXECUTABLE(ChimericGenomeMaker "${SOURCES_MAIN}")# "${SOURCES_STATIC}" "${SOURCES_SHARED}"
    
    TARGET_LINK_LIBRARIES(ChimericGenomeMaker calculMean) 
    TARGET_LINK_LIBRARIES(ChimericGenomeMaker calculSum)
    
    INSTALL(TARGETS ChimericGenomeMaker DESTINATION bin)
    
    ADD_CUSTOM_COMMAND(TARGET calculMean
                       POST_BUILD
                       COMMAND "${CMAKE_SOURCE_DIR}/bash/post-build.sh" "HELLO YOU!"
                       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
                       COMMENT "Post-build is Running" VERBATIM
    )
    
    
    # If you want to share your lib and give description of the methods you need to make install & export header
    #INSTALL(FILES "${PROJECT_SOURCE_DIR}/include/static/calc_sum.h" DESTINATION include)
    
    
    # ------------------------- Begin Generic CMake Variable Logging ------------------
    
    
    MESSAGE( STATUS "CMAKE_INSTALL_NAME_DIR:         " ${CMAKE_INSTALL_NAME_DIR} )
    MESSAGE( STATUS "CMAKE_INSTALL_RPATH:         " ${CMAKE_INSTALL_RPATH} )
    
    # if you are building in-source, this is the same as CMAKE_SOURCE_DIR, otherwise 
    # this is the top level directory of your build tree 
    MESSAGE( STATUS "CMAKE_BINARY_DIR:         " ${CMAKE_BINARY_DIR} )
    
    # if you are building in-source, this is the same as CMAKE_CURRENT_SOURCE_DIR, otherwise this 
    # is the directory where the compiled or generated files from the current CMakeLists.txt will go to 
    MESSAGE( STATUS "CMAKE_CURRENT_BINARY_DIR: " ${CMAKE_CURRENT_BINARY_DIR} )
    
    # this is the directory, from which cmake was started, i.e. the top level source directory 
    MESSAGE( STATUS "CMAKE_SOURCE_DIR:         " ${CMAKE_SOURCE_DIR} )
    
    # this is the directory where the currently processed CMakeLists.txt is located in 
    MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
    
    # contains the full path to the top level directory of your build tree 
    MESSAGE( STATUS "PROJECT_BINARY_DIR: " ${PROJECT_BINARY_DIR} )
    
    # contains the full path to the root of your project source directory,
    # i.e. to the nearest directory where CMakeLists.txt contains the PROJECT() command 
    MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
    
    # set this variable to specify a common place where CMake should put all executable files
    # (instead of CMAKE_CURRENT_BINARY_DIR)
    MESSAGE( STATUS "EXECUTABLE_OUTPUT_PATH: " ${EXECUTABLE_OUTPUT_PATH} )
    
    # set this variable to specify a common place where CMake should put all libraries 
    # (instead of CMAKE_CURRENT_BINARY_DIR)
    MESSAGE( STATUS "LIBRARY_OUTPUT_PATH:     " ${LIBRARY_OUTPUT_PATH} )
    
    # tell CMake to search first in directories listed in CMAKE_MODULE_PATH
    # when you use FIND_PACKAGE() or INCLUDE()
    MESSAGE( STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH} )
    
    # this is the complete path of the cmake which runs currently (e.g. /usr/local/bin/cmake) 
    MESSAGE( STATUS "CMAKE_COMMAND: " ${CMAKE_COMMAND} )
    
    # this is the CMake installation directory 
    MESSAGE( STATUS "CMAKE_ROOT: " ${CMAKE_ROOT} )
    
    # this is the filename including the complete path of the file where this variable is used. 
    MESSAGE( STATUS "CMAKE_CURRENT_LIST_FILE: " ${CMAKE_CURRENT_LIST_FILE} )
    
    # this is linenumber where the variable is used
    MESSAGE( STATUS "CMAKE_CURRENT_LIST_LINE: " ${CMAKE_CURRENT_LIST_LINE} )
    
    # this is used when searching for include files e.g. using the FIND_PATH() command.
    MESSAGE( STATUS "CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH} )
    
    # this is used when searching for libraries e.g. using the FIND_LIBRARY() command.
    MESSAGE( STATUS "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH} )
    
    # the complete system name, e.g. "Linux-2.4.22", "FreeBSD-5.4-RELEASE" or "Windows 5.1" 
    MESSAGE( STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM} )
    
    # the short system name, e.g. "Linux", "FreeBSD" or "Windows"
    MESSAGE( STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME} )
    
    # only the version part of CMAKE_SYSTEM 
    MESSAGE( STATUS "CMAKE_SYSTEM_VERSION: " ${CMAKE_SYSTEM_VERSION} )
    
    # the processor name (e.g. "Intel(R) Pentium(R) M processor 2.00GHz") 
    MESSAGE( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR} )
    
    # is TRUE on all UNIX-like OS's, including Apple OS X and CygWin
    MESSAGE( STATUS "UNIX: " ${UNIX} )
    
    # is TRUE on Windows, including CygWin 
    MESSAGE( STATUS "WIN32: " ${WIN32} )
    
    # is TRUE on Apple OS X
    MESSAGE( STATUS "APPLE: " ${APPLE} )
    
    # is TRUE when using the MinGW compiler in Windows
    MESSAGE( STATUS "MINGW: " ${MINGW} )
    
    # is TRUE on Windows when using the CygWin version of cmake
    MESSAGE( STATUS "CYGWIN: " ${CYGWIN} )
    
    # is TRUE on Windows when using a Borland compiler 
    MESSAGE( STATUS "BORLAND: " ${BORLAND} )
    
    # Microsoft compiler 
    MESSAGE( STATUS "MSVC: " ${MSVC} )
    MESSAGE( STATUS "MSVC_IDE: " ${MSVC_IDE} )
    MESSAGE( STATUS "MSVC60: " ${MSVC60} )
    MESSAGE( STATUS "MSVC70: " ${MSVC70} )
    MESSAGE( STATUS "MSVC71: " ${MSVC71} )
    MESSAGE( STATUS "MSVC80: " ${MSVC80} )
    MESSAGE( STATUS "CMAKE_COMPILER_2005: " ${CMAKE_COMPILER_2005} )
    
    # set this to true if you don't want to rebuild the object files if the rules have changed, 
    # but not the actual source files or headers (e.g. if you changed the some compiler switches) 
    MESSAGE( STATUS "CMAKE_SKIP_RULE_DEPENDENCY: " ${CMAKE_SKIP_RULE_DEPENDENCY} )
    
    # since CMake 2.1 the install rule depends on all, i.e. everything will be built before installing. 
    # If you don't like this, set this one to true.
    MESSAGE( STATUS "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY: " ${CMAKE_SKIP_INSTALL_ALL_DEPENDENCY} )
    
    # If set, runtime paths are not added when using shared libraries. Default it is set to OFF
    MESSAGE( STATUS "CMAKE_SKIP_RPATH: " ${CMAKE_SKIP_RPATH} )
    
    # set this to true if you are using makefiles and want to see the full compile and link 
    # commands instead of only the shortened ones 
    MESSAGE( STATUS "CMAKE_VERBOSE_MAKEFILE: " ${CMAKE_VERBOSE_MAKEFILE} )
    
    # this will cause CMake to not put in the rules that re-run CMake. This might be useful if 
    # you want to use the generated build files on another machine. 
    MESSAGE( STATUS "CMAKE_SUPPRESS_REGENERATION: " ${CMAKE_SUPPRESS_REGENERATION} )
    
    # A simple way to get switches to the compiler is to use ADD_DEFINITIONS(). 
    # But there are also two variables exactly for this purpose: 
    
    # the compiler flags for compiling C sources 
    MESSAGE( STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS} )
    
    # the compiler flags for compiling C++ sources 
    MESSAGE( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} )
    
    # Choose the type of build.  Example: SET(CMAKE_BUILD_TYPE Debug) 
    MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
    
    # if this is set to ON, then all libraries are built as shared libraries by default.
    MESSAGE( STATUS "BUILD_SHARED_LIBS: " ${BUILD_SHARED_LIBS} )
    
    # the compiler used for C files 
    MESSAGE( STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} )
    
    # the compiler used for C++ files 
    MESSAGE( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} )
    
    # if the compiler is a variant of gcc, this should be set to 1 
    MESSAGE( STATUS "CMAKE_COMPILER_IS_GNUCC: " ${CMAKE_COMPILER_IS_GNUCC} )
    
    # if the compiler is a variant of g++, this should be set to 1 
    MESSAGE( STATUS "CMAKE_COMPILER_IS_GNUCXX : " ${CMAKE_COMPILER_IS_GNUCXX} )
    
    # the tools for creating libraries 
    MESSAGE( STATUS "CMAKE_AR: " ${CMAKE_AR} )
    MESSAGE( STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB} )
    
    # ENVIRONNEMENT VARIABLE 
    MESSAGE(STATUS "PATH : $ENV{PATH}")
    
    
    # ------------------------- End of Generic CMake Variable Logging ------------------