Re: [CMake] custom nsis template- "Install targets" not working

2014-03-27 Thread Eric Noulard
2014-03-27 7:08 GMT+01:00 Lloyd :
> Hi,
>
> My CMake file contains the install comands like this
>
> install(TARGETS MyExe RUNTIME DESTINATION .)
>
> When I use the standard NSIS template, the installer is created with
> "MyExe". But our project needs a custom NSIS template so I have written one,
> and it is generating an installer *without* MyExe.
>
> So I made a comparison between my nsis template and the standard one.
>
> The one big difference I found is the presence of
>
> @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@
>  @CPACK_NSIS_FULL_INSTALL@
>
> after the SetOutPath "$INSTDIR" command. These above two variables seems to
> be undocumented.

>From the source code one can see that
CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS is empty unless the user provide
some value for it.

CPACK_NSIS_FULL_INSTALL is populated with "File /r
\"${INST_DIR}\\*.*\" unless the
user provide another value.

> When the standard nsis template is processed, these lines are changed to
>
> File /r "${INST_DIR}\*.*"

which corresponds to the source code default behavior.

> I am struck at this point, how can I make my install targets command work?
> Any hint or documentation would be greatly appreciated.

I am no NSIS expert so I can't imagine why 'File /r "${INST_DIR}\*.*"'
could possibly do ???

So I guess that if your template does not contain such command you
either need it
(and should use CPACK_NSIS_FULL_INSTALL in your template) or replace
it with something more appropriate to you case.

Now on the semantic,

CPACK_NSIS_FULL_INSTALL probably means "full install of all components"

you will find other CPACK_NSIS_*_COMPONENTS* var

CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC
CPACK_NSIS_PAGE_COMPONENTS
CPACK_NSIS_COMPONENT_SECTIONS
CPACK_NSIS_COMPONENT_SECTION_LIST
...

See http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack
for some explanation about component vs full/monolithic install with CPack.

-- 
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] custom nsis template- "Install targets" not working

2014-03-27 Thread Lloyd
>
> I am no NSIS expert so I can't imagine why 'File /r "${INST_DIR}\*.*"'
> could possibly do ???
>


About the file command the NSIS documentation says this:
Adds file(s) to be extracted to the current output path ($OUTDIR).
If the /r switch is used, files and directories are added recursively.

That is, the File command copies the files (all files as it is *.*)
specified in the path ${INST_DIR}\*.* recursively to the current set output
directory of the NSIS. The value of the INST_DIR variable is the directory
which the user has selected at install time.




>
> So I guess that if your template does not contain such command you
> either need it
>

I tried adding @CPACK_NSIS_FULL_INSTALL@, and it generated File /r
"${INST_DIR}\*.*" but this causes NSIS an error. Now I am in the assumption
that CMake copies all the files hierarchically to some temp directory and
from that location it does the copy (this is only a wild guess).



> (and should use CPACK_NSIS_FULL_INSTALL in your template) or replace
> it with something more appropriate to you case.
>
>

What I don't understand is, what happens to the "install targets" commands
in the CMake file on windows platform
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] custom nsis template- "Install targets" not working

2014-03-27 Thread Lloyd
Solved the problem.

Further verification revealed that, when I build "PACKAGE", it generates a
"install_manifest.txt" file in my build directory. It contains absolute
paths to copy of install files I mentioned using "install targets" command.
This temporary directory and its files are also created when we build the
"PACKAGE" target.

What caused all these problem is, I misread the "INSTDIR" in SetOutPath
command and "INST_DIR" in File command as the *same*

  SetOutPath "$INSTDIR"

  File /r "${INST_DIR}\*.*"

tracing the INST_DIR value revealed that, it is defined in the template
as !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"


Thanks a lot,
  Lloyd




On Thu, Mar 27, 2014 at 2:05 PM, Lloyd  wrote:

>
>
>> I am no NSIS expert so I can't imagine why 'File /r "${INST_DIR}\*.*"'
>> could possibly do ???
>>
>
>
> About the file command the NSIS documentation says this:
> Adds file(s) to be extracted to the current output path ($OUTDIR).
> If the /r switch is used, files and directories are added recursively.
>
> That is, the File command copies the files (all files as it is *.*)
> specified in the path ${INST_DIR}\*.* recursively to the current set output
> directory of the NSIS. The value of the INST_DIR variable is the directory
> which the user has selected at install time.
>
>
>
>
>>
>> So I guess that if your template does not contain such command you
>> either need it
>>
>
> I tried adding @CPACK_NSIS_FULL_INSTALL@, and it generated File /r
> "${INST_DIR}\*.*" but this causes NSIS an error. Now I am in the assumption
> that CMake copies all the files hierarchically to some temp directory and
> from that location it does the copy (this is only a wild guess).
>
>
>
>> (and should use CPACK_NSIS_FULL_INSTALL in your template) or replace
>> it with something more appropriate to you case.
>>
>>
>
> What I don't understand is, what happens to the "install targets" commands
> in the CMake file on windows platform
>
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] target name collision

