Ian Scott
2001-08-17 10:20:16 UTC
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.
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.