diff --git a/CMakeLists.txt b/CMakeLists.txt index acecb01a3..9e916be1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,6 +344,13 @@ ENDIF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") # Installation stuff SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows") +ADD_DEFINITIONS("-DOSG_DEBUG_POSTFIX='\"${CMAKE_DEBUG_POSTFIX}\"'") +IF(UNIX AND NOT WIN32 AND NOT APPLE) + IF(CMAKE_BUILD_TYPE STREQUAL "Debug") + ADD_DEFINITIONS("-D_DEBUG") + ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug") +ENDIF(UNIX AND NOT WIN32 AND NOT APPLE) + IF(UNIX AND NOT WIN32 AND NOT APPLE) IF(CMAKE_SIZEOF_VOID_P MATCHES "8") diff --git a/CMakeModules/OsgMacroUtils.cmake b/CMakeModules/OsgMacroUtils.cmake index fdf1febc0..4abeb0973 100644 --- a/CMakeModules/OsgMacroUtils.cmake +++ b/CMakeModules/OsgMacroUtils.cmake @@ -145,7 +145,9 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME) #not sure if needed, but for plugins only Msvc need the d suffix IF(NOT MSVC) - SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "") + IF(NOT UNIX) + SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "") + ENDIF(NOT UNIX) ELSE(NOT MSVC) IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4) IF(NOT MSVC_IDE) diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index 26a3c354c..d83933e65 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -39,6 +39,9 @@ using std::tolower; #endif +#ifndef OSG_DEBUG_POSTFIX +#define OSG_DEBUG_POSTFIX "d" +#endif using namespace osg; using namespace osgDB; @@ -603,7 +606,7 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext) return prepend+"mingw_"+"osgdb_"+lowercase_ext+".dll"; #elif defined(WIN32) #ifdef _DEBUG - return prepend+"osgdb_"+lowercase_ext+"d.dll"; + return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX +".dll"; #else return prepend+"osgdb_"+lowercase_ext+".dll"; #endif @@ -613,7 +616,12 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext) // why don't we use PLUGIN_EXT from the makefiles here? return prepend+"osgdb_"+lowercase_ext+".sl"; #else - return prepend+"osgdb_"+lowercase_ext+".so"; + #ifdef _DEBUG +#pragma message(OSG_DEBUG_POSTFIX) + return prepend+"osgdb_"+lowercase_ext+ OSG_DEBUG_POSTFIX + ".so"; + #else + return prepend+"osgdb_"+lowercase_ext+".so"; + #endif #endif } @@ -626,7 +634,7 @@ std::string Registry::createLibraryNameForNodeKit(const std::string& name) return "lib"+name+".dll"; #elif defined(WIN32) #ifdef _DEBUG - return name+"d.dll"; + return name+OSG_DEBUG_POSTFIX +".dll"; #else return name+".dll"; #endif @@ -636,7 +644,11 @@ std::string Registry::createLibraryNameForNodeKit(const std::string& name) // why don't we use PLUGIN_EXT from the makefiles here? return "lib"+name+".sl"; #else - return "lib"+name+".so"; + #ifdef _DEBUG + return "lib"+name+OSG_DEBUG_POSTFIX +".so"; + #else + return "lib"+name+".so"; + #endif #endif }