Notes |
|
(0025578)
|
Dorian Scholz
|
2011-02-25 07:25
|
|
This does not only apply to VS, but also to other (if not all) IDE's.
I'm trying to get this to work on QtCreator. |
|
|
(0036753)
|
ptxmac
|
2014-09-09 07:29
|
|
Is anyone working on this? |
|
|
(0037244)
|
SepticInsect
|
2014-11-21 07:28
|
|
Is anyone working on this? |
|
|
(0037247)
|
Nils Gladitz
|
2014-11-21 11:04
|
|
You can use add_custom_target(mytarget SOURCES src1 [src2...]) to add files without compile/build semantics. |
|
|
(0037256)
|
SepticInsect
|
2014-11-24 02:53
|
|
But I'm using add_custom_command to precompile a pgc-file to a c-file. Then I use the c-file in add_library. But I want QtCreator to find my pgc-file. |
|
|
(0037257)
|
Nils Gladitz
|
2014-11-24 03:26
|
|
@SepticInsect: For that something like add_custom_target(new-target-for-my-pgc-file SOURCES path/to/my/foo.pgc) should work as well. |
|
|
(0037258)
|
SepticInsect
|
2014-11-24 03:29
|
|
I have tried add_custom_target but it doesn't work the first time I compile, when the c-file doesn't exist. |
|
|
(0037260)
|
Nils Gladitz
|
2014-11-24 03:33
|
|
@SepticInsect: You might want to take the discussion to the user's mailing list.
The add_custom_target() call I suggested did not reference the c-file.
Can you elaborate? |
|
|
(0037261)
|
SepticInsect
|
2014-11-24 04:19
|
|
Maby I misunderstood you. I thought you meant that I should replace my add_custom_command with an add_custom_target? Or did you mean that I should keep my add_custom_command and add add_custom_target(new-target-for-my-pgc-file SOURCES path/to/my/foo.pgc)? Isn't that an ugly solution? To add and add_custom_target just go get my pgc-file in QtCreator? |
|
|
(0037262)
|
Nils Gladitz
|
2014-11-24 04:26
|
|
@SepticInsect: Yes, I meant an additional custom target (unless you already have an existing custom target which would be appropriate).
Since as far as I can tell there are no compile/build semantics associated with .pgc files you could just as well list it in your add_library() call. |
|
|
(0037263)
|
SepticInsect
|
2014-11-24 04:34
|
|
Ok. If I do add_library(my_lib file1.c file2.pgc), cmake wouldn't care about file2.pgc and just build my_lib from file1.c? |
|
|
(0037264)
|
Nils Gladitz
|
2014-11-24 04:37
|
|
@SepticInsect: CMake will assert file2.pgc exists and will add it to IDE file listings but will not influence the build beyond that (unless you define/enable a compiler which happens to use the .pgc suffix). |
|
|
(0037265)
|
SepticInsect
|
2014-11-24 04:39
|
|
Ok. Thanks for all the help! |
|
|
(0037266)
|
SepticInsect
|
2014-11-24 05:38
(edited on: 2014-11-24 06:56) |
|
@ngladitz Is it wrong to add set_source_files_properties(file2.pgc PROPERTIES HEADER_FILE_ONLY TRUE) just to clarify that file2.pgc shall not be built into my_lib?
|
|
|
(0037267)
|
Nils Gladitz
|
2014-11-24 09:40
|
|
@SepticInsect: Sounds superfluous in this case but should not hurt either. |
|
|
(0041151)
|
Mateusz Loskot
|
2016-06-09 07:37
|
|
For anyone who is still looking for the solution to attach non-sources to an IDE project, here is a possible utility:
# collect_info_files function
# Takes collect_info_files - list of non-source files to look for
# Returns INFO_FILES with all files found from the input list.
# Based on macro posted here
# http://lists.qt-project.org/pipermail/qt-creator/2012-August/001191.html [^]
function(collect_info_files)
list(APPEND _all_found)
foreach(_it ${ARGN})
if(NOT IS_DIRECTORY ${_it})
get_filename_component(_path ${_it} ABSOLUTE)
if(EXISTS ${_path})
list(APPEND _all_found ${_it})
if(NOT ${_it} MATCHES "^/\\\\..*$;~$")
set_source_files_properties(${_it} PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
endif()
endif()
endforeach()
set(INFO_FILES ${_all_found} PARENT_SCOPE)
endfunction()
and here is the function usage:
# List all non-source code files (documents, configuration files, etc.)
set(other_files .gitignore .travis.yml appveyor.yml README.md)
# Collect all existing files and configure as non-sources.
collect_info_files(${other_files})
# Create dummy target/project for an IDE with documents attached
add_custom_target(docs SOURCES ${INFO_FILES}) |
|
|
(0041456)
|
Kitware Robot
|
2016-06-10 14:27
|
|
Resolving issue as `moved`.
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
|