2014-03-27 Thread Aurelien Richez
Hi, 

I have two project that are independent and can be compiled on their own. I 
also have a bigger project which include these two project with 
add_subdirectory. However, these projects contain targets with the same names. 
As a consequence, cmake 2.8 complains with a message such as "another target 
with the same name already exists" when I try to generate the makefile. 

Isn't there a way to handle this situation which does not involve renaming the 
targets in the subproject ? Like an option to automatically add a prefix to 
target added from add_subdirectory (for instance, target "doc" in "subproject1" 
would become "subproject1/doc" in the upper project). 

Thanks, 

Aurélien Richez 
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] target name collision

2014-03-27 Thread Jakub Zakrzewski
Is there a reason, why you treat your independent projects with add_directory() 
instead of making them external projects?

--
Gruesse,
Jakub


From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Aurelien Richez
Sent: Donnerstag, 27. März 2014 14:58
To: cmake@cmake.org
Subject: [CMake] target name collision

Hi,

I have two project that are independent and can be compiled on their own. I 
also have a bigger project which include these two project with 
add_subdirectory. However, these projects contain targets with the same names. 
As a consequence, cmake 2.8 complains with a message such as "another target 
with the same name already exists" when I try to generate the makefile.

Isn't there a way to handle this situation which does not involve renaming the 
targets in the subproject ? Like an option to automatically add a prefix to 
target added from add_subdirectory (for instance, target "doc" in "subproject1" 
would become "subproject1/doc" in the upper project).

Thanks,

Aurélien Richez
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] target name collision

2014-03-27 Thread Angeliki Chrysochou
Hi Aurelien,

Even though it is unsafe and not recommended, you could set policy CMP0002
to old so that cmake silently accepts non-unique target names like this:

cmake_policy(SET CMP0002 OLD)

I can't guarantee that your build will then work however.

Another option is to write your own wrapper to include the directory name
using a macro or a function providing the name of the root project added by
cmake using the variable CMAKE_PROJECT_NAME. Here is an example wrapper of
add_library (I used "_" as a delimiter instead of "/"):

macro( my_add_library LIB_NAME LIB_TYPE SRC_FILES INC_FILES )
 add_library( ${CMAKE_PROJECT_NAME}_${LIB_NAME} ${LIB_TYPE}
${SRC_FILES} ${INC_FILES} )
endmacro()

Invoking it for a project with name ProjectA to create a shared library
LibA would look like this, for example:

my_add_library(LibA SHARED src.cpp inc.h)

and would result to library name ProjectA_LibA.

A third solution is to set the target properties after adding the target.
Here is an example for shared libraries in case you want to preserve the
original prefix too:

set_target_properties(LibA PROPERTIES PREFIX
"${CMAKE_SHARED_LIBRARY_PREFIX}${CMAKE_PROJECT_NAME}_" )

I hope it helps!

Best regards,
Angeliki




On Thu, Mar 27, 2014 at 3:30 PM, Jakub Zakrzewski wrote:

>  Is there a reason, why you treat your independent projects with
> add_directory() instead of making them external projects?
>
>
>
> --
>
> Gruesse,
>
> Jakub
>
>
>
>
>
> *From:* CMake [mailto:cmake-boun...@cmake.org] *On Behalf Of *Aurelien
> Richez
> *Sent:* Donnerstag, 27. März 2014 14:58
> *To:* cmake@cmake.org
> *Subject:* [CMake] target name collision
>
>
>
> Hi,
>
>
>
> I have two project that are independent and can be compiled on their own.
> I also have a bigger project which include these two project with
> add_subdirectory. However, these projects contain targets with the same
> names. As a consequence, cmake 2.8 complains with a message such as
> "another target with the same name already exists" when I try to generate
> the makefile.
>
>
>
> Isn't there a way to handle this situation which does not involve renaming
> the targets in the subproject ? Like an option to automatically add a
> prefix to target added from add_subdirectory (for instance, target "doc" in
> "subproject1" would become "subproject1/doc" in the upper project).
>
>
>
> Thanks,
>
>
>
> Aurélien Richez
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] target name collision

2014-03-27 Thread Aurelien Richez
Thanks Angeliki. I will try to do something like this. In fact I forgot to 
mention that my target which collide comes from add_custom target() but I can 
apply the same principle. 

To be more precise about the context, my projects have a target "unit_test" 
which is run tests each time I build (included in all) and a target "doc" to 
generate the documentation. 

To answer to Jakub : 

There are other subprojects which are modules needing my independent projects. 
like this: 

