tyker1
tyker1

Reputation: 123

generate a file before creating installer using CPack and NSIS

I'm current making a installer for a large project, where it requires to get the most up-to-date tables from database. Till now the Database dump was done manually, now i want it to be done automatically when i generate the installer. Since there is already a script doing the dump process, i am wondering if it is possible to tell CPack (or CMake) to run this script first before generating the installer? For instance, there is a rule in the CMakeList:

    install(
            FILES "../db/structures.sql"
            DESTINATION ${INSTALL_DB} 
            CONFIGURATIONS Release
            RENAME "create.sql"
    )

The Sql-Dump file "structures.sql" can automatically being created using another script called "make_db_dump.pl" (So in the command line it should be called using "perl make_db_dump.pl"). And i want the make_db_dump.pl to be automatically called and file generated before generating the installer. Is that possible?

For the environment: im using VS 2019 together with CMake under windows.

And the workflow is:CMake -> VS Project -> generating installer

Upvotes: 0

Views: 306

Answers (1)

Anders
Anders

Reputation: 101756

In NSIS you can execute external commands from inside the compiler with !system:

!system '"c:\stuff\app.exe" -foo -bar' 

Upvotes: 1

Related Questions