| View previous topic :: View next topic |
|
|
| Author |
Message |
Sukender Appreciator
Joined: 29 Jan 2009 Posts: 654
|
Posted: Fri Oct 22, 2010 6:14 pm Post subject: Wrong CMake output directory using Visual - "half" submission |
|
|
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 |
|
 |
Chuck Seberino Guest
|
Posted: Fri Oct 22, 2010 6:34 pm Post subject: Wrong CMake output directory using Visual - "half" submission |
|
|
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: 654
|
Posted: Mon Oct 25, 2010 7:21 am Post subject: Wrong CMake output directory using Visual - "half" submission |
|
|
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 |
|
 |
|
|
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
|
|
Powered by phpBB © 2001, 2005 phpBB Group
|