CMakeLists.txt forces use of static c-runtime in client code

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
ander833
Posts: 6
Joined: Tue, 2005-01-04, 11:14

CMakeLists.txt forces use of static c-runtime in client code

#1 Post by ander833 »

Hi,

The CMake configuration for building DCMTK on Windows prevents the user from using anything other than the static c-runtime library which makes it almost impossible to use DCMTK from a DLL. Also, the compilation flags specified does not correctly reflect what is actually used by VC++.

The CMakeLists.txt file specifies the CMAKE_C_FLAGS_DEBUG, CMAKE_C_FLAGS_RELEASE, CMAKE_CXX_FLAGS_DEBUG, CMAKE_CXX_FLAGS_RELEASE using the option FORCE making it impossible for the user to change these flags. Since the flags specify that the static (multithreaded) c-runtime shall be used with the /MT and /MTd flags all code that uses DCMTK (even indirectly) must also use the static multithreaded c-runtime since different versions of the c-runtime cannot be mixed. This makes it almost impossible to produce DLLs that use DCMTK since you get seperate c-runtimes in every DLL and in the executable making it impossible to share resources (you want the dynamic c-runtime using the /MD and /MDd flags instead).

Therefore it would be great if the FORCE option was removed so that the user can decide upon the c-runtime to use.

Also the compiler flags in CMakeLists.txt specifies the /GR- option to disable RTTI information! However, (either because of CMake or some conflicting flag) RTTI information is still enabled in the VC++ projects. Therefore, I suggest that the flags are changed to use /GR instead of /GR- especially since the RTTI information realy should be enabled so that the user of DCMTK can do dynamic_cast on DCMTK objects.

Regards,

Andreas

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest