Discussion:
[Cmake] Adding Header files to CMakeLists.txt
Ian Scott
2001-08-17 10:20:16 UTC
Permalink
Hi,

I've been playing around with adding .h files to the CMakeLists.txt, so that
they appear in my generated .dsp file.* This appears to do the correct thing
under NT, adding them to the "Header Files" cmSourceGroup, and then into the
correct place in the dsp file.

My CMakeLists.txt file looks like


ADD_LIBRARY(ian ian_sources)

SOURCE_FILES(ian_sources
ian_file1.cxx
ian_file1.h
ian_file2.cxx
ian_file2.h
)


However using the same CMakeLists.txt file under Unix, it attempts to build
ian_file2.o and ian_file1.o twice

So my solution is
ADD_LIBRARY(ian ian_sources)

SOURCE_FILES(ian_sources
ian_file1.cxx
ian_file2.cxx
)

IF (WIN32)
SOURCE_FILES(ian_sources
ian_file1.h
ian_file2.h
)
ENDIF(WIN32)

This appears to work satisfactorily. However, I wondered if it was
necessary, or if I or CMake was doing something wrong?

Many thanks,
Ian.


* I know that some UNIX users will have doubts about the desirability of
this. However, our NT users have been complaining loudly about the lack of
.h files in the produced DSP files, and our UNIX users are willing to
tolerate additions to the CMakeLists.txt.
Bill Hoffman
2001-08-17 14:31:10 UTC
Permalink
I think what might be better is a new command in cmake:

It would work like this:

HEADER_FILES(ian_sources)

It would search the source list for .h files.
For unix it would be a no-op, but for msdev, it would
add the sources.

Is there anyway to turn off the class browsing features in msdev?
The problem with adding the .h files is that for a large project,
it may take a LONG time to load.

-Bill
Post by Ian Scott
Hi,
I've been playing around with adding .h files to the CMakeLists.txt, so that
they appear in my generated .dsp file.* This appears to do the correct thing
under NT, adding them to the "Header Files" cmSourceGroup, and then into the
correct place in the dsp file.
My CMakeLists.txt file looks like
ADD_LIBRARY(ian ian_sources)
SOURCE_FILES(ian_sources
ian_file1.cxx
ian_file1.h
ian_file2.cxx
ian_file2.h
)
However using the same CMakeLists.txt file under Unix, it attempts to build
ian_file2.o and ian_file1.o twice
So my solution is
ADD_LIBRARY(ian ian_sources)
SOURCE_FILES(ian_sources
ian_file1.cxx
ian_file2.cxx
)
IF (WIN32)
SOURCE_FILES(ian_sources
ian_file1.h
ian_file2.h
)
ENDIF(WIN32)
This appears to work satisfactorily. However, I wondered if it was
necessary, or if I or CMake was doing something wrong?
Many thanks,
Ian.
* I know that some UNIX users will have doubts about the desirability of
this. However, our NT users have been complaining loudly about the lack of
.h files in the produced DSP files, and our UNIX users are willing to
tolerate additions to the CMakeLists.txt.
_______________________________________________
Cmake mailing list
http://public.kitware.com/mailman/listinfo/cmake
Loading...