Sukender,

It is indeed related to CMake >= 2.8.1.  I have had success setting all 
configuration types including the generic one, which seems to work on Linux, 
OSX and Windows.  So:

SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY         ${OUTPUT_LIBDIR})
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${OUTPUT_LIBDIR})
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG   ${OUTPUT_LIBDIR})

That way it works with older and newer versions of CMake.  Older versions don't 
know/use/ignore the specific configuration types and newer CMake uses the most 
specific setting.

The conditional below I use for other situations.  It works for me since I am 
simply checking against previous versions:

        # CMake >= 2.8.1 changed the output directory algorithm...
        if (CMAKE_CONFIGURATION_TYPES AND NOT APPLE)
            if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND 
(${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 8.1))
                #Perform 'old' CMake method.
                # ...
            endif ()
        endif ()

HTH

Chuck Seberino


On Oct 22, 2010, at 11:13 AM, Sukender wrote:

> Hi Robert, hi all,
> 
> I spotted the binaries are not in /bin as usual with my new config (CMake 
> 2.8.2, VS2010 x64), but in /bin/Debug and /bin/Release.
> I think CMake 2.8.2 is the cause because the usual way to work around these 
> subdirs should not work anymore (SET_TARGET_PROPERTIES("Target" PROPERTIES 
> PREFIX "../")). I found a way to make it work properly. However I don't post 
> it as a submussion because I didn't test it as it should (not tested under 
> Linux), and I guess we must write some versionning code (if cmake version is 
> below x.y.z...). Here is my code, to be put in the root CMakeLists.txt:
> 
> Instead of using
>    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
> and such, use:
>    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> "${OUTPUT_LIBDIR}")
> 
> So the code should look like:
> 
> FOREACH(CONF ${CMAKE_CONFIGURATION_TYPES})
>       STRING(TOUPPER "${CONF}" CONF)
>       SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}")
>       SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}")
>       IF(WIN32)
>               SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}")
>       ELSE()
>               SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}")
>       ENDIF()
> ENDFOREACH()
> 
> 
> Hope someone will take a few minutes to write a nice CMake script (and figure 
> out the version number from which this can bu used, if this is really 100% 
> CMake related)
> Cheers,
> 
> Sukender
> PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to