OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Wrong CMake output directory using Visual - "half" submission


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Sukender
Appreciator


Joined: 29 Jan 2009
Posts: 675

PostPosted: Fri Oct 22, 2010 6:14 pm    Post subject:
Wrong CMake output directory using Visual - "half" submission
Reply with quote

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/


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Chuck Seberino
Guest





PostPosted: Fri Oct 22, 2010 6:34 pm    Post subject:
Wrong CMake output directory using Visual - "half" submission
Reply with quote

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:
Quote:
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/




------------------
Post generated by Mail2Forum
Back to top
Sukender
Appreciator


Joined: 29 Jan 2009
Posts: 675

PostPosted: Mon Oct 25, 2010 7:21 am    Post subject:
Wrong CMake output directory using Visual - "half" submission
Reply with quote

Hi Chuck,

Your point of view joins mine. Thanks for clarification.

Be careful however: you wrote *_DEBUG and *_RELEASE. This is half true, because CMake has 4 configurations by default, and users can change them. So if I rename "Release" to "Zrolbgluck" (or add this new configuration), you'll have to write *_ZROLBGLUCK. Hence the FOREACH() loop I wrote in my previous email, which does the job fo every defined configuration.

I'll make a sumbissions this morning I guess/hope.

Cheers,

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

----- "Chuck Seberino" <> a écrit :

Quote:
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/






------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts The new FinGStreamer.cmake script won... Mattias Helsing Submission 0 Wed Dec 17, 2014 11:20 pm View latest post
No new posts support for policy settings with cmak... Mattias Helsing Submission 1 Wed Dec 17, 2014 11:14 pm View latest post
No new posts Transform Feedback Extensions (submis... robertosfield Submission 0 Wed Dec 10, 2014 1:12 pm View latest post
No new posts Half Side-by-side argesino General 4 Mon Dec 01, 2014 11:46 am View latest post
No new posts iOS & GLES2 : VERTEX glCompileSha... skylook General 8 Fri Nov 07, 2014 9:14 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP