View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010579CMakeModulespublic2010-04-20 09:192013-01-09 14:05
ReporterRolf Eike Beer 
Assigned ToRolf Eike Beer 
PrioritynormalSeverityfeatureReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionCMake 2.8.10Fixed in VersionCMake 2.8.10 
Summary0010579: CheckStructHasMember should also return the size of the type
DescriptionFor properly detecting e.g. large file support one should check if off_t is 64 bit and struct stat member st_size is 64 bit too. There is currently no easy way to do that so I suggest that CheckStructHasMember will additionally return the size of the member when it checks for it's presence.
TagsNo tags attached.
Attached Filespatch file icon 0001-CheckTypeSize-show-in-documentation-how-to-get-struc.patch [^] (1,022 bytes) 2012-08-13 13:02 [Show Content]
patch file icon 0002-CheckTypeSize-add-a-test-for-size-of-struct-members.patch [^] (4,258 bytes) 2012-08-13 13:29 [Show Content]

 Relationships

  Notes
(0022032)
Brad King (manager)
2010-08-31 15:33

Perhaps a new CheckSizeofStructMember would be better?
(0022094)
Rolf Eike Beer (developer)
2010-09-06 04:42

Whatever works ;) If it is an optional field of a struct I still would need to check if it exists first. Or this new check would simply return 0 then and not raise an error.

What I wanted to avoid is something like:

CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC)
IF (HAVE_TIMEVAL_TV_SEC)
  CheckSizeofStructMember("struct timeval" tv_sec sys/select.h TIMEVAL_TV_SEC_SIZE)
ELSE ()
  SET(TIMEVAL_TV_SEC_SIZE 0)
ENDIF ()

It would be nice if that would just be one single call at the end. Since CheckStructHasMember must do basically all the magic anyway (set headers, check if it compiles at all, ...) I thought it would be easier to just extend this one. But at the end I would welcome every working solution.
(0022164)
Brad King (manager)
2010-09-09 15:22

While investigating an implementation I realized that "CheckTypeSize" should actually be called "CheckExprSize". You can do this:

include(CheckTypeSize)
set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h)
check_type_size("((struct stat*)0)->st_mode" SIZEOF_MEMBER)
message("SIZEOF_MEMBER=[${SIZEOF_MEMBER}]")
message("SIZEOF_MEMBER_CODE=[${SIZEOF_MEMBER_CODE}]")

and it works even back in CMake 2.4. The size is zero or blank if the member does not exist.
(0022217)
David Cole (manager)
2010-09-14 09:17

We will not be addressing this for the upcoming CMake 2.8.3 release. Changing target release value back to empty for now.

Waiting for reply from reporter to note 22164.
(0030472)
Rolf Eike Beer (developer)
2012-08-13 10:17

From my POV we don't need a new macro since we can already do what I wanted. But that trick should be added to the documentation.
(0030474)
Brad King (manager)
2012-08-13 10:36

Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0030571)
Rolf Eike Beer (developer)
2012-08-13 13:01

This patch should do it. Testcase to keep this stuff working will follow shortly.
(0030715)
Rolf Eike Beer (developer)
2012-08-21 02:34

Patches merged to next:

9926f68 CheckTypeSize: add a test for size of struct members
2d68b03 CheckTypeSize: show in documentation how to get struct member size (0010579)
(0032077)
Robert Maynard (manager)
2013-01-09 14:05

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2010-04-20 09:19 Rolf Eike Beer New Issue
2010-05-08 03:38 Alex Neundorf Category CMake => Modules
2010-08-31 15:31 David Cole Status new => assigned
2010-08-31 15:31 David Cole Assigned To => Brad King
2010-08-31 15:33 Brad King Note Added: 0022032
2010-08-31 18:06 David Cole Target Version => CMake 2.8.3
2010-09-06 04:42 Rolf Eike Beer Note Added: 0022094
2010-09-09 15:22 Brad King Note Added: 0022164
2010-09-14 09:17 David Cole Note Added: 0022217
2010-09-14 09:17 David Cole Target Version CMake 2.8.3 =>
2012-08-13 10:17 Rolf Eike Beer Note Added: 0030472
2012-08-13 10:36 Brad King Status assigned => backlog
2012-08-13 10:36 Brad King Note Added: 0030474
2012-08-13 13:01 Rolf Eike Beer Note Added: 0030571
2012-08-13 13:01 Rolf Eike Beer Assigned To Brad King => Rolf Eike Beer
2012-08-13 13:01 Rolf Eike Beer Status backlog => assigned
2012-08-13 13:01 Rolf Eike Beer Target Version => CMake 2.8.10
2012-08-13 13:02 Rolf Eike Beer File Added: 0001-CheckTypeSize-show-in-documentation-how-to-get-struc.patch
2012-08-13 13:29 Rolf Eike Beer File Added: 0002-CheckTypeSize-add-a-test-for-size-of-struct-members.patch
2012-08-21 02:34 Rolf Eike Beer Note Added: 0030715
2012-08-21 02:34 Rolf Eike Beer Status assigned => resolved
2012-08-21 02:34 Rolf Eike Beer Resolution open => fixed
2012-08-21 02:34 Rolf Eike Beer Fixed in Version => CMake 2.8.10
2013-01-09 14:05 Robert Maynard Note Added: 0032077
2013-01-09 14:05 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team