Project 
|--subrojectWithTargetCollision1 
|--subrojectWithTargetCollision2 
|--someOtherProject1 
`--someOtherProject2 

My independent projects are both under development and not stable yet.So, 
having a code repository containing both project is a convenient way to work 
with a fixed version (which will ensure that every project compile) and update 
when I want to. 

May be add_subdirectory is not the way to go but it was handy to compile every 
project at once and link my programs with libraries in the project, without 
installing them (for testing purpose). 

Thanks for your answers. 
Regards, 

Aurélien 

- Mail original -

> De: "Angeliki Chrysochou" 
> À: "Jakub Zakrzewski" 
> Cc: "Aurelien Richez" , cmake@cmake.org
> Envoyé: Jeudi 27 Mars 2014 16:20:14
> Objet: Re: [CMake] target name collision

> Hi Aurelien,

> Even though it is unsafe and not recommended, you could set policy CMP0002 to
> old so that cmake silently accepts non-unique target names like this:

> cmake_policy(SET CMP0002 OLD)

> I can't guarantee that your build will then work however.

> Another option is to write your own wrapper to include the directory name
> using a macro or a function providing the name of the root project added by
> cmake using the variable CMAKE_PROJECT_NAME. Here is an example wrapper of
> add_library (I used "_" as a delimiter instead of "/"):

> macro( my_add_library LIB_NAME LIB_TYPE SRC_FILES INC_FILES )
> add_library( ${CMAKE_PROJECT_NAME}_${LIB_NAME} ${LIB_TYPE} ${SRC_FILES}
> ${INC_FILES} )
> endmacro()

> Invoking it for a project with name ProjectA to create a shared library LibA
> would look like this, for example:

> my_add_library(LibA SHARED src.cpp inc.h)

> and would result to library name ProjectA_LibA.

> A third solution is to set the target properties after adding the target.
> Here is an example for shared libraries in case you want to preserve the
> original prefix too:

> set_target_properties(LibA PROPERTIES PREFIX
> "${CMAKE_SHARED_LIBRARY_PREFIX}${CMAKE_PROJECT_NAME}_" )

> I hope it helps!

> Best regards,
> Angeliki

> On Thu, Mar 27, 2014 at 3:30 PM, Jakub Zakrzewski < jzakrzew...@e2e.ch >
> wrote:

> > Is there a reason, why you treat your independent projects with
> > add_directory() instead of making them external projects?
> 

> > --
> 

> > Gruesse,
> 

> > Jakub
> 

> > From: CMake [mailto: cmake-boun...@cmake.org ] On Behalf Of Aurelien Richez
> 
> > Sent: Donnerstag, 27. März 2014 14:58
> 
> > To: cmake@cmake.org
> 
> > Subject: [CMake] target name collision
> 

> > Hi,
> 

> > I have two project that are independent and can be compiled on their own. I
> > also have a bigger project which include these two project with
> > add_subdirectory. However, these projects contain targets with the same
> > names. As a consequence, cmake 2.8 complains with a message such as
> > "another
> > target with the same name already exists" when I try to generate the
> > makefile.
> 

> > Isn't there a way to handle this situation which does not involve renaming
> > the targets in the subproject ? Like an option to automatically add a
> > prefix
> > to target added from add_subdirectory (for instance, target "doc" in
> > "subproject1" would become "subproject1/doc" in the upper project).
> 

> > Thanks,
> 

> > Aurélien Richez
> 

> > --
> 

> > Powered by www.kitware.com
> 

> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> 

> > Kitware offers various services to support the CMake community. For more
> > information on each offering, please visit:
> 

> > CMake Support: http://cmake.org/cmake/help/support.html
> 
> > CMake Consulting: http://cmake.org/cmake/help/consulting.html
> 
> > CMake Training Courses: http://cmake.org/cmake/help/training.html
> 

> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> 

> > Follow this link to subscribe/unsubscribe:
> 
> > http://www.cmake.org/mailman/listinfo/cmake
> 
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/ope

[CMake] multi-line strings... is this expected?

2014-03-27 Thread Matthew Woehlke

I have¹ a CTest like:

execute_process(...)
set(expected "
...text...
...text...
")
string(REGEX MATCH ${expected} match ${out})

So, basically, I'm checking that the process outputs a certain set of 
lines, and taking advantage of multi-line strings in CTest script for 
convenience and readability.


This works great... *IF* the script file has UNIX line endings. I'm 
wondering if that is expected? It seems that CTest must be processing 
the script in binary mode in order for the string to contain '\r' 
characters...


(I don't need the obvious work-around². I'm asking if this is expected 
and e.g. if I should file a bug report...)


I haven't tested exhaustively but this may not affect all versions of 
CMake. (Noticed on 2.8.11.1.)


(¹ 
https://github.com/commontk/AppLauncher/blob/master/Testing/CMake/AppLauncher-Settings-TestEnvironment.cmake)


(² 
https://github.com/mwoehlke-kitware/AppLauncher/tree/test-multi-line-string-fixes)


--
Matthew

